mirror of
https://github.com/Grace-Solutions/Depl0y-Custom.git
synced 2026-07-26 11:28:19 +00:00
feat(docker/combined): add nginx proxy matching installer
This commit is contained in:
@@ -6,20 +6,21 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
APP_VERSION=${APP_VERSION}
|
||||
|
||||
# System dependencies required by the backend (SSH, PDF, etc.)
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
curl \
|
||||
wget \
|
||||
sshpass \
|
||||
openssh-client \
|
||||
ca-certificates \
|
||||
libpango-1.0-0 \
|
||||
libpangocairo-1.0-0 \
|
||||
libgdk-pixbuf2.0-0 \
|
||||
libffi-dev \
|
||||
shared-mime-info \
|
||||
# System dependencies required by the backend (SSH, PDF, nginx, etc.)
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
curl \
|
||||
wget \
|
||||
sshpass \
|
||||
openssh-client \
|
||||
ca-certificates \
|
||||
nginx \
|
||||
libpango-1.0-0 \
|
||||
libpangocairo-1.0-0 \
|
||||
libgdk-pixbuf2.0-0 \
|
||||
libffi-dev \
|
||||
shared-mime-info \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Create application directories
|
||||
@@ -43,6 +44,7 @@ RUN pip install --no-cache-dir --upgrade pip \
|
||||
# Copy backend code and built frontend assets
|
||||
COPY src/backend /opt/depl0y/backend
|
||||
COPY src/frontend/dist /opt/depl0y/frontend/dist
|
||||
COPY deployment/docker/combined/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
# Default environment values (can be overridden at runtime)
|
||||
ENV DATABASE_URL=sqlite:////var/lib/depl0y/db/depl0y.db \
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
set -e
|
||||
|
||||
APP_PORT="${APPLICATION_PORT_INTERNAL:-8080}"
|
||||
BACKEND_PORT="${BACKEND_PORT_INTERNAL:-8000}"
|
||||
|
||||
# Ensure core data directories exist (may be bind-mounted)
|
||||
mkdir -p /var/lib/depl0y/db \
|
||||
@@ -27,6 +28,9 @@ echo "Ensuring default admin user exists..."
|
||||
python /opt/depl0y/backend/init_admin_user.py || echo "Warning: admin user initialization failed"
|
||||
echo "Admin user initialization step completed."
|
||||
|
||||
echo "Starting Depl0y with uvicorn on port ${APP_PORT}..."
|
||||
exec uvicorn app.main:app --host 0.0.0.0 --port "${APP_PORT}"
|
||||
echo "Starting Depl0y backend (uvicorn) on port ${BACKEND_PORT} and nginx on port ${APP_PORT}..."
|
||||
uvicorn app.main:app --host 127.0.0.1 --port "${BACKEND_PORT}" &
|
||||
|
||||
echo "Starting nginx..."
|
||||
exec nginx -g "daemon off;"
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
server {
|
||||
listen 8080;
|
||||
server_name _;
|
||||
|
||||
client_max_body_size 10G;
|
||||
|
||||
# Frontend
|
||||
location / {
|
||||
root /opt/depl0y/frontend/dist;
|
||||
try_files $uri $uri/ /index.html;
|
||||
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
}
|
||||
|
||||
# Backend API
|
||||
location /api {
|
||||
proxy_pass http://127.0.0.1:8000;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection 'upgrade';
|
||||
proxy_set_header Host $host;
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
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_connect_timeout 300s;
|
||||
proxy_send_timeout 300s;
|
||||
proxy_read_timeout 300s;
|
||||
}
|
||||
|
||||
access_log /var/log/nginx/depl0y_access.log;
|
||||
error_log /var/log/nginx/depl0y_error.log;
|
||||
}
|
||||
|
||||
@@ -5,8 +5,25 @@ server {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# Frontend SPA
|
||||
location / {
|
||||
try_files $uri /index.html;
|
||||
}
|
||||
|
||||
# Backend API - expects a backend service reachable at http://backend:8000
|
||||
location /api {
|
||||
proxy_pass http://backend:8000;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection 'upgrade';
|
||||
proxy_set_header Host $host;
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
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_connect_timeout 300s;
|
||||
proxy_send_timeout 300s;
|
||||
proxy_read_timeout 300s;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user