# Host sculk.network yourself

This guide runs your own copy of sculk.network with Docker Compose. Follow the sections in order. At the end of "Sign in and connect your first server" you are signed in as the owner of a connected server. You can add GitHub and CurseForge later.

Every command runs in a terminal on the host. Each command block shows what it prints. Lines in angle brackets, like `<your key>`, are values that differ on your machine.

## Before you start

You need:

- A Linux host with Docker Engine and the Compose plugin version 2 or later.
- A name or address that you and your players can reach, for example `https://sculk.example.org`. Players' launchers download mods from it.
- Git and OpenSSL.

Run one sculk.network container per database. Two containers on the same data volume corrupt each other's state.

Check Docker and Compose:

```sh
docker compose version
```

```text
Docker Compose version v2.<x>.<y>
```

Any version that starts with `v2` or later works.

## Get the code and build the image

```sh
git clone https://github.com/YellowUmbrellaDev/sculk.network.git
cd sculk.network
```

```text
Cloning into 'sculk.network'...
```

To run a specific release, check out its tag now with `git checkout <tag>`.

Build the image. The build argument puts the commit into `/healthz`, so you can always see which code runs.

```sh
docker build --build-arg SCULK_COMMIT="$(git rev-parse HEAD)" -t sculk .
```

`/healthz` reports the version `0.0.0-dev` for an image you build yourself. If you checked out a release tag such as `v0.2.0`, add `--build-arg SCULK_VERSION=0.2.0` and it reports that version instead.

The build takes a few minutes. It ends with:

```text
 => => naming to docker.io/library/sculk:latest
```

## Create the master key

sculk.network encrypts panel credentials, API keys and other secrets in its database with one master key. Create it:

```sh
openssl rand -base64 32
```

```text
<44 characters ending in =>
```

Store a copy of this key somewhere other than this host and other than your backups, for example in your password manager. Without it, nobody can read the secrets in the database or in a backup of it. If you lose it, [Lost the master key](#lost-the-master-key) explains how to start again without those secrets.

## Copy `.env.example` to `.env`

All settings live in one file, `.env`, next to `compose.yml`. Start from the example:

```sh
cp .env.example .env
```

This prints nothing. Open `.env` in an editor, fill in the two required lines, and add `SCULK_PORT` at the end:

```sh
SCULK_BASE_URL=https://sculk.example.org
SCULK_MASTER_KEY=<the key from "Create the master key">
SCULK_PORT=127.0.0.1:8080
```

`SCULK_PORT` is the host address and port Compose publishes the container on. `127.0.0.1:8080` keeps it on this host only, so the only way in is your https reverse proxy. Without it, Compose publishes plain http on port 8080 on every network interface, and anyone who reaches the host skips your proxy. Keep it in `.env` rather than typing it in the shell, so every later `docker compose up -d` uses it. Use another port, such as `127.0.0.1:9000`, if 8080 is taken.

Keep `.env` private. It holds your master key and, later, your OAuth and GitHub secrets. Never commit it.

This table lists every setting. Optional settings are commented out in `.env.example` with their default value.

<!-- env:start -->
| Name | Required | Default | Secret | What it does | Explained in |
| --- | --- | --- | --- | --- | --- |
| `SCULK_COMMIT` | no |  | no | Commit that /healthz prints. The image build sets it. | [Get the code and build the image](#get-the-code-and-build-the-image) |
| `SCULK_VERSION` | no |  | no | Version that /healthz and the User-Agent print. The release build sets it; 0.0.0-dev otherwise. | [Get the code and build the image](#get-the-code-and-build-the-image) |
| `SCULK_MASTER_KEY` | yes |  | yes | 32 random bytes in base64 that seal stored secrets. | [Create the master key](#create-the-master-key) |
| `SCULK_BASE_URL` | yes |  | no | Public https origin players and owners reach. | [Copy .env.example to .env](#copy-envexample-to-env) |
| `SCULK_OIDC_ADMINS` | no |  | no | Comma-separated user IDs allowed to manage OIDC clients, grants, and signing keys. | [Serve as an OpenID Connect provider](#serve-as-an-openid-connect-provider) |
| `SCULK_TRUSTED_PROXIES` | no |  | no | Comma-separated trusted reverse-proxy IPs or CIDRs whose X-Forwarded-For header is read for rate limiting. | [Start sculk.network](#start-sculknetwork) |
| `SCULK_PUBLIC` | no |  | no | Set to 1 on an instance open to the internet. | [Copy .env.example to .env](#copy-envexample-to-env) |
| `SCULK_DEV_IDP_URL` | no |  | no | Development only. Sends sign-in to a mock provider. | [Copy .env.example to .env](#copy-envexample-to-env) |
| `SCULK_LOG_LEVEL` | no |  | no | Set to debug to log each file the client channel reads. | [Copy .env.example to .env](#copy-envexample-to-env) |
| `SCULK_FEATURES` | no |  | no | Comma-separated feature names to force on, or off with a leading -. See docs/releases.md#feature-stages. | [Copy .env.example to .env](#copy-envexample-to-env) |
| `SCULK_CONTACT` | no | `https://github.com/YellowUmbrellaDev/sculk.network` | no | Contact URL sent to Modrinth and Mojang. | [Copy .env.example to .env](#copy-envexample-to-env) |
| `SCULK_IMPORT_MAX_MB` | no | `512` | no | Largest modpack upload, in MB. | [Copy .env.example to .env](#copy-envexample-to-env) |
| `SCULK_MODRINTH_BASE` | no | `https://api.modrinth.com/v2` | no | Modrinth API base URL. | [Copy .env.example to .env](#copy-envexample-to-env) |
| `SCULK_MODRINTH_RPM` | no | `250` | no | Modrinth requests per minute. | [Copy .env.example to .env](#copy-envexample-to-env) |
| `SCULK_MOJANG_BASE_URL` | no | `https://api.minecraftservices.com` | no | Mojang API base URL. | [Copy .env.example to .env](#copy-envexample-to-env) |
| `GOOGLE_CLIENT_ID` | no |  | no | Google OAuth client ID. | [Create one OAuth app](#create-one-oauth-app) |
| `GOOGLE_CLIENT_SECRET` | no |  | yes | Google OAuth client secret. | [Create one OAuth app](#create-one-oauth-app) |
| `DISCORD_CLIENT_ID` | no |  | no | Discord OAuth client ID. | [Create one OAuth app](#create-one-oauth-app) |
| `DISCORD_CLIENT_SECRET` | no |  | yes | Discord OAuth client secret. | [Create one OAuth app](#create-one-oauth-app) |
| `MICROSOFT_CLIENT_ID` | no |  | no | Microsoft OAuth client ID. | [Create one OAuth app](#create-one-oauth-app) |
| `MICROSOFT_CLIENT_SECRET` | no |  | yes | Microsoft OAuth client secret. | [Create one OAuth app](#create-one-oauth-app) |
| `SCULK_MS_VERIFY` | no |  | no | Set to 1 to let players prove Minecraft ownership. | [Create one OAuth app](#create-one-oauth-app) |
| `SCULK_NAME_CLAIM` | no |  | no | Set to 1 to let players link a Minecraft name they type, with no proof. | [Create one OAuth app](#create-one-oauth-app) |
| `SCULK_OAUTHMC_URL` | no |  | no | Base URL of the OAuthMC HTTP API, for example http://oauthmc:8080. | [Verify Minecraft accounts by joining a server](#verify-minecraft-accounts-by-joining-a-server) |
| `SCULK_OAUTHMC_KEY` | no |  | yes | Bearer API key for OAuthMC (must match OAUTHMC_API_KEYS). | [Verify Minecraft accounts by joining a server](#verify-minecraft-accounts-by-joining-a-server) |
| `SCULK_OAUTHMC_ADDRESS` | no |  | no | Minecraft server address players join to get their code, for example verify.sculk.network. | [Verify Minecraft accounts by joining a server](#verify-minecraft-accounts-by-joining-a-server) |
| `SCULKWORM_URL` | no |  | no | Base URL of the Sculkworm HTTP admin API, for example http://sculkworm:8080. | [Route servers through Sculkworm](#route-servers-through-sculkworm) |
| `SCULKWORM_API_KEY` | no |  | yes | Tenant bearer API key for Sculkworm (must match SCULKWORM_TENANTS_FILE). | [Route servers through Sculkworm](#route-servers-through-sculkworm) |
| `SCULKWORM_BASE_DOMAIN` | no |  | no | Base domain under which sculk.network registers server routes, for example play.sculk.network. | [Route servers through Sculkworm](#route-servers-through-sculkworm) |
| `SCULKWORM_PUBLIC_URL` | no |  | no | Public https URL players use to reach the shared Sculkworm relay, for example https://relay.sculk.network. | [Route servers through Sculkworm](#route-servers-through-sculkworm) |
| `SCULKWORM_OIDC_CLIENT` | no |  | no | OIDC client name in the relay secrets file that points at this sculk.network instance, for example sculk-main. | [Route servers through Sculkworm](#route-servers-through-sculkworm) |
| `PORT` | no | `8080` | no | Port inside the container. | [Start sculk.network](#start-sculknetwork) |
| `GITHUB_APP_ID` | no |  | no | GitHub App ID. | [Add the GitHub App](#add-the-github-app) |
| `GITHUB_APP_SLUG` | no |  | no | GitHub App slug, from its public URL. | [Add the GitHub App](#add-the-github-app) |
| `GITHUB_APP_CLIENT_ID` | no |  | no | GitHub App client ID. | [Add the GitHub App](#add-the-github-app) |
| `GITHUB_APP_CLIENT_SECRET` | no |  | yes | GitHub App client secret. | [Add the GitHub App](#add-the-github-app) |
| `GITHUB_APP_PRIVATE_KEY_FILE` | no |  | no | Path in the container to the App private key. | [Add the GitHub App](#add-the-github-app) |
| `GITHUB_APP_PRIVATE_KEY` | no |  | yes | The App private key inline, instead of a file. | [Add the GitHub App](#add-the-github-app) |
| `SCULK_GITHUB_BRANCH_ALLOW` | no |  | no | Regular expression of branch names sculk may write. | [Add the GitHub App](#add-the-github-app) |
| `CURSEFORGE_API_KEY` | no |  | yes | CurseForge API key for the whole instance. | [Add the CurseForge key](#add-the-curseforge-key) |
| `SCULK_CURSEFORGE_BASE` | no | `https://api.curseforge.com` | no | CurseForge API base URL. | [Add the CurseForge key](#add-the-curseforge-key) |
| `SCULK_CURSEFORGE_RPM` | no | `120` | no | CurseForge requests per minute per key. | [Add the CurseForge key](#add-the-curseforge-key) |
| `SCULK_PLUGIN_DIR` | no |  | no | Folder whose *.plugin.json files every user may connect with. | [Add plugins for the whole instance](#add-plugins-for-the-whole-instance) |
| `SCULK_MASTER_KEY_OLD` | no |  | yes | Earlier master keys, comma-separated, while you rotate. | [Back up and restore](#back-up-and-restore) |
| `SCULK_ALLOW_UNREADABLE_SECRETS` | no |  | no | Set to 1 to start when the master key opens none of the stored secrets. | [Back up and restore](#back-up-and-restore) |
| `SCULK_DATA_DIR` | no | `/data` | no | Folder that holds sculk.db. | [Back up and restore](#back-up-and-restore) |
| `SCULK_DEV_PLUGIN_HOSTS` | no |  | no | Development only. Exact host:port entries a user plugin may reach on a private address. Never set it in production. | [Development](#development) |
<!-- env:end -->

### Settings that change how the instance behaves

`SCULK_BASE_URL` is the public origin of your instance, with no trailing slash. It must be the https address players reach. sculk.network uses it for:

- When it starts with `https://`, the `sculk_session`, `sculk_oauth` and `sculk_oidc_consent` cookies get the `Secure` flag, so browsers only send them over https.
- A sign-out request whose `Origin` header differs from it is refused.
- It builds the OAuth redirect URIs, `<SCULK_BASE_URL>/auth/<provider>/callback`.
- It builds the URLs in the client channel, installer and packwiz exports, which players' launchers download from.
- It is the `issuer` and endpoint base URL when the [OpenID Connect provider](#serve-as-an-openid-connect-provider) is enabled.

`SCULK_PUBLIC=1` turns on the protections an instance open to strangers needs. Panel addresses that are, or resolve to, private, loopback or link-local IP addresses are refused, both when an owner connects a panel and when sculk.network pings a server. Downloads of modpacks, CurseForge files, deployment files and plugin requests go through `outboundFetch` with the same address guard, a fixed host list and a size limit. It cannot be set together with `SCULK_DEV_IDP_URL` or `SCULK_DEV_PLUGIN_HOSTS`, and the server refuses to start if either is set alongside it.

The public instance at sculk.network runs with `SCULK_PUBLIC=1`.

A self-hosted instance on a private network leaves `SCULK_PUBLIC` unset, so it can reach a panel on a LAN address such as `http://192.168.1.20:8080`. That holds for the bundled plugins and the plugins in `SCULK_PLUGIN_DIR`, not for a plugin a user installed: see [Plugins your users install can't reach your network](#plugins-your-users-install-cant-reach-your-network).

`SCULK_FEATURES` overrides [feature stages](https://docs.sculk.network/nightly/sculk/releases.md#feature-stages): a comma-separated list of feature names to force on, or off with a leading `-` (for example `SCULK_FEATURES=oidcProvider,sculkworm` or `SCULK_FEATURES=-sculkworm`). Boot fails if a name is not in `apps/server/src/config/features.ts`. `GET /api/build` reports the version, the channel (`dev`, `nightly` or `stable`) and the enabled flags.

`CURSEFORGE_API_KEY` turns on CurseForge for every server on the instance: search, import of CurseForge modpacks and creating a server from one. Without it, CurseForge stays off: the owners see a notice that asks them to ask you for the key.

`SCULK_LOG_LEVEL=debug` adds one `channel: read files/<path>` line to the log for each file a player's launcher downloads. Leave it unset in normal use.

## Create one OAuth app

People sign in with Google, Discord or Microsoft. You need at least one OAuth app with one of them. Each provider asks for a redirect URI. Use exactly:

```text
<SCULK_BASE_URL>/auth/<provider>/callback
```

where `<provider>` is `google`, `discord` or `microsoft`. For example, `https://sculk.example.org/auth/discord/callback`.

- Google: in the Google Cloud console, open "APIs & Services", then "Credentials", and create an "OAuth client ID" of type "Web application". Add the redirect URI.
- Discord: in the Discord Developer Portal, create an application and open "OAuth2". Add the redirect URI.
- Microsoft: in the Microsoft Entra admin center, register an application for "Accounts in any organizational directory and personal Microsoft accounts". Add the redirect URI under the "Web" platform, then create a client secret. Copy the secret's **Value**, which Entra shows only once, not its **Secret ID**. sculk.network refuses to start when `MICROSOFT_CLIENT_SECRET` is a Secret ID.

Copy the client ID and the client secret into `.env`. For Discord:

```sh
DISCORD_CLIENT_ID=<client id>
DISCORD_CLIENT_SECRET=<client secret>
```

Use `GOOGLE_` or `MICROSOFT_` in the names for the other providers. You can set more than one provider. The sign-in page shows a button for each.

`SCULK_MS_VERIFY=1` lets players prove they own their Minecraft account with the same Microsoft app. It needs a second redirect URI, `<SCULK_BASE_URL>/auth/minecraft/callback`, and Mojang's approval of the app's client ID ([form](https://aka.ms/AppRegistrationForm)). Until Mojang approves it, **Verify with Microsoft** answers "Microsoft did not allow this check. Your claim stays unverified."

Microsoft is the only way to link a Minecraft account unless you turn on [Verify Minecraft accounts by joining a server](#verify-minecraft-accounts-by-joining-a-server) or opt in to `SCULK_NAME_CLAIM=1`. That setting lets a player link any name they type, with no proof, so anyone can take someone else's name until its owner verifies it with Microsoft or by joining. A claimed name never seats a member or reaches a whitelist on its own: an owner has to confirm it. Without the setting, `PUT /api/account/minecraft` answers `403 {"error":"name_claim_disabled"}` and `/account` shows no name box. Names claimed earlier stay linked, and their owners can unlink them or verify them.

## Verify Minecraft accounts by joining a server

If you do not want to wait for Mojang to approve a Microsoft Entra app, players can verify their Minecraft Java Edition account by joining an OAuthMC server. Players on Minecraft 1.21.6 or later get an in-game dialog with a clickable verification link (`SCULK_BASE_URL` must start with `https://` for link mode; otherwise sculk.network falls back to code mode automatically). Older clients and fallback cases disconnect with a one-time 8-character code that the player types on `/account`. `compose.yml` ships OAuthMC under the optional `oauthmc` profile, built from `./crates/oauthmc` in this checkout, so it stays off until you enable it.

1. Generate a random API key (at least 32 characters):

   ```sh
   openssl rand -hex 24
   ```

   ```text
   <48 hex characters>
   ```

2. Add the three settings to `.env`:

   ```sh
   SCULK_OAUTHMC_URL=http://oauthmc:8080
   SCULK_OAUTHMC_KEY=<the key from step 1>
   SCULK_OAUTHMC_ADDRESS=verify.example.org
   ```

   All three must be set for **Verify by joining a server** to appear on `/account`. The HTTP API stays on Compose's internal network; only the Minecraft port (`OAUTHMC_PORT`, default `25565`) is published.

3. Build OAuthMC and start both services with the `oauthmc` profile. Build only `oauthmc`: `--build` on `up` would also rebuild `sculk` without its commit, and `/healthz` would print `"commit":"unknown"`.

   ```sh
   docker compose --profile oauthmc build oauthmc
   docker compose --profile oauthmc up -d
   ```

   ```text
    Image oauthmc  Built
    Container sculknetwork-oauthmc-1  Started
    Container sculknetwork-sculk-1  Started
   ```

4. Point DNS at the host so players can connect to `SCULK_OAUTHMC_ADDRESS`:
   - If port `25565` is free on your host, add an `A` (or `AAAA`) record pointing `verify.example.org` at your host's IP address.
   - If another Minecraft server already uses `25565`, set `OAUTHMC_PORT=25566` in `.env` and add a DNS `SRV` record so players still type `verify.example.org` without a port:

     ```text
     _minecraft._tcp.verify.example.org. 300 IN SRV 0 5 25566 verify-host.example.org.
     ```

5. Open Minecraft Java Edition, add `verify.example.org` to your Multiplayer server list, and check that the entry shows online with the MOTD `OAuthMC account verification` / `Join to get your code`.

## Serve as an OpenID Connect provider

sculk.network can act as an OpenID Connect 1.0 provider (issuer `SCULK_BASE_URL`, discovery at `/.well-known/openid-configuration`) so relying parties such as Sculkworm can authenticate players and read which servers they may play on (`sculk:servers`). See [sculk.network as an OpenID Connect provider](https://docs.sculk.network/nightly/sculk/oidc-provider.md) for the discovery document, protocol rules, and worked flow.

This integration is currently behind the `oidcProvider` [feature stage](https://docs.sculk.network/nightly/sculk/releases.md#feature-stages) (`nightly`: enabled by default on `dev` and `nightly` builds, off on `stable` unless forced with `SCULK_FEATURES=oidcProvider`).

To manage OIDC clients, grants, blocked subjects, and signing keys through `/api/oidc/*`, list the allowed user IDs in `.env`. When `SCULK_OIDC_ADMINS` is unset or empty, `/api/oidc/*` returns `403`:

```sh
SCULK_OIDC_ADMINS=<user id 1>,<user id 2>
```

## Route servers through Sculkworm

When you run a shared Sculkworm Minecraft TCP relay (`crates/sculkworm`), sculk.network can automatically register `<server>.<SCULKWORM_BASE_DOMAIN>` addresses for the servers it manages, update them when a server's backend address changes, and remove them when a server is disconnected. See [Sculkworm integration](https://docs.sculk.network/nightly/sculk/sculkworm-integration.md) for the full setup, API reference, and worked flow.

This integration is currently behind the `sculkworm` [feature stage](https://docs.sculk.network/nightly/sculk/releases.md#feature-stages) (`nightly`: enabled by default on `dev` and `nightly` builds, off on `stable` unless forced with `SCULK_FEATURES=sculkworm`). Set all three variables in `.env` to turn it on; leaving any of them unset disables it:

```sh
SCULKWORM_URL=http://sculkworm:8080
SCULKWORM_API_KEY=<tenant key from SCULKWORM_TENANTS_FILE>
SCULKWORM_BASE_DOMAIN=play.example.org
```

## Start sculk.network

```sh
docker compose up -d
```

```text
 Network sculknetwork_default  Created
 Volume sculknetwork_sculk-data  Created
 Container sculknetwork-sculk-1  Started
```

Check that it answers. Use the port from `SCULK_PORT` if you changed it.

```sh
curl -s http://localhost:8080/healthz
```

```json
{"ok":true,"version":"0.0.0-dev","commit":"<the commit you built>"}
```

The `commit` is the output of `git rev-parse HEAD` from the build step. If `curl` prints nothing, read the log:

```sh
docker compose logs sculk
```

The last line of a healthy start is `listening on :8080`. Any line before it that starts with an error names the setting to fix in `.env`. After you change `.env`, run `docker compose up -d` again.

The container answers on the address in `SCULK_PORT`, `127.0.0.1:8080` above. Point your https reverse proxy at it, so that `SCULK_BASE_URL` reaches this port. Never publish that port to the internet without the proxy in front.

When running behind a reverse proxy, set `SCULK_TRUSTED_PROXIES` to the proxy's IP address or CIDR (for example `127.0.0.1,::1` for a proxy on the same host, or `172.17.0.0/16` for a Docker bridge) and configure the proxy to append the client IP to `X-Forwarded-For`. Otherwise rate limiting sees every request coming from the proxy's address and shares one per-IP bucket across all users. Only list addresses controlled by your proxy: sculk.network reads the rightmost `X-Forwarded-For` hop that is not in `SCULK_TRUSTED_PROXIES`, ignores `X-Forwarded-For` when the direct socket peer is untrusted, and groups IPv6 clients by `/64`.

## Sign in and connect your first server

1. Open `SCULK_BASE_URL` in your browser and press **Sign in**.
2. Choose your provider and sign in. You land on your account page.
3. Open `<SCULK_BASE_URL>/servers` and press **Connect a server**.
4. The form **Add a connection** is open. Choose your panel's plugin, PufferPanel or Pterodactyl, and fill in the panel URL and its credentials:
   - PufferPanel: create an OAuth2 client in your PufferPanel account settings, and copy its client ID and client secret.
   - Pterodactyl: create an application API key in the admin area and a client API key in your account, and copy both.
5. Press **Test**. It shows `Connected, 1 server`, or `Connected, <n> servers` when the panel holds more. Press **Save**.
6. Choose the server from the list, give it a name, and press **Connect server**.

The server's connection settings open. Press **Server page** (or open `<SCULK_BASE_URL>/servers`), and your server shows with you as **Owner**.

If **Test** shows "This panel address isn't allowed", the instance runs with `SCULK_PUBLIC=1` and the panel URL points to a private address. See [Settings that change how the instance behaves](#settings-that-change-how-the-instance-behaves).

## Set the server icon and message

Minecraft shows two things about a server in the multiplayer list: `server-icon.png` and the `motd` line of `server.properties`. Both live in **Settings**, then **Server details**, the first section. Each saves to the draft; Minecraft reads them at startup, so open **Config**, press **Apply** and restart for them to go live.

### Icon

The icon has to be a 64 x 64 PNG in the server root, so sculk.network converts what you pick.

1. Press **Choose an image** and pick a PNG, JPEG or WebP of up to 2 MiB. The image is cropped to its centre square and resized to 64 x 64.
2. **Draft** shows the result. **Live** changes only once the server restarts.

The icon is the modpack file `server-icon.png`, so **History** lists it and you can undo it. A GIF answers `415` and a file over 2 MiB answers `413`; both leave the draft as it was. The icon appears beside the server name in `/servers` and in the server header, and the Prism and installer downloads carry it.

The exports differ in what they can carry:

| Export | Icon |
| --- | --- |
| Minecraft server | `server-icon.png` in the root, shown by Server List Ping |
| Prism instance (`.zip`) | `iconKey=sculk-<serverId>` in `instance.cfg` and `sculk-<serverId>.png` at the instance root, which Prism installs as the instance icon |
| Installer (`.jar`) | `iconKey` in `sculk-installer.json` and `server-icon.png` inside the jar, shown in the installer window and installed as the launcher icon |
| `.mrpack` | None. `modrinth.index.json` has no icon field |
| packwiz | None. `pack.toml` has no icon field |

### Message of the day

**Message of the day** edits the `motd` line of the draft's `server.properties`. When the draft has no such file yet, the section says so: press **Import server.properties from the server** to bring in the server's own file, with its port and other settings, before you edit.

1. Click the preview and type, or paste text with `&` or `§` codes; pick a colour or a style from the toolbar (or press `Ctrl+B`, `Ctrl+I`, `Ctrl+U`) to style selected text or what you type next.
2. The preview draws the entry as the pack's Minecraft version draws it: the 2-line limit, the width each line wraps at (271 pixels up to 1.21.8, 267 from 1.21.9) and the text shadow (from 1.21.4). Under it, each line shows its width in pixels. **Centre** pads each line with spaces to the middle.
3. Press **Save to the draft**. Only the `motd` line changes; every other line of `server.properties` stays as it was.

The saved line is what a vanilla server reads, for example:

```properties
motd=\u00A76\u00A7lSculk \u00A77network\n\u00A7bplay
```

A vanilla, Fabric, Quilt, Forge or NeoForge server shows only the 16 legacy colours in this line: no hex colours, gradients or MiniMessage. **Source code** (shown outside Simplified view) reads and writes `&` codes, `§` codes, MiniMessage, JSON text components and the `server.properties` line, so you can bring a message from another tool or take this one to a Velocity or BungeeCord proxy. Hex colours and gradients on import become the nearest of the 16 colours, and the section says so.

## Add the GitHub App

sculk.network keeps each modpack in a GitHub repository. It writes there through a GitHub App that you own.

1. On GitHub, open "Settings", then "Developer settings", then "GitHub Apps", and press "New GitHub App". To own it with an organization, open the organization's settings instead.
2. Fill in:
   - "Homepage URL": your `SCULK_BASE_URL`.
   - "Callback URL": `<SCULK_BASE_URL>/auth/github/callback`.
   - Check "Request user authorization (OAuth) during installation".
   - Under "Webhook", clear "Active".
   - Under "Repository permissions", set "Contents" to "Read and write" and "Administration" to "Read and write". "Metadata" becomes "Read-only". "Administration" is what lets sculk.network create a new repository for a server. Without it, servers can still use a repository that already exists.
3. Create the App. On its page, note the "App ID" and the "Client ID". The slug is the last part of its public link, `https://github.com/apps/<slug>`.
4. Press "Generate a new client secret" and copy it.
5. Press "Generate a private key". GitHub downloads a `.pem` file.

Add the values to `.env`:

```sh
GITHUB_APP_ID=<app id>
GITHUB_APP_SLUG=<slug>
GITHUB_APP_CLIENT_ID=<client id>
GITHUB_APP_CLIENT_SECRET=<client secret>
```

Add the private key on one line. Replace the file name with yours:

```sh
printf 'GITHUB_APP_PRIVATE_KEY=%s\n' "$(awk '{printf "%s\\n", $0}' <app>.private-key.pem)" >> .env
docker compose up -d
```

```text
 Container sculknetwork-sculk-1  Started
```

On your server page, open **Settings**, then **GitHub**, and press **Install the GitHub App**. GitHub asks you to authorize the App and then where to install it. Pick the repositories sculk.network may use. If the App is already installed on your account or organization, GitHub does not ask again: sculk.network finds the installations you can see and registers them, so you never need to uninstall first.

When you create or link a server, the repository step has two views:

- **New repository** (the default) creates an empty repository, adds `sculk.json` and a `README.md` on the production branch, and creates the staging branch from it. The branch names start as `main` and `staging` and you can change them. A new repository needs two things from GitHub. The installation must be on an **organization**, because GitHub does not let a GitHub App create repositories on a personal account. And the App needs the "Administration" permission, which for an App you already created means opening its settings, adding "Administration: Read and write", and accepting the change on the installation (GitHub emails the owner and shows a banner on the installation page). Until both are true, the view explains what is missing and the **Existing repository** view stays available.
- **Existing repository** assumes the repository already holds a sculk.network server. You pick it, then pick the production and staging branches from the ones it has. Both need a valid `sculk.json`. sculk.network reads the Minecraft version and the loader from the production branch and writes nothing to the repository.

## Add the CurseForge key

CurseForge needs an API key. Ask for one in the CurseForge console at `https://console.curseforge.com`. The key belongs to the instance, so there is no setting per server: put it in `.env` and run `docker compose up -d`:

```sh
CURSEFORGE_API_KEY=<your key>
```

Until you do, searching CurseForge, importing a CurseForge modpack and creating a server from one show "This sculk.network has no CurseForge key. Ask the operator to set CURSEFORGE_API_KEY.".

Earlier versions let each owner save a key of their own in the server settings. That setting is gone and the keys saved there are deleted on upgrade, so set `CURSEFORGE_API_KEY` before you upgrade if any of your servers used one.

## Add plugins for the whole instance

Each user can install their own panel plugin on their **Plugins** page. To offer a plugin to every user of the instance instead, put it on the `/data` volume:

1. Create a folder such as `/data/plugins` on the volume and copy your `*.plugin.json` files into it. Files in subfolders count too, and other files are ignored.
2. Set the folder in `.env`:

   ```sh
   SCULK_PLUGIN_DIR=/data/plugins
   ```

3. Run `docker compose up -d` to restart.

The plugins show under "This instance" when someone presses "Add a connection". sculk.network checks every file at start. An invalid file, or a file whose id a bundled plugin such as `pufferpanel` already has, stops the start, and `docker compose logs sculk` shows the reason:

```text
SCULK_PLUGIN_DIR: /data/plugins/a/bad.plugin.json: /actions/listServers/steps/0/request/path uses url variable "url"
SCULK_PLUGIN_DIR: /data/plugins/p.plugin.json uses id "pufferpanel", which a bundled plugin has
```

Fix or remove the file and start again.

A user who installs a plugin by URL needs an `https` URL whose certificate the instance trusts. Plain `http` URLs are refused.

### Plugins your users install can't reach your network

Anyone who can sign in can install a plugin, and a plugin decides which requests sculk.network sends. So a plugin a user installed is never trusted to reach private addresses, whether or not `SCULK_PUBLIC` is set:

- Installing it is refused when one of its hosts is, or resolves to, a private, loopback or link-local address.
- Every request it sends, the panel address and the sign-in request to the panel included, is refused when it goes to such an address. **Test** then shows "This panel address isn't allowed".

The plugins you ship are different: bundled plugins and the ones in `SCULK_PLUGIN_DIR` are your code, and on an instance without `SCULK_PUBLIC` they reach a panel on your LAN as before. If a user needs a plugin for a panel on your network, review it and put it in `SCULK_PLUGIN_DIR`.

## Back up and restore

A backup is the data volume, which holds `sculk.db`, plus your master key. One is useless without the other.

Stop the container, so the database is complete on disk, copy the volume, and start again:

```sh
docker compose stop
docker compose cp sculk:/data ./sculk-backup
docker compose start
```

```text
 Container sculknetwork-sculk-1  Stopped
 sculknetwork-sculk-1 Copied sculknetwork-sculk-1:/data to ./sculk-backup
 Container sculknetwork-sculk-1  Started
```

Keep `./sculk-backup` off the host, and keep it apart from your master key. Store the key somewhere else, such as your password manager, and never next to the backup or in `.env` beside it. Anyone who holds both can read every panel credential, channel token and API key in the backup. You need both to restore: without the key, the secrets in the backup can't be read.

To restore, start from a working `compose.yml` and a `.env` that holds the master key the backup was sealed with. Remove the container and its volume if they exist, copy the backup into a new volume, and start:

```sh
docker compose down -v
docker compose run --rm --no-deps -v "$PWD/sculk-backup:/backup:ro" sculk cp -r /backup/. /data/
docker compose up -d
```

`docker compose down -v` deletes the data volume. Run it only when you hold a backup. The copy runs inside the image, so the restored files belong to the user the server runs as.

### Start with the wrong key

If `SCULK_MASTER_KEY` opens none of the stored secrets, the server refuses to start and names the problem. `docker compose logs sculk` shows, once per attempt:

```text
sealed: <n> values have no key, kid=<8 hex characters>
sealed: SCULK_MASTER_KEY opens none of the <n> stored secrets (kid=<8 hex characters>). Start with the key that sealed them, or set SCULK_ALLOW_UNREADABLE_SECRETS=1 to start without them.
```

The container keeps restarting and `/healthz` does not answer. Put the right key in `.env` and run `docker compose up -d`.

If the key opens some secrets but not others, the server starts. Each `sealed: <n> values have no key` line in the log counts secrets that an earlier key sealed. Those secrets stay unreadable. For panel credentials, the server's connection settings show "The saved credentials can't be read. Replace them to reconnect the panel."

### Lost the master key

If the key is gone for good, you can still start the instance. Users, servers, members and modpack history are not encrypted and stay as they are. Every secret is lost: panel credentials, channel tokens, server secrets.

1. Create a new key with `openssl rand -base64 32` and put it in `SCULK_MASTER_KEY` in `.env`. Store a copy as in [Create the master key](#create-the-master-key).
2. Add `SCULK_ALLOW_UNREADABLE_SECRETS=1` to `.env` and run `docker compose up -d`. The server starts and logs how many secrets it can't read.
3. Each owner opens **Settings**, then **Connection**, on their server and presses **Replace credentials** to enter the panel credentials again. Re-enter any other secret the same way.
4. Remove `SCULK_ALLOW_UNREADABLE_SECRETS` from `.env` and run `docker compose up -d`. From now on the server starts as long as the new key opens at least one stored secret.

### Change the master key

Move the current key to `SCULK_MASTER_KEY_OLD`, put a new key in `SCULK_MASTER_KEY`, and run `docker compose up -d`. The server re-encrypts every secret with the new key at start. Remove `SCULK_MASTER_KEY_OLD` after that start.

## Upgrade

Back up first. Then fetch the new code, rebuild the image and restart. If you run a published image instead, set `SCULK_IMAGE` to the channel you want and run `docker compose pull && docker compose up -d`; [Switch channels on an instance](https://docs.sculk.network/nightly/sculk/releases.md#switch-channels-on-an-instance) lists the tags and why a nightly database cannot go back to stable.

If your instance predates `.env`, create it before you restart: follow [Copy `.env.example` to `.env`](#copy-envexample-to-env) and [Create one OAuth app](#create-one-oauth-app). Compose refuses to start without it. Your data stays in the volume `sculknetwork_sculk-data`, because `compose.yml` fixes the project name to `sculknetwork`. Check that the volume exists before you start:

```sh
docker volume ls --filter name=sculknetwork_sculk-data
```

```text
DRIVER    VOLUME NAME
local     sculknetwork_sculk-data
```

If the list is empty and you ran sculk.network before, your data is in a volume with another prefix: Compose named it after the folder you ran it from. Find it with `docker volume ls --filter name=sculk-data`, then copy it into the new name before you start:

```sh
docker volume create sculknetwork_sculk-data
docker run --rm --user root -v <old volume>:/from:ro -v sculknetwork_sculk-data:/to sculk sh -c 'cp -a /from/. /to/'
```

The copy runs as root so it can write into the new volume, and `cp -a` keeps the files owned by the user the server runs as.

Then upgrade:

```sh
git pull
docker build --build-arg SCULK_COMMIT="$(git rev-parse HEAD)" -t sculk .
docker compose up -d
curl -s http://localhost:8080/healthz
```

```json
{"ok":true,"version":"<version>","commit":"<the new commit>"}
```

If you enabled the `oauthmc` profile, rebuild OAuthMC and restart it too. Build only `oauthmc`: `--build` on `up` would also rebuild `sculk` without its commit, and `/healthz` would print `"commit":"unknown"`.

```sh
docker compose --profile oauthmc build oauthmc
docker compose --profile oauthmc up -d
```

```text
 Image oauthmc  Built
 Container sculknetwork-oauthmc-1  Started
 Container sculknetwork-sculk-1  Running
```

The server applies database migrations when it starts. You don't run anything else.

## Development

These settings exist for working on sculk.network itself. Don't set them on an instance people use.

`SCULK_DEV_PLUGIN_HOSTS` lists exact `host:port` entries, such as `fake-panel:8080`, that a user plugin may reach even though they are private addresses. The development lanes set it for their fake panel. It never lets a request through to a link-local or cloud metadata address, the server refuses to start when it is set together with `SCULK_PUBLIC=1`, and it prints a warning that names the entries at every start.
