Skip to content

Commit bf374a1

Browse files
committed
changes related to deployment testing
1 parent f1cb713 commit bf374a1

4 files changed

Lines changed: 86 additions & 38 deletions

File tree

.env.local.example

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Environment Variables for LOCAL TESTING
2+
# Copy this file to .env.local for local Docker testing
3+
# Command: cp .env.local.example .env.local
4+
5+
# IMPORTANT: This is for LOCAL TESTING ONLY
6+
# For production deployment, use .env.example instead
7+
8+
# ============================================================================
9+
# Docker Compose Configuration
10+
# ============================================================================
11+
12+
# Project name - use different name to avoid conflicts with production
13+
COMPOSE_PROJECT_NAME=survey-dashboard-local
14+
15+
# ============================================================================
16+
# Application Configuration
17+
# ============================================================================
18+
19+
# Port the Panel application runs on inside the container
20+
APP_PORT=5006
21+
22+
# ============================================================================
23+
# Nginx Configuration
24+
# ============================================================================
25+
26+
# Port nginx exposes on the host machine
27+
# Default: 80 for HTTP
28+
# If port 80 is in use, change to 8080 or another available port
29+
NGINX_PORT=80
30+
31+
# Domain name - use localhost for local testing
32+
# IMPORTANT: HTTPS will NOT work with localhost (Let's Encrypt requires real domains)
33+
# You can only test HTTP locally
34+
HOST=localhost
35+
36+
# Path on the domain where the dashboard is accessible
37+
# Test the same path you'll use in production
38+
# Example: VIRTUAL_PATH=/2021community
39+
# Leave empty to serve from root: http://localhost/
40+
VIRTUAL_PATH=/2021community
41+
42+
# ============================================================================
43+
# SSL/HTTPS Configuration (Let's Encrypt)
44+
# ============================================================================
45+
46+
# Dummy email for local testing
47+
# This is not used when HOST=localhost (Let's Encrypt won't run)
48+
# In production, use a real email address
49+
LETSENCRYPT_EMAIL=test@localhost
50+
51+
# ============================================================================
52+
# Python Configuration
53+
# ============================================================================
54+
55+
# Keep Python output unbuffered for better logging
56+
PYTHONUNBUFFERED=1
57+
58+
# ============================================================================
59+
# LOCAL TESTING NOTES
60+
# ============================================================================
61+
62+
# What works locally:
63+
# ✅ Docker build and container startup
64+
# ✅ HTTP access at http://localhost/2021community
65+
# ✅ Path routing and restrictions
66+
# ✅ WebSocket connections
67+
# ✅ Dashboard interactivity
68+
# ✅ Container restarts and rebuilds
69+
70+
# What does NOT work locally:
71+
# ❌ HTTPS/SSL certificates (requires real domain)
72+
# ❌ Let's Encrypt certificate acquisition (localhost is not valid)
73+
# ❌ External access from internet (only local machine)
74+
75+
# How to test:
76+
# 1. Copy this file: cp .env.local.example .env.local
77+
# 2. Start containers: docker-compose --env-file .env.local up -d --build
78+
# 3. Test in browser: http://localhost/2021community
79+
# 4. Follow LOCAL_TESTING.md for detailed testing scenarios
80+
81+
# Cleanup after testing:
82+
# docker-compose --env-file .env.local down
83+
# docker-compose --env-file .env.local down -v # Remove volumes too

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ celerybeat.pid
107107

108108
# Environments
109109
.env
110-
.env.local.example
111110
.env.local
112111
.venv
113112
env/

nginx/conf.d/default.conf

Lines changed: 0 additions & 36 deletions
This file was deleted.

survey_dashboard/scripts.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def run_app():
6262
"--port", args.port,
6363
"--address", args.host if args.production else "localhost",
6464
"--static-dirs", f"en_files={static_dir}",
65+
"--index", "app", # Serve app.py at the root of prefix instead of /app
6566
]
6667

6768
# Production-specific settings
@@ -78,11 +79,12 @@ def run_app():
7879

7980
# Add URL prefix if VIRTUAL_PATH is set (for serving from subpath)
8081
# This tells Panel to prepend the path to all generated URLs (static files, WebSockets, etc.)
82+
# With --index flag, the app is served at the root of the prefix (not /app)
8183
if virtual_path:
8284
cmd.extend(["--prefix", virtual_path])
8385
print(f"Using URL prefix: {virtual_path}")
8486
if args.production:
85-
print(f"Dashboard will be accessible at: http://{args.host}:{args.port}{virtual_path}")
87+
print(f"Dashboard will be accessible at: http://{args.host}:{args.port}{virtual_path}/")
8688

8789
print(f"Running: {' '.join(cmd)}")
8890

0 commit comments

Comments
 (0)