Clean-up,readme

This commit is contained in:
miklo 2025-11-25 01:29:17 +01:00
parent 701c638140
commit b36cd5d1b0
6 changed files with 56 additions and 7 deletions

View File

@ -9,7 +9,8 @@ WORKDIR /app
COPY requirements.txt . COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt RUN pip install --no-cache-dir -r requirements.txt
COPY . . COPY src/ .
RUN mkdir -p /data RUN mkdir -p /data
VOLUME ["/data"] VOLUME ["/data"]

23
README.md Normal file
View File

@ -0,0 +1,23 @@
# queue.hswro.org website - a simple queue managemet system:
- People receive physical tokens with numbers on them.
- Operator:
- Adds numbers to the list of tokens issued.
- Selects numbers from the list to be called.
- Removes the called number from the list or moves it back to the queue.
## Common tasks
### Testing the website locally
In the repo directory:
```
docker build -t queue-app:latest .
docker run -p="5000:5000" --volume="$PWD:/data:" -it queue-app:latest
```
Preview should be available on:
`http://localhost:5000` - end user access
`http://localhost:5000/admin` - operator access

View File

@ -2,16 +2,40 @@ version: "3.8"
services: services:
queue: queue:
image: "queue-app:latest" # zmień na registry/name:tag jeśli pobierasz z rejestru image: "queue-app:latest"
ports: 5000 ports:
- 5000
volumes: volumes:
- queue_data:/data - queue_data:/data
environment: environment:
- DB_PATH=/data/queue.db - DB_PATH=/data/queue.db
- ADMIN_URL=admin-panel - ADMIN_URL=secret-admin-panel
restart: always restart: unless-stopped
networks:
- web
deploy: deploy:
resources:
limits:
cpus: '2.0'
memory: 512M
mode: replicated
replicas: 1 replicas: 1
placement:
constraints: [node.role == manager]
labels:
- "traefik.enable=true"
- "traefik.docker.network=web"
- "traefik.http.routers.queue.rule=Host(`domain.tld`)"
- "traefik.http.routers.queue.entrypoints=websecure"
- "traefik.http.services.queue.loadbalancer.server.port=5000"
- "traefik.http.routers.queue.tls=true"
- "traefik.http.routers.queue.tls.certresolver=myresolver"
volumes: volumes:
queue_data: queue_data:
networks:
web:
external:
name: web

View File

@ -2,6 +2,7 @@ from flask import Flask, render_template, request, redirect, url_for, g, jsonify
import sqlite3 import sqlite3
import os import os
DB = os.environ.get("DB_PATH", "queue.db") DB = os.environ.get("DB_PATH", "queue.db")
ADMIN_SUFFIX = os.environ.get("ADMIN_URL", "admin").strip("/") ADMIN_SUFFIX = os.environ.get("ADMIN_URL", "admin").strip("/")
ADMIN_PATH = f"/{ADMIN_SUFFIX}" if ADMIN_SUFFIX else "/admin" ADMIN_PATH = f"/{ADMIN_SUFFIX}" if ADMIN_SUFFIX else "/admin"

View File

@ -38,11 +38,11 @@
</script> </script>
</head> </head>
<body> <body>
<h1>Zapraszamy do stanowiska osoby z numerem:</h1> <h1>Zapraszamy do stanowiska osoby z numerami:</h1>
<div id="nums">-</div> <div id="nums">-</div>
<div id="waiting" style="margin-top:18px;color:#333"> <div id="waiting" style="margin-top:18px;color:#333">
<h3>Liczba osób oczekujących: <span id="waiting-count">0</span></h3> <h3>Wszystkich osób oczekujących: <span id="waiting-count">0</span></h3>
</div> </div>
</body> </body>