bye caddy
This commit is contained in:
parent
b3278c0287
commit
b3a907e91c
|
@ -4,5 +4,4 @@ __pycache__
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.env.*
|
.env.*
|
||||||
db.sqlite3
|
db.sqlite3
|
||||||
caddy.env
|
|
||||||
.vscode/launch.json
|
.vscode/launch.json
|
||||||
|
|
10
DOCKER.md
10
DOCKER.md
|
@ -1,17 +1,10 @@
|
||||||
# Docker
|
# Docker
|
||||||
|
|
||||||
There are 3 images that make up this project:
|
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.
|
||||||
- `caddy` - [caddy](https://hub.docker.com/_/caddy) running as a reverse proxy that also provides auto-https for production
|
|
||||||
- `postgres` - [postgresql](https://hub.docker.com/_/postgres) database
|
- `postgres` - [postgresql](https://hub.docker.com/_/postgres) database
|
||||||
|
|
||||||
## Production
|
|
||||||
|
|
||||||
By default, `PRODUCTION=NO` is set in the `caddy.env` file which means the reverse proxy (Caddy) will listen on port 80/http. Changing this to `PRODUCTION=YES` will cause Caddy to listen on 443/https and will generate SSL certificates and attempt to confirm ownership of the domain (progress.deco.mp).
|
|
||||||
|
|
||||||
Note: The production domain can be overridden by setting `DOMAIN_NAME=www.mydomainname.com` environment variable within the `caddy.env`
|
|
||||||
|
|
||||||
## 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.
|
||||||
|
@ -27,7 +20,6 @@ Check what containers are running:
|
||||||
$ docker-compose ps
|
$ docker-compose ps
|
||||||
Name Command State Ports
|
Name Command State Ports
|
||||||
----------------------------------------------------------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
frogress_caddy_1 /entrypoint.sh Up 2019/tcp, 0.0.0.0:443->443/tcp,:::443->443/tcp, 0.0.0.0:80->80/tcp,:::80->80/tcp
|
|
||||||
frogress_frogress_1 /entrypoint.sh Up 0.0.0.0:8000->8000/tcp,:::8000->8000/tcp
|
frogress_frogress_1 /entrypoint.sh Up 0.0.0.0:8000->8000/tcp,:::8000->8000/tcp
|
||||||
frogress_postgres_1 docker-entrypoint.sh postgres Up 0.0.0.0:5432->5432/tcp,:::5432->5432/tcp
|
frogress_postgres_1 docker-entrypoint.sh postgres Up 0.0.0.0:5432->5432/tcp,:::5432->5432/tcp
|
||||||
```
|
```
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
__DOMAIN_NAME__ {
|
|
||||||
reverse_proxy __BACKEND_HOST__:__BACKEND_PORT__
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
FROM caddy:2.5.2-alpine
|
|
||||||
|
|
||||||
COPY deployment/caddy/Caddyfile /etc/caddy/
|
|
||||||
|
|
||||||
COPY deployment/caddy/entrypoint.sh /entrypoint.sh
|
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
|
|
@ -1,26 +0,0 @@
|
||||||
#!/usr/bin/env sh
|
|
||||||
|
|
||||||
BE_HOST=${BACKEND_HOST:-frogress}
|
|
||||||
BE_PORT=${BACKEND_PORT:-8000}
|
|
||||||
|
|
||||||
CADDY_DOMAIN=${DOMAIN_NAME:-progress.deco.mp}
|
|
||||||
|
|
||||||
IS_PROD=${PRODUCTION:-YES}
|
|
||||||
|
|
||||||
until nc -z ${BE_HOST} ${BE_PORT} > /dev/null; do
|
|
||||||
echo "Waiting for backend to become available on ${BE_HOST}:${BE_PORT}..."
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
|
|
||||||
if [[ "${IS_PROD}" == "YES" ]]; then
|
|
||||||
echo "Frogress API available at https://${CADDY_DOMAIN}"
|
|
||||||
sed -i "s/__DOMAIN_NAME__/${CADDY_DOMAIN}/g" /etc/caddy/Caddyfile
|
|
||||||
else
|
|
||||||
echo "Frogress API available at http://localhost:80"
|
|
||||||
sed -i "s/__DOMAIN_NAME__/:80/g" /etc/caddy/Caddyfile
|
|
||||||
fi
|
|
||||||
|
|
||||||
sed -i "s/__BACKEND_HOST__/${BE_HOST}/g" /etc/caddy/Caddyfile
|
|
||||||
sed -i "s/__BACKEND_PORT__/${BE_PORT}/g" /etc/caddy/Caddyfile
|
|
||||||
|
|
||||||
/usr/bin/caddy run --config /etc/caddy/Caddyfile --adapter caddyfile
|
|
|
@ -15,11 +15,3 @@ services:
|
||||||
dockerfile: deployment/frogress/Dockerfile
|
dockerfile: deployment/frogress/Dockerfile
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "8000:8000"
|
||||||
caddy:
|
|
||||||
env_file: caddy.env
|
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
dockerfile: deployment/caddy/Dockerfile
|
|
||||||
ports:
|
|
||||||
- "80:80"
|
|
||||||
- "443:443"
|
|
||||||
|
|
Loading…
Reference in New Issue