Deploy and rehearse a release
Start with a 2-vCPU, 4-GB VPS. Validate a release on a test hostname before switching to production.
Start a production site on a VPS with 2 vCPUs and 4 GB of RAM. Nginx terminates HTTPS for the public site and the separate Admin hostname. Run the public site on standalone Node.js or in containers.
Keep the database, Redis, and persistent publication directory on the same machine or in the same data center. Size upgrades against peak SSR traffic, background jobs, and actual database usage.
Choose a runtime for your team
| Runtime | When it fits | What to prepare |
|---|---|---|
| Standalone Node on a VPS | You supervise the public and admin processes directly | Nginx, Node, database, media storage, and HTTPS |
| Containers on a VPS | You deploy and run services through Compose | Nginx, a container runtime, database, Redis, object storage, and a release configuration |
To evaluate the workflow, the local tutorial is enough to publish a first page. The steps below prepare a test or production environment you operate.
Configure VPS hostnames and HTTPS
- Point the public and Admin DNS records at the VPS and configure valid HTTPS certificates for both hostnames.
- Give the public site and Admin separate Nginx virtual hosts and upstreams. Forward the original host and HTTPS scheme. Keep application ports on loopback or the container network.
- If you enable Nginx full-page caching, cache shareable anonymous responses. Verify language, cookie and query parameter variants, plus invalidation after updates and removals.
Enable static HTML publication on the VPS
CMS_STATIC_DOCUMENT_URLS=https://site-staging.example.com/*
CMS_STATIC_DOCUMENT_DIR=/srv/sitenera/static-documents
Use the canonical HTTPS origin. The /* covers eligible routes on that origin. You can also list exact URLs separated by commas. For standalone Node, use a private persistent directory writable by the process. The repository’s Compose configuration mounts /app/static-documents in its public-site containers. Replicas on the same host should share the directory, with one SERVICE_ROLE=all instance consuming jobs and rendering. After saving the test page, confirm the new body and X-Sitenera-Static-Document: FILE at the origin, then check the public hostname as a visitor. Inspect and roll back releases
Confirm where the admin sends requests
Sitenera builds the public site and admin separately. The admin uses the first value of SERVICE_ORIGINS as its API origin. For a rehearsal using https://site-staging.example.com and https://admin-staging.example.com, list the public site first and allow the admin origin to access its API.
Set up the database and media storage, then confirm the target environment and migration state. Set the application and theme keys before the first release. For an upgrade, record the current build and back up the database and media. Make sure the team knows how to restore them.
Standalone Node
Configure public and admin addresses, database, storage, and keys in .env.standalone. Confirm the target database before running migrations.
npm run build:standalone
npm run build:standalone --prefix apps/admin
npm run migrate -- direct:standalone
Run the public site and admin separately. A production process supervisor can manage both.
npm start
npm run start:standalone --prefix apps/admin
When the public site loads and the admin connects to the correct site, continue to the release checks.
Containers
On a build machine, run npm run pack:container to create the release package. Configure the target database, Redis, object storage, and secrets, then run npm run deploy:container. Check the public and admin URLs and the migration state. The default Compose deployment runs two Web replicas. Both serve HTTP and process background jobs. During release, Nginx drains one replica before replacement and routes traffic to the updated replica after its health check passes. The first successful release from the previous three-Web layout stops the retired third container.
The rolling release updates the Nginx sitenera_web upstream. With multiple Web replicas, Nginx workers share passive failure state and skip a peer for one second after a failed attempt. Docker restarts exited containers according to the Compose restart policy.
In the public proxy location using proxy_pass http://sitenera_web, include the deployed deploy/container/nginx/web-failover.conf by absolute path. Replace duplicate directives for that location, run nginx -t, and reload. The snippet sets a 350 ms connect timeout and allows at most three upstream attempts within a two-second retry window. Omit non_idempotent so Nginx cannot replay an already forwarded POST. The site’s existing response read timeout still applies.
Configuration reference by symptom
A test environment can set the public and admin origins like this:
SERVICE_ORIGINS=https://site-staging.example.com,https://admin-staging.example.com
An origin contains a scheme, hostname, and optional port. The admin build reads the first entry as its API origin. When changing the public site address, update the runtime configuration and rebuild the admin with the new address.
| Setting | Where it applies | When to check it |
|---|---|---|
SERVICE_ORIGINS |
Allowed public-site origins and the admin build’s API origin | The admin connects to the wrong site or requests are rejected |
SITE_HOSTS |
Allowed hostnames for a Node public-site build, including aliases still in service | The new domain resolves but Node rejects access. Rebuild after changing the host list. |
THEME_DIR |
Selects a theme directory under packages/ with a manifest.ts |
Pages use a different template set, or installation reads the wrong theme |
THEME_KEY |
Public runtime key for editor tickets, at least 32 characters | The installer or editor cannot load theme settings |
APP_KEY |
Root key for encryption, session digests, and storage signatures | A release breaks sessions or signed access. Keep the key associated with an existing site’s data. |
DATABASE_DRIVER and DATABASE_FILE or DATABASE_URL |
Node database selection and connection. | A migration targets the wrong database, or the admin shows unexpected data |
Store public addresses and hostnames in environment configuration. Keep application keys, theme keys, and deployment credentials in the target’s private configuration or secrets. Verify that the public site and admin agree on the intended origins before releasing.
Verify the release with one announcement
- Open the public homepage on the test hostname, then sign in to the admin. On a new site, follow the initial setup steps.
- Publish clearly labeled content, then verify its title, image, and links from the public URL. Check a second locale, including translated content, switching, and search metadata.
- Verify public assets, the sitemap, and an old URL redirect. On a company site with an inquiry form, send a labeled test inquiry and locate it in the admin.
- For a static URL, record when the new release becomes visible. Keep the test results and recovery steps before switching the production hostname.
| Symptom | First check |
|---|---|
| Admin loads but login or data requests fail | The first SERVICE_ORIGINS value is the public API, and the admin origin is allowed |
| Pages load but media upload or preview fails | Storage configuration, signed upload URLs, and the allowed admin origin on the storage service |
| A save succeeds in the admin but visitors see old content | Check the VPS origin body and release first, then Nginx and browser caches |
When changing hostnames, continue with sites, domains, and domain moves.