CloudPanel deployment

CloudPanel can host all three Simple Worship Presenter domains. The important decision is the site type: documentation and marketing sites are plain static files, while the application is a Node.js App.

What to select in CloudPanel

When you press Sites → New Site, the first thing you choose is the site type. Use this table:

DomainWhat it servesSite type to selectAlso needed
docs.simpleworshippresenter.com This documentation Static HTML Nothing else — no PHP version, no Node version, no startup file
simpleworshippresenter.com The marketing site (website/ folder) Static HTML Nothing else
app.simpleworshippresenter.com The application (workspace + audience display) Node.js App Node 20 or newer, startup file server.js, application port 3002

Quick answer

For docs.simpleworshippresenter.com select Static HTML — this site is plain HTML, CSS and JavaScript with no build step and no server-side runtime. Choosing Node.js App would ask you for a port and a startup file that a static site does not have. The only Node.js site in this project is the application.

Deploying the documentation site

  1. Create the site Sites → New Site. Site type: Static HTML. Domain: docs.simpleworshippresenter.com. Add www as a domain alias if you want it. Pick or create a site user, then create the site.
  2. Point DNS at the server Create an A record for docs.simpleworshippresenter.com with your DNS provider, targeting the server's IP address. Wait for it to resolve before requesting the certificate.
  3. Upload the files Copy the whole contents of this documentation folder into the site's document root with SFTP or CloudPanel's File Manager:
    /home/your-site-user/htdocs/docs.simpleworshippresenter.com/
      index.html
      getting-started.html
      … one file per page …
      styles.css
      docs.js
      search-index.js
      logo.svg
    index.html must sit directly in that folder — it is the default document.
  4. Enable SSL Open the site in CloudPanel → SSL/TLS → Let's Encrypt, request the certificate for the domain (and alias, if any), and enable it. Turn on the HTTPS redirect so visitors land on https:// automatically.
  5. Verify Open https://docs.simpleworshippresenter.com/, check that search works with Ctrl+K, and click through the sidebar to the last page.

Updating the docs

There is no build step. Edit an HTML file, upload it again, and hard-refresh the browser. If a page looks stale after an update, check your proxy or CDN cache settings.

Deploying the application (Node.js App)

The application is the only part that needs a runtime. In short:

  1. Sites → New Site → Node.js App, domain app.simpleworshippresenter.com.
  2. Choose Node 20 or newer.
  3. Set the application root to the project directory and the startup file to server.js.
  4. Set the application port to 3002.
  5. In the application directory run npm ci --omit=dev, then create .env from .env.example:
NODE_ENV=production
PORT=3002
DATA_DIR=/home/cloudpanel/htdocs/simple-worship-data
SESSION_SECRET=<48+ random hex characters>
TRUST_PROXY=1
INSTANCE_NAME=Simple Worship Presenter
PUBLIC_URL=https://app.simpleworshippresenter.com
DEFAULT_QUOTA_BYTES=262144000
MAX_UPLOAD_BYTES=262144000
ALLOW_REGISTRATION=1
LOG_LEVEL=info

Generate the secret with:

node -e "console.log(require('crypto').randomBytes(48).toString('hex'))"
  1. Point CloudPanel's proxy at port 3002 and enable SSL for the domain.
  2. Start the application and complete the first-run administrator setup at https://app.simpleworshippresenter.com.

Keep the data outside the site

Set DATA_DIR to a persistent path outside the release directory — for example /home/cloudpanel/htdocs/simple-worship-data — so upgrades never overwrite church content.

Start the application on server boot

CloudPanel does not supervise Node processes for you. The supported method is pm2 plus a @reboot cron entry, run as the site user — not root.

# 1. SSH in as the CloudPanel site user
ssh your-site-user@your-server-ip

# 2. Go to the application root
cd htdocs/app.simpleworshippresenter.com

# 3. Install pm2
npm install pm2@latest -g

# 4. Start the app (port 3002 and NODE_ENV=production come from ecosystem.config.js)
pm2 start ecosystem.config.js

# 5. Save the process list — without this, nothing restarts at boot
pm2 save

Then register the reboot hook:

# 6. Print your PATH and copy the whole line
echo $PATH

# 7. Edit the site user's crontab
crontab -e
PATH=/home/your-site-user/.nvm/versions/node/v20.x.x/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
@reboot pm2 resurrect &> /dev/null

The PATH line is essential: cron runs with a minimal environment, so pm2 resurrect would otherwise not be found and your app would stay down after a reboot.

Verify by rebooting the server and checking:

pm2 status          # should show simple-worship-presenter as "online"
pm2 logs simple-worship-presenter --lines 30
curl http://127.0.0.1:3002/api/health

Reverse proxy settings worth knowing

SymptomCloudPanel / nginx sideApplication side
Signed out on every request Terminate TLS for the domain; serve over HTTPS TRUST_PROXY=1
Uploads return 413 Raise the client body size limit Raise MAX_UPLOAD_BYTES and the account quota
Wrong client IP in logs Forward X-Forwarded-For TRUST_PROXY=1

Mobile remote: WebSocket proxying

The mobile remote uses a WebSocket at /api/remote/ws. The reverse proxy must forward WebSocket upgrades, or a phone falls back to polling. Add this inside the server { … } block for app.simpleworshippresenter.com, alongside the existing location / proxy:

location /api/remote/ws {
    proxy_pass http://127.0.0.1:3002;
    proxy_http_version 1.1;

    # These two lines are what make it a WebSocket instead of a plain request.
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";

    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;

    # A remote stays connected for the length of a service. Without these the
    # proxy closes the socket after its default idle timeout.
    proxy_read_timeout 3600s;
    proxy_send_timeout 3600s;
    proxy_buffering off;
}

Reload nginx, then verify the upgrade reaches the app:

sudo nginx -t && sudo systemctl reload nginx

curl -i -N \
  -H "Connection: Upgrade" \
  -H "Upgrade: websocket" \
  -H "Sec-WebSocket-Version: 13" \
  -H "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==" \
  https://app.simpleworshippresenter.com/api/remote/ws

You want 101 Switching Protocols. A 200 or 404 means the upgrade is not reaching the app.

If WebSockets are blocked

The remote still works. When the socket cannot be established it automatically falls back to plain HTTPS commands, so a locked-down proxy degrades to slightly less instant updates rather than breaking. Controls remain usable.

Local-network-only installs. If the server is reachable only on the church LAN: put the phone on the same Wi-Fi network, pair using the local address (for example http://192.168.1.50:3002/remote), set PUBLIC_URL in .env to that address so the generated pairing link is correct, and set TRUST_PROXY=0 as there is no proxy in front. No inbound port forwarding is needed for the hosted service — the phone makes an ordinary outbound connection to the server.

After deployment

Ports

PortUse
3002Simple Worship Presenter application (CloudPanel Node.js App)
80 / 443Reverse proxy, terminating TLS for all three domains