forked from inspirehep/inspire-next
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.test.yml
441 lines (414 loc) · 12.5 KB
/
docker-compose.test.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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2014-2017 CERN.
#
# INSPIRE is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# INSPIRE is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with INSPIRE. If not, see <http://www.gnu.org/licenses/>.
#
# In applying this license, CERN does not waive the privileges and immunities
# granted to it by virtue of its status as an Intergovernmental Organization
# or submit itself to any jurisdiction.
version: '2.1'
services:
test-service_base:
# Overrides default inspirehep config.
extends:
file: services.yml
service: base
environment:
- APP_SQLALCHEMY_DATABASE_URI=postgresql+psycopg2://inspirehep:dbpass123@test-database:5432/inspirehep
- APP_CELERY_BROKER_URL=pyamqp://guest:guest@test-rabbitmq:5672//
- APP_CELERY_RESULT_BACKEND=redis://test-redis:6379/1
- APP_CACHE_REDIS_URL=redis://test-redis:6379/0
- APP_ACCOUNTS_SESSION_REDIS_URL=redis://test-redis:6379/2
- APP_SEARCH_ELASTIC_HOSTS=test-indexer
proxied_base:
extends: test-service_base
environment:
- HTTP_PROXY=mitm-proxy:8080
- http_proxy=mitm-proxy:8080
- HTTPS_PROXY=mitm-proxy:8080
- https_proxy=mitm-proxy:8080
- APP_CFG_BIBCATALOG_SYSTEM_RT_URL="https://rt.inspirehep.net/REST/1.0/"
- APP_CFG_BIBCATALOG_SYSTEM_RT_DEFAULT_USER="rtuser"
- APP_CFG_BIBCATALOG_SYSTEM_RT_DEFAULT_PWD="rtpass"
- APP_CFG_BIBCATALOG_SYSTEM_RT_VERIFY_SSL="False"
- APP_BIBCATALOG_QUEUES="Test"
mitm-proxy:
image: inspirehep/inspire-mitmproxy:0
tty: true
ports:
- 127.0.0.1:8081:8081
environment:
- SCENARIOS_PATH=/inspire-next/tests/e2e/scenarios/
- HTTP_PROXY=mitm-proxy:8080
- http_proxy=mitm-proxy:8080
- HTTPS_PROXY=mitm-proxy:8080
- https_proxy=mitm-proxy:8080
- INSPIRE_NEXT_NETLOC=test-web-e2e.local:5000
healthcheck:
timeout: 5s
interval: 5s
retries: 5
test: nc -z 127.0.0.1:8080
volumes:
- ".:/inspire-next"
unit:
extends:
service: test-service_base
volumes_from:
- test-static
command: bash -c "flake8 inspirehep tests && py.test tests/unit && make -C docs html"
workflows:
extends:
service: test-service_base
command: py.test tests/integration/workflows
volumes_from:
- test-static
depends_on:
test-database:
condition: service_healthy
test-indexer:
condition: service_healthy
test-redis:
condition: service_healthy
integration:
extends:
service: test-service_base
command: py.test tests/integration --ignore tests/integration/workflows
volumes_from:
- test-static
depends_on:
test-database:
condition: service_healthy
test-indexer:
condition: service_healthy
test-redis:
condition: service_healthy
ui:
extends:
service: test-service_base
command: py.test --driver Remote --host selenium --port 4444 --capability browserName firefox --html=selenium-report.html tests/ui
volumes_from:
- test-static
depends_on:
test-database:
condition: service_healthy
test-indexer:
condition: service_healthy
test-rabbitmq:
condition: service_healthy
test-redis:
condition: service_healthy
test-worker:
condition: service_healthy
selenium:
condition: service_started
test-web:
condition: service_started
environment:
- SERVER_NAME=test-web:5000
visible_ui:
extends:
service: test-service_base
command: py.test --driver Firefox --host selenium --port 4444 --capability browserName firefox --html=selenium-report.html tests/ui
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix
volumes_from:
- test-static
depends_on:
test-database:
condition: service_healthy
test-indexer:
condition: service_healthy
test-rabbitmq:
condition: service_healthy
test-redis:
condition: service_healthy
test-worker:
condition: service_healthy
selenium:
condition: service_started
test-web:
condition: service_started
environment:
- SERVER_NAME=test-web:5000
- DISPLAY=$DISPLAY
ui-authors:
extends:
service: test-service_base
command: py.test --driver Remote --host selenium --port 4444 --capability browserName firefox --html=selenium-report.html tests/ui/authors
volumes_from:
- test-static
depends_on:
test-database:
condition: service_healthy
test-indexer:
condition: service_healthy
test-rabbitmq:
condition: service_healthy
test-redis:
condition: service_healthy
test-worker:
condition: service_healthy
selenium:
condition: service_started
test-web:
condition: service_started
environment:
- SERVER_NAME=test-web:5000
ui-literature:
extends:
service: test-service_base
command: py.test --driver Remote --host selenium --port 4444 --capability browserName firefox --html=selenium-report.html tests/ui/literature
volumes_from:
- test-static
depends_on:
test-database:
condition: service_healthy
test-indexer:
condition: service_healthy
test-rabbitmq:
condition: service_healthy
test-redis:
condition: service_healthy
test-worker:
condition: service_healthy
selenium:
condition: service_started
test-web:
condition: service_started
environment:
- SERVER_NAME=test-web:5000
test-web:
extends:
service: test-service_base
command: gunicorn -b 0.0.0.0:5000 -t 3600 -w 1 --access-logfile "-" inspirehep.wsgi_with_coverage:application
volumes_from:
- test-static
depends_on:
test-database:
condition: service_healthy
test-indexer:
condition: service_healthy
test-rabbitmq:
condition: service_healthy
test-redis:
condition: service_healthy
environment:
- APP_SERVER_NAME=test-web:5000
test-worker:
extends:
service: test-service_base
command: celery worker -E -A inspirehep.celery_tests --loglevel=INFO --purge --queues celery,migrator,harvests,orcid_push
volumes_from:
- test-static
healthcheck:
timeout: 5s
interval: 5s
retries: 5
test:
- "CMD"
- "bash"
- "-c"
- "/virtualenv/bin/celery --broker=pyamqp://guest:guest@test-rabbitmq:5672// inspect ping | grep OK"
depends_on:
test-database:
condition: service_healthy
test-indexer:
condition: service_healthy
test-rabbitmq:
condition: service_healthy
test-redis:
condition: service_healthy
test-redis:
image: redis:3.2.3
healthcheck:
timeout: 5s
interval: 5s
retries: 5
test:
- "CMD"
- "bash"
- "-c"
- "exec 3<> /dev/tcp/127.0.0.1/6379 && echo PING >&3 && head -1 <&3 | grep PONG"
test-indexer:
extends:
file: services.yml
service: indexer
healthcheck:
timeout: 5s
interval: 5s
retries: 5
test:
- "CMD-SHELL"
- "curl http://localhost:9200/_cluster/health | grep '.status.:.\\(green\\|yellow\\)'"
test-rabbitmq:
image: rabbitmq
healthcheck:
timeout: 5s
interval: 5s
retries: 5
test:
- "CMD"
- "rabbitmqctl"
- "status"
test-database:
extends:
file: services.yml
service: database
healthcheck:
timeout: 5s
interval: 5s
retries: 5
test:
- "CMD-SHELL"
- "pg_isready --dbname=inspirehep --host=localhost --username=inspirehep"
selenium:
image: selenium/standalone-firefox:2.53.1-beryllium
test-static:
extends:
file: services.yml
service: static
test-scrapyd:
extends:
service: proxied_base
command: bash -c "rm -f twistd.pid && exec scrapyd"
volumes_from:
- test-static
environment:
- APP_FILES_STORE=/tmp/file_urls
- APP_LAST_RUNS_PATH=/code/.scrapy/last_runs
- APP_CRAWL_ONCE_PATH=/code/.scrapy
- APP_BROKER_URL=pyamqp://guest:guest@test-rabbitmq:5672//
- APP_CELERY_RESULT_BACKEND=redis://test-redis:6379/1
depends_on:
test-rabbitmq:
condition: service_healthy
test-redis:
condition: service_healthy
test-scrapyd-deploy:
extends:
service: proxied_base
working_dir: /virtualenv/lib/python2.7/site-packages/hepcrawl
command: bash -c "sed -i -e 's|^url .*|url = http://test-scrapyd:6800|' scrapy.cfg && exec scrapyd-deploy"
volumes_from:
- test-static
links:
- test-scrapyd
# we need the .local to allow session cookies to be used correctly by the
# browsers/http libraries (like requests)
test-web-e2e.local:
extends:
service: proxied_base
command: gunicorn -b 0.0.0.0:5000 -t 3600 -w 1 --access-logfile "-" inspirehep.wsgi_with_coverage:application
volumes_from:
- test-static
healthcheck:
timeout: 5s
interval: 5s
retries: 15
test:
- "CMD"
- "bash"
- "-c"
- "env http_proxy= curl -v http://test-web-e2e.local:5000/ping | grep OK"
depends_on:
test-database:
condition: service_healthy
test-indexer:
condition: service_healthy
test-rabbitmq:
condition: service_healthy
test-redis:
condition: service_healthy
environment:
- APP_SERVER_NAME="test-web-e2e.local:5000"
- APP_JSONSCHEMAS_HOST="test-web-e2e.local:5000"
- APP_SESSON_COOKIE_DOMAIN=".local:5000"
- APP_ARXIV_PDF_URL="/pdf/{arxiv_id}"
- APP_ARXIV_PDF_URL_ALTERNATIVE="/pdf/{arxiv_id}"
- APP_ARXIV_TARBALL_URL="/e-print/{arxiv_id}"
- APP_PRODUCTION_MODE=True
- APP_LEGACY_ROBOTUPLOAD_URL="http://inspirehep.net/"
- APP_CRAWLER_HOST_URL=http://test-scrapyd:6800
test-worker-e2e:
extends:
service: proxied_base
command: celery worker -E -A inspirehep.celery_tests --loglevel=DEBUG --purge --queues celery,migrator,harvests,orcid_push
healthcheck:
timeout: 5s
interval: 5s
retries: 5
test:
- "CMD"
- "bash"
- "-c"
- "/virtualenv/bin/celery --broker=pyamqp://guest:guest@test-rabbitmq:5672// inspect ping | grep OK"
volumes_from:
- test-static
depends_on:
test-database:
condition: service_healthy
test-indexer:
condition: service_healthy
test-rabbitmq:
condition: service_healthy
test-redis:
condition: service_healthy
environment:
- APP_SERVER_NAME="test-web-e2e.local:5000"
- APP_JSONSCHEMAS_HOST="test-web-e2e.local:5000"
- APP_PRODUCTION_MODE=True
- APP_LEGACY_ROBOTUPLOAD_URL="http://inspirehep.net/"
- APP_LEGACY_PID_PROVIDER="http://inspirehep.net//batchuploader/allocaterecord"
- APP_CRAWLER_HOST_URL=http://test-scrapyd:6800
# This is needed as docker-compose does not wait for the entry services to
# be actually healthy when doing `docker-compose run e2e`, but only for
# derived dependent services.
e2e-deps-placeholder:
extends:
service: proxied_base
command: "true"
depends_on:
mitm-proxy:
condition: service_healthy
test-database:
condition: service_healthy
test-indexer:
condition: service_healthy
test-rabbitmq:
condition: service_healthy
test-redis:
condition: service_healthy
test-web-e2e.local:
condition: service_healthy
test-worker-e2e:
condition: service_started
test-scrapyd:
condition: service_started
test-scrapyd-deploy:
condition: service_started
e2e:
extends:
service: proxied_base
command: py.test -vvv tests/e2e
volumes_from:
- test-static
depends_on:
e2e-deps-placeholder:
condition: service_started
environment:
- APP_SERVER_NAME=test-web:5000
- APP_CRAWLER_HOST_URL=http://test-scrapyd:6800