Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLeitwolf112026-08-28 23:21:06 +0300
committerLeitwolf112026-08-28 23:21:06 +0300
commitc53ae2482c50b2c29abb0d5ebef5343a80b9b705 (patch)
tree3976c9e9f77862cb05cb90d6456c1244f888e308
parent18da54ce240b1bfefce36aa2ec3b44b58bd0dbde (diff)
downloadprogmaweb-c53ae2482c50b2c29abb0d5ebef5343a80b9b705.tar.gz
Separate Progmasoft production hosting from Visual X#: enable portable Next.js standalone output, add hardened loopback-only systemd services for the frontend and account API, define dedicated TLS Nginx virtual hosts with canonical www redirection and ACME handling, document immutable release activation and rollback, and remove workstation-specific tool paths from orchestration.
-rw-r--r--apps/web/next.config.ts1
-rw-r--r--justfile13
-rw-r--r--ops/README.md35
-rw-r--r--ops/nginx/progmaweb.conf59
-rw-r--r--ops/systemd/progmaweb-api.service32
-rw-r--r--ops/systemd/progmaweb-web.service34
6 files changed, 166 insertions, 8 deletions
diff --git a/apps/web/next.config.ts b/apps/web/next.config.ts
index d7c6945..f32d55c 100644
--- a/apps/web/next.config.ts
+++ b/apps/web/next.config.ts
@@ -1,6 +1,7 @@
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
+ output: "standalone",
poweredByHeader: false,
reactStrictMode: true,
typedRoutes: true,
diff --git a/justfile b/justfile
index 0214be7..c92d9f1 100644
--- a/justfile
+++ b/justfile
@@ -1,21 +1,18 @@
set shell := ["powershell.exe", "-NoLogo", "-NoProfile", "-Command"]
-node := "C:/Users/hasan/AppData/Local/Programs/nodejs"
-dotnet := "C:/Program Files/JetBrains/JetBrains Rider 2026.2.0.2/lib/ReSharperHost/windows-x64/dotnet/dotnet.exe"
-
install:
- $env:Path = '{{node}};' + $env:Path; pnpm install --frozen-lockfile
+ pnpm install --frozen-lockfile
web-check:
- $env:Path = '{{node}};' + $env:Path; pnpm check
+ pnpm check
web-build:
- $env:Path = '{{node}};' + $env:Path; pnpm build
+ pnpm build
api-build:
- & '{{dotnet}}' build Progmaweb.slnx --configuration Release
+ dotnet build Progmaweb.slnx --configuration Release
api-test:
- & '{{dotnet}}' test --project apps/api-tests/Progmaweb.Api.Tests.csproj --configuration Release
+ dotnet test --project apps/api-tests/Progmaweb.Api.Tests.csproj --configuration Release
verify: web-check web-build api-build api-test
diff --git a/ops/README.md b/ops/README.md
new file mode 100644
index 0000000..2c8c0c6
--- /dev/null
+++ b/ops/README.md
@@ -0,0 +1,35 @@
+# Progmaweb operations
+
+Production uses immutable releases below `/srv/progmaweb/releases`. The `/srv/progmaweb/current` symlink selects one
+release atomically. The account API and Next.js frontend listen only on loopback; Nginx is the sole public listener.
+
+## Release layout
+
+```text
+/srv/progmaweb/
+ current -> releases/<git-sha>
+ releases/<git-sha>/
+ api/
+ Progmaweb.Api
+ web/
+ server.js
+ .next/static/
+ public/
+```
+
+The web directory is produced by Next.js standalone output. Copy `.next/static` beside the standalone `.next` directory
+because Next.js intentionally does not include static or public assets in the standalone bundle. The API is published as
+a framework-dependent Linux x64 executable and uses the server's supported .NET runtime.
+
+## Activation contract
+
+1. Build into a new directory named after the full Git commit; never mutate `current` in place.
+2. Verify the API directly on `127.0.0.1:5085` and the frontend on `127.0.0.1:3010` before changing Nginx.
+3. Point a temporary symlink at the verified release and rename it over `current` atomically.
+4. Run `systemd-analyze verify`, `nginx -t`, then restart the two Progmaweb services and reload Nginx.
+5. Verify apex HTTPS, the canonical `www` redirect, `/robots.txt`, `/api/v1/status`, registration validation, and the
+ existing Visual X# and ViGet hosts.
+6. On failure, restore the previous `current` target and restart only the Progmaweb services.
+
+The Progmasoft Nginx host must never reuse `/srv/xsharp/website/current`. Visual X# compiler and language content belongs
+to `xsharp-lang.xyz`; sharing an origin server does not imply sharing a document root or application process.
diff --git a/ops/nginx/progmaweb.conf b/ops/nginx/progmaweb.conf
new file mode 100644
index 0000000..31d84e5
--- /dev/null
+++ b/ops/nginx/progmaweb.conf
@@ -0,0 +1,59 @@
+server {
+ listen 80;
+ listen [::]:80;
+ server_name progmasoft.com www.progmasoft.com;
+
+ location ^~ /.well-known/acme-challenge/ {
+ root /var/lib/letsencrypt;
+ default_type text/plain;
+ }
+
+ location / {
+ return 301 https://progmasoft.com$request_uri;
+ }
+}
+
+server {
+ listen 443 ssl;
+ listen [::]:443 ssl;
+ http2 on;
+ server_name www.progmasoft.com;
+
+ ssl_certificate /etc/letsencrypt/live/progmasoft.com/fullchain.pem;
+ ssl_certificate_key /etc/letsencrypt/live/progmasoft.com/privkey.pem;
+ include /etc/letsencrypt/options-ssl-nginx.conf;
+
+ return 308 https://progmasoft.com$request_uri;
+}
+
+server {
+ listen 443 ssl;
+ listen [::]:443 ssl;
+ http2 on;
+ server_name progmasoft.com;
+
+ ssl_certificate /etc/letsencrypt/live/progmasoft.com/fullchain.pem;
+ ssl_certificate_key /etc/letsencrypt/live/progmasoft.com/privkey.pem;
+ include /etc/letsencrypt/options-ssl-nginx.conf;
+
+ client_max_body_size 1m;
+
+ add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
+ add_header X-Content-Type-Options "nosniff" always;
+ add_header X-Frame-Options "DENY" always;
+ add_header Referrer-Policy "strict-origin-when-cross-origin" always;
+ add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
+
+ location / {
+ proxy_pass http://127.0.0.1:3010;
+ 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_set_header X-Forwarded-Host $host;
+ proxy_set_header Upgrade $http_upgrade;
+ proxy_set_header Connection "upgrade";
+ proxy_read_timeout 60s;
+ }
+}
diff --git a/ops/systemd/progmaweb-api.service b/ops/systemd/progmaweb-api.service
new file mode 100644
index 0000000..97041d6
--- /dev/null
+++ b/ops/systemd/progmaweb-api.service
@@ -0,0 +1,32 @@
+[Unit]
+Description=Progmaweb account API
+After=network-online.target
+Wants=network-online.target
+
+[Service]
+Type=exec
+User=progmaweb
+Group=progmaweb
+WorkingDirectory=/srv/progmaweb/current/api
+ExecStart=/usr/bin/env /srv/progmaweb/current/api/Progmaweb.Api
+Environment=ASPNETCORE_ENVIRONMENT=Production
+Environment=ASPNETCORE_URLS=http://127.0.0.1:5085
+Restart=on-failure
+RestartSec=5s
+TimeoutStopSec=30s
+
+# The API currently has no writable application files. Runtime state belongs in external services, not in the release.
+NoNewPrivileges=true
+PrivateTmp=true
+ProtectHome=true
+ProtectSystem=strict
+ProtectKernelTunables=true
+ProtectKernelModules=true
+ProtectControlGroups=true
+RestrictSUIDSGID=true
+LockPersonality=true
+MemoryDenyWriteExecute=true
+SystemCallArchitectures=native
+
+[Install]
+WantedBy=multi-user.target
diff --git a/ops/systemd/progmaweb-web.service b/ops/systemd/progmaweb-web.service
new file mode 100644
index 0000000..1452d6d
--- /dev/null
+++ b/ops/systemd/progmaweb-web.service
@@ -0,0 +1,34 @@
+[Unit]
+Description=Progmaweb Next.js frontend
+After=network-online.target progmaweb-api.service
+Wants=network-online.target
+Requires=progmaweb-api.service
+
+[Service]
+Type=exec
+User=progmaweb
+Group=progmaweb
+WorkingDirectory=/srv/progmaweb/current/web
+ExecStart=/opt/progmaweb/node/bin/node /srv/progmaweb/current/web/server.js
+Environment=NODE_ENV=production
+Environment=HOSTNAME=127.0.0.1
+Environment=PORT=3010
+Environment=PROGMAWEB_API_ORIGIN=http://127.0.0.1:5085
+Restart=on-failure
+RestartSec=5s
+TimeoutStopSec=30s
+
+# Standalone Next.js only reads immutable release files and opens its loopback listener.
+NoNewPrivileges=true
+PrivateTmp=true
+ProtectHome=true
+ProtectSystem=strict
+ProtectKernelTunables=true
+ProtectKernelModules=true
+ProtectControlGroups=true
+RestrictSUIDSGID=true
+LockPersonality=true
+SystemCallArchitectures=native
+
+[Install]
+WantedBy=multi-user.target