-
Notifications
You must be signed in to change notification settings - Fork 4
/
docker-compose.yml
217 lines (206 loc) · 7.36 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
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
# This is a Docker Compose development environment for Restarters. It allows you to run a development environment
# locally. You'll get:
# - a web server on http://www.example.com:8001 which serves up restarters. Admin user is [email protected]/passw0rd.
# - phpMyAdmin on http://www.example.com:8002. Use host restarters_db, user root/s3cr3t
# - Discourse on http://www.example.com:8003. User is someuser/mustbetencharacters; see below about hostname.
# - Mailhog on http://localhost:8025.
#
# TODO The domain name could be better but needs some configuration on the Discourse images which is hard.
# TODO It doesn't yet include the wiki.
# TODO If your host is Linux, this probably only works if you run as root.
# TODO This is stock Discourse - no theme. Would be nice to have the theme, but that doesn't matter so far as
# testing the integration.
#
# On the machine where you will be using your browser to access the Restarters / Discourse sites once set up on Docker,
# add a record to your hosts file to point the domain www.example.com to the machine.
#
# Then start using:
# - docker-compose up -d
#
# The Restarters web server won't be available for some time after that finishes - it will be doing a composer
# install, artisan migrate etc. Discourse also takes quite a few minutes to finish initialising. You can monitor
# progress using:
#
# docker logs --follow restarters
#
# (or via Docker Desktop's UI on Windows). Check for any obvious errors.
#
# Then:
# - edit .env and set GOOGLE_API_CONSOLE_KEY to the dev key.
# TODO This isn't checked in to the codebase, but once this works on Circle then we can put it in an env variable and edit it in via docker_run.sh.
# - log in to the restarters container using: docker exec -it restarters bash
# - run UT using: export DB_TEST_HOST=restarters_db; php vendor/phpunit/phpunit/phpunit --configuration ./phpunit.xml
# TODO This isn't a very convenient way to do run tests. Would be good to enable SSH on the Restarter container so
# that JetBrains and other IDEs can trigger the running of tests.
#
# If you want to remove everything to free up disk space or force a complete rebuild (e.g. as a sanity check
# after changing this configuration):
# - docker-compose down -v --rmi all --remove-orphans
#
# Discourse will be set up with an API key of 9fd72d4c45226cbf7a540af3cb49ee2e2da034b1984881b13743a3f2e071be29. If
# you need to recreate this, then:
# - Log in to http://www.example.com:8003 using someuser/mustbetencharacters
# - Go to http://www.example.com:8003/admin/api/keys/new and create an API key for all users with all scope.
# Then put it in .env as DISCOURSE_APIKEY.
# - Go to http://www.example.com:8003/admin/site_settings/category/login?filter= and
# - set the discourse connect url to http://www.example.com:8001/discourse/sso
# - enable discourse connect
# - enable discourse connect provider
# - set the discourse connect secret to mustbetencharacters (should match DISCOURSE_SECRET in .env).
# This is automated in a different way in CircleCI - see config.yml.
version: '3'
services:
restarters:
depends_on:
- restarters_db
build:
context: .
dockerfile: Dockerfile
image: php:7.4
user: root
container_name: restarters
restart: unless-stopped
tty: true
ports:
- "8001:80"
environment:
SERVICE_NAME: restarters
SERVICE_TAGS: dev
working_dir: /var/www
volumes:
# We share the current folder into /var/www. This means code changes on the host will get picked up
# by the client.
- ./:/var/www:rw
- ./php/local.ini:/usr/local/etc/php/conf.d/local.ini
networks:
- app-network
restarters_db:
image: mysql:5.7.33
container_name: restarters_db
restart: unless-stopped
tty: true
expose:
- "3306"
environment:
MYSQL_DATABASE: restarters_db_test
MYSQL_ROOT_PASSWORD: s3cr3t
MYSQL_USER: restarters
MYSQL_PASSWORD: s3cr3t
SERVICE_TAGS: dev
SERVICE_NAME: mysql
volumes:
- dbdata:/var/lib/mysql
- ./mysql/my.cnf:/etc/mysql/my.cnf
networks:
- app-network
phpmyadmin:
depends_on:
- restarters_db
image: phpmyadmin
container_name: restarters_phpmyadmin
restart: unless-stopped
ports:
- 8002:80
environment:
- PMA_ARBITRARY=1
- PMA_HOST=restarters_db
# - PMA_USER=root
# - PMA_PASSWORD=s3cr3t
networks:
- app-network
mailhog:
image: mailhog/mailhog
container_name: restarters_mailhog
logging:
driver: 'none' # disable saving logs
ports:
- 1025:1025 # smtp server
- 8025:8025 # web ui
networks:
- app-network
# From here, it's stuff that Discourse needs.
#
# The other Docker images hardcode the name of the postgresql server in some places, so we can't prefix that.
#
# If you want to connect to the database that Discourse uses, you can do this from the restarters container using:
# psql -h postgresql -U bn_discourse -p 5432 -w bitnami_discourse
postgresql:
image: docker.io/bitnami/postgresql:11
container_name: postgresql
volumes:
- 'postgresql_data:/bitnami/postgresql'
environment:
- ALLOW_EMPTY_PASSWORD=yes
- POSTGRESQL_USERNAME=bn_discourse
- POSTGRESQL_DATABASE=bitnami_discourse
networks:
- app-network
restarters_discourse_redis:
image: docker.io/bitnami/redis:6.0
container_name: restarters_discourse_redis
environment:
- ALLOW_EMPTY_PASSWORD=yes
volumes:
- 'redis_data:/bitnami/discourse'
networks:
- app-network
restarters_discourse:
image: docker.io/bitnami/discourse:2
container_name: restarters_discourse
ports:
- '8003:80'
volumes:
- 'discourse_data:/bitnami/discourse'
depends_on:
- postgresql
- restarters_discourse_redis
environment:
- ALLOW_EMPTY_PASSWORD=yes
- DISCOURSE_USERNAME=someuser
- DISCOURSE_PASSWORD=mustbetencharacters
- DISCOURSE_HOST=www.example.com:8003 # You should have set this in hosts.
- DISCOURSE_PORT_NUMBER=80
- DISCOURSE_DATABASE_HOST=postgresql
- DISCOURSE_DATABASE_PORT_NUMBER=5432
- DISCOURSE_DATABASE_USER=bn_discourse
- DISCOURSE_DATABASE_NAME=bitnami_discourse
- DISCOURSE_REDIS_HOST=restarters_discourse_redis
- DISCOURSE_REDIS_PORT_NUMBER=6379
- POSTGRESQL_CLIENT_POSTGRES_USER=postgres
- POSTGRESQL_CLIENT_CREATE_DATABASE_NAME=bitnami_discourse
- POSTGRESQL_CLIENT_CREATE_DATABASE_EXTENSIONS=hstore,pg_trgm
networks:
- app-network
sidekiq:
image: docker.io/bitnami/discourse:2
container_name: restarters_discourse_sidekiq
depends_on:
- restarters_discourse
volumes:
- 'sidekiq_data:/bitnami/discourse'
command: /opt/bitnami/scripts/discourse-sidekiq/run.sh
environment:
- ALLOW_EMPTY_PASSWORD=yes
- DISCOURSE_HOST=www.example.com
- DISCOURSE_DATABASE_HOST=postgresql
- DISCOURSE_DATABASE_PORT_NUMBER=5432
- DISCOURSE_DATABASE_USER=bn_discourse
- DISCOURSE_DATABASE_NAME=bitnami_discourse
- DISCOURSE_REDIS_HOST=restarters_discourse_redis
- DISCOURSE_REDIS_PORT_NUMBER=6379
networks:
- app-network
networks:
app-network:
driver: bridge
volumes:
dbdata:
driver: local
postgresql_data:
driver: local
redis_data:
driver: local
discourse_data:
driver: local
sidekiq_data:
driver: local