add: reverse proxy

v0.2
rrr-marble 4 years ago
parent 1c4664aca8
commit 7090e1e85a

@ -3,6 +3,9 @@
- python 3.7
- postgresql 12
# Prepair
`docker volume create --name=caddy_data`
# Known restrictions
- *models.py*, *schema.py*, and current representation of column headers in `headers` db table (as initialised by alembic migration script) **must** be kept in sync
- `SQALCHEMY_DATABASE_URL` in *database.py* and `sqlalchemy.url` in *alembic.ini* **must** be kept in sync

@ -0,0 +1,10 @@
:80 {
handle_path /api/v1/* {
rewrite * {path}
reverse_proxy geodata:8000
}
redir /openapi.json /api/v1/openapi.json permanent
respond "pong!"
}

@ -22,5 +22,5 @@ CMD [ \
"alembic", "upgrade", "heads", \
"&&", \
"gunicorn", "--workers=2", "--worker-class=uvicorn.workers.UvicornWorker", "--bind=0.0.0.0:8000", \
"geodata.main:app" \
]
"geodata.main:app", "--root-path=/api/v1" \
]

@ -18,8 +18,21 @@ services:
volumes:
- geodata_db:/var/lib/postgresql/data
rproxy:
image: caddy:2-alpine
context: ../
ports:
- "80:80"
volumes:
- caddy_data:/data
- caddy_config:/config
- ./caddy:/etc/caddy
volumes:
geodata_db:
caddy_config:
caddy_data:
external: true
tmp_vol:
driver_opts:
type: tmpfs

Loading…
Cancel
Save