File tree 5 files changed +49
-6
lines changed
5 files changed +49
-6
lines changed Original file line number Diff line number Diff line change @@ -51,10 +51,12 @@ COPY --from=backend-build /usr/local/bin/celery /usr/local/bin/celery
51
51
52
52
# Stage 3.2 - Copy source code
53
53
WORKDIR /app
54
+ COPY ./bin/wait_for_db.sh /wait_for_db.sh
54
55
COPY ./bin/docker_start.sh /start.sh
55
56
COPY ./bin/celery_worker.sh /celery_worker.sh
56
57
COPY ./bin/celery_flower.sh /celery_flower.sh
57
58
COPY ./bin/check_celery_worker_liveness.py ./bin/
59
+ COPY ./bin/setup_configuration.sh /setup_configuration.sh
58
60
RUN mkdir /app/log /app/config
59
61
60
62
# copy frontend build statics
Original file line number Diff line number Diff line change @@ -15,10 +15,8 @@ uwsgi_threads=${UWSGI_THREADS:-2}
15
15
16
16
mountpoint=${SUBPATH:-/ }
17
17
18
- until pg_isready; do
19
- >&2 echo " Waiting for database connection..."
20
- sleep 1
21
- done
18
+ # wait for required services
19
+ ${SCRIPTPATH} /wait_for_db.sh
22
20
23
21
>&2 echo " Database is up."
24
22
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # setup initial configuration using environment variables
4
+ # Run this script from the root of the repository
5
+
6
+ # set -e
7
+ ${SCRIPTPATH} /wait_for_db.sh
8
+
9
+ src/manage.py migrate
10
+ src/manage.py setup_configuration --no-selftest
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ set -e
4
+
5
+ # Wait for the database container
6
+ # See: https://docs.docker.com/compose/startup-order/
7
+ export PGHOST=${DB_HOST:- db}
8
+ export PGPORT=${DB_PORT:- 5432}
9
+
10
+ until pg_isready; do
11
+ >&2 echo " Waiting for database connection..."
12
+ sleep 1
13
+ done
14
+
15
+ >&2 echo " Database is up."
Original file line number Diff line number Diff line change @@ -30,14 +30,32 @@ services:
30
30
- CELERY_BROKER_URL=redis://redis:6379/1
31
31
- CELERY_RESULT_BACKEND=redis://redis:6379/1
32
32
- CELERY_LOGLEVEL=DEBUG
33
+ # setup_configuration env vars
34
+ - OBJECTS_DOMAIN=web:8000
35
+ - OBJECTS_ORGANIZATION=Objects
36
+ - OBJECTTYPES_API_ROOT=https://objecttypes.example.com/api/v2/
37
+ - OBJECTS_OBJECTTYPES_TOKEN=some-random-string
38
+ - DEMO_CONFIG_ENABLE=yes
39
+ - DEMO_TOKEN=demo-random-string
40
+ - DEMO_PERSON=Demo
41
+
33
42
ports :
34
43
- 8000:8000
35
44
depends_on :
36
- - db
37
- - redis
45
+ web-init :
46
+ condition : service_completed_successfully
38
47
volumes : &web_volumes
39
48
- media:/app/media # Shared media volume to get access to saved OAS files
40
49
50
+ web-init :
51
+ build : *web_build
52
+ environment : *web_env
53
+ command : /setup_configuration.sh
54
+ depends_on :
55
+ - db
56
+ - redis
57
+ volumes : *web_volumes
58
+
41
59
celery :
42
60
build : *web_build
43
61
environment : *web_env
You can’t perform that action at this time.
0 commit comments