-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add dev docker-compose file to manage supporting services #525
base: next
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.PHONY: dev | ||
dev: | ||
docker compose --profile central -f docker-compose.yml -f docker-compose.dev.yml up -d | ||
|
||
.PHONY: upgrade-successful | ||
upgrade-successful: | ||
docker compose exec postgres14 touch /var/lib/odk/postgresql/14/.postgres14-upgrade-successful | ||
|
||
.PHONY: stop | ||
stop: | ||
docker compose stop |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Assumption: This file will be merged by `docker compose` | ||
# | ||
# What it does: | ||
# Sets profiles for each service depending on whether that | ||
# service is required for development of that particular application | ||
# For Central be/fe development, we need postgres14, pyxform, enketo, redis_main | ||
# For Enketo development, we need postgres14, service, nginx, redis_main | ||
# 'none' profile is set for services that are not need for either | ||
# | ||
# depends_on of some services are reset using !reset custom yml tag | ||
# nb: can't replace depends_on so we have removed all the values, ok for dev | ||
services: | ||
postgres14: | ||
profiles: | ||
- central | ||
network_mode: host | ||
postgres: | ||
profiles: | ||
- none | ||
mail: | ||
profiles: | ||
- none | ||
service: | ||
profiles: | ||
- none | ||
nginx: | ||
profiles: | ||
- none | ||
pyxform: | ||
profiles: | ||
- central | ||
# changing port here - can't use `ports` mapping with host networking | ||
command: ["gunicorn", "--bind", "0.0.0.0:5001", "--workers", "5", "--timeout", "600", "--max-requests", "1", "--max-requests-jitter", "3", "main:app()"] | ||
network_mode: host | ||
secrets: | ||
profiles: | ||
- none | ||
enketo: | ||
profiles: | ||
- central | ||
depends_on: !reset [] | ||
environment: | ||
- ENV=DEV | ||
network_mode: host | ||
enketo_redis_main: | ||
profiles: | ||
- central | ||
network_mode: host | ||
enketo_redis_cache: | ||
profiles: | ||
- none |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,15 @@ | |
CONFIG_PATH=${ENKETO_SRC_DIR}/config/config.json | ||
echo "generating enketo configuration..." | ||
|
||
if [ "$ENV" = "DEV" ]; then | ||
sed -i -e 's/enketo_redis_main/localhost/g' \ | ||
-e 's/enketo_redis_cache/localhost/g' \ | ||
-e 's/6380/6379/g' \ | ||
-e 's/${SECRET}/s0m3v3rys3cr3tk3y/g' \ | ||
-e 's/${LESS_SECRET}/this $3cr3t key is crackable/g' \ | ||
-e 's/${API_KEY}/enketorules/g' "$CONFIG_PATH.template" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason these env vars can't be handled in |
||
fi | ||
|
||
BASE_URL=$( [ "${HTTPS_PORT}" = 443 ] && echo https://"${DOMAIN}" || echo https://"${DOMAIN}":"${HTTPS_PORT}" ) \ | ||
SECRET=$(cat /etc/secrets/enketo-secret) \ | ||
LESS_SECRET=$(cat /etc/secrets/enketo-less-secret) \ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#!/bin/bash -eu | ||
set -o pipefail | ||
|
||
flag_upgradeCompletedOk="$PGDATA/../.postgres14-upgrade-successful" | ||
flag_upgradeCompletedOk=$(readlink -f -m "$PGDATA/../.postgres14-upgrade-successful") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens currently when the " |
||
|
||
logPrefix="$(basename "$0")" | ||
log() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove stale comment.