Slide 1

Slide 1 text

Automation using Gitlab CI and Docker Ondrej Sika [email protected] DevHeaven, Pilsen CZ, 21. 4. 2018

Slide 2

Slide 2 text

Goals - Build application - Auto deploy to test - Manual deploy to production

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

Tools - Git - Gitlab + Gitlab CI - Docker - Traefik

Slide 5

Slide 5 text

Setup CI environment

Slide 6

Slide 6 text

Gitlab CI Runner docker-machine create runner eval $(docker-machine env runner) git clone [email protected]:ondrejsika/gitlab-ci-runner.git cd gitlab-ci-runner ./create-runner.sh ./register-runner.sh GITLAB_CI_TOKEN

Slide 7

Slide 7 text

Server

Slide 8

Slide 8 text

Traefik Proxy git clone [email protected]:ondrejsika/traefik-ssl.git cd traefik-ssl # put SSL cert.pem and key.pem to certs/ dit docker-compose up -d

Slide 9

Slide 9 text

Gitlab

Slide 10

Slide 10 text

Gitlab - Create Gitlab project - Setup CI sercret variables - SSLPASS (password to server which runs the app)

Slide 11

Slide 11 text

Application

Slide 12

Slide 12 text

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

Slide 13

Slide 13 text

Clone Jekyll Website git clone [email protected]:ondrejsika/jekyll-demo.git cd jekyll-demo git remote rename origin github git remote add origin [email protected]:test/jekyll.git git push origin master -u

Slide 14

Slide 14 text

Dockerize git reset --hard github/docker cat Dockerfile

Slide 15

Slide 15 text

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

Slide 16

Slide 16 text

Push & some magic hapens

Slide 17

Slide 17 text

Push git push origin master -u

Slide 18

Slide 18 text

Make some changes git checkout -b awesome-header vim index.md git commit -am 'make header awesome' git push origin awesome-header -u

Slide 19

Slide 19 text

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/

Slide 20

Slide 20 text

Thank you & Questions Ondrej Sika email: [email protected] web: ondrej-sika.cz twitter: @ondrejsika linkedin: /in/ondrejsika/ Slides: https://sika.link/devheaven2018