---
title: "Running as a Service"
description: "Run the Koios Admin Console as a systemd service so it starts on boot"
source_url: https://ai-ops.com/docs/admin-console/running-as-a-service
---

# Running as a Service

For production, run the Admin Console as a systemd service so it starts automatically on boot and restarts on failure.

## Create the Service File

Create the unit file:

```bash
sudo nano /etc/systemd/system/docker.koios-admin.service
```

Paste the following:

```ini
[Unit]
Description=Koios Admin Console
After=docker.service network-online.target
Requires=docker.service
Wants=network-online.target

[Service]
Restart=always
RestartSec=5
ExecStartPre=-/usr/bin/docker rm -f koios-admin
ExecStart=/usr/bin/docker run --rm --name koios-admin \
  -p 443:443 -p 80:80 \
  -v koios_admin_data:/var/lib/koios-admin \
  -v koios_admin_secrets:/var/lib/koios-admin-secrets \
  -e ENABLE_TLS=true \
  aiopinc/koios-admin:latest
ExecStop=/usr/bin/docker stop koios-admin

[Install]
WantedBy=multi-user.target
```

For production, replace `:latest` with a specific version tag so upgrades are intentional.

## Enable and Start

```bash
sudo systemctl daemon-reload
sudo systemctl enable docker.koios-admin.service
sudo systemctl start docker.koios-admin.service
```

`Restart=always` ensures the container comes back automatically if it exits or the host reboots.

## Check Status and Logs

```bash
sudo systemctl status docker.koios-admin.service
```

The console's application logs are written inside the container. Follow them with:

```bash
docker logs -f koios-admin
```

Press `Ctrl+C` to stop following.

## Behind a Reverse Proxy

To serve the console under a sub-path of an existing reverse proxy, such as a `/wfwd/koios-admin/` junction, set `KOIOS_ADMIN_BASE_PATH`. Add an `Environment=` line and pass it through in `ExecStart`:

```ini
Environment=KOIOS_ADMIN_BASE_PATH=/wfwd/koios-admin/
```

```bash
  -e KOIOS_ADMIN_BASE_PATH=${KOIOS_ADMIN_BASE_PATH} \
```

> [!WARNING] The proxy must strip the prefix
> The console's web server always serves at the root, so the reverse proxy is expected to strip the sub-path prefix before forwarding requests. Leave `KOIOS_ADMIN_BASE_PATH` unset (the default) to serve at the root.

## Updating

To move to a newer version, pull the image and restart the service:

```bash
docker pull aiopinc/koios-admin:latest
sudo systemctl restart docker.koios-admin.service
```

Your data and encryption key persist in the two volumes across the update.

## What's next

- [Managing Instances](https://ai-ops.com/docs/admin-console/managing-instances.md): connect boxes and manage licenses
