Web Server: Difference between revisions
No edit summary |
No edit summary |
||
| (4 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
= Synology Site Management = | = Synology Site Management = | ||
Both sites are hosted on '''mainsqueeze''' (Synology) behind NGINX Reverse Proxy, served over 443. | Both sites are hosted on '''mainsqueeze''' (Synology) behind NGINX Reverse Proxy, served over 443. | ||
{| class="wikitable" | {| class="wikitable" | ||
! Site !! Local Port !! Directory | ! Site !! Local Port !! Directory | ||
| Line 10: | Line 8: | ||
| [https://justinbjur.com justinbjur.com] || <code>localhost:3001</code> || <code>/volume2/justinbjur.com/justinbjur.com</code> | | [https://justinbjur.com justinbjur.com] || <code>localhost:3001</code> || <code>/volume2/justinbjur.com/justinbjur.com</code> | ||
|} | |} | ||
== Updating Site Content == | == Updating Site Content == | ||
# Make changes locally and commit to GitHub | # Make changes locally and commit to GitHub | ||
# SSH into mainsqueeze: <code>ssh guernica@ | # SSH into mainsqueeze: <code>ssh guernica@wreckroom.nyc</code> | ||
# Navigate to the site and pull: | # Navigate to the site and pull: | ||
## <code>cd /volume2/wreckroom.nyc/wreckroom.nyc</code> (or justinbjur.com) | ## <code>cd /volume2/wreckroom.nyc/wreckroom.nyc</code> (or justinbjur.com) | ||
## <code>git pull</code> | ## <code>git pull</code> | ||
# Restart pm2: <code>sudo pm2 restart wreckroom.nyc</code> (or justinbjur.com) | # Restart pm2: <code>sudo pm2 restart wreckroom.nyc</code> (or justinbjur.com) | ||
#or git pull && sudo npm run build && sudo pm2 restart justinbjur.com | |||
== PM2 == | == PM2 == | ||
'''PM2''' is a process manager that keeps both Next.js apps alive on | '''PM2''' is a process manager that keeps both Next.js apps alive on the server. | ||
=== Current Processes === | === Current Processes === | ||
{| class="wikitable" | {| class="wikitable" | ||
| Line 30: | Line 26: | ||
| <code>justinbjur.com</code> || <code>npm run start</code> | | <code>justinbjur.com</code> || <code>npm run start</code> | ||
|} | |} | ||
=== Startup Persistence === | |||
DSM on mainsqueeze uses systemd. PM2 startup is configured and the service is enabled. | |||
To set up from scratch (or after <code>pm2 unstartup</code>): | |||
# Start both processes: | |||
## <code>cd /volume2/wreckroom.nyc/wreckroom.nyc && sudo pm2 start npm --name "wreckroom.nyc" -- run start</code> | |||
## <code>cd /volume2/justinbjur.com/justinbjur.com && sudo pm2 start npm --name "justinbjur.com" -- run start</code> | |||
# <code>sudo pm2 save</code> | |||
# <code>sudo pm2 startup</code> — enables <code>pm2-root.service</code> via systemd | |||
On reboot, systemd calls <code>pm2 resurrect</code> which restores from <code>/root/.pm2/dump.pm2</code>. | |||
Run <code>sudo pm2 save</code> any time processes are added, removed, or renamed. | |||
To verify: | |||
sudo systemctl status pm2-root | |||
sudo pm2 list | |||
=== After a Synology Reboot === | === After a Synology Reboot === | ||
PM2 should auto-resume | PM2 should auto-resume via systemd. If processes are not running after a reboot: | ||
# <code>sudo systemctl start pm2-root</code> | |||
# Verify with <code>sudo pm2 list</code> | |||
If that fails, restart manually: | |||
# <code>cd /volume2/wreckroom.nyc/wreckroom.nyc</code> | # <code>cd /volume2/wreckroom.nyc/wreckroom.nyc</code> | ||
# <code>sudo pm2 start npm --name "wreckroom.nyc" -- run start</code> | # <code>sudo pm2 start npm --name "wreckroom.nyc" -- run start</code> | ||
| Line 38: | Line 55: | ||
# <code>sudo pm2 start npm --name "justinbjur.com" -- run start</code> | # <code>sudo pm2 start npm --name "justinbjur.com" -- run start</code> | ||
# <code>sudo pm2 save</code> | # <code>sudo pm2 save</code> | ||
=== Troubleshooting === | === Troubleshooting === | ||
If a site is down and pm2 shows an error, delete and restart that process: | If a site is down and pm2 shows an error, delete and restart that process: | ||
| Line 44: | Line 60: | ||
# <code>sudo pm2 start npm --name "wreckroom.nyc" -- run start</code> | # <code>sudo pm2 start npm --name "wreckroom.nyc" -- run start</code> | ||
# <code>sudo pm2 save</code> | # <code>sudo pm2 save</code> | ||
== Certificates == | == Certificates == | ||
If you modify a certificate's FQDN, you '''must''' also update the reverse proxy entry. | If you modify a certificate's FQDN, you '''must''' also update the reverse proxy entry. | ||
'''Control Panel → Login Portal → Advanced → Reverse Proxy''' | '''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. | 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. | ||
Latest revision as of 01:47, 19 May 2026
Synology Site Management[edit]
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[edit]
- Make changes locally and commit to GitHub
- SSH into mainsqueeze:
ssh guernica@wreckroom.nyc - Navigate to the site and pull:
cd /volume2/wreckroom.nyc/wreckroom.nyc(or justinbjur.com)git pull
- Restart pm2:
sudo pm2 restart wreckroom.nyc(or justinbjur.com) - or git pull && sudo npm run build && sudo pm2 restart justinbjur.com
PM2[edit]
PM2 is a process manager that keeps both Next.js apps alive on the server.
Current Processes[edit]
| Name | Command |
|---|---|
wreckroom.nyc |
npm run start
|
justinbjur.com |
npm run start
|
Startup Persistence[edit]
DSM on mainsqueeze uses systemd. PM2 startup is configured and the service is enabled.
To set up from scratch (or after pm2 unstartup):
- Start both processes:
cd /volume2/wreckroom.nyc/wreckroom.nyc && sudo pm2 start npm --name "wreckroom.nyc" -- run startcd /volume2/justinbjur.com/justinbjur.com && sudo pm2 start npm --name "justinbjur.com" -- run start
sudo pm2 savesudo pm2 startup— enablespm2-root.servicevia 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[edit]
PM2 should auto-resume via systemd. If processes are not running after a reboot:
sudo systemctl start pm2-root- Verify with
sudo pm2 list
If that fails, restart manually:
cd /volume2/wreckroom.nyc/wreckroom.nycsudo pm2 start npm --name "wreckroom.nyc" -- run startcd /volume2/justinbjur.com/justinbjur.comsudo pm2 start npm --name "justinbjur.com" -- run startsudo pm2 save
Troubleshooting[edit]
If a site is down and pm2 shows an error, delete and restart that process:
sudo pm2 delete wreckroom.nycsudo pm2 start npm --name "wreckroom.nyc" -- run startsudo pm2 save
Certificates[edit]
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.