feat: initial Greasy Sprocket website — Astro static + Go feedback service
- Astro 5.x static site with content collections for extensions - Pages: index, [slug] (per-extension), coffee (Ko-fi), feedback form - Go binary gs-feedback: SQLite storage + Discord webhook notification - Nginx config: static serving + POST proxy to Go backend - Deploy script: build + rsync to VPS - ThockBoard landing page with features and sound pack listing
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Deploy Greasy Sprocket website to VPS
|
||||
# Usage: VPS_IP=1.2.3.4 bash deploy/deploy.sh
|
||||
|
||||
VPS_IP="${VPS_IP:?Set VPS_IP env var}"
|
||||
SSH_KEY="${SSH_KEY:-$HOME/.hermes/id_rsa_gs}"
|
||||
SSH_USER="${SSH_USER:-root}"
|
||||
|
||||
echo "=== Building Astro ==="
|
||||
cd astro
|
||||
pnpm install --frozen-lockfile 2>/dev/null || pnpm install
|
||||
pnpm run build
|
||||
cd ..
|
||||
|
||||
echo "=== Building Go feedback service ==="
|
||||
cd feedback-svc
|
||||
make build
|
||||
cd ..
|
||||
|
||||
echo "=== Uploading to VPS ==="
|
||||
# Upload static files
|
||||
rsync -avz --delete astro/dist/ "${SSH_USER}@${VPS_IP}:/var/www/greasysprocket.com/"
|
||||
|
||||
# Upload Go binary
|
||||
scp -i "$SSH_KEY" feedback-svc/bin/gs-feedback "${SSH_USER}@${VPS_IP}:/usr/local/bin/gs-feedback"
|
||||
|
||||
# Upload systemd service (if changed)
|
||||
scp -i "$SSH_KEY" deploy/gs-feedback.service "${SSH_USER}@${VPS_IP}:/etc/systemd/system/gs-feedback.service"
|
||||
|
||||
echo "=== Restarting services ==="
|
||||
ssh -i "$SSH_KEY" "${SSH_USER}@${VPS_IP}" '
|
||||
chmod +x /usr/local/bin/gs-feedback &&
|
||||
mkdir -p /var/lib/gs-feedback &&
|
||||
chown www-data:www-data /var/lib/gs-feedback &&
|
||||
systemctl daemon-reload &&
|
||||
systemctl restart gs-feedback &&
|
||||
systemctl reload nginx &&
|
||||
echo "✅ Deploy complete"
|
||||
'
|
||||
@@ -0,0 +1,24 @@
|
||||
[Unit]
|
||||
Description=Greasy Sprocket Feedback Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/local/bin/gs-feedback
|
||||
Environment=GS_PORT=8080
|
||||
Environment=GS_DB_PATH=/var/lib/gs-feedback/feedback.db
|
||||
Environment=GS_DISCORD_WEBHOOK=__DISCORD_WEBHOOK_URL__
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
User=www-data
|
||||
Group=www-data
|
||||
|
||||
# Security
|
||||
NoNewPrivileges=true
|
||||
ProtectSystem=strict
|
||||
ProtectHome=true
|
||||
ReadWritePaths=/var/lib/gs-feedback
|
||||
PrivateTmp=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,54 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name greasysprocket.com www.greasysprocket.com;
|
||||
|
||||
root /var/www/greasysprocket.com;
|
||||
index index.html;
|
||||
|
||||
# Static files
|
||||
location / {
|
||||
try_files $uri $uri/index.html $uri.html =404;
|
||||
}
|
||||
|
||||
# Feedback POST → Go binary (separate location for POST only)
|
||||
location = /feedback {
|
||||
# POST goes to Go backend
|
||||
limit_except GET POST { deny all; }
|
||||
# If POST, proxy to Go service
|
||||
if ($request_method = POST) {
|
||||
rewrite ^ /feedback_api last;
|
||||
}
|
||||
# GET serves the feedback page
|
||||
try_files $uri $uri/index.html /feedback/index.html;
|
||||
}
|
||||
|
||||
# Internal location for POST proxy
|
||||
location = /feedback_api {
|
||||
internal;
|
||||
proxy_pass http://127.0.0.1:8080/feedback;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header Content-Type $http_content_type;
|
||||
}
|
||||
|
||||
# Stats endpoint
|
||||
location /feedback/stats {
|
||||
proxy_pass http://127.0.0.1:8080/feedback/stats;
|
||||
proxy_set_header Host $host;
|
||||
}
|
||||
|
||||
# Gzip
|
||||
gzip on;
|
||||
gzip_types text/plain text/css application/json application/javascript text/xml;
|
||||
gzip_min_length 1000;
|
||||
|
||||
# Cache static assets
|
||||
location ~* \.(jpg|jpeg|png|gif|svg|ico|woff2?)$ {
|
||||
expires 30d;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
location ~* \.(css|js)$ {
|
||||
expires 7d;
|
||||
add_header Cache-Control "public";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user