diff --git a/.env b/.env index b8d71cc..ca16ea6 100644 --- a/.env +++ b/.env @@ -2,3 +2,7 @@ DEBUG=on SECRET_KEY=django-insecure-4g&!7-muxr8a*6!pxk$agny_3z5w_bztudcbb7(*@ynco%$c6k DATABASE_URL=sqlite:///db.sqlite3 ULTIMATE_API_KEY=meowp +POSTGRES_USER=user +POSTGRES_PASSWORD=pass +POSTGRES_PORT=5432 +BACKEND_PORT=9000 diff --git a/DOCKER.md b/DOCKER.md index 10354c6..9d742b6 100644 --- a/DOCKER.md +++ b/DOCKER.md @@ -5,6 +5,17 @@ There are 2 images that make up this project: - `frogress` - the app itself, based upon [python:3.10-slim](https://hub.docker.com/_/python) image. - `postgres` - [postgresql](https://hub.docker.com/_/postgres) database +## Configuration + +The following environment variables in `.env` are required to run the services via docker-compose: + +- `POSTGRES_USER` self-explanatory. Can be set to `user`. +- `POSTGRES_PASSWORD` self-explanatory. Can be set to `pass`. +- `POSTGRES_PORT` to connect to postgres externally. Can be set to `5432`. +- `BACKEND_PORT` the port to access the service to. Can be set to `9000`. + +With the above configuration, you will be able to use the API via `http://localhost:9000`. You can also connect to postgres via `localhost:5432`. + ## Persisted data The database data is persisted to `./deployment/postgres/data`, this can be changed within the `docker-compose.yaml` file. diff --git a/docker-compose.yaml b/docker-compose.yaml index a38fa9a..b2b87ba 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -10,11 +10,13 @@ services: volumes: - ./deployment/postgres/data:/var/lib/postgresql/data frogress: + depends_on: + - postgres build: context: . dockerfile: deployment/frogress/Dockerfile ports: - - "${BACKEND_PORT}:${BACKEND_PORT}" + - "${BACKEND_PORT}:8000" environment: - POSTGRES_HOST: ${POSTGRES_HOST} + POSTGRES_HOST: postgres POSTGRES_PORT: 5432