Go to file
Joseph Le a298ecfa89 add FE env 2023-10-20 14:15:49 +11:00
service add FE env 2023-10-20 14:15:49 +11:00
.gitignore update .gitignore 2023-10-17 04:16:16 +00:00
Dockerfile giteaHook service 2023-09-25 19:58:46 +10:00
README.md update env source 2023-10-13 18:20:43 +11:00
abc.txt commit 2023-10-13 12:56:49 +11:00
docker-compose.yaml giteaHook service 2023-09-25 19:58:46 +10:00
index.js check status 2023-10-17 09:56:01 +00:00
install.sh udpate logic 2023-10-13 08:51:20 +00:00
package-lock.json add FE env 2023-10-20 14:15:49 +11:00
package.json update email and REAME.md 2023-10-03 09:24:10 +00:00

README.md

gitea_CICD

NodeJS

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 gitea_CICD

3) Check the directory path

root@root#

    pwd
  • output: /gitea_CICD

4) Create folder service_run

root@root#

    mkdir service_run

Copy environment file

    cp service/giteaService.conf service_run/giteaService.conf

5) Fill in environment variables (*)

root@root#

    nano service_run/giteaService.conf

6) Add Nginx configuration

  • Open the Nginx configuration file.

  • Add thr following configuration content.

        location /git/ {
        #index index.html;
        proxy_pass http://<IP-address>:<PORT>;
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Host $http_host;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_pass_request_headers on;
        proxy_max_temp_file_size 0;
        proxy_connect_timeout 900;
        proxy_send_timeout 900;
        proxy_read_timeout 900;
        proxy_buffer_size 128k;
        proxy_buffers 4 256k;
        proxy_busy_buffers_size 256k;
        proxy_temp_file_write_size 256k;
        }
    
  • Change "IP-address" and "PORT". The "PORT" corresponds to the "PORT_SERVICE" of the "service_run/giteaService.conf" file.

  • Restart Nginx service.

        systemctl restart nginx
    

7) Run file "install.sh" to install service

root@root#

    ./install.sh
install server

8) Add webhook

  • Open your project on Gitea:
  • Choose "Setting"
webhook1
  • Choose "Webhooks" and "Add Webhooks"
webhook2
  • Fill in the information
webhook3
  • Target URL: URL to the API that handles requests when a event is triggered (Default: your_domain/git/gitea-webhook).
  • Trigger on: Event to trigger the webhook.
  • Branch filter: Events will be listened on the branch you choose. ( '*' :all branch)

** 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_run/giteaHook.sh" file will be custom configured to match the technology.

**____ Joseph Le____ **