forked from inspirehep/inspire-next
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
166 lines (155 loc) · 4.46 KB
/
docker-compose.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
# -*- 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:
service_base:
# Overrides default inspirehep config.
extends:
file: services.yml
service: base
environment:
- APP_SQLALCHEMY_DATABASE_URI=postgresql+psycopg2://inspirehep:dbpass123@database:5432/inspirehep
- APP_BROKER_URL=amqp://guest:guest@rabbitmq:5672//
- APP_CELERY_RESULT_BACKEND=amqp://guest:guest@rabbitmq:5672//
- APP_CACHE_REDIS_URL=redis://redis:6379/0
- APP_ACCOUNTS_SESSION_REDIS_URL=redis://redis:6379/2
- APP_SEARCH_ELASTIC_HOSTS=indexer
- APP_ES_BULK_TIMEOUT=240
- APP_CRAWLER_HOST_URL=http://scrapyd:6800
- APP_CRAWLER_API_PIPELINE_URL=http://flower:5555/api/task/async-apply
- APP_OAIHARVESTER_WORKDIR=/virtualenv/oaiharvest_workdir
# Services using the inspirehep code.
web:
extends:
service: service_base
command: gunicorn -b 0.0.0.0:5000 -t 3600 --access-logfile "-" --reload inspirehep.wsgi
volumes_from:
- static
ports:
- "5000:5000"
depends_on:
database:
condition: service_healthy
indexer:
condition: service_healthy
rabbitmq:
condition: service_healthy
redis:
condition: service_healthy
environment:
- APP_DEBUG=True
- APP_ASSETS_DEBUG=True
worker:
extends:
service: service_base
command: celery worker -E -A inspirehep.celery --loglevel=INFO --purge
volumes_from:
- static
depends_on:
database:
condition: service_healthy
indexer:
condition: service_healthy
rabbitmq:
condition: service_healthy
redis:
condition: service_healthy
# Services needed for inspirehep to run.
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"
indexer:
extends:
file: services.yml
service: indexer
ports:
- "9200:9200"
volumes:
- "${DOCKER_DATA}/tmp/inspirehep_elastic/data:/usr/share/elasticsearch/data"
- "${DOCKER_DATA}/tmp/inspirehep_elastic/log:/usr/share/elasticsearch/log"
healthcheck:
timeout: 5s
interval: 5s
retries: 5
test:
- "CMD-SHELL"
- "curl http://localhost:9200/_cluster/health | grep '.status.:.\\(green\\|yellow\\)'"
rabbitmq:
image: rabbitmq
healthcheck:
timeout: 5s
interval: 5s
retries: 5
test:
- "CMD"
- "rabbitmqctl"
- "status"
database:
extends:
file: services.yml
service: database
volumes:
- "${DOCKER_DATA}/tmp/inspirehep_db/data:/var/lib/postgresql/data/pgdata"
healthcheck:
timeout: 5s
interval: 5s
retries: 5
test:
- "CMD-SHELL"
- "pg_isready --dbname=inspirehep --host=localhost --username=inspirehep"
scrapyd:
extends:
service: service_base
command: scrapyd
volumes_from:
- static
# Services useful for monitoring/debugging.
flower:
extends:
service: service_base
ports:
- "5555:5555"
command: flower -A inspirehep.celery --broker=amqp://guest:guest@rabbitmq:5672//
volumes_from:
- static
depends_on:
database:
condition: service_healthy
indexer:
condition: service_healthy
rabbitmq:
condition: service_healthy
redis:
condition: service_healthy
# Static volume config for service_base.
static:
extends:
file: services.yml
service: static