> Documentation index: https://metorial.com/llms.txt. Every page is available as Markdown by adding .md to its URL.

# Fix errors from the Metorial self-hosting script
URL: https://metorial.com/docs/platform/troubleshooting/self-hosting

What each error from self-hosting/run.sh means, from Host is required! to Failed to start backend services, and the command that gets the Docker Compose stack running.

---

`./self-hosting/run.sh` stops at the first failed check and prints a line that starts with `✗`. Find that line below. To see the state of a stack that did start, run `./self-hosting/run.sh --status`, then `./self-hosting/run.sh --logs`.

**What you'll learn**

* What each `run.sh` error means and how to fix it
* How to read the logs of a service that does not start
* How to stop the stack and start again

**Before you start**

* A clone of [metorial-platform](https://github.com/metorial/metorial-platform), with your shell at its root
* Docker with Compose, Node.js, npm, and Bun

## Arguments

### `Host is required!`

The script needs a hostname. Pass it with `--host`, or set `METORIAL_HOST`:

```bash
./self-hosting/run.sh --host localhost --secret "$(openssl rand -hex 32)"
```

### `Secret is required!`

The backend needs a secret for encryption and auth tokens. Pass it with `--secret`, or set `METORIAL_SECRET`:

```bash
export METORIAL_SECRET="$(openssl rand -hex 32)"
./self-hosting/run.sh --host localhost
```

### `Invalid environment:`

`--env` accepts `development` or `production`. Leave the flag out to get `production`.

### `Unknown option:`

The script does not know the flag that follows the colon. Print the accepted ones:

```bash
./self-hosting/run.sh --help
```

## Frontend build

### `Could not find repository root with src/metorial-frontend/apps/dashboard`

The script walks up from its own folder to find the repository root and did not find the dashboard source. Run it from a full clone:

```bash
git clone https://github.com/metorial/metorial-platform.git
cd metorial-platform
./self-hosting/run.sh --host localhost --secret "$(openssl rand -hex 32)"
```

### `Inspector directory not found at:`

The script builds the MCP Inspector from `vendor/mcp-inspector`, and that folder is missing in your clone. To start only the backend services, skip the frontend build and the web servers:

```bash
./self-hosting/run.sh --host localhost --secret "$(openssl rand -hex 32)" --skip-build --skip-serve
```

### `Node.js is not installed!`

The script needs Node.js, npm, and Bun to build the dashboard. `npm is not installed!` and `Bun is not installed!` are the same check for the other two. Install Node.js 18 or later, which includes npm, then install Bun:

```bash
curl -fsSL https://bun.sh/install | bash
```

### `Prisma generation failed!`

`bun run prisma:generate` failed at the repository root. The error is in the output above the line. Install dependencies and run the step on its own to read it:

```bash
bun install
bun run prisma:generate
```

### `Root build failed!`

`bun run build` failed at the repository root. `Dashboard build failed!` is the same for the dashboard. Scroll up to the first error in the build output. Once you have a working build, later runs can skip it:

```bash
./self-hosting/run.sh --host localhost --secret "$(openssl rand -hex 32)" --skip-build
```

## Backend services

### `Docker is not installed!`

Install Docker from [docs.docker.com/get-docker](https://docs.docker.com/get-docker/). `Docker Compose is not available!` means `docker compose version` failed, so install the Compose plugin or a current Docker Desktop.

### `Docker daemon is not running!`

`docker info` failed. Start Docker Desktop, or on Linux:

```bash
sudo systemctl start docker
docker info
```

### `Failed to pull required images`

`docker compose pull` failed for a reason other than a missing image. The script prints the pull log. Check your network and registry access, then pull by hand:

```bash
docker compose -f ./self-hosting/docker-compose.yml pull
```

The warning `Some images could not be pulled (possibly private/unavailable)` does not stop the script. It continues with the images it has.

### `Failed to start backend services`

`docker compose up -d` failed, and the script prints the output under `Error details:`. If it also prints `Some Docker images are not available`, an image is private or missing for your CPU architecture. Sign in to the registry and start again:

```bash
docker login ghcr.io
./self-hosting/run.sh --host localhost --secret "$(openssl rand -hex 32)" --skip-build
```

A port that is already in use fails here too. Change the host port in `self-hosting/docker-compose.yml` and update the matching URL variables of the `api` service.

## A service starts and does not work

The script only waits five seconds after `docker compose up`, so a service can still be starting or crash later.

```bash
# Which containers are up
docker compose -f ./self-hosting/docker-compose.yml ps

# Logs of the API
docker compose -f ./self-hosting/docker-compose.yml logs api

# Restart the API once PostgreSQL is up
docker compose -f ./self-hosting/docker-compose.yml restart api
```

Containers that exit or restart in a loop usually lack memory. The stack needs at least 8 GB of RAM for Docker.

## Start over

```bash
./self-hosting/run.sh --stop
./self-hosting/run.sh --host localhost --secret "$(openssl rand -hex 32)"
```

> **Note:** Data lives in named Docker volumes and survives `--stop`. `docker compose -f ./self-hosting/docker-compose.yml down -v` deletes the volumes and all data in them.

When the script finishes, the dashboard answers on `http://localhost:3300`.

## Next steps

* [Docker Compose setup files](https://github.com/metorial/metorial-platform/tree/main/self-hosting) in the Metorial Platform repository
* [Keep data in your network](https://metorial.com/docs/platform/guides/keep-data-in-your-network): Outposts and retention levels on the hosted platform
* [Error reference](https://metorial.com/docs/platform/troubleshooting/error-reference): Metorial error messages with their fixes