Going live
The Docker stack in docker-compose.yml is safe by default: every port binds to
127.0.0.1, MySQL and Redis are reachable only inside Docker, debug output is
off and the admin password is generated on first install. To let players in from
the internet, keep those defaults and add the steps below on the server.
1. Before the first start
In the project root .env (copy .env.example if it does not exist), choose a
database password. It is used when MySQL is first created and written into
backend/.env on the first boot:
PULSE_DB_PASSWORD=choose-a-long-random-password
Use letters, digits and ._-+= only. If the stack has already started once,
change the password in MySQL and in DB_PASSWORD in backend/.env instead.
Never copy docker-compose.override.yml to a server. It is for engine
development and turns debug output on.
2. Production settings
Edit backend/.env for your domain, here play.example.com:
APP_ENV=production
APP_DEBUG=false
APP_URL=https://play.example.com
FRONTEND_URL=https://play.example.com
CORS_ALLOWED_ORIGINS=https://play.example.com
SANCTUM_STATEFUL_DOMAINS=play.example.com
Production mode sends session cookies over HTTPS only, so finish step 3 before you sign in on the domain. Apply the settings with:
docker compose up -d
docker compose exec backend php artisan optimize:clear
3. HTTPS in front of the game
Put a reverse proxy with a TLS certificate in front of 127.0.0.1:8010. The
backend serves the player site, the admin panel at /admin and the API, and it
forwards realtime connections (/app/...) to Reverb inside Docker, so one
upstream is enough.
With Caddy, which obtains the certificate itself:
play.example.com {
reverse_proxy 127.0.0.1:8010
}
With nginx, keep the WebSocket upgrade headers:
server {
listen 443 ssl;
server_name play.example.com;
# ssl_certificate / ssl_certificate_key from your certificate provider
location / {
proxy_pass http://127.0.0.1:8010;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
Do not publish the containers directly with PULSE_BIND_ADDRESS=0.0.0.0 on a
public server; the proxy is what provides HTTPS.
Two things happen automatically when the backend starts, so the proxy works as expected:
- The backend trusts the Docker network's gateway as a proxy, so each player
keeps their own IP address for login limits and bans, and HTTPS is detected.
This is only safe while the ports stay bound to
127.0.0.1. SetTRUSTED_PROXIES_EXTRAyourself to override it. - The example realtime secret (
REVERB_APP_SECRET) is replaced with a random one inbackend/.env, because realtime connections now reach Reverb through the game's own address.
Enforcing the strict Content Security Policy
By default (CSP_MODE=report-only) every page enforces a permissive policy and
only reports what the strict one would block. Watch the browser console on a
real install first, then set CSP_MODE=enforce in backend/.env. That switches
the pages PHP renders. The player's index.html and the admin panel are files
the web server sends itself, so the server needs the same switch:
- Apache (the Docker image):
backend/public/.htaccessenforces the strict policy when Apache hasPULSE_CSP_ENFORCEdefined. A.htaccessfile cannot define it, so addDefine PULSE_CSP_ENFORCEto the virtual host (or a file inconf-enabled/), or start Apache with-D PULSE_CSP_ENFORCE, and restart Apache. Without it, static pages keep today's report-only headers. - nginx serving the built files: include
infra/nginx/snippets/pulse-security-headers-enforce.confin each location that serves the player or admin files (pulse-security-headers-report-only.confis the default equivalent). Do not include it where nginx proxies to the backend: PHP sends its own policy with a per-request nonce, and a second policy header would block that nonce.
The web server switch is separate from CSP_MODE: it does not follow the
.env file, nor a game that sets security.csp_mode in code (The Hustle
enforces in production from its plugin). Move both together. To back out in an
emergency, set CSP_MODE=report-only (or the game's own switch, such as
HUSTLE_PRODUCTION_CSP_MODE=report-only) and remove PULSE_CSP_ENFORCE (or
switch back to the report-only nginx snippet) and reload the web server;
otherwise the player and admin pages stay enforced.
The shipped files hold the policy for the default configuration. If you set
CSP_CONNECT_HOSTS or CSP_IMAGE_HOSTS, use a Reverb host other than the
game's own address, or run the 3D extension's room on another origin, print the
policy for your install and put it in place of the shipped line:
docker compose exec backend php artisan security:static-csp --server=apache # or nginx, or policy
The strict policy allows no eval (neither does the default one), so a game
library that compiles code at runtime needs its no-eval build, as Skyline Stack
does with import 'pixi.js/unsafe-eval'. It also narrows network access from
any https:/wss: address to the game's own origin plus the hosts above.
4. The admin account
The first install creates the admin account. Unless you set ADMIN_PASSWORD
(at least 8 characters) in the project root .env before the first start, it
generates a random password and prints it once in the backend log, in a box
headed "ADMIN CREDENTIALS (SHOWN ONCE)":
docker compose logs backend | grep -A6 "SHOWN ONCE"
Sign in at https://play.example.com/admin and change it when prompted. The
password is not stored anywhere else, so note the new one in a password manager.
The log is lost when the container is recreated; if you lose the password, set a
new one (printed once, and changed at the next sign-in) with:
docker compose exec backend php artisan user:reset-password admin
5. Keep it running
- Back up the database off the server: set
BACKUP_DISKand the schedule in operations. - Check health with
docker compose exec backend php artisan ops:health ticks, or from a monitor againsthttps://play.example.com/api/v1/healthz/ready. - To upgrade the engine, replace the engine files with the new release, keep your
plugins and
.envfiles, then rundocker compose up -d --build.
Never reset the database (migrate:fresh, db:wipe) on a live game to fix a
problem.