forked from webkom/lego-webapp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.yml
226 lines (226 loc) · 5.5 KB
/
.drone.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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
pipeline:
postgres:
image: postgres:9.5
detach: true
group: services
environment:
- POSTGRES_USER=lego
when:
event: [push]
branch:
exclude: [ prod ]
minio:
image: minio/minio
detach: true
group: services
environment:
- MINIO_ACCESS_KEY=lego-dev
- MINIO_SECRET_KEY=lego-dev
command: server /export
when:
event: [push]
branch:
exclude: [ prod ]
thumbor:
image: apsl/thumbor:latest
detach: true
group: services
environment:
SECURITY_KEY: 'lego-dev'
MAX_WIDTH: '1000'
MAX_HEIGHT: '800'
QUALITY: '98'
ALLOW_UNSAFE_URL: '0'
ALLOW_OLD_URLS: '0'
AWS_ACCESS_KEY_ID: 'lego-dev'
AWS_SECRET_ACCESS_KEY: 'lego-dev'
TC_AWS_LOADER_BUCKET: lego
TC_AWS_REGION: us-east-1
TC_AWS_ENDPOINT: '"http://minio:9000"'
LOADER: tc_aws.loaders.s3_loader
links:
- minio
when:
event: [push]
branch:
exclude: [ prod ]
redis:
image: redis
detach: true
group: services
when:
event: [push]
branch:
exclude: [ prod ]
api:
image: registry.abakus.no/webkom/lego:latest
detach: true
pull: true
group: services
command: >
bash -c "./wait-for-it.sh -t 60 postgres:5432 &&
./wait-for-it.sh -t 60 redis:6379 &&
./wait-for-it.sh -t 60 minio:9000 &&
./wait-for-it.sh -t 60 thumbor:8000 &&
python manage.py reset_db --noinput &&
python manage.py migrate &&
python manage.py load_fixtures --development &&
python manage.py runserver 0.0.0.0:8000"
environment:
- PORT=8000
- ALLOWED_HOSTS=*,
- DATABASE_URL=postgres://lego@postgres:5432/lego
- SECRET_KEY=abc123
- SERVER_URL=http://api:8000
- FRONTEND_URL=http://ssr:3000
- CACHE_URL=rediscache://redis/0?client_class=django_redis.client.DefaultClient
- EMAIL_URL=smtp://localhost
- AWS_ACCESS_KEY_ID=lego-dev
- AWS_SECRET_ACCESS_KEY=lego-dev
- AWS_REGION=us-east-1
- AWS_S3_BUCKET=lego
- AWS_ENTRYPOINT=http://minio:9000
- THUMBOR_SERVER=http://thumbor:8000
- THUMBOR_SECURITY_KEY=lego-dev
- SENTRY=http://sentry:sentry@localhost/2
- CELERY_BROKER_URL=redis://redis/1
- CHANNELS_REDIS_URL=redis://redis/2
- ELASTICSEARCH_HOST=http://elasticsearch
- STRIPE_API_KEY=123
- STRIPE_WEBHOOK_SECRET=123
- CAPTCHA_KEY=123
- LDAP_SERVER=localhost
- LDAP_USER=123
- LDAP_PASSWORD=123
- APNS_CERTIFICATE=123
- SEARCH_BACKEND=postgres
- ELASTICSEARCH_HOST=ignored
- CORS_ORIGIN_DOMAINS=ssr:3000
when:
event: [push]
branch:
exclude: [ prod ]
legocypresshelper:
image: abakus/lego-cypress-helper:latest
detach: true
pull: true
group: services
when:
event: [push]
branch:
exclude: [ prod ]
environment:
- PG_HOST=postgres
- PG_USERNAME=lego
- PG_DATABASE=lego
commands:
- cd /app
- ./wait-for-it.sh -t 420 api:8000
- node index.js
- echo "server stopped"
setup:
image: node:11
when:
event: [push]
environment:
- CYPRESS_INSTALL_BINARY=0
commands:
- yarn --frozen-lockfile
build_server:
image: node:11
when:
event: [push]
branch:
exclude: [ prod ]
group: testing
commands:
- yarn build:server
build_client:
image: node:11
when:
event: [push]
branch:
exclude: [ prod ]
group: testing
commands:
- yarn build:client
test:
image: node:11
when:
event: [push]
group: testing
commands:
- yarn test
lint:
image: node:11
when:
event: [push]
group: testing
commands:
- yarn lint
flow:
image: node:11
when:
event: [push]
group: testing
commands:
- yarn flow --quiet
install_cypress:
image: node:11
when:
event: [push]
branch:
exclude: [ prod ]
group: testing
environment:
- CYPRESS_CACHE_FOLDER=/drone/src/.cypress_cache
commands:
- yarn cypress install
ssr:
image: node:11
detach: true
when:
event: [push]
branch:
exclude: [ prod ]
environment:
- API_URL=http://api:8000/api/v1
- BASE_URL=http://api:8000
- WS_URL=ws://api:8000
commands:
- yarn ssr
cypress:
image: cypress/browsers:chrome69
shm_size: 100000000 # 100MB
when:
event: [push]
branch:
exclude: [ prod ]
environment:
- CYPRESS_API_BASE_URL=http://api:8000
- CYPRESS_RESET_DB_API=http://legocypresshelper:3030
- CYPRESS_BASE_URL=http://ssr:3000
- CYPRESS_CACHE_FOLDER=/drone/src/.cypress_cache
secrets: [cypress_record_key]
commands:
- ./wait-for-it.sh -t 180 ssr:3000
- ./wait-for-it.sh -t 180 legocypresshelper:3030
- yarn cypress run --record
docker:
image: plugins/docker
when:
branch:
- prod
event: push
status: success
registry: https://registry.abakus.no
repo: registry.abakus.no/webkom/lego-webapp
secrets: [docker_username, docker_password, sentry_auth_token]
tags:
- ${DRONE_BRANCH}-${DRONE_COMMIT_SHA:0:7}
build_args:
- RELEASE=${DRONE_BRANCH}-${DRONE_COMMIT_SHA:0:7}
- SENTRY_AUTH_TOKEN
- SENTRY_ORG=webkom
- SENTRY_PROJECT=lego-webapp
- SENTRY_URL=https://sentry.abakus.no/