Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3eeae76e6c | |||
| 0228e6cb1d | |||
| 4c59cca1a4 | |||
| 8412ae76ee |
@@ -92,6 +92,8 @@ services:
|
|||||||
args:
|
args:
|
||||||
PYTHON_VERSION: "3.13"
|
PYTHON_VERSION: "3.13"
|
||||||
OPTIMIZATION_LEVEL: 2
|
OPTIMIZATION_LEVEL: 2
|
||||||
|
working_dir: /app/Web
|
||||||
|
command: ["gunicorn", "app:app", "--bind", "0.0.0.0:8000", "--workers", "2", "--timeout", "30", "--graceful-timeout", "20", "--max-requests", "200", "--max-requests-jitter", "50", "--log-level", "info", "--access-logfile", "-", "--error-logfile", "-"]
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
security_opt:
|
security_opt:
|
||||||
- no-new-privileges:true
|
- no-new-privileges:true
|
||||||
@@ -106,7 +108,6 @@ services:
|
|||||||
- "8000"
|
- "8000"
|
||||||
volumes:
|
volumes:
|
||||||
- ./config.json:/app/config.json:ro
|
- ./config.json:/app/config.json:ro
|
||||||
- ./Web:/app/Web:ro
|
|
||||||
- app_uploads:/app/Web/uploads:cached
|
- app_uploads:/app/Web/uploads:cached
|
||||||
- app_thumbnails:/app/Web/thumbnails:cached
|
- app_thumbnails:/app/Web/thumbnails:cached
|
||||||
- app_previews:/app/Web/previews:cached
|
- app_previews:/app/Web/previews:cached
|
||||||
|
|||||||
+2
-1
@@ -42,6 +42,8 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
working_dir: /app/Web
|
||||||
|
command: ["gunicorn", "app:app", "--bind", "0.0.0.0:8000", "--workers", "2", "--timeout", "30", "--graceful-timeout", "20", "--max-requests", "200", "--max-requests-jitter", "50", "--log-level", "info", "--access-logfile", "-", "--error-logfile", "-"]
|
||||||
container_name: inventarsystem-app
|
container_name: inventarsystem-app
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
security_opt:
|
security_opt:
|
||||||
@@ -66,7 +68,6 @@ services:
|
|||||||
- "8000"
|
- "8000"
|
||||||
volumes:
|
volumes:
|
||||||
- ./config.json:/app/config.json:ro
|
- ./config.json:/app/config.json:ro
|
||||||
- ./Web:/app/Web:ro
|
|
||||||
- app_uploads:/app/Web/uploads
|
- app_uploads:/app/Web/uploads
|
||||||
- app_thumbnails:/app/Web/thumbnails
|
- app_thumbnails:/app/Web/thumbnails
|
||||||
- app_previews:/app/Web/previews
|
- app_previews:/app/Web/previews
|
||||||
|
|||||||
@@ -564,6 +564,8 @@ write_runtime_compose_override() {
|
|||||||
cat > "$RUNTIME_COMPOSE_OVERRIDE_FILE" <<EOF
|
cat > "$RUNTIME_COMPOSE_OVERRIDE_FILE" <<EOF
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
|
working_dir: /app/Web
|
||||||
|
command: ["gunicorn", "app:app", "--bind", "0.0.0.0:8000", "--workers", "2", "--timeout", "30", "--graceful-timeout", "20", "--max-requests", "200", "--max-requests-jitter", "50", "--log-level", "info", "--access-logfile", "-", "--error-logfile", "-"]
|
||||||
image: ${APP_IMAGE_VALUE}
|
image: ${APP_IMAGE_VALUE}
|
||||||
build: null
|
build: null
|
||||||
EOF
|
EOF
|
||||||
|
|||||||
@@ -119,6 +119,36 @@ server {
|
|||||||
return 301 https://$host$request_uri;
|
return 301 https://$host$request_uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl;
|
||||||
|
server_name _;
|
||||||
|
|
||||||
|
ssl_certificate /etc/nginx/certs/inventarsystem.crt;
|
||||||
|
ssl_certificate_key /etc/nginx/certs/inventarsystem.key;
|
||||||
|
|
||||||
|
client_max_body_size 50M;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://app:8000;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_read_timeout 300;
|
||||||
|
}
|
||||||
|
|
||||||
|
error_page 500 502 503 504 /50x.html;
|
||||||
|
location = /50x.html {
|
||||||
|
default_type text/html;
|
||||||
|
return 200 '<!doctype html><html><head><meta charset="utf-8"><title>Server Error</title></head><body><h1>Server Error</h1><p>The service is temporarily unavailable.</p></body></html>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
log_message "Recreated missing nginx config at $config_path"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
Usage: $0 [options]
|
Usage: $0 [options]
|
||||||
@@ -154,36 +184,6 @@ parse_args() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
|
||||||
listen 443 ssl;
|
|
||||||
server_name _;
|
|
||||||
|
|
||||||
ssl_certificate /etc/nginx/certs/inventarsystem.crt;
|
|
||||||
ssl_certificate_key /etc/nginx/certs/inventarsystem.key;
|
|
||||||
|
|
||||||
client_max_body_size 50M;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
proxy_pass http://app:8000;
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
proxy_read_timeout 300;
|
|
||||||
}
|
|
||||||
|
|
||||||
error_page 500 502 503 504 /50x.html;
|
|
||||||
location = /50x.html {
|
|
||||||
default_type text/html;
|
|
||||||
return 200 '<!doctype html><html><head><meta charset="utf-8"><title>Server Error</title></head><body><h1>Server Error</h1><p>The service is temporarily unavailable.</p></body></html>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
log_message "Recreated missing nginx config at $config_path"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
archive_logs() {
|
archive_logs() {
|
||||||
log_message "Checking for monthly log archival..."
|
log_message "Checking for monthly log archival..."
|
||||||
if [ -x "$PROJECT_DIR/archive-logs.sh" ]; then
|
if [ -x "$PROJECT_DIR/archive-logs.sh" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user