Make internal and host ports configurable via env vars
This commit is contained in:
parent
fa01ac0f32
commit
3ef8aaf45a
5 changed files with 12 additions and 6 deletions
|
|
@ -10,5 +10,7 @@ PUBLIC_BASE_URL=http://127.0.0.1:5000
|
||||||
BOOTH_NAME=Trollgorithm Theme Songs
|
BOOTH_NAME=Trollgorithm Theme Songs
|
||||||
DATABASE=/app/data/booth.db
|
DATABASE=/app/data/booth.db
|
||||||
UPLOAD_FOLDER=/app/uploads
|
UPLOAD_FOLDER=/app/uploads
|
||||||
|
INTERNAL_PORT=8000
|
||||||
|
HOST_PORT=127.0.0.1:8000
|
||||||
PRICE_PER_VERSION=10.00
|
PRICE_PER_VERSION=10.00
|
||||||
CURRENCY=CAD
|
CURRENCY=CAD
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,8 @@ ENV PYTHONUNBUFFERED=1
|
||||||
RUN useradd -m -u 1000 boothuser && mkdir -p /app/data /app/uploads && chown -R boothuser:boothuser /app
|
RUN useradd -m -u 1000 boothuser && mkdir -p /app/data /app/uploads && chown -R boothuser:boothuser /app
|
||||||
USER boothuser
|
USER boothuser
|
||||||
|
|
||||||
|
# Default internal port; override with INTERNAL_PORT env var
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
CMD ["gunicorn", "-b", "0.0.0.0:8000", "--access-logfile", "-", "app:app"]
|
# Use shell form so environment variables are expanded at runtime
|
||||||
|
CMD gunicorn -b 0.0.0.0:${INTERNAL_PORT:-8000} --access-logfile - app:app
|
||||||
|
|
|
||||||
|
|
@ -39,13 +39,15 @@ The repo includes a `docker-compose.yml` that builds directly from GitLab, so Po
|
||||||
- `ADMIN_PASSWORD`
|
- `ADMIN_PASSWORD`
|
||||||
- `SMTP_PASS`
|
- `SMTP_PASS`
|
||||||
- `PUBLIC_BASE_URL` (your HTTPS domain)
|
- `PUBLIC_BASE_URL` (your HTTPS domain)
|
||||||
|
- `INTERNAL_PORT` (default `8000`) — port the container listens on
|
||||||
|
- `HOST_PORT` (default `127.0.0.1:8000`) — host-side mapping to avoid conflicts with other containers
|
||||||
- `BOOTH_NAME` (optional)
|
- `BOOTH_NAME` (optional)
|
||||||
5. Deploy the stack.
|
5. Deploy the stack.
|
||||||
6. Open a console into the `booth` container and run once:
|
6. Open a console into the `booth` container and run once:
|
||||||
```bash
|
```bash
|
||||||
python init_db.py
|
python init_db.py
|
||||||
```
|
```
|
||||||
7. Point your reverse proxy (Nginx Proxy Manager, Traefik, Caddy, etc.) at `http://host-ip:8000` on the chosen domain.
|
7. Point your reverse proxy at the `HOST_PORT` you chose (e.g. `http://host-ip:8000`).
|
||||||
8. Print the booth QR code pointing to `https://your-domain/request`.
|
8. Print the booth QR code pointing to `https://your-domain/request`.
|
||||||
|
|
||||||
### Portainer Notes
|
### Portainer Notes
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,9 @@ class Config:
|
||||||
PUBLIC_BASE_URL = os.environ.get('PUBLIC_BASE_URL', 'http://127.0.0.1:5000')
|
PUBLIC_BASE_URL = os.environ.get('PUBLIC_BASE_URL', 'http://127.0.0.1:5000')
|
||||||
BOOTH_NAME = os.environ.get('BOOTH_NAME', 'Trollgorithm Theme Songs')
|
BOOTH_NAME = os.environ.get('BOOTH_NAME', 'Trollgorithm Theme Songs')
|
||||||
|
|
||||||
|
# Port the container listens on internally (gunicorn)
|
||||||
|
INTERNAL_PORT = int(os.environ.get('INTERNAL_PORT', '8000'))
|
||||||
|
|
||||||
# Price settings (informational, for receipt page)
|
# Price settings (informational, for receipt page)
|
||||||
PRICE_PER_VERSION = float(os.environ.get('PRICE_PER_VERSION', '10.00'))
|
PRICE_PER_VERSION = float(os.environ.get('PRICE_PER_VERSION', '10.00'))
|
||||||
CURRENCY = os.environ.get('CURRENCY', 'CAD')
|
CURRENCY = os.environ.get('CURRENCY', 'CAD')
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,12 @@
|
||||||
services:
|
services:
|
||||||
booth:
|
booth:
|
||||||
# Option A: use a pre-built image (push this from CI or build locally and tag)
|
|
||||||
# image: registry.gitlab.hallsworth.ca/yrtria/theme-song-booth:latest
|
|
||||||
# Option B: build directly from the GitLab repo in Portainer
|
|
||||||
build:
|
build:
|
||||||
context: https://gitlab.hallsworth.ca/yrtria/theme-song-booth.git#main
|
context: https://gitlab.hallsworth.ca/yrtria/theme-song-booth.git#main
|
||||||
container_name: theme-song-booth
|
container_name: theme-song-booth
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file: .env
|
env_file: .env
|
||||||
ports:
|
ports:
|
||||||
- "127.0.0.1:8000:8000"
|
- "${HOST_PORT:-127.0.0.1:8000}:${INTERNAL_PORT:-8000}"
|
||||||
volumes:
|
volumes:
|
||||||
- booth-data:/app/data
|
- booth-data:/app/data
|
||||||
- booth-uploads:/app/uploads
|
- booth-uploads:/app/uploads
|
||||||
|
|
|
||||||
Reference in a new issue