- server/: FastAPI app with SQLAlchemy models for sops, work_packages, comments - Endpoints for SOP/WP upsert+list+get+delete and comment create+list; /api/feedback kept as an alias so the existing client keeps working - Portable across engines (PostgreSQL prod, SQLite dev fallback) - requirements.txt, .env.example, and server/README.md (Postgres + systemd) - NGINX now proxies /api/ to the API (replaces the Power Automate hop; comments persist to SQL) - Rewrite DEPLOYMENT.md for the API + database architecture - Add .gitignore for venv/.env/sqlite Phase 2 (wire the client apps to the API) is next. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
53 lines
2.4 KiB
Plaintext
53 lines
2.4 KiB
Plaintext
# ─────────────────────────────────────────────────────────────────────────────
|
|
# Work Package Suite — NGINX site config
|
|
#
|
|
# Serves the static site and reverse-proxies /api/ to the Python API
|
|
# (FastAPI on 127.0.0.1:8000), which stores SOPs, Work Packages, and comments
|
|
# in PostgreSQL. Same-origin, so there is no CORS.
|
|
#
|
|
# Install:
|
|
# 1. Copy the project files to the web root (e.g. /var/www/wp-suite).
|
|
# 2. Run the API as a service (see server/README.md) listening on :8000.
|
|
# 3. Put this file at /etc/nginx/conf.d/wp-suite.conf
|
|
# (or /etc/nginx/sites-available/ + symlink into sites-enabled/).
|
|
# 4. Replace server_name and the ssl_certificate paths.
|
|
# 5. sudo nginx -t && sudo systemctl reload nginx
|
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
|
|
# Redirect plain HTTP to HTTPS
|
|
server {
|
|
listen 80;
|
|
server_name wp-suite.company.local; # <-- your internal hostname
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl;
|
|
server_name wp-suite.company.local; # <-- your internal hostname
|
|
|
|
# Internal certificate from your company CA
|
|
ssl_certificate /etc/nginx/ssl/wp-suite.crt; # <-- cert path
|
|
ssl_certificate_key /etc/nginx/ssl/wp-suite.key; # <-- key path
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
|
|
# Static site
|
|
root /var/www/wp-suite; # <-- web root
|
|
index index.html;
|
|
|
|
location / {
|
|
try_files $uri $uri/ =404;
|
|
}
|
|
|
|
# ── API proxy → Python (FastAPI) ─────────────────────────────────────────
|
|
# All /api/ calls (SOPs, Work Packages, comments) go to the local API
|
|
# service. Keep the /api/ prefix — the API routes are defined under /api.
|
|
location /api/ {
|
|
proxy_pass http://127.0.0.1:8000;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-For $remote_addr;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
client_max_body_size 5m; # WP documents can be larger
|
|
}
|
|
}
|