Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 1. Create file .gitlab-ci.yml
- # 2. Setting -> CI/CD -> General pipelines, uncheck Skip outdated deployment jobs
- # 3. Setting -> CI/CD -> Runners, klik Disable shared runner
- # 4. Setting -> CI/CD -> Variables, tambahkan variable sesuai tanda $ yang ada di file .gitlab-ci.yml
- # NPA_PASSWORD = token dari user profile -> Personal Access Tokens -> create token (isi nama dan centang)
- # NPA_USERNAME = username gitlab
- # Registry = registry.gitlab.com
- # RunDev = whoami
- # RunProd = wget -O /dev/null --post-data 'key=value' http://10.242.xxx.xx:port/api/webhooks/b844 ... dst
- # RunStag = whoami
- # Tagging = registry.gitlab.com/.../.../nama-repo
- # 5. Setting -> CI/CD -> Cleanup policy for tags, pilih disabled jika dipertahankan, enable jika otomatis hapus
- # 6. Install runner sendiri agar tidak dibatasi waktu di gitlab:
- # create volume config
- docker volume create gitlab-runner-config
- # start runner
- docker run -d --name gitlab-runner --restart always \
- -v /var/run/docker.sock:/var/run/docker.sock \
- -v gitlab-runner-config:/etc/gitlab-runner \
- gitlab/gitlab-runner:latest
- # 7. Register gitlab runner
- docker run --rm -it -v gitlab-runner-config:/etc/gitlab-runner gitlab/gitlab-runner:latest register
- # pastikan di project sudah ada file .gitlab-ci.yml
- # enter gitlab ci coordinator -> https://gitlab.com/ (lihat di gitlab -> Setting -> CI/CD -> Runner -> Set up a specific Runner manually)
- # enter gitlab token -> sAV6UhXsXXXXybRr_ (lihat di gitlab -> Setting -> CI/CD -> Runner -> Set up a specific Runner manually)
- # enter gitlab runner description -> bebas
- # enter gitlab runner tag -> bebas
- # Provide the runner executor. For most use cases, enter docker -> docker
- # If you entered docker as your executor, you’ll be asked for the default image to be used for projects that do not define one in .gitlab-ci.yml
- # 8. connect bash container gitlab-runner, tambahkan volume di file /etc/gitlab-runner/config.toml pada bagian volume
- # volumes = ["/var/run/docker.sock:/var/run/docker.sock", "/cache"]
- cd /etc/gitlab-runner
- apt update
- apt install nano
- nano config.toml
- # 9. Di gitlab -> Setting -> CI/CD -> runner -> pilih runner yg jalan, klik edit, centang -> Run untagged jobs
- # 10. Deploy awal dengan membuat service, image dari registry.gitlab.com
- # 11. Di docker portaniner service, lihat detil service, klik webhook, copy alamat webhook, paste di variable RunProd (wget -O /dev/null --post-data 'key=value' http:// ... dst)
Add Comment
Please, Sign In to add comment