Update Docker configuration and scripts for multi-tenant support: change app image, adjust port settings, and clean up logs
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
||||
NUITKA_BUILD=0
|
||||
INVENTAR_HTTP_PORT=80
|
||||
INVENTAR_HTTPS_PORT=443
|
||||
INVENTAR_APP_IMAGE=ghcr.io/aiirondev/inventarsystem:latest
|
||||
INVENTAR_APP_IMAGE=ghcr.io/aiirondev/legendary-octo-garbanzo:latest
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
[2026-04-19 20:20:39,502] ERROR in app: Error during scheduler shutdown: name '__file__' is not defined
|
||||
@@ -15,3 +15,4 @@ python-barcode
|
||||
openpyxl
|
||||
cryptography
|
||||
pywebpush
|
||||
py-vapid==1.9.0
|
||||
|
||||
@@ -69,9 +69,9 @@ services:
|
||||
image: mongo:7.0
|
||||
container_name: inventarsystem-mongodb
|
||||
restart: unless-stopped
|
||||
command: mongod --wiredTigerCacheSizeGB 2 --journal --dbPath /data/db
|
||||
ports:
|
||||
- "27017:27017"
|
||||
command: mongod --wiredTigerCacheSizeGB 2
|
||||
expose:
|
||||
- "27017"
|
||||
volumes:
|
||||
- mongodb_data:/data/db
|
||||
- ./docker/mongo:/docker-entrypoint-initdb.d:ro
|
||||
@@ -191,9 +191,6 @@ volumes:
|
||||
networks:
|
||||
inventar-net:
|
||||
driver: bridge
|
||||
ipam:
|
||||
config:
|
||||
- subnet: 172.20.0.0/16
|
||||
|
||||
# Scale guidance:
|
||||
# 1 tenant (20 users): 1 app instance + redis + mongodb = ~500MB
|
||||
|
||||
@@ -37,7 +37,8 @@ upstream inventar_backend {
|
||||
|
||||
# Main HTTPS server block
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
listen 443 ssl;
|
||||
http2 on;
|
||||
server_name ~^(?<tenant>[a-z0-9-]+)?\.?example\.com$;
|
||||
|
||||
# SSL Configuration (wildcard certificate)
|
||||
@@ -75,9 +76,9 @@ server {
|
||||
application/x-javascript application/xml+rss application/json;
|
||||
gzip_comp_level 5;
|
||||
|
||||
# Access/Error logs with tenant in filename
|
||||
access_log /var/log/nginx/inventar_access_${tenant}.log combined buffer=32k;
|
||||
error_log /var/log/nginx/inventar_error_${tenant}.log warn;
|
||||
# Access/Error logs
|
||||
access_log /var/log/nginx/inventar_access.log combined buffer=32k;
|
||||
error_log /var/log/nginx/inventar_error.log warn;
|
||||
|
||||
# Root location - proxy to app with tenant context
|
||||
location / {
|
||||
|
||||
@@ -14,3 +14,4 @@ python-barcode
|
||||
openpyxl
|
||||
cryptography
|
||||
pywebpush
|
||||
py-vapid==1.9.0
|
||||
|
||||
@@ -14,8 +14,8 @@ if [ "$(id -u)" -ne 0 ] && command -v sudo >/dev/null 2>&1; then
|
||||
fi
|
||||
|
||||
NUITKA_BUILD_VALUE="0"
|
||||
HTTP_PORT_VALUE="80"
|
||||
HTTPS_PORT_VALUE="443"
|
||||
HTTP_PORT_VALUE="8001"
|
||||
HTTPS_PORT_VALUE="8443"
|
||||
CRON_SETUP_VALUE="${INVENTAR_SETUP_CRON:-1}"
|
||||
APP_IMAGE_VALUE="${INVENTAR_APP_IMAGE:-$APP_IMAGE_REPO:latest}"
|
||||
COMPOSE_FILE="docker-compose.yml"
|
||||
@@ -499,20 +499,20 @@ configure_host_ports() {
|
||||
requested_http="$(awk -F= '/^INVENTAR_HTTP_PORT=/{print $2}' "$ENV_FILE" | tr -d ' ' || true)"
|
||||
fi
|
||||
if [ -z "$requested_http" ]; then
|
||||
requested_http="80"
|
||||
requested_http="8001"
|
||||
fi
|
||||
|
||||
if stack_owns_host_port "$requested_http" "80"; then
|
||||
HTTP_PORT_VALUE="$requested_http"
|
||||
elif port_in_use "$requested_http"; then
|
||||
stop_host_nginx_services || true
|
||||
|
||||
|
||||
if ! port_in_use "$requested_http"; then
|
||||
HTTP_PORT_VALUE="$requested_http"
|
||||
echo "Freed HTTP port $requested_http by stopping host nginx service"
|
||||
else
|
||||
HTTP_PORT_VALUE="$(find_free_port 8080)"
|
||||
echo "HTTP port 80 is in use. Using fallback HTTP port: $HTTP_PORT_VALUE"
|
||||
echo "HTTP port is in use. Using fallback HTTP port: $HTTP_PORT_VALUE"
|
||||
fi
|
||||
else
|
||||
HTTP_PORT_VALUE="$requested_http"
|
||||
@@ -524,13 +524,13 @@ configure_host_ports() {
|
||||
fi
|
||||
|
||||
if [ -z "$requested_https" ]; then
|
||||
requested_https="443"
|
||||
requested_https="8443"
|
||||
fi
|
||||
|
||||
if stack_owns_host_port "$requested_https" "443"; then
|
||||
HTTPS_PORT_VALUE="$requested_https"
|
||||
elif port_in_use "$requested_https"; then
|
||||
stop_host_nginx_services || true
|
||||
|
||||
|
||||
if ! port_in_use "$requested_https"; then
|
||||
HTTPS_PORT_VALUE="$requested_https"
|
||||
@@ -539,7 +539,7 @@ configure_host_ports() {
|
||||
fi
|
||||
|
||||
HTTPS_PORT_VALUE="$(find_free_port 8443)"
|
||||
echo "HTTPS port 443 is in use. Using fallback HTTPS port: $HTTPS_PORT_VALUE"
|
||||
echo "HTTPS port is in use. Using fallback HTTPS port: $HTTPS_PORT_VALUE"
|
||||
else
|
||||
HTTPS_PORT_VALUE="$requested_https"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user