-
Notifications
You must be signed in to change notification settings - Fork 4
/
.gitlab-ci.yml
135 lines (123 loc) · 3.25 KB
/
.gitlab-ci.yml
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
125
126
127
128
129
130
131
132
133
134
135
stages:
- build
- remove
- deploy
- service
before_script:
- cat "$GOOGLE_APPLICATION_CREDENTIALS" > $(pwd)/google-keys.json
# Build Staging:
# stage: build
# script:
# - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
# - docker build -t $CI_REGISTRY_IMAGE/bot:staging .
# - docker push $CI_REGISTRY_IMAGE/bot:staging
# tags:
# - builder
# only:
# refs:
# - develop
# environment:
# name: development
# Deploy Bot:
# stage: deploy
# script:
# - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
# - docker-compose -f deploy/compose.yml pull
# - docker-compose -f deploy/compose.yml -p tezos-bot up --remove-orphans -d
# tags:
# - deployer
# only:
# refs:
# - develop
# variables:
# DB: "User ID=${DB_USER};Host=db;Password=${DB_PASSWORD};Port=5432;Database=${DB_NAME};Pooling=true;"
# ENV: Staging
# BASE_DOMAIN: test.tnb.thegroup.tech
# DOCKER_VERSION: staging
# environment:
# name: development
# Restart Staging:
# stage: service
# script:
# - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
# - docker-compose -f deploy/compose.yml -p tezos-bot restart bot
# tags:
# - deployer
# only:
# refs:
# - develop
# when: manual
# variables:
# DB: "User ID=${DB_USER};Host=db;Password=${DB_PASSWORD};Port=5432;Database=${DB_NAME};Pooling=true;"
# ENV: Staging
# BASE_DOMAIN: test.tnb.thegroup.tech
# DOCKER_VERSION: staging
# environment:
# name: development
Build Release:
stage: build
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $CI_REGISTRY_IMAGE/bot:$CI_COMMIT_TAG --build-arg version=$CI_COMMIT_TAG .
- docker push $CI_REGISTRY_IMAGE/bot:$CI_COMMIT_TAG
tags:
- builder
only:
refs:
- tags
environment:
name: release
Deploy Release:
stage: deploy
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker-compose -f deploy/compose.yml pull
- docker-compose -f deploy/compose.yml -p tezos-bot-release up -d
tags:
- deployer
only:
refs:
- tags
variables:
DB: "User ID=${DB_USER};Host=db;Password=${DB_PASSWORD};Port=5432;Database=${DB_NAME};Pooling=true;"
ENV: Production
BASE_DOMAIN: tnb.thegroup.tech
DOCKER_VERSION: $CI_COMMIT_TAG
environment:
name: release
Restart Release:
stage: service
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker-compose -f deploy/compose.yml -p tezos-bot-release restart bot
only:
refs:
- tags
tags:
- deployer
when: manual
environment:
name: release
Shutdown Release:
stage: service
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker-compose -f deploy/compose.yml -p tezos-bot-release stop bot
only:
refs:
- tags
tags:
- deployer
when: manual
environment:
name: release
Backup Database:
stage: service
script:
- cat deploy/dump.sh | docker-compose -f deploy/compose.yml -p tezos-bot-release exec -T db bash
only:
- schedules
tags:
- deployer
environment:
name: release