Skip to content

Commit

Permalink
feat: add docker-compose.yml creating proxy, backend and db services
Browse files Browse the repository at this point in the history
Closes: #14
  • Loading branch information
lfjnascimento committed Jun 27, 2024
1 parent 55eb1b5 commit a835f45
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 1 deletion.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,13 @@ What we have as a repository is a monorepo containing the *dashboard* (the web a
A web app built with [React](https://react.dev/) + [Typescript](https://www.typescriptlang.org/), to see more information check the dashboard [README](dashboard/README.md).

### Backend
A Python http server built with [Django](https://www.djangoproject.com/) + [DRF](https://www.django-rest-framework.org/), to see more information check the backend [README](/backend/README.md).
A Python http server built with [Django](https://www.djangoproject.com/) + [DRF](https://www.django-rest-framework.org/), to see more information check the backend [README](/backend/README.md).


# Docker compose

```bash
mkdir -p backend/runtime/secrets
uuidgen > backend/runtime/secrets/postgres_password_secret
docker-compose up -d
```
63 changes: 63 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
volumes:
db-data:
runtime-data:

networks:
public:
private:

secrets:
postgres_password_secret:
file: ./backend/runtime/secrets/postgres_password_secret

services:
db:
image: postgres:16.3-alpine
networks:
- private
environment:
- POSTGRES_USER=kernelci
- POSTGRES_PASSWORD_FILE=/run/secrets/postgres_password_secret
- PGDATA=/var/run/postgresql/data
volumes:
- db-data:/var/run/postgresql/data
ports:
- target: 5432
published: 5432
protocol: tcp
mode: host
secrets:
- postgres_password_secret

backend:
build: ./backend
restart: always
networks:
- private
- public
ports:
- target: 8000
published: 8000
protocol: tcp
mode: host
secrets:
- postgres_password_secret
environment:
- 'ALLOWED_HOSTS=["backend"]'
- DB_DEFAULT_PASSWORD_FILE=/run/secrets/postgres_password_secret
- DB_DEFAULT_HOST=db

proxy:
build: ./proxy
restart: always
depends_on:
- backend
networks:
- public
ports:
- target: 80
published: 80
protocol: tcp
mode: host
environment:
- PROXY_TARGET=http://backend:8000

0 comments on commit a835f45

Please sign in to comment.