summaryrefslogtreecommitdiff
path: root/day2/from-dev-to-prod-with-gitlab-ci.txt
blob: f7e25ba0cb54d5ab170bfef958e20843a2e6ac47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# 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/