-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-compose.yml
150 lines (141 loc) · 4.75 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
# Docker Compose File for Development / Single Machine Deployments
# Creates an Nginx, Django, and Postgres container that work
# together.
version: "3"
networks:
frontend:
driver: bridge
ipam:
driver: default
config:
- subnet: 192.168.0.0/24
backend:
driver: bridge
ipam:
driver: default
config:
- subnet: 192.168.1.0/24
services:
presqt_nginx:
depends_on:
- presqt_django
image: nginx:1.15
networks:
- frontend
ports:
# This ties host port 8000 to nginx container port 80
# Inside of the nginx config, it's port 80 it forwarded to Django 8000
# It is a little confusing.
- 80:80
- 443:443
restart: always
volumes:
- ./config/ssl:/etc/ssl
- ./config/nginx/conf.d/${ENVIRONMENT}_local.conf:/etc/nginx/conf.d/default.conf
- ./config/nginx/snippets:/etc/nginx/snippets
- ./config/nginx/nginx.conf:/etc/nginx/nginx.conf
- ./announcements:/usr/src/app/announcements
- presqt_ui_volume:/usr/src/app/ui
- presqt_static_volume:/usr/src/app/staticfiles
- presqt_media_volume:/usr/src/app/mediafiles
- nginx_logs_volume:/var/log/nginx/
# Create a Django container. Note that no secrets should
# be stored within the container, but passed in via
# environment variables.
presqt_django:
command: "docker/django_entrypoint.sh"
build:
context: .
dockerfile: django.dockerfile
# "Build Args" don't persist into the running
# container, so we prefix them with BUILD to
# make this clear.
args:
BUILD_ENVIRONMENT: ${ENVIRONMENT:-production}
environment:
CURATE_ND_TEST_TOKEN: $CURATE_ND_TEST_TOKEN
GITHUB_TEST_USER_TOKEN: $GITHUB_TEST_USER_TOKEN
GITLAB_TEST_USER_TOKEN: $GITLAB_TEST_USER_TOKEN
GITLAB_UPLOAD_TEST_USER_TOKEN: $GITLAB_UPLOAD_TEST_USER_TOKEN
OSF_TEST_USER_TOKEN: $OSF_TEST_USER_TOKEN
OSF_PRIVATE_USER_TOKEN: $OSF_PRIVATE_USER_TOKEN
OSF_UPLOAD_TEST_USER_TOKEN: $OSF_UPLOAD_TEST_USER_TOKEN
OSF_PRESQT_FORK_TOKEN: $OSF_PRESQT_FORK_TOKEN
ZENODO_TEST_USER_TOKEN: $ZENODO_TEST_USER_TOKEN
FIGSHARE_TEST_USER_TOKEN: $FIGSHARE_TEST_USER_TOKEN
SECRET_KEY: $SECRET_KEY
ENVIRONMENT: ${ENVIRONMENT:-production}
DJANGO_SETTINGS_MODULE: config.settings.${ENVIRONMENT:-production}
EMAIL_HOST_USER: ${EMAIL_HOST_USER:-NA}
FAIRSHAKE_TOKEN: ${FAIRSHAKE_TOKEN:-NA}
restart: always
volumes:
- .:/usr/src/app
- presqt_static_volume:/usr/src/app/staticfiles
- presqt_media_volume:/usr/src/app/mediafiles
networks:
- frontend
- backend
# Since only one service should be running
# per container, we need something separate
# to run scheduled jobs.
presqt_cron:
command: "docker/cron_startup.sh"
restart: always
depends_on:
- presqt_django
build:
context: .
dockerfile: django.dockerfile
args:
BUILD_ENVIRONMENT: ${ENVIRONMENT:-production}
environment:
CURATE_ND_TEST_TOKEN: $CURATE_ND_TEST_TOKEN
GITHUB_TEST_USER_TOKEN: $GITHUB_TEST_USER_TOKEN
GITLAB_TEST_USER_TOKEN: $GITLAB_TEST_USER_TOKEN
GITLAB_UPLOAD_TEST_USER_TOKEN: $GITLAB_UPLOAD_TEST_USER_TOKEN
OSF_TEST_USER_TOKEN: $OSF_TEST_USER_TOKEN
OSF_PRIVATE_USER_TOKEN: $OSF_PRIVATE_USER_TOKEN
OSF_UPLOAD_TEST_USER_TOKEN: $OSF_UPLOAD_TEST_USER_TOKEN
OSF_PRESQT_FORK_TOKEN: $OSF_PRESQT_FORK_TOKEN
ZENODO_TEST_USER_TOKEN: $ZENODO_TEST_USER_TOKEN
FIGSHARE_TEST_USER_TOKEN: $FIGSHARE_TEST_USER_TOKEN
SECRET_KEY: $SECRET_KEY
ENVIRONMENT: ${ENVIRONMENT:-production}
DJANGO_SETTINGS_MODULE: config.settings.${ENVIRONMENT:-production}
EMAIL_HOST_USER: ${EMAIL_HOST_USER:-NA}
FAIRSHAKE_TOKEN: ${FAIRSHAKE_TOKEN:-NA}
volumes:
- .:/usr/src/app
- presqt_static_volume:/usr/src/app/staticfiles
- presqt_media_volume:/usr/src/app/mediafiles
- ./config/cron/crontabs/${ENVIRONMENT:-production}.crontab:/etc/crontabs/root
networks:
- backend
presqt_nginx_logger:
command: "docker/nginx_logger_startup.sh"
restart: always
depends_on:
- presqt_nginx
build:
context: .
dockerfile: django.dockerfile
args:
BUILD_ENVIRONMENT: ${ENVIRONMENT:-production}
environment:
ENVIRONMENT: ${ENVIRONMENT:-production}
volumes:
- .:/usr/src/app
- nginx_logs_volume:/var/log/nginx/
# We create two top-level networks to provide some isolation
# of concerns / greater security. In our case, we use this to
# disallow direct connections between the NGINX container and
# the Postgres container.
networks:
frontend:
backend:
volumes:
presqt_static_volume:
presqt_media_volume:
presqt_ui_volume:
nginx_logs_volume: