# FIRST STEP TO DO The first thing to do to run the CI CD process locally is to install db2-mwconfig locally by the Forke/Clone project. You need a local db2 database simulation, you can visit the repository below. ``` https://code.senomas.com/btn/server-dev-local ``` # HOW TO RUN go to the repository folder where you cloned, and type remove the folder `a` and `b` ``` make ``` ## IMPORTANT !!! MAKE SURE REGENERATE server-jenkins/ssh/id_rsa IN SERVER PRODS AND SECURE IT PROPERLY ## SETUP GOGS SSH in folder server-jenkins/gogs-data/gogs/conf/app.ini ``` [server] DOMAIN = localhost HTTP_PORT = 3000 EXTERNAL_URL = http://localhost:3000/ DISABLE_SSH = false SSH_PORT = 1022 START_SSH_SERVER = true OFFLINE_MODE = false ``` make sure SSH_PORT is 1022 and START_SSH_SERVER is true Open gogs website http://localhost:3000/user/settings/ssh login as `deploy` and Add SSH KEY with keyname jenkins and content from server-jenkins/ssh/id_rsa.pub ## SETUP JENKINS GOGS CREDENTIALS Go to jenkins Dashboard -> Credentials -> System -> Global credentials (unrestricted) -> Add Credentials Kind SSH Username with private key ID : gogs Username : git Private key : Enter directly copy from file server-jenkins/ssh/id_rsa # TEST CICD Open jenkins in browser `Manage Jenkins` / `System` / `Global Properties` -> make sure HOST_WORKSPACE is correct ``` git clone http://localhost:3000/raymond.cahyadi/btn-module-itm-trf.git module-itm-trf cd module-itm-trf git commit --allow-empty -m "test build" git push ``` # SETUP SSH without password ## copy id_rsa.pub to remote server ``` docker run --rm -it -v (pwd)/ssh:/home/node/.ssh/ docker.senomas.com/process-db-config:2023092118 sh -c "ssh-copy-id seno@192.168.1.29 ; ls -al /home/node/.ssh" ``` ## test ssh without password ``` docker run --rm -it -v (pwd)/ssh:/home/node/.ssh/ docker.senomas.com/process-db-config:2023092118 sh -c "ssh seno@192.168.1.29 -C 'hostname' ; ls -al /home/node/.ssh" ``` make sure no password was asked ## BUILD JENKINS ```bash DESIGN JENKINS Urutan deployment / jenkins pipeline : > ssh ke server ace > git pull repo [module] > git pull repo [server] > [optional] merge ace/db-config-[in]-[is].xml ke folder jplugin di server > [optional] execute ace/queue.mqsc > [optional] deploy bar based on ace/release.yaml > ssh ke server db > git pull repo [module] > run script db/*.sql > restart/reload > jika "ada" perubahan db-config > ssh ke server ace > restart integration server > jika "tidak ada" perubahan db-config > ssh ke server db > jalankan script update reloadts ```