Smeltery
Get started

Deployment

v0.1

Operations

  • Logs: journalctl -u myapp (-f follows, --since "1 hour ago"); with LOG_FILE, also storage/logs/smeltery.log and its .1 backup. Requests are logged at debug; secrets in URLs appear as [redacted].
  • Health checks: point an uptime monitor or load balancer at https://app.example.com/up (200, body OK).
  • Backups: .env (without its APP_KEY every session, signed Spark state and the API token change), the database and storage/app/. Backups hold password hashes and sessions, so they go into a folder only root can read:

    shell
    sudo install -d -m 700 /var/backups/myapp
    # SQLite (apt install sqlite3): a consistent copy while the app runs
    sudo sqlite3 /srv/myapp/database/database.sqlite ".backup '/var/backups/myapp/db.sqlite'"
    # PostgreSQL
    sudo -u postgres pg_dump -Fc myapp | sudo tee /var/backups/myapp/myapp.dump > /dev/null
    # MySQL (root signs in through the socket on Ubuntu)
    sudo mysqldump --single-transaction myapp | sudo tee /var/backups/myapp/myapp.sql > /dev/null
    

    Copying the SQLite file alone misses what is still in database.sqlite-wal; .backup includes it. With QUEUE_DRIVER=redis the queued jobs and dead letters are on the Redis server, kept by its own persistence (RDB or AOF). - Rotating APP_KEY (a new key from key:generate --show as under "Production .env", pasted into .env, then a restart) signs every user out (session and remember-me cookies), invalidates the Spark state in open pages and pending signed uploads, and changes the Watchfire API token. Database rows stay as they are. - Clearing the cache: sudo -u myapp ./myapp cache:clear keeps Watchfire's leases and schedule claims. cache:clear --all removes them too: the processes take their agents again within WATCHFIRE_LEASE_TTL, and until then a singleton agent can run in two processes and a tick of the current minute can run again. - Sharing a cache store: Watchfire's leases and schedule claims, the cache entries and locks of the app all live under CACHE_PREFIX (default <app name>_cache_). Two apps, or the staging and production copy of one app, on one Redis database, memcached server or database need different CACHE_PREFIX values (or separate Redis databases or tables); with the same prefix they take each other's leases and claims and read each other's entries. Memcached cannot flush by prefix, so a shared memcached is emptied for every app by cache:clear --all. - Sharing a Redis queue: with QUEUE_DRIVER=redis, two apps (or the staging and production copy of one app) on one Redis database need different QUEUE_PREFIX values (default <app name>_queue_) or separate Redis databases; with the same prefix their workers take each other's jobs. - HTTP caches: web pages are per visitor (their session, the CSRF token in their forms): a CDN or a caching proxy in front of the app caches only public/ files (STATIC_CACHE_CONTROL), never pages.

↑↓ moveEnter openEsc close