File tree 5 files changed +48
-6
lines changed
5 files changed +48
-6
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,9 @@ COPY --from=backend-build /usr/local/bin/uwsgi /usr/local/bin/uwsgi
50
50
51
51
# Stage 3.2 - Copy source code
52
52
WORKDIR /app
53
+ COPY ./bin/wait_for_db.sh /wait_for_db.sh
53
54
COPY ./bin/docker_start.sh /start.sh
55
+ COPY ./bin/setup_configuration.sh /setup_configuration.sh
54
56
RUN mkdir /app/log /app/config
55
57
56
58
# 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 @@ -11,19 +11,36 @@ services:
11
11
12
12
web :
13
13
build : .
14
- environment :
14
+ environment : &app-env
15
15
- DJANGO_SETTINGS_MODULE=objects.conf.docker
16
16
- SECRET_KEY=${SECRET_KEY:-1(@f(-6s_u(5fd&1sg^uvu2s(c-9sapw)1era8q&)g)h@cwxxg}
17
17
- OBJECTS_SUPERUSER_USERNAME=admin
18
18
- OBJECTS_SUPERUSER_PASSWORD=admin
19
19
- OBJECTS_SUPERUSER_EMAIL=admin@localhost
20
20
- ALLOWED_HOSTS=*
21
+ # setup_configuration env vars
22
+ - OBJECTS_DOMAIN=web:8000
23
+ - OBJECTS_ORGANIZATION=Objects
24
+ - OBJECTTYPES_API_ROOT=https://objecttypes.example.com/api/v2/
25
+ - OBJECTS_OBJECTTYPES_TOKEN=some-random-string
26
+ - DEMO_CONFIG_ENABLE=yes
27
+ - DEMO_TOKEN=demo-random-string
28
+ - DEMO_PERSON=Demo
29
+
21
30
ports :
22
31
- 8000:8000
23
32
depends_on :
24
- - db
33
+ web-init :
34
+ condition : service_completed_successfully
25
35
volumes :
26
36
- media:/app/media # Shared media volume to get access to saved OAS files
27
37
38
+ web-init :
39
+ build : .
40
+ environment : *app-env
41
+ command : /setup_configuration.sh
42
+ depends_on :
43
+ - db
44
+
28
45
volumes :
29
46
media :
You can’t perform that action at this time.
0 commit comments