mirror of
https://github.com/Cccc-owo/CheckInApp.git
synced 2026-06-17 05:56:29 +00:00
refactor(structure): reorganize app layout
BREAKING CHANGE: root backend/frontend directories and old run/manage entrypoints were removed. Use apps/backend, apps/frontend, and python main.py commands instead.
This commit is contained in:
@@ -0,0 +1,145 @@
|
||||
# ==============================================================================
|
||||
# CheckIn App V2 - Nginx Configuration Example (HTTP Only)
|
||||
# ==============================================================================
|
||||
#
|
||||
# Usage:
|
||||
# 1. Copy this file: sudo cp deploy/nginx/checkin-app.conf.example /etc/nginx/sites-available/checkin-app
|
||||
# 2. Edit the file and replace placeholders with your actual values
|
||||
# 3. Create symlink: sudo ln -s /etc/nginx/sites-available/checkin-app /etc/nginx/sites-enabled/
|
||||
# 4. Test config: sudo nginx -t
|
||||
# 5. Reload Nginx: sudo systemctl reload nginx
|
||||
#
|
||||
# ==============================================================================
|
||||
|
||||
# HTTP Server - Production Configuration
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name your-domain.com; # CHANGE THIS: Replace with your domain or IP
|
||||
|
||||
# CHANGE THIS: Replace with your actual frontend build path
|
||||
root /var/www/checkin-app;
|
||||
index index.html;
|
||||
|
||||
# Access and Error Logs
|
||||
access_log /var/log/nginx/checkin-app-access.log;
|
||||
error_log /var/log/nginx/checkin-app-error.log;
|
||||
|
||||
# Gzip Compression
|
||||
gzip on;
|
||||
gzip_vary on;
|
||||
gzip_min_length 1024;
|
||||
gzip_types text/plain text/css text/xml text/javascript
|
||||
application/x-javascript application/xml+rss
|
||||
application/json application/javascript;
|
||||
|
||||
# Client body size (for file uploads)
|
||||
client_max_body_size 10M;
|
||||
|
||||
# ==========================================
|
||||
# API Proxy Configuration
|
||||
# ==========================================
|
||||
location /api/ {
|
||||
# Proxy to backend FastAPI server
|
||||
proxy_pass http://localhost:8000/api/;
|
||||
|
||||
# Proxy headers
|
||||
proxy_set_header Host $host:$server_port;
|
||||
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_set_header X-Forwarded-Host $host:$server_port;
|
||||
|
||||
# HTTP version and buffering
|
||||
proxy_http_version 1.1;
|
||||
proxy_buffering off;
|
||||
proxy_request_buffering off;
|
||||
|
||||
proxy_redirect off;
|
||||
|
||||
# Timeouts
|
||||
proxy_connect_timeout 60s;
|
||||
proxy_send_timeout 60s;
|
||||
proxy_read_timeout 60s;
|
||||
}
|
||||
|
||||
# API Documentation endpoints
|
||||
location ~ ^/(docs|redoc|openapi.json|health) {
|
||||
proxy_pass http://127.0.0.1:8000;
|
||||
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;
|
||||
}
|
||||
|
||||
# ==========================================
|
||||
# Frontend Static Files
|
||||
# ==========================================
|
||||
|
||||
# Cache static assets (JS, CSS, images, fonts)
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
# Frontend routes (SPA - Single Page Application)
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||||
}
|
||||
|
||||
# Favicon
|
||||
location = /favicon.ico {
|
||||
log_not_found off;
|
||||
access_log off;
|
||||
}
|
||||
|
||||
# Robots.txt
|
||||
location = /robots.txt {
|
||||
log_not_found off;
|
||||
access_log off;
|
||||
}
|
||||
}
|
||||
|
||||
# ==============================================================================
|
||||
# HTTPS Configuration (Currently Commented Out)
|
||||
# ==============================================================================
|
||||
# Uncomment and configure below when you need HTTPS with SSL certificate
|
||||
#
|
||||
# server {
|
||||
# listen 80;
|
||||
# listen [::]:80;
|
||||
# server_name your-domain.com;
|
||||
#
|
||||
# # Redirect HTTP to HTTPS
|
||||
# return 301 https://$server_name$request_uri;
|
||||
# }
|
||||
#
|
||||
# server {
|
||||
# listen 443 ssl http2;
|
||||
# listen [::]:443 ssl http2;
|
||||
# server_name your-domain.com;
|
||||
#
|
||||
# # SSL Certificate (use Let's Encrypt: certbot --nginx)
|
||||
# ssl_certificate /etc/letsencrypt/live/your-domain.com/fullchain.pem;
|
||||
# ssl_certificate_key /etc/letsencrypt/live/your-domain.com/privkey.pem;
|
||||
#
|
||||
# # SSL Configuration
|
||||
# ssl_protocols TLSv1.2 TLSv1.3;
|
||||
# ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256';
|
||||
# ssl_prefer_server_ciphers off;
|
||||
# ssl_session_cache shared:SSL:10m;
|
||||
# ssl_session_timeout 10m;
|
||||
#
|
||||
# # Security Headers
|
||||
# add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
||||
# add_header X-Frame-Options "SAMEORIGIN" always;
|
||||
# add_header X-Content-Type-Options "nosniff" always;
|
||||
#
|
||||
# # CHANGE THIS: Replace with your actual frontend build path
|
||||
# root /path/to/CheckInApp/apps/frontend/dist;
|
||||
# index index.html;
|
||||
#
|
||||
# # ... (rest of the configuration same as HTTP version above)
|
||||
# }
|
||||
@@ -0,0 +1,66 @@
|
||||
# ==============================================================================
|
||||
# CheckIn App V2 - Systemd Service File Example
|
||||
# ==============================================================================
|
||||
#
|
||||
# This file defines a systemd service for running the CheckIn App backend
|
||||
#
|
||||
# Installation:
|
||||
# 1. Copy this file: sudo cp deploy/systemd/checkin-app.service.example /etc/systemd/system/checkin-app.service
|
||||
# 2. Edit the file and replace placeholders with your actual values
|
||||
# 3. Reload systemd: sudo systemctl daemon-reload
|
||||
# 4. Enable service: sudo systemctl enable checkin-app.service
|
||||
# 5. Start service: sudo systemctl start checkin-app.service
|
||||
# 6. Check status: sudo systemctl status checkin-app.service
|
||||
#
|
||||
# Management Commands:
|
||||
# Start: sudo systemctl start checkin-app
|
||||
# Stop: sudo systemctl stop checkin-app
|
||||
# Restart: sudo systemctl restart checkin-app
|
||||
# Status: sudo systemctl status checkin-app
|
||||
# Logs: sudo journalctl -u checkin-app -f
|
||||
#
|
||||
# ==============================================================================
|
||||
|
||||
[Unit]
|
||||
Description=CheckIn App V2 - Backend API Service
|
||||
Documentation=https://github.com/Cccc-owo/CheckInApp
|
||||
After=network.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
# CHANGE THIS: Replace with your actual username
|
||||
User=username
|
||||
|
||||
# CHANGE THIS: Replace with your actual installation path
|
||||
# Example: /home/username/CheckInApp
|
||||
WorkingDirectory=/path/to/CheckInApp
|
||||
|
||||
# Start backend using the Python project manager
|
||||
ExecStart=/path/to/CheckInApp/venv/bin/python /path/to/CheckInApp/main.py backend --no-reload
|
||||
|
||||
# Restart policy
|
||||
Restart=on-failure
|
||||
RestartSec=10s
|
||||
|
||||
# Kill settings
|
||||
KillSignal=SIGTERM
|
||||
KillMode=mixed
|
||||
|
||||
# Timeout settings
|
||||
TimeoutStartSec=60
|
||||
TimeoutStopSec=30
|
||||
|
||||
# Resource limits
|
||||
LimitNOFILE=65535
|
||||
|
||||
# Security settings
|
||||
NoNewPrivileges=true
|
||||
|
||||
# Logging
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
SyslogIdentifier=checkin-app
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user