This commit is contained in:
Joseph Le 2023-09-26 08:03:37 +00:00
parent 275ebc7ae6
commit 7b781ca5e8
5 changed files with 78 additions and 16 deletions

View File

@ -1,2 +1,52 @@
# gitea_CICD
1) Clone project to your server
git clone https://gitea.nswteam.net/joseph/gitea_CICD.git
2) Access the folder you just cloned
root@root#cd <path>/gitea_CICD
3) Check the directory path
root@root# pwd
output: <path>/gitea_CICD
4) Fill in environment variables
root@root# nano service/giteaService
- GIT_USERNAME: Username of the git account.
- GIT_PASSWORD: Password of the git account.
- PROJECT_PATH: Root path of your project.
- FE_PROJECT_PATH: Path of the front-end folder.
- BE_PROJECT_PATH: Path of the back-end folder.
- FE_ROOT_FOLDER: Path of folder front-end public.
5) Run file "install.sh" to install service
root@root# ./install.sh
** Note: **
- Project gitea_CICD should be placed at the same folder level as your project
..
|
|__your project
|
|__gitea_CICD project
|
|__ . . .
- Depending on the technology your project uses, the "gitea_CICD/service/giteaHook.sh" file will be custom configured to match the technology.
**____ Joseph ____ **

View File

@ -16,23 +16,27 @@ if [ -d "/etc/systemd/system" ]; then
sudo sed -i "s#ExecStart=.*#ExecStart=$escaped_pwd_install/service/giteaService.sh#" $pwd_install/service/giteaHook.service &&
echo "* ExecStart *" &&
sleep 3 &&
sleep 2 &&
sudo sed -i "s#WorkingDirectory=.*#WorkingDirectory=$escaped_pwd_install/service#" $pwd_install/service/giteaHook.service &&
echo "* WorkingDirectory *" &&
sleep 3 &&
sleep 2 &&
sudo sed -i "s#EnvironmentFile=.*#EnvironmentFile=$escaped_pwd_install/service/giteaService#" $pwd_install/service/giteaHook.service &&
echo "* EnvironmentFile *" &&
sleep 3 &&
sleep 2 &&
sudo sed -i "s#INDEXJS_HOOK_PATH=.*#INDEXJS_HOOK_PATH=$escaped_pwd_install#" $pwd_install/service/giteaService &&
echo "* INDEXJS_HOOK_PATH *" &&
sleep 3 &&
sleep 2 &&
sudo sed -i "s#HOOK_PATH=.*#HOOK_PATH=$escaped_pwd_install#" $pwd_install/service/giteaService &&
echo "* HOOK_PATH *" &&
sleep 3 &&
sleep 2 &&
sudo sed -i "s#source .*#source $escaped_pwd_install/service/giteaService#" $pwd_install/service/giteaHook.sh &&
echo "* EXEC_FILE *" &&
sleep 2 &&
systemctl stop giteaHook.service

View File

@ -3,13 +3,13 @@ Description=Gitea Hook Service
After=network.target
[Service]
ExecStart=/home/joseph/gitea_CICD/service/giteaService.sh
ExecStart=/home/joseph/abc/gitea_CICD/service/giteaService.sh
Restart=always
WorkingDirectory=/home/joseph/gitea_CICD/service
WorkingDirectory=/home/joseph/abc/gitea_CICD/service
User=root
Group=root
Restart=on-failure
EnvironmentFile=/home/joseph/gitea_CICD/service/giteaService
EnvironmentFile=/home/joseph/abc/gitea_CICD/service/giteaService
[Install]
WantedBy=multi-user.target

View File

@ -1,7 +1,7 @@
#!/bin/bash
#File chua bien moi truong
source /home/gitea_CICD/service/giteaService
source /home/joseph/abc/gitea_CICD/service/giteaService
#URL project
project=$PROJECT_PATH

View File

@ -1,18 +1,26 @@
#Duong dan thu muc, index.js file de chay dich vu giteaHook
INDEXJS_HOOK_PATH=/home/joseph/gitea_CICD
HOOK_PATH=/home/joseph/gitea_CICD
#Luu y: (*) La nhung bien moi truong can khai bao
#Duong dan cac thu muc trong project chinh
#Co the khai bao nhieu bien hon de cau hinh giteaHook.sh
#Duong dan thu muc, index.js file de chay dich vu giteaHook (cac bien do he thong tu dong cap nhat)
INDEXJS_HOOK_PATH=/home/joseph/abc/gitea_CICD
HOOK_PATH=/home/joseph/abc/gitea_CICD
#Tai khoan git (*)
GIT_USERNAME=joseph.le@apactech.io
GIT_PASSWORD=Maypjtkh0ng
#
#Duong dan goc cua project (*)
PROJECT_PATH=/home/Log_service
#Duong dan folder FE (*)
FE_PROJECT_PATH=manage-view/
#Duong dan folder BE (*)
BE_PROJECT_PATH=/home/Log_service
#
#Duong dan folder public FE (*)
FE_ROOT_FOLDER=/var/www/html