Skip to content

Deploying Tradehall

Tradehall is single-tenant: each business runs its own copy with its own Postgres database, or a SQLite file on a small server (see sqlite.md). Every option below runs the published image, ghcr.io/hudsonville-digital-foundry/tradehall, so installs report themselves as official builds and hear about new releases.

Option Good for Updates
One-line install on a server Most people: a small VPS you control One click, or automatic (see updating.md)
Render No server to look after One click with a deploy hook, or redeploy
DigitalOcean App Platform Already on DigitalOcean Redeploy
Fly.io Command line people fly deploy
Railway Fast trials Redeploy
Coolify / Dokploy Your own self-hosted PaaS One click with a deploy hook, or redeploy
Docker Compose by hand Full control docker compose pull && docker compose up -d
Kubernetes Homelabs and clusters GitOps (see docs/releasing.md)

The buttons and the install script need things that aren’t true yet:

  1. The image is public. GHCR packages from a private repository are private. Until the tradehall package is public (Package settings, Change visibility), every option needs registry credentials: GHCR_USER/GHCR_TOKEN for the script, a registry credential on Render, DigitalOcean, Railway, Coolify, or Dokploy, and fly deploy --image after docker login on Fly.
  2. A release is tagged. The templates use :latest, which only exists once a vX.Y.Z tag has been released (see docs/releasing.md). Until then, use the main tag.
  3. The repository is public for the Render and DigitalOcean buttons (they read render.yaml and .do/deploy.template.yaml from it) and for curl | sh from raw.githubusercontent.com. Railway, Coolify, and Dokploy templates are published from their own dashboards or template repositories.
  • Postgres. Every option creates one (version 17 where the option lets us pick).
  • APP_KEY. It encrypts sessions and stored secrets, so it must stay the same across deploys, and a database backup is useless without it. Any random string longer than 32 characters works (the templates generate one); Tradehall turns it into a key. A key from tradehall key:generate --show works too.
  • APP_URL, the address people use. In production Tradehall answers only requests for that host, and returns 400 for others. On Render, Railway, and Fly.io Tradehall defaults to the address the platform gives it; once you add your own domain, set APP_URL to it.
  • Backups. Tradehall backs the database up every night to its storage volume. Point backups and uploads at an S3-compatible bucket (R2, B2, S3, MinIO, RustFS) so they survive losing the server; on platforms without a persistent disk, a bucket is the only place uploads survive a deploy. See docs/backups-and-storage.md.
  • The server, a queue worker, and the scheduler. The worker sends email and runs agents; the scheduler issues recurring invoices. The hosted templates run all three in one container (TRADEHALL_ALL_IN_ONE=true, or the all command), so they cost one service. Don’t let the service sleep (free plans do), or recurring invoices and email stop.

When it’s up, open /setup to create the owner account. It asks for a one-time token, which Tradehall writes to its log as Finish setup at /setup with token ...; open the platform’s log view to find it. The templates set SEED_DEMO_DATA=false, since demo data has a public login.

Set up email in Settings > Email once you’ve signed in. It sends through any SMTP server (SendGrid, Postmark, Mailgun, your own) or SendGrid’s API, and until then emails only go to the log. You can set it in the environment instead; see docs/sending-email.md. Stripe and the Claude API are optional (STRIPE_SECRET, STRIPE_WEBHOOK_SECRET, ANTHROPIC_API_KEY); .env.example lists every setting.

On a fresh Ubuntu or Debian server (2 GB of memory with PostgreSQL, 1 GB with SQLite), point your domain’s DNS at the server, then:

Terminal window
curl -fsSL https://raw.githubusercontent.com/Hudsonville-Digital-Foundry/Tradehall/main/deploy/install.sh | sudo sh

The script installs Docker if it’s missing (it asks first), writes /opt/tradehall/compose.yml and /opt/tradehall/.env with a generated app key and database password, and starts Postgres, the app, a worker, the scheduler, and Caddy, which gets a certificate for your domain. It asks which database to use first: PostgreSQL (the default) or SQLite, which needs no database server (TRADEHALL_DATABASE=postgres|sqlite answers ahead; see sqlite.md). Leave the domain empty to try it on http://<server address>:8000 first. It also installs update.sh and a systemd unit, so owners can install new releases from Settings > About and updates, with a backup first and an automatic rollback if the new version doesn’t start (see updating.md). Running the script again still updates too; it keeps .env and the data. Settings such as TRADEHALL_DOMAIN and TRADEHALL_VERSION are listed at the top of deploy/install.sh.

While the image is private, sign in as you install:

Terminal window
curl -fsSL .../install.sh | sudo GHCR_USER=you GHCR_TOKEN=ghp_... sh

Choose where backups go in Settings > Backups (see backups-and-storage.md), and keep a copy of /opt/tradehall/.env somewhere safe.

Deploy to Render

The button reads render.yaml: a starter web service (paid, because free services sleep) running the image with TRADEHALL_ALL_IN_ONE=true, and a basic Postgres database. Render generates APP_KEY and asks for the optional email, Stripe, and Claude settings (leave them empty to fill in later). Updates: Manual Deploy, then Deploy latest reference, which pulls :latest again, or set TRADEHALL_DEPLOY_HOOK to the service’s deploy hook to update from Tradehall’s settings page (see updating.md).

Deploy to DigitalOcean

The button reads .do/deploy.template.yaml: one service on the image and a dev Postgres database. DigitalOcean has no secret generator, so paste a random string into APP_KEY when it asks (openssl rand -base64 48). For real use, move to a managed database cluster; dev databases are for trials.

Fly has no button. With flyctl installed:

Terminal window
fly launch --copy-config --config deploy/fly/fly.toml --no-deploy --name my-tradehall
fly postgres create --name my-tradehall-db # or Fly's Managed Postgres: fly mpg create
fly postgres attach my-tradehall-db --app my-tradehall # sets DATABASE_URL
fly secrets set APP_KEY="$(openssl rand -base64 48)" --app my-tradehall
fly deploy --config deploy/fly/fly.toml --app my-tradehall

deploy/fly/fly.toml keeps one Machine running, since the scheduler and worker live in it. Update with fly deploy again.

Railway templates are built in Railway’s dashboard rather than from a file in the repository. To publish one:

  1. Create a project, then add a Postgres database.

  2. Add a service from the Docker image ghcr.io/hudsonville-digital-foundry/tradehall:latest.

  3. Give it these variables:

    DATABASE_URL=${{Postgres.DATABASE_URL}}
    APP_KEY=${{secret(48)}}
    TRADEHALL_ALL_IN_ONE=true
    TRADEHALL_INSTALL=hosted
    TRUSTED_PROXIES=*
    SESSION_SECURE_COOKIE=true
    SEED_DEMO_DATA=false
    PORT=8000
  4. Under Networking, generate a domain for port 8000. Under Settings, set the healthcheck path to /up.

  5. From the project’s settings, create a template from the project and publish it. Railway gives you a https://railway.com/deploy/... button link to put in the README.

Create a resource from Docker Compose and paste deploy/coolify/docker-compose.yml. Coolify generates the domain, database login, and app key from the SERVICE_* variables. Coolify’s generated sslip.io address is plain HTTP; once you attach your own domain with HTTPS, set SESSION_SECURE_COOKIE=true. To offer Tradehall in Coolify’s one-click list, the same file goes to Coolify’s templates/compose directory in a pull request.

Create a Compose service from deploy/dokploy/docker-compose.yml, or import it as a template with deploy/dokploy/template.toml, which generates the domain, app key, and database password. As with Coolify, switch APP_URL to https:// and set SESSION_SECURE_COOKIE=true once the domain has HTTPS. To list Tradehall in Dokploy’s template gallery, the two files go to the Dokploy/templates repository in a pull request.

deploy/compose.yml is what the install script uses with PostgreSQL, and deploy/compose.sqlite.yml with SQLite (.env then needs TRADEHALL_DATABASE=sqlite and no POSTGRES_PASSWORD). Copy it to a server, write a .env next to it with at least APP_KEY, APP_URL, and POSTGRES_PASSWORD (and TRADEHALL_DOMAIN plus COMPOSE_PROFILES=https to have Caddy serve HTTPS), then docker compose up -d. The docker-compose.yml at the root of the repository is for trying Tradehall locally; it builds from source and seeds demo data.