Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Automation using Gitlab CI and Docker, DevHeaven 2018

Automation using Gitlab CI and Docker, DevHeaven 2018

Ondrej Sika

April 21, 2018
Tweet

More Decks by Ondrej Sika

Other Decks in Programming

Transcript

  1. Automation using Gitlab CI and Docker Ondrej Sika ondrej@ondrejsika.com DevHeaven,

    Pilsen CZ, 21. 4. 2018
  2. Goals - Build application - Auto deploy to test -

    Manual deploy to production
  3. None
  4. Tools - Git - Gitlab + Gitlab CI - Docker

    - Traefik
  5. Setup CI environment

  6. Gitlab CI Runner docker-machine create runner eval $(docker-machine env runner)

    git clone git@github.com:ondrejsika/gitlab-ci-runner.git cd gitlab-ci-runner ./create-runner.sh ./register-runner.sh GITLAB_CI_TOKEN
  7. Server

  8. Traefik Proxy git clone git@github.com:ondrejsika/traefik-ssl.git cd traefik-ssl # put SSL

    cert.pem and key.pem to certs/ dit docker-compose up -d
  9. Gitlab

  10. Gitlab - Create Gitlab project - Setup CI sercret variables

    - SSLPASS (password to server which runs the app)
  11. Application

  12. Application - Dockerize project - Add .gitlab-ci.yml (CI config)

  13. Clone Jekyll Website git clone git@github.com:ondrejsika/jekyll-demo.git cd jekyll-demo git remote

    rename origin github git remote add origin git@gitlab.sikahq.com:test/jekyll.git git push origin master -u
  14. Dockerize git reset --hard github/docker cat Dockerfile

  15. Add Gitlab CI configuration git reset --hard github/gitlab-ci cat .gitlab-ci.yml

  16. Push & some magic hapens

  17. Push git push origin master -u

  18. Make some changes git checkout -b awesome-header vim index.md git

    commit -am 'make header awesome' git push origin awesome-header -u
  19. Resources - https://github.com/ondrejsika/jekyll-demo - https://github.com/ondrejsika/traefik-ssl - https://github.com/ondrejsika/gitlab-ci-runner - https://github.com/ondrejsika/ondrejsika-ci-docker -

    https://traefik.io/
  20. Thank you & Questions Ondrej Sika email: ondrej@ondrejsika.com web: ondrej-sika.cz

    twitter: @ondrejsika linkedin: /in/ondrejsika/ Slides: https://sika.link/devheaven2018