Enhance support for docker-compose (#23)
* Fix docker-compose.yml * Update DOCKER to describe the configuration * Ensure postgres is running before spinning up frogress * Add default config for docker-compose
This commit is contained in:
parent
47b142adea
commit
31616f9132
4
.env
4
.env
|
@ -2,3 +2,7 @@ DEBUG=on
|
||||||
SECRET_KEY=django-insecure-4g&!7-muxr8a*6!pxk$agny_3z5w_bztudcbb7(*@ynco%$c6k
|
SECRET_KEY=django-insecure-4g&!7-muxr8a*6!pxk$agny_3z5w_bztudcbb7(*@ynco%$c6k
|
||||||
DATABASE_URL=sqlite:///db.sqlite3
|
DATABASE_URL=sqlite:///db.sqlite3
|
||||||
ULTIMATE_API_KEY=meowp
|
ULTIMATE_API_KEY=meowp
|
||||||
|
POSTGRES_USER=user
|
||||||
|
POSTGRES_PASSWORD=pass
|
||||||
|
POSTGRES_PORT=5432
|
||||||
|
BACKEND_PORT=9000
|
||||||
|
|
11
DOCKER.md
11
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.
|
- `frogress` - the app itself, based upon [python:3.10-slim](https://hub.docker.com/_/python) image.
|
||||||
- `postgres` - [postgresql](https://hub.docker.com/_/postgres) database
|
- `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
|
## Persisted data
|
||||||
|
|
||||||
The database data is persisted to `./deployment/postgres/data`, this can be changed within the `docker-compose.yaml` file.
|
The database data is persisted to `./deployment/postgres/data`, this can be changed within the `docker-compose.yaml` file.
|
||||||
|
|
|
@ -10,11 +10,13 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- ./deployment/postgres/data:/var/lib/postgresql/data
|
- ./deployment/postgres/data:/var/lib/postgresql/data
|
||||||
frogress:
|
frogress:
|
||||||
|
depends_on:
|
||||||
|
- postgres
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: deployment/frogress/Dockerfile
|
dockerfile: deployment/frogress/Dockerfile
|
||||||
ports:
|
ports:
|
||||||
- "${BACKEND_PORT}:${BACKEND_PORT}"
|
- "${BACKEND_PORT}:8000"
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_HOST: ${POSTGRES_HOST}
|
POSTGRES_HOST: postgres
|
||||||
POSTGRES_PORT: 5432
|
POSTGRES_PORT: 5432
|
||||||
|
|
Loading…
Reference in New Issue