Deploy LogChimp on Fly.io

Guide to deploy LogChimp on Fly.io.

There are many ways to install LogChimp Self-Managed. In this guide you we will deploy LogChimp on Fly.io

Prerequisites

Install the Fly CLI (refer to Fly CLI docs) and log in:

fly auth login

Choose a unique name prefix (examples below use my-logchimp). Replace it everywhere.

Generate secrets locally (you will set them on Fly later):

openssl rand -hex 32

Create Managed Postgres

fly mpg create

Follow the prompts (org, name, region, plan). Note the cluster ID.

Attach it later to the API app (after the app exists). You can also create the app first and attach in one go; the order below is explicit.

Create Upstash Redis (Valkey-compatible)

fly redis create

Pick the same region as your Postgres if possible.

After creation, run:

fly redis status <redis-name>

Copy the private Redis URL (looks like redis://default:...@fly-....upstash.io).

You will set this as LOGCHIMP_VALKEY_URL.

Create LogChimp API

We will first create an empty app (no launch yet)

fly apps create my-logchimp-api

Create a minimal fly.toml for the API (in a new directory, e.g. logchimp-fly/api/):

app = "my-logchimp-api"
primary_region = "ord" # change to your region

[deploy]
release_command = "./scripts/migrate.sh"

[build]
	image = "ghcr.io/logchimp/logchimp/api:latest"

[http_service]
	internal_port = 8000
	force_https = true
	auto_stop_machines = "stop"
	auto_start_machines = true
	min_machines_running = 0
	processes = ["app"]

[[vm]]
	size = "shared-cpu-1x"
	memory = "512mb"

Deploy the empty shell first so we can attach Postgres and set secrets:

fly deploy --app my-logchimp-api --image ghcr.io/logchimp/logchimp/api:latest --ha=false

If you want to add or change existing environment variable for each service, this would be the place before all the services are deployed on Railway. To learn more about them, see environment variables.

Enter the following environment variables by clicking on the "Configure" button next to "LogChimp API" service.

fly secrets set \
	LOGCHIMP_LICENSE_KEY="" \
	LOGCHIMP_SIGNATURE_TOKEN="" \
	LOGCHIMP_IS_SELF_HOSTED="true" \
	LOGCHIMP_SECRET_KEY="<your-openssl-rand-hex-32>" \
	LOGCHIMP_WEB_URL="https://my-logchimp-theme.fly.dev" \
	LOGCHIMP_VALKEY_URL="<private-redis-url-from-fly-redis-status>" \
	LOGCHIMP_API_HOST="0.0.0.0" \
	NODE_ENV="production" \
	PORT="8000" \
	-a my-logchimp-api

Attach Managed Postgres

fly mpg attach <CLUSTER_ID> -a my-logchimp-api

This injects a DATABASE_URL secret. LogChimp prefers discrete variables, so we will also set them explicitly.

Set Postgres DB variable

Get the connection string:

fly ssh console -a my-logchimp-api -C 'printenv DATABASE_URL'

It will looks like:

postgres://fly-user:PASSWORD@pgbouncer.XXXX.flympg.net/fly-db

LogChimp support full database URL and split-one, you can use either one.

Sending emails

You will need to set-up SMTP configuration to let your users get emails to reset password, and account verification.

You can read more about SMTP for Emails.

fly secrets set \
	LOGCHIMP_MAIL_HOST="smtp.example.com" \
	LOGCHIMP_MAIL_USER="..." \
	LOGCHIMP_MAIL_PASSWORD="..." \
	LOGCHIMP_MAIL_PORT="587" \
	-a my-logchimp-api

Create LogChimp Theme

fly apps create my-logchimp-theme

fly.toml file for LogChimp Theme app

app = "my-logchimp-theme"
primary_region = "ord"

[build]
	image = "ghcr.io/logchimp/logchimp/theme:latest"

[http_service]
	internal_port = 3000
	force_https = true
	auto_stop_machines = "stop"
	auto_start_machines = true
	min_machines_running = 0
	processes = ["app"]

[[vm]]
	size = "shared-cpu-1x"
	memory = "256mb"

Set theme environment variables

fly secrets set \
	NODE_ENV="production" \
	PORT="3000" \
	VITE_WEBAPP_URL="https://my-logchimp-theme.fly.dev" \
	VITE_API_URL="https://my-logchimp-api.fly.dev" \
	VITE_IS_SELF_HOSTED="true" \
	-a my-logchimp-theme

Deploy LogChimp

Trigger a redeploy so the LogChimp API app picks up everything cleanly and deploy the LogChimp Theme docker image.

fly deploy -a my-logchimp-api
fly deploy -a my-logchimp-theme --image ghcr.io/logchimp/logchimp/theme:latest

Set LogChimp API url to LogChimp Theme

Update the API’s public URLs (now that both apps exist):

fly secrets set \
	LOGCHIMP_WEB_URL="https://my-logchimp-theme.fly.dev" \
	-a my-logchimp-api

(You can also set a custom domain later with fly certs add.)

Unlock more features

Paid plans add features such as Boards and Roadmaps. To compare options, see the paid plans.

To unlock these features, activate your license key.

Next step

Congrats on successfully installing LogChimp. Phew! That was a lot of work! Let's move to next step.

On this page