Skip to content

Commit

Permalink
Include docker compose to handle kpi db services. Pip install jwt pac…
Browse files Browse the repository at this point in the history
…kage within kpi web docker container. Comment out mongo and postgres db wait docker scripts
  • Loading branch information
WinnyTroy committed May 4, 2021
1 parent 47497b9 commit bd0bd78
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ COPY . "${KPI_SRC_DIR}"
RUN virtualenv "$VIRTUAL_ENV"
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
RUN pip install --quiet --upgrade pip && \
pip install --quiet pip-tools
pip install --quiet pip-tools && pip install jwt
COPY ./dependencies/pip/external_services.txt /srv/tmp/pip_dependencies.txt
RUN pip-sync /srv/tmp/pip_dependencies.txt 1>/dev/null && \
rm -rf ~/.cache/pip
Expand Down
37 changes: 37 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
version: '2.2'

services:
kpi_db:
image: postgis/postgis:9.6-3.0
environment:
- POSTGRES_PASSWORD=kpi
- POSTGRES_USER=kpi
- POSTGRES_DB=kpi
volumes:
# One level above the code to prevent having to move or delete
# it everytime we rebuild.
- /var/lib/postgresql/data
onadata_db:
image: postgis/postgis:9.6-3.0
environment:
- POSTGRES_PASSWORD=onadata
- POSTGRES_USER=onadata
- POSTGRES_DB=onadata
volumes:
# One level above the code to prevent having to move or delete
# it everytime we rebuild.
- /var/lib/postgresql/data
web:
build:
context: .
dockerfile: Dockerfile
image: kpi:latest
ports:
- "8000:8000"
depends_on:
- kpi_db
- onadata_db
environment:
- DATABASE_URL=postgres://db:5432/kpi
volumes:
- .:/srv/src/kpi
4 changes: 2 additions & 2 deletions docker/init.bash
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ fi


# Wait for databases to be up & running before going further
/bin/bash "${INIT_PATH}/wait_for_mongo.bash"
/bin/bash "${INIT_PATH}/wait_for_postgres.bash"
# /bin/bash "${INIT_PATH}/wait_for_mongo.bash"
# /bin/bash "${INIT_PATH}/wait_for_postgres.bash"

echo 'Running migrations...'
python manage.py migrate --noinput
Expand Down

0 comments on commit bd0bd78

Please sign in to comment.