Web Server

From Wreckroom
Revision as of 01:47, 19 May 2026 by 66.108.234.75 (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Synology Site Management

Both sites are hosted on mainsqueeze (Synology) behind NGINX Reverse Proxy, served over 443.

Site Local Port Directory
wreckroom.nyc localhost:3000 /volume2/wreckroom.nyc/wreckroom.nyc
justinbjur.com localhost:3001 /volume2/justinbjur.com/justinbjur.com

Updating Site Content

  1. Make changes locally and commit to GitHub
  2. SSH into mainsqueeze: ssh guernica@wreckroom.nyc
  3. Navigate to the site and pull:
    1. cd /volume2/wreckroom.nyc/wreckroom.nyc (or justinbjur.com)
    2. git pull
  4. Restart pm2: sudo pm2 restart wreckroom.nyc (or justinbjur.com)
  5. or git pull && sudo npm run build && sudo pm2 restart justinbjur.com

PM2

PM2 is a process manager that keeps both Next.js apps alive on the server.

Current Processes

Name Command
wreckroom.nyc npm run start
justinbjur.com npm run start

Startup Persistence

DSM on mainsqueeze uses systemd. PM2 startup is configured and the service is enabled.

To set up from scratch (or after pm2 unstartup):

  1. Start both processes:
    1. cd /volume2/wreckroom.nyc/wreckroom.nyc && sudo pm2 start npm --name "wreckroom.nyc" -- run start
    2. cd /volume2/justinbjur.com/justinbjur.com && sudo pm2 start npm --name "justinbjur.com" -- run start
  2. sudo pm2 save
  3. sudo pm2 startup — enables pm2-root.service via systemd

On reboot, systemd calls pm2 resurrect which restores from /root/.pm2/dump.pm2.

Run sudo pm2 save any time processes are added, removed, or renamed.

To verify:

sudo systemctl status pm2-root
sudo pm2 list

After a Synology Reboot

PM2 should auto-resume via systemd. If processes are not running after a reboot:

  1. sudo systemctl start pm2-root
  2. Verify with sudo pm2 list

If that fails, restart manually:

  1. cd /volume2/wreckroom.nyc/wreckroom.nyc
  2. sudo pm2 start npm --name "wreckroom.nyc" -- run start
  3. cd /volume2/justinbjur.com/justinbjur.com
  4. sudo pm2 start npm --name "justinbjur.com" -- run start
  5. sudo pm2 save

Troubleshooting

If a site is down and pm2 shows an error, delete and restart that process:

  1. sudo pm2 delete wreckroom.nyc
  2. sudo pm2 start npm --name "wreckroom.nyc" -- run start
  3. sudo pm2 save

Certificates

If you modify a certificate's FQDN, you must also update the reverse proxy entry. Control Panel → Login Portal → Advanced → Reverse Proxy Update the hostname there — without this step the site will not resolve correctly even after migrating the cert. This has cost half a day before, don't skip it.