# Dev to prod with GitLab CI https://talks.bitexpert.de/phpuk19-gitlabci/ Stephan Hockdorfer ## Overview - Stefan - bitExpert AG (Germany) ## Gitlab Old wikipedia description: Web based git repo manager with wiki and issue tracking ## Beyond CI/CD - Dev, Ops, CD/CO ## Installation Lots of ways. Docker. - Use a registry - Sonatype Nexus - Nexus installation for repo manager - Reverse proxy for routing, and running multiple instances ### Traefik Simple to configure Configure Can listen to socket, and other things Can do lets encrypt stuff ## Crating projects Magento as an example Slightly more difficult to install Has some complication 1. Composer install 2. Add to git and push 3. Need a git lab runner (Can host the runners or use SASS offering) (docker container for runner) (Gitlab instance and runner installed via docker) Access runner overview page and grab registration token Create runner instance gitlab-runner gitlab-runner register - token - description - tags - run untagged builds? - current project? - executor? (docker, shell,.. etc) (more control if we use docker) - default docker image -- This creates the runner config file -- Edit and amend, e.g. add volumes of shared composer stuff ***Should we do this at d3r?*** ## Managing Secrets add to project, can use in groups ## Add .gitlab-ci.yaml (similar to travis) -- define Image -- define job scripts ## http-basic auth via composer What is this? ## Gitlab services Multiple images should spin up first, then jobs can run Health checks built in, cheks exposed ports Spins up second container waiting for ports to be available then spins down (Gitlab says you cant 100% trust this to coinfirm all is working) ### add mysql service 1. Define image, define variables (passowrd) 2. define things it needs ## Build piplines - test - build - build staging - define where in "data center" the staging stuff is - Define git registration - dine staging url - Build creates tar file ready for deploy - deploy! - when manual trigger - Dont auto build and deploy everything to staging and production, Allow us to test te staging env first and then manually kick off the deployment for production ## Problem with this set-up - Multi developers means we're not sure of staging set-up - Staging per developer? - What about a staging per feature branch? - yes - Review Apps - documentation not great - Dynamically create staging environments - make sure on_stop - only run for merge_requests (fairly new, used to have to do "all branches but not master") - define stop_review to pull down containers 1. Create merge request 2. Test and build begins 3. It then gives you the urls for testing 4. Merge. Then staging is deployed 5. Then manually hit up production ## Questions Create a standard web app Can Import from github!!! Auto dev ops? - Auto turned on - Not sure how good it is - maybe we just disable Can we lock down how things get deployed - Role based auth is bad - Don't have fine grain control (most of the team need maintainer role) # Useful links https://www.sonatype.com/ https://traefik.io/ https://talks.bitexpert.de/phpuk19-gitlabci/