diff --git a/README.md b/README.md index f2afb037..b45f2d90 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,11 @@ In addition to the Backend and the Frontend, Central deploys services: * Central relies on [pyxform-http](https://github.com/getodk/pyxform-http) for converting Forms from XLSForm. It generally shouldn't be needed in development but can be run locally. * Central relies on [Enketo](https://github.com/enketo/enketo-express) for Web Form functionality. Enketo can be run locally and configured to work with Frontend and Backend in development by following [these instructions](https://github.com/getodk/central-frontend/blob/master/docs/enketo.md). -If you want to work on Central codebase and don't want to setup dependent services like Postgresql, Enketo, etc manually then you can run `make dev`, which will start those services as Docker containers. +If you want to work on Central codebase and don't want to setup dependent services like Postgresql, Enketo, etc manually then you can run `make dev`, which will start those services as Docker containers. With this setup you would need a local domain name, `central-dev` is a good choice. Following are the places where you need to add this: + +* Set `DOMAIN=central-dev` in .env file. +* Add an entry in your `/etc/hosts` file for `127.0.0.1 central-dev`. +* Create `local.json` in central-backend directory and set value of default.env.domain to `http://central-dev:8989` Operations ---------- diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 7f455bf9..9f44d263 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -10,7 +10,8 @@ services: postgres14: profiles: - central - network_mode: host + ports: + - 5432:5432 postgres: profiles: - central @@ -28,9 +29,8 @@ services: 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 + ports: + - 5001:80 secrets: profiles: - central @@ -48,14 +48,15 @@ services: - enketo_redis_main environment: - ENV=DEV - network_mode: host + extra_hosts: + - "${DOMAIN}:host-gateway" + ports: + - 8005:8005 enketo_redis_main: profiles: - central - network_mode: host enketo_redis_cache: profiles: - central - network_mode: host volumes: dev_secrets: \ No newline at end of file diff --git a/files/enketo/start-enketo.sh b/files/enketo/start-enketo.sh index 6b6d7055..b9a43ac0 100755 --- a/files/enketo/start-enketo.sh +++ b/files/enketo/start-enketo.sh @@ -3,11 +3,6 @@ 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' "$CONFIG_PATH.template" -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) \