Temple of the Moon - Deployment & Infrastructure
Production Environment
| Component | Details |
|---|---|
| Hosting | Hostinger VPS |
| Server IP | 76.13.115.76 |
| Hostname | srv1314175.hstgr.cloud |
| OS | Ubuntu (Node v24.13.0) |
| SSH User | root |
| SSH Key | ~/.ssh/github_ed25519 (from pop-os) |
VPS Services
| Port | Service | Notes |
|---|---|---|
| 22 | SSH | |
| 80 | nginx | HTTP β HTTPS redirect |
| 443 | nginx | HTTPS proxy |
| 3001 | Next.js | TOTM app (via PM2) |
| 3002 | Next.js | Northland Tech (via PM2) |
| 5432 | PostgreSQL | localhost only |
| 9000 | Webhook | Auto-deploy listener |
Repository
| Property | Value |
|---|---|
| GitHub | git@github.com:red40mademedoit/templeofthemoonbooks.com.git |
| Branch | master |
| Local Dev | /home/shdwdev/projects/templeofthemoonbooks.com |
| VPS Path | /opt/deploy/repos/templeofthemoonbooks.com |
Deployment Workflow
Auto-Deploy (GitHub Webhook)
- Push to GitHub
masterbranch - GitHub sends webhook to
76.13.115.76:9000 - Webhook triggers
/opt/deploy/scripts/deploy.sh - Script pulls, installs, builds, restarts PM2
β οΈ Note: Deploy script uses git pull origin main but branch is master. May need manual deploy or fix the script.
Manual Deploy
# SSH into VPS
ssh -i ~/.ssh/github_ed25519 root@76.13.115.76
# Navigate to app
cd /opt/deploy/repos/templeofthemoonbooks.com
# Pull latest
git pull origin master
# Install deps (if changed)
export PATH="/root/.nvm/versions/node/v24.13.0/bin:$PATH"
npm ci --production=false
# Build
npm run build
# Restart
pm2 restart templeofthemoonbooks.comQuick Deploy One-Liner
ssh -i ~/.ssh/github_ed25519 root@76.13.115.76 'export PATH="/root/.nvm/versions/node/v24.13.0/bin:$PATH" && cd /opt/deploy/repos/templeofthemoonbooks.com && git pull origin master && npm ci --production=false && npm run build && pm2 restart templeofthemoonbooks.com'Process Management (PM2)
# List processes
pm2 list
# View logs
pm2 logs templeofthemoonbooks.com
# Restart
pm2 restart templeofthemoonbooks.com
# Stop
pm2 stop templeofthemoonbooks.comCurrent PM2 Apps:
| ID | Name | Port |
|---|---|---|
| 0 | templeofthemoonbooks.com | 3001 |
| 1 | nortlandtechsolutions.com | 3002 |
| 2 | webhook | 9000 |
Database
| Property | Value |
|---|---|
| Engine | PostgreSQL |
| Host | localhost (VPS only) |
| Port | 5432 |
| Database | totm |
| User | totm |
| Schema | Prisma managed |
Database Access
# From VPS
PGPASSWORD=*** psql -h localhost -U totm -d totm
# Quick query
PGPASSWORD=*** psql -h localhost -U totm -d totm -c "SELECT COUNT(*) FROM products;"Local Development
Local .env uses placeholder β real creds only on VPS:
DATABASE_URL="postgresql://johndoe:randompassword@localhost:5432/mydb?schema=public"Environment Variables
Production (VPS .env)
| Variable | Purpose |
|---|---|
DATABASE_URL | PostgreSQL connection |
PAYPAL_CLIENT_ID | PayPal REST API |
PAYPAL_CLIENT_SECRET | PayPal REST API |
PAYPAL_MODE | sandbox or live |
NEXT_PUBLIC_BASE_URL | Site URL for callbacks |
Domain & SSL
| Property | Value |
|---|---|
| Domain | templeofthemoonbooks.com |
| DNS | A record β 76.13.115.76 |
| SSL | nginx (likely Letβs Encrypt) |
| Proxy | nginx β localhost:3001 |
Image Assets
Azure Green Product Images
Products reference Azure Green CDN directly:
https://www.azuregreen.net/images/{SKU}.jpg
Configured in next.config.ts:
images: {
remotePatterns: [
{ hostname: 'www.azuregreen.net', pathname: '/images/**' },
],
}Local Category Images
public/images/categories/
βββ amulet.jpg
βββ book.jpg
βββ candle.jpg
βββ statue.jpg
βββ stone.jpg
βββ tool.jpg
Adding Images for New Products
Azure Green products get images auto-generated from SKU:
INSERT INTO product_images (id, product_id, url, alt_text, position)
SELECT gen_random_uuid()::text, p.id,
'https://www.azuregreen.net/images/' || p.sku || '.jpg',
p.name, 0
FROM products p
LEFT JOIN product_images pi ON p.id = pi.product_id
WHERE p.source = 'AZUREGREEN' AND p.sku IS NOT NULL AND pi.id IS NULL;Webhook Configuration
Location: /opt/deploy/webhook.js
Listens on port 9000 for GitHub push events:
const REPO_MAP = {
'templeofthemoonbooks.com': 'templeofthemoonbooks.com',
'nortlandtechsolutions.com': 'nortlandtechsolutions.com',
// ...
};Deploy Script: /opt/deploy/scripts/deploy.sh
Troubleshooting
Build Fails with TypeScript Error
Ensure tsconfig.json excludes seed/script files:
"exclude": ["node_modules", "prisma/*.ts", "scripts/*.ts"]PM2 Command Not Found
Need to set PATH:
export PATH="/root/.nvm/versions/node/v24.13.0/bin:$PATH"Check if Site is Running
curl -I https://templeofthemoonbooks.com
pm2 listQuick Reference
# SSH
ssh -i ~/.ssh/github_ed25519 root@76.13.115.76
# Check status
pm2 list
# View logs
pm2 logs templeofthemoonbooks.com --lines 50
# Manual deploy
cd /opt/deploy/repos/templeofthemoonbooks.com
git pull origin master && npm run build && pm2 restart templeofthemoonbooks.com
# Database query
PGPASSWORD=*** psql -h localhost -U totm -d totm -c "SELECT COUNT(*) FROM products;"