# Choose where to run LyEve

URL: https://lyeve.com/docs/deploy/

LyEve ships as two container images. You run each one where it fits, next to a database you
provide.

| Image | What it is | Listens on |
|---|---|---|
| `ghcr.io/lyeve-labs/lyeve-core` | The engine: the Admin API and the Content API | `3001` (Admin API), `3002` (Content API) |
| `ghcr.io/lyeve-labs/lyeve-console` | LyEve Console, a Node server that calls the engine for the browser | `3002` |

The engine is a long-running server. It keeps a pool of database connections open, holds its
signing key, and applies its migrations when it starts. A platform that starts a process per
request, such as Vercel Functions, Cloudflare Workers or Netlify Functions, cannot host it.
[Concepts](https://lyeve.com/docs/concepts/) explains what each API is for.

## Compare the hosts

| Host | Best for | What you give up | Guide |
|---|---|---|---|
| Docker | Trying LyEve, or one server you manage yourself | You wire the database, the proxy and TLS | [Docker images](https://lyeve.com/docs/deploy/docker/) |
| Docker Compose | The whole stack on one server: engine, console, Postgres and TLS | One machine, so no failover | [Docker Compose](https://lyeve.com/docs/deploy/docker-compose/) |
| Kubernetes | Several replicas, rolling deploys and a cluster you already run | More than one replica needs Redis, an S3 bucket and a shared signing key | [Kubernetes](https://lyeve.com/docs/deploy/kubernetes/) |
| Google Cloud Run | An engine that scales to zero and bills per request | One API per service, cold starts, and a new signing key per instance | [Cloud Run](https://lyeve.com/docs/deploy/engine-cloud-run/) |
| Fly.io | Both APIs public from one small Machine | Usage is billed, the Admin API answers on port 8443, and each Machine start signs everyone out unless a volume keeps the signing key and `CACHE_DRIVER=redis` and `REDIS_URL` point at a Redis | [Fly.io](https://lyeve.com/docs/deploy/engine-fly/) |
| Railway | Both APIs from one service, with a volume for the signing key | No lasting free plan, usage is billed | [Railway](https://lyeve.com/docs/deploy/engine-railway/) |
| Render | A free engine for a demo or staging | One API per service, and a free service spins down and signs everyone out | [Render](https://lyeve.com/docs/deploy/engine-render/) |
| Free-tier stack | An engine and a database at $0 a month | Cold starts, tight connection limits, and no free host for the console | [Free-tier stack](https://lyeve.com/docs/deploy/free-tier-overview/) |
| Stateless mode | A webhook relay in one container, with no database | No console, one tenant, and nothing kept across a restart | [Stateless mode](https://lyeve.com/docs/deploy/stateless-mode/) |

:::tip[Not sure?]
- **Evaluating on a laptop:** [Docker Compose](https://lyeve.com/docs/deploy/docker-compose/) runs everything, the console included.
- **Production on one server:** Docker Compose with your own Postgres backups.
- **Production with failover:** [Kubernetes](https://lyeve.com/docs/deploy/kubernetes/), and read
  [Scaling](https://lyeve.com/docs/scaling/) first.
- **Spending nothing:** the [free-tier stack](https://lyeve.com/docs/deploy/free-tier-overview/), for a demo or staging.
:::

## Supported databases

The engine stores everything in one database. It reads the type from the scheme of
`DATABASE_URL` and creates its tables on first start.

| Database | `DATABASE_URL` form |
|---|---|
| PostgreSQL 15 to 18 | `postgres://user:pass@host:5432/lyeve?sslmode=require` (or `postgresql://`) |
| MySQL 8.0.14 or later, or 8.4 | `mysql://user:pass@tcp(host:3306)/lyeve`, with the host in `tcp(...)` |
| SQL Server 2019 or later, and Azure SQL | `sqlserver://user:pass@host:1433?database=lyeve` |

On MySQL the engine gives a new database the `utf8mb4_unicode_ci` collation and adds
`parseTime=true` to the URL itself. See
[What the engine sets on MySQL](https://lyeve.com/docs/getting-started/installation/#what-the-engine-sets-on-mysql).

SQL Server needs read committed snapshot isolation turned on before it takes traffic. See
[Installation](https://lyeve.com/docs/getting-started/installation/).

Use a dedicated database user. A production engine refuses to start as `postgres` on
PostgreSQL, `root` on MySQL or `sa` on SQL Server.

The blog has a guide for each database, from creating it and its user to the first start:
[PostgreSQL](https://lyeve.com/blog/headless-cms-on-postgresql/),
[MySQL](https://lyeve.com/blog/headless-cms-on-mysql/) and
[SQL Server](https://lyeve.com/blog/headless-cms-on-sql-server/).

### SQLite, Turso and libSQL are not supported

The engine reads any URL whose scheme is not one of the above as PostgreSQL. A URL for SQLite,
Turso or libSQL therefore fails to connect, and the engine does not start. For a free database
with no server to run, use managed Postgres instead:

- [Supabase](https://lyeve.com/docs/deploy/database-supabase/): free managed Postgres.
- [Neon](https://lyeve.com/docs/deploy/database-neon/): free serverless Postgres that suspends when idle.

Both are a `DATABASE_URL` value and nothing more. For an engine with no database at all, see
[Stateless mode](https://lyeve.com/docs/deploy/stateless-mode/).

## The console needs a server, not Vercel or Cloudflare Pages

The console is a long-running Node server. It ships as the container image
`ghcr.io/lyeve-labs/lyeve-console`, and its source is public in
[`lyeve-console`](https://github.com/lyeve-labs/lyeve-console). Vercel and Cloudflare Pages run
neither a container image nor a long-running server, so neither runs the console as it ships.

Run the image as its own service on a host that runs containers.
The console's server sends every `/api` call to one base URL, `CORE_INTERNAL_URL`, so that URL
must route `/api/admin` to the engine's port `3001` and every other `/api` path to port `3002`.
A small proxy or a Gateway API route does that:

- [Docker Compose](https://lyeve.com/docs/deploy/docker-compose/): the engine, the console, Postgres and a TLS proxy on one
  host.
- [Kubernetes](https://lyeve.com/docs/deploy/kubernetes/): the same images on a cluster, routed with the Gateway API.

[The admin image](https://lyeve.com/docs/deploy/docker/#the-admin-image) lists the console's settings.

## Before go-live

- [Production checklist](https://lyeve.com/docs/deploy/production-checklist/): every setting to confirm, one line each.
- [Configuration](https://lyeve.com/docs/reference/configuration/): every variable and its default.
- [Scaling](https://lyeve.com/docs/scaling/): more than one replica, Redis and load shedding.
