Add an Unraid installer for a self-hosted Fluxer instance.
The official compose bundle stores uploads in Docker volumes and expects a proxy on loopback, which does not fit Unraid docker.img or a containerized reverse proxy.
This commit is contained in:
commit
1f6c4c0c39
9 files changed
+881
No files matched your search
@@ -0,0 +1,5 @@
|
|||||||
|
* text=auto
|
||||||
|
*.sh text eol=lf
|
||||||
|
*.yml text eol=lf
|
||||||
|
*.md text eol=lf
|
||||||
|
*.conf text eol=lf
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
# Official compose bundle, generated secrets, and runtime data.
|
||||||
|
# Never commit these. The bundle is downloaded on the Unraid server.
|
||||||
|
stack/
|
||||||
|
data/
|
||||||
|
backups/
|
||||||
|
|
||||||
|
.env
|
||||||
|
*.pem
|
||||||
|
vapid.pem
|
||||||
|
fluxer-compose.tar.gz
|
||||||
@@ -0,0 +1,189 @@
|
|||||||
|
# Fluxer on Unraid
|
||||||
|
|
||||||
|
Install [Fluxer](https://fluxer.com/) on an Unraid server using the official Docker Compose bundle. Fluxer is the self-hosted chat server documented at [docs.fluxer.com](https://docs.fluxer.com/). This repo is the Unraid procedure: where files go, how secrets are created, and how the stack sits behind the proxy you already run.
|
||||||
|
|
||||||
|
This is not the Remix music bot. That packaging lives in [fluxer-unraid](https://git.masengr.com/Michael-A-Sloan/fluxer-unraid).
|
||||||
|
|
||||||
|
The decisions, the compose file that was inspected, and the things that are still easy to get wrong are in [docs/WORKING-NOTES.md](docs/WORKING-NOTES.md).
|
||||||
|
|
||||||
|
Fluxer itself is AGPL-3.0. This repo does not vendor Fluxer's images or compose bundle. The prepare script downloads the current bundle from Fluxer when you run it on the server.
|
||||||
|
|
||||||
|
## What you need
|
||||||
|
|
||||||
|
- Unraid with Docker running, and Docker Compose **2.24 or newer** (the Compose Manager plugin is the usual way to get that). The bundle uses compose syntax that older Compose rejects.
|
||||||
|
- A 64-bit server. Fluxer asks for at least 2 CPU cores, 4 GB of RAM, and 20 GB of disk for about a thousand people online. On Unraid, plan on **8 GB of RAM the stack can actually use** and a larger Docker image store. The compose file's own defaults are tuned much larger than 4 GB; the prepare script writes a smaller home-server profile the first time it creates `.env`.
|
||||||
|
- A hostname such as `chat.example.com` with a DNS A record to the address clients use.
|
||||||
|
- TCP **7881** and UDP **7882** forwarded from the router to Unraid for voice and video. Call media does not go through the reverse proxy.
|
||||||
|
- A reverse proxy is the path this repo sets up by default, because Unraid (or Nginx Proxy Manager, SWAG, or Traefik) is usually already on ports 80 and 443.
|
||||||
|
|
||||||
|
Email is optional. With no SMTP settings, the setup wizard can use username sign-in.
|
||||||
|
|
||||||
|
## Before the first start
|
||||||
|
|
||||||
|
1. **Give Docker room for the images.** Uploads are kept out of `docker.img` by this repo, but the images still land there. Settings → Docker → stop Docker, raise the vDisk (50 GB is a practical floor) or switch the Docker data root to a directory on the cache pool, then start Docker again.
|
||||||
|
2. **Keep Fluxer's data on a cache-only path.** Postgres on a multi-disk `/mnt/user` share is a known way to corrupt a database. Create the appdata folder on a pool that is cache-only (or use `/mnt/cache/appdata/fluxer`).
|
||||||
|
3. Confirm Compose is new enough, in the Unraid terminal:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose version
|
||||||
|
```
|
||||||
|
|
||||||
|
You want 2.24 or newer.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
Run this on the Unraid server, not on your PC. Do not clone onto the USB flash drive (`/boot`).
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir -p /mnt/user/appdata
|
||||||
|
cd /mnt/user/appdata
|
||||||
|
git clone https://git.masengr.com/Michael-A-Sloan/Fluxer-selfhost-unraid.git
|
||||||
|
cd Fluxer-selfhost-unraid
|
||||||
|
sh scripts/prepare-unraid.sh chat.example.com
|
||||||
|
```
|
||||||
|
|
||||||
|
Replace `chat.example.com` with your hostname. The script:
|
||||||
|
|
||||||
|
- downloads the official bundle into `stack/`
|
||||||
|
- creates `/mnt/user/appdata/fluxer/` and the data directories under it
|
||||||
|
- writes `stack/.env`, generates the secrets Fluxer requires, and points storage at those directories
|
||||||
|
- listens for your existing proxy on **port 18080** of the Unraid host
|
||||||
|
|
||||||
|
It does not start the containers. Read the script's output. Copy `stack/.env` somewhere safe before you continue. These values are fixed after the first start:
|
||||||
|
|
||||||
|
- `POSTGRES_PASSWORD`
|
||||||
|
- `MEILI_MASTER_KEY`
|
||||||
|
- `FLUXER_VAPID_PUBLIC_KEY` and `FLUXER_VAPID_PRIVATE_KEY`
|
||||||
|
|
||||||
|
Show the admin token with:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
awk -F= '$1=="FLUXER_SETUP_TOKEN"{print $2}' stack/.env
|
||||||
|
```
|
||||||
|
|
||||||
|
### Put your proxy in front
|
||||||
|
|
||||||
|
Default prepare mode publishes plain HTTP on `0.0.0.0:18080`. `127.0.0.1:8080` from the Fluxer docs is the wrong address on Unraid: another container cannot open the host's loopback, and port 8080 is a common Unraid web UI port.
|
||||||
|
|
||||||
|
In Nginx Proxy Manager, add a proxy host:
|
||||||
|
|
||||||
|
| Field | Value |
|
||||||
|
| --- | --- |
|
||||||
|
| Domain | your Fluxer hostname |
|
||||||
|
| Scheme | `http` |
|
||||||
|
| Forward hostname | Unraid's LAN IP, not `127.0.0.1` |
|
||||||
|
| Forward port | `18080` |
|
||||||
|
| Websockets | on |
|
||||||
|
| Block Common Exploits | off |
|
||||||
|
|
||||||
|
Paste [unraid/npm-advanced.conf](unraid/npm-advanced.conf) into that host's Advanced tab. Request a certificate in NPM. Leave Fluxer's own certificate off; in this mode Caddy is only the HTTP edge.
|
||||||
|
|
||||||
|
The proxy also has to allow a **512 MB** upload body, keep idle connections for an hour, forward WebSocket upgrades, and not add its own Content-Security-Policy. The snippet covers the nginx side of that.
|
||||||
|
|
||||||
|
### Voice and video
|
||||||
|
|
||||||
|
Forward these from the router to the Unraid host, same numbers on both sides:
|
||||||
|
|
||||||
|
| Port | Protocol | Use |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| 18080 | TCP | only if you are not using a proxy on the same machine |
|
||||||
|
| 7881 | TCP | voice and video |
|
||||||
|
| 7882 | UDP | voice and video |
|
||||||
|
|
||||||
|
A Cloudflare Tunnel, or any proxy that only carries HTTP, cannot carry the call media. If the server is behind CGNAT and you cannot forward 7881/7882, calls need a TURN server on a public machine. That is written up in the [Fluxer proxy docs](https://docs.fluxer.com/operator/reverse-proxy/) under "Voice behind a tunnel".
|
||||||
|
|
||||||
|
### Start
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd /mnt/user/appdata/Fluxer-selfhost-unraid
|
||||||
|
docker compose --project-directory stack up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
The first start pulls a lot of images. Then:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose --project-directory stack ps
|
||||||
|
docker compose --project-directory stack logs -f api
|
||||||
|
```
|
||||||
|
|
||||||
|
When the API is healthy, open `https://chat.example.com`, enter `FLUXER_SETUP_TOKEN`, and create the admin account. The admin panel is at `/admin` on that same host.
|
||||||
|
|
||||||
|
To start as part of prepare, add `--up`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sh scripts/prepare-unraid.sh chat.example.com --up
|
||||||
|
```
|
||||||
|
|
||||||
|
## Direct HTTPS instead of your proxy
|
||||||
|
|
||||||
|
Use this only when nothing else on Unraid is bound to 80 and 443, and the DNS A record already points at this machine so Caddy can get a certificate.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sh scripts/prepare-unraid.sh chat.example.com --direct
|
||||||
|
```
|
||||||
|
|
||||||
|
Also forward TCP 80, TCP 443, and UDP 443, plus the voice ports above.
|
||||||
|
|
||||||
|
## Where files live
|
||||||
|
|
||||||
|
| Path | What it is |
|
||||||
|
| --- | --- |
|
||||||
|
| `stack/` | Official compose bundle, generated `.env`, and the Unraid volume file. Not in git. |
|
||||||
|
| `/mnt/user/appdata/fluxer/` | Postgres, uploads, search, Valkey, NATS, Caddy data. Not in git. |
|
||||||
|
| `unraid/docker-compose.unraid.yml` | Bind-mounts those directories so they are not stored in `docker.img`. |
|
||||||
|
|
||||||
|
Override the data path if cache is not `/mnt/user/appdata`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
FLUXER_APPDATA=/mnt/cache/appdata/fluxer sh scripts/prepare-unraid.sh chat.example.com
|
||||||
|
```
|
||||||
|
|
||||||
|
## Update
|
||||||
|
|
||||||
|
Back up first. Then, on the server:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sh scripts/backup-unraid.sh
|
||||||
|
sh scripts/update-unraid.sh
|
||||||
|
docker compose --project-directory stack up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
The update downloads a new official bundle into `stack/` and keeps `.env`. New keys sometimes appear in `.env.example`. If the release notes or a failed start say a setting is missing, copy that line from `stack/.env.example` into `stack/.env`.
|
||||||
|
|
||||||
|
Passing `--proxy` or `--direct` to prepare again rewrites `COMPOSE_FILE`. A plain update does not.
|
||||||
|
|
||||||
|
## Back up
|
||||||
|
|
||||||
|
`scripts/backup-unraid.sh` stops the stack, writes a Postgres custom dump, tars the data directories, copies `.env`, and starts the stack again. The folder it creates contains secrets. Copy it off the server.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sh scripts/backup-unraid.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Fluxer's own restore steps for a compose install are in the [Docker Compose doc](https://docs.fluxer.com/operator/docker-compose/). Restore with the bundle version that created the backup, then upgrade.
|
||||||
|
|
||||||
|
## Useful checks
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose --project-directory stack ps
|
||||||
|
docker volume ls | grep fluxer
|
||||||
|
```
|
||||||
|
|
||||||
|
`fluxer_postgres-data` should be a bind whose device is `/mnt/user/appdata/fluxer/postgres` (or whatever `FLUXER_APPDATA` you set). If the device is blank, that volume was created inside `docker.img` before the Unraid file was applied. On a brand-new install with no data you care about, remove the empty `fluxer_*` volumes and run `docker compose --project-directory stack up -d` again. Do not remove them if they already hold a database you need.
|
||||||
|
|
||||||
|
## LAN-only voice
|
||||||
|
|
||||||
|
Leave the defaults when callers are on the internet: LiveKit discovers the public address with STUN, and the router forwards 7881/7882.
|
||||||
|
|
||||||
|
If clients are only on your LAN and hairpin NAT breaks calls, set these in `stack/.env` and recreate:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
FLUXER_LIVEKIT_USE_EXTERNAL_IP=false
|
||||||
|
FLUXER_LIVEKIT_NODE_IP=192.168.1.10
|
||||||
|
```
|
||||||
|
|
||||||
|
Use the Unraid LAN address. Then `docker compose --project-directory stack up -d`.
|
||||||
|
|
||||||
|
## If a container is killed for memory
|
||||||
|
|
||||||
|
The first `.env` lowers the bundle's large caps (Postgres defaults to a 5 GB cap and a 1 GB shared-memory mount). If the API, worker, or Postgres is still OOM-killed, raise that service's `FLUXER_*_MEMORY_LIMIT` in `stack/.env` and recreate. The full list is in [Environment variables](https://docs.fluxer.com/operator/environment/).
|
||||||
@@ -0,0 +1,179 @@
|
|||||||
|
# Working notes
|
||||||
|
|
||||||
|
Date opened: 2026-11-23.
|
||||||
|
|
||||||
|
This file is the running record of what was read, what was decided, and what is still unverified. The install steps you actually follow are in the README. When a later change disagrees with this file, update this file in the same commit.
|
||||||
|
|
||||||
|
## What was asked
|
||||||
|
|
||||||
|
Put this project on the public Gitea at `git.masengr.com` under `Michael-A-Sloan`, and make it possible to install Fluxer on the Unraid server from that repo. The source of truth given for the product was https://docs.fluxer.com/.
|
||||||
|
|
||||||
|
## What this project is
|
||||||
|
|
||||||
|
Fluxer, in these docs, is a self-hosted chat platform: HTTP API, gateway, voice, media proxy, admin API. Official self-hosting is `rexctl` on a normal Linux host, or a Helm chart on Kubernetes. For Unraid, TrueNAS, and Portainer, Fluxer publishes a Docker Compose bundle because those systems run compose for you and are a poor fit for `rexctl`.
|
||||||
|
|
||||||
|
Pages used:
|
||||||
|
|
||||||
|
- https://docs.fluxer.com/
|
||||||
|
- https://docs.fluxer.com/operator/
|
||||||
|
- https://docs.fluxer.com/operator/docker-compose/
|
||||||
|
- https://docs.fluxer.com/operator/reverse-proxy/
|
||||||
|
- https://docs.fluxer.com/operator/environment/
|
||||||
|
- https://docs.fluxer.com/operator/voice-compose/
|
||||||
|
- https://fluxer.com/selfhost
|
||||||
|
- Compose bundle downloaded 2026-11-23 from https://fluxer.dev/compose/latest
|
||||||
|
- GitHub release found while checking the bundle: `fluxerapp/fluxer` tag `fluxer-release@2026.1118.162713`, asset `fluxer-compose-2026.1118.162713.tar.gz` listed at about 49.9 KB. The tarball fetched from `fluxer.dev/compose/latest` was 51164 bytes. Treat the bundle as "whatever latest served that day", not as a pin inside this repo.
|
||||||
|
|
||||||
|
## What this project is not
|
||||||
|
|
||||||
|
`c:\Users\Michael Sloan\Desktop\Github Projects\fluxer-unraid` is already a public Gitea repo, https://git.masengr.com/Michael-A-Sloan/fluxer-unraid. Its README says it packages the Remix music bot (MySQL, Redis, NodeLink, `fluxer-bot`). It maps host port 8080. It is a different piece of software that happens to use the same word.
|
||||||
|
|
||||||
|
This repo must not grow templates for that bot, and the bot's `fluxer-net` network is not the network the official stack creates. The official compose project name is `fluxer`, so its containers are `fluxer-api-1`, `fluxer-postgres-1`, and so on. The bot uses fixed names `fluxer-mysql`, `fluxer-redis`, `fluxer-nodelink`, `fluxer-bot`. They can run on one server if port 8080 is left for the bot. This stack's proxy port is **18080** for that reason, and because Unraid's own UI is often moved to 8080.
|
||||||
|
|
||||||
|
## Why not rexctl on Unraid
|
||||||
|
|
||||||
|
`rexctl` installs Docker if it is missing, writes an instance folder (`/opt/fluxer` as root), and owns the compose lifecycle. Unraid already owns Docker. The OS root is not a durable place to keep an instance. The Docker data root is usually a vdisk. Fluxer's own compose page names Unraid as a platform that should use the bundle instead of `rexctl`.
|
||||||
|
|
||||||
|
`rexctl takeover --dir <stack>` can adopt a bundle install later, including one upgraded by hand. That is an escape hatch, not the install path.
|
||||||
|
|
||||||
|
## Bundle, as unpacked
|
||||||
|
|
||||||
|
Top-level files in the 2026-11-23 tarball:
|
||||||
|
|
||||||
|
- `docker-compose.yml` (project name `fluxer`)
|
||||||
|
- `docker-compose.proxy.yml`
|
||||||
|
- `tunnel.compose.yml`
|
||||||
|
- `external-object-store.compose.yml`
|
||||||
|
- `filesystem-object-store.compose.yml`
|
||||||
|
- `kv-postgres.compose.yml`
|
||||||
|
- `rust-server.compose.yml`
|
||||||
|
- `ipv6.compose.yml`
|
||||||
|
- `external-voice.compose.yml`
|
||||||
|
- `Caddyfile`, `caddy.d/`, `certs/`, `ca/`
|
||||||
|
- `.env.example` (large; it is the same catalog as the environment-variables doc)
|
||||||
|
- `voice/` for extra LiveKit servers
|
||||||
|
|
||||||
|
Services in `docker-compose.yml`:
|
||||||
|
|
||||||
|
| Service | Role | Host ports |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| edge | Caddy | 80, 443/tcp, 443/udp, unless the proxy file replaces them |
|
||||||
|
| postgres | Postgres 16 | none |
|
||||||
|
| valkey | cache / queue data | none |
|
||||||
|
| nats | internal bus | none |
|
||||||
|
| meilisearch | search | none |
|
||||||
|
| seaweedfs + seaweedfs-init | bundled S3 | none |
|
||||||
|
| livekit | voice | TCP 7881, UDP 7882 |
|
||||||
|
| api, worker | main app | none |
|
||||||
|
| gateway | WebSocket | none (through the edge at `/gateway`) |
|
||||||
|
| media-proxy, push, static-proxy, app-proxy | media, push, static, web app | none |
|
||||||
|
| snowflakes, users, gifs, messages, unfurl, admin | smaller services | none |
|
||||||
|
|
||||||
|
Images are pinned by digest. App images are `ghcr.io/fluxerapp/...`. No GHCR login is required for a public pull. This repo does not copy those pins into git. An upgrade is "download the new bundle", which is what Fluxer documents, because the digests change every release.
|
||||||
|
|
||||||
|
Named volumes in the bundle: `edge-data`, `edge-config`, `postgres-data`, `valkey-data`, `nats-data`, `meilisearch-data`, `seaweedfs-data`, `media-proxy-tmp`.
|
||||||
|
|
||||||
|
`docker-compose.proxy.yml` is tiny and important. It replaces the edge port list with:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
ports: !override
|
||||||
|
- "${FLUXER_EDGE_BIND:-127.0.0.1:8080}:8080"
|
||||||
|
```
|
||||||
|
|
||||||
|
and sets the site address to `:8080`, clears the TLS directive, and trusts `private_ranges`. The `!override` tag is why Compose must be 2.24 or newer. Older Compose will refuse the file or mis-merge the ports and try to bind 80 and 443 as well.
|
||||||
|
|
||||||
|
Compose will not start at all unless `FLUXER_SETTINGS_LOADED=true`. That variable is the bundle's way of saying "a human filled in .env; rexctl is not in charge".
|
||||||
|
|
||||||
|
## Decisions
|
||||||
|
|
||||||
|
1. **Ship an installer, not a fork.** Vendoring `docker-compose.yml` would freeze image digests and drift from Fluxer's upgrade instructions ("unpack the new bundle over the folder, keep `.env`"). `scripts/prepare-unraid.sh` downloads `https://fluxer.dev/compose/latest` into `stack/` on the server. `stack/` is gitignored because it contains that bundle and the generated secrets.
|
||||||
|
|
||||||
|
2. **Default to a reverse proxy.** Unraid, Nginx Proxy Manager, SWAG, or Traefik almost always owns 80/443. Direct Caddy remains available with `--direct`.
|
||||||
|
|
||||||
|
3. **Publish the edge on `0.0.0.0:18080`, not `127.0.0.1:8080`.** The documented bind is correct when the proxy is a process on the same network namespace as the host. On Unraid the proxy is another container. It cannot connect to the host's `127.0.0.1`. Publishing only on loopback also hides the port from the LAN IP that NPM is told to use. Port 18080 avoids the bot repo's 8080 mapping and the usual Unraid UI port.
|
||||||
|
|
||||||
|
4. **Bind-mount data under `/mnt/user/appdata/fluxer`.** A named volume with the local driver stores bytes in Docker's data root. On Unraid that is `docker.img` until someone changes it. SeaweedFS holds uploads. A busy chat would fill the vdisk and Docker would stop. `unraid/docker-compose.unraid.yml` recreates each named volume as a bind. The directory has to exist first; the prepare script creates it. Compose will not retarget a volume that already exists. The prepare script warns if `fluxer_postgres-data` is already there.
|
||||||
|
|
||||||
|
5. **Keep the project name `fluxer`.** Volume names become `fluxer_postgres-data` and so on. Changing the project name later creates a second, empty set of volumes. `COMPOSE_PROJECT_NAME=fluxer` is written into `.env` so a different folder name cannot silently rename the project.
|
||||||
|
|
||||||
|
6. **Generate secrets once, in `.env`, mode 600.** The official `sed` loop is the list of keys. ActivityPub signing key and VAPID keys are generated too. `FLUXER_S3_ACCESS_KEY` stays `fluxer` and `LIVEKIT_API_KEY` stays `fluxer`, matching the seaweed init user and the LiveKit key the bundle expects. Re-running prepare does not rotate secrets. `--update` does not rewrite `COMPOSE_FILE` unless `--proxy` or `--direct` is passed again, so extra compose files a person added (filesystem object store, for example) survive an upgrade.
|
||||||
|
|
||||||
|
7. **Shrink the first-run memory profile.** Counted from `deploy.resources.limits.memory` defaults in the unpacked compose file, the caps add up to roughly 19 GB (Postgres 5 GB, API 2.5 GB, worker 2.5 GB, SeaweedFS 2 GB, Meilisearch 1.5 GB, plus a long tail of 256 MB services). Those limits are caps, not reservations, but two settings are real RAM even if a Compose version ignores `deploy.resources`: `shm_size` defaults to 1 GB, and Postgres is started with `shared_buffers=512MB`. The official "4 GB is enough" line is about `rexctl`, which resizes to the machine. Raw compose does not. The first `.env` sets a home profile (Postgres cap 1 GB, shm 256 MB, shared_buffers 128 MB, API and worker caps 768 MB, and smaller caps for gateway, Meilisearch, SeaweedFS, and the media proxy). Later edits to `.env` are kept. This profile is a guess for a home server, not a number Fluxer published. If a container is OOM-killed, raise that one limit.
|
||||||
|
|
||||||
|
8. **Do not build eighteen Unraid XML templates.** One template is one container. This stack is about twenty containers that must share a compose network and start in health-check order. The Docker UI would hide that. Compose is the interface Fluxer documents for Unraid.
|
||||||
|
|
||||||
|
9. **Backup is a script, not rexctl.** `rexctl backup` does not exist without rexctl. The script follows the compose doc: `pg_dump --format=custom`, then stop, then archive the data directories, then start. Because data is bind-mounted, the archive is the appdata tree rather than `docker run` against named volumes. The dump is taken before the stop so a failed dump does not take the stack down. After the stop, an EXIT trap starts it again if the tar fails.
|
||||||
|
|
||||||
|
10. **Username sign-in needs no extra key when email is off.** `FLUXER_ACCOUNT_IDENTITY` is used only on the first start. Empty means: email if delivery is configured, otherwise username. The setup wizard asks again and its answer wins. Leaving the variable empty is deliberate.
|
||||||
|
|
||||||
|
## Ports
|
||||||
|
|
||||||
|
| Port | When | Why |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| 18080/tcp on the host | proxy mode | NPM / SWAG / Traefik → edge container port 8080 |
|
||||||
|
| 80, 443/tcp, 443/udp | direct mode only | Caddy and HTTP/3 |
|
||||||
|
| 7881/tcp, 7882/udp | always, if calls should work | LiveKit media. Not proxied. One UDP port, not a range, so Docker's port publish is enough. |
|
||||||
|
|
||||||
|
Proxy requirements copied from the reverse-proxy page, and turned into `unraid/npm-advanced.conf`: TLS 1.2 and 1.3, WebSockets, 512 MB body, one-hour idle timeout, no extra CSP, forward every path unchanged, `X-Forwarded-For` set from the socket address rather than appended to a client-supplied value. Health check path, if a proxy wants one, is `/_health`.
|
||||||
|
|
||||||
|
`FLUXER_EDGE_TRUSTED_PROXIES` defaults to `private_ranges` in the proxy compose file. That matches a proxy on a private LAN or a Docker bridge. A proxy that connects from a public IP would need that setting changed or every user would share the proxy's rate limit.
|
||||||
|
|
||||||
|
## Secrets that must not change after first start
|
||||||
|
|
||||||
|
From the environment doc and `.env.example`:
|
||||||
|
|
||||||
|
- `POSTGRES_PASSWORD` (Postgres applies it only on an empty data directory)
|
||||||
|
- `MEILI_MASTER_KEY`
|
||||||
|
- `FLUXER_VAPID_PUBLIC_KEY` and `FLUXER_VAPID_PRIVATE_KEY`
|
||||||
|
|
||||||
|
Other secrets can be rotated only with the side effects the environment page describes (kicking admin sessions, invalidating in-flight links, and so on). The safe habit is to treat the whole `.env` as permanent and back it up with the database.
|
||||||
|
|
||||||
|
## Unraid hazards written down so they are not rediscovered
|
||||||
|
|
||||||
|
- **docker.img still fills with images.** Bind mounts move Postgres and SeaweedFS out of the vdisk. They do not move the image layers. Expand the vdisk or use a directory data-root before the first pull.
|
||||||
|
- **Postgres on `/mnt/user` across multiple disks.** Prefer a cache-only appdata path. The script refuses `/boot` because the USB flash drive is not a database disk. It cannot see whether the share is cache-only.
|
||||||
|
- **Existing named volumes ignore the new bind options.** Symptom: `docker volume inspect fluxer_postgres-data` has an empty device, while `/mnt/user/appdata/fluxer/postgres` stays empty and the real data is in the vdisk.
|
||||||
|
- **Meilisearch and Postgres file ownership.** Official images chown their data directory on an empty start when the container starts as root, which is the Unraid default. If a bind is created with odd permissions and a service boot-loops, that is the first place to look. Not reproduced here.
|
||||||
|
- **CGNAT.** No inbound 7881/7882 means no calls unless TURN is added. The web app can still work through a tunnel or a public proxy.
|
||||||
|
- **Cloudflare orange-cloud.** The reverse-proxy page says turn Rocket Loader off, do not cache HTML, turn Bot Fight Mode off for `/api/`, `/gateway`, and `/livekit/`, and use Full (strict). A tunnel still cannot carry voice.
|
||||||
|
- **First start is slow.** The edge waits until the API and gateway are healthy. `docker compose ps` during the pull looks broken. It is not done until those health checks pass.
|
||||||
|
- **Compose path separator is set to `:`.** Unraid is Linux, where that is the default. Writing it down keeps a copied `.env` from being re-read with Windows' semicolon rule. A Windows `docker compose` still needs the variable visible early enough to split `COMPOSE_FILE`; the prepare script's own check runs on the server.
|
||||||
|
- **Upgrade deletes nothing we add, and overwrites everything in the tarball.** `.env` is not in the tarball, so it survives. `docker-compose.unraid.yml` is copied back from this repo after each download. Hand edits to `Caddyfile` inside `stack/` are wiped by `--update`. Put lasting edge changes in a way that survives, or re-apply them after an update. Not automated.
|
||||||
|
|
||||||
|
## Thought sequence
|
||||||
|
|
||||||
|
The first reading of "Fluxer on Unraid" collided with the music-bot repo. The docs URL settled that: this is the chat server, and Fluxer already tells Unraid users to use compose.
|
||||||
|
|
||||||
|
The next trap was following the compose page literally (`127.0.0.1:8080`, named volumes, the `sed` secret loop, `docker compose up -d`). Each of those is right on a single-purpose Linux VM and wrong, or incomplete, on Unraid. The bind file, the port, and the memory profile are the parts that exist only because the host is Unraid.
|
||||||
|
|
||||||
|
rexctl was rejected after reading where it stores the instance and that the compose page lists Unraid by name. XML templates were rejected because the stack is one compose project, not four independent containers like the music bot.
|
||||||
|
|
||||||
|
The bundle was downloaded and read before the override was written, so the volume names and the proxy port merge match this release's files. Those names are stable in the docs (the backup section lists `seaweedfs-data`, `meilisearch-data`, `valkey-data`, `nats-data`). If a future bundle renames a volume, `docker compose config` in the prepare script should fail or the new volume will fall back to the vdisk. Check `docker volume ls` after the first up of a new release.
|
||||||
|
|
||||||
|
## Checked on this workstation
|
||||||
|
|
||||||
|
2026-11-23, after the scripts were written:
|
||||||
|
|
||||||
|
- `scripts/prepare-unraid.sh chat.example.com` was run with the stack and data paths pointed at a temp directory. It downloaded the live bundle, wrote one assignment per setting, generated a 64-character hex setup token and database password, an 87-character VAPID public key, a 43-character VAPID private key, and left `FLUXER_S3_ACCESS_KEY` and `LIVEKIT_API_KEY` at `fluxer`. A second run did not change `.env`. A hand-added compose file on `COMPOSE_FILE` survived a later run that did not pass `--proxy` or `--direct`. `--direct` wrote `docker-compose.yml:docker-compose.unraid.yml` and did not publish an edge bind.
|
||||||
|
- Docker Compose 5.1.4 rendered that stack. The edge publishes `18080 -> 8080` and does not publish 80 or 443. LiveKit publishes 7881 and 7882. The bundle maps 7882 as UDP; the render confirmed the host and container port numbers. All eight data volumes are binds under the appdata path. The containers were not started, and this was not the Unraid machine. Compose on Windows only split `COMPOSE_FILE` after `COMPOSE_PATH_SEPARATOR=:` was set in the environment; Unraid's default separator is already `:`.
|
||||||
|
|
||||||
|
## Not done, on purpose
|
||||||
|
|
||||||
|
- The stack was not started, here or on Unraid. Rendering the compose file is not the same as a healthy API.
|
||||||
|
- No domain, LAN IP, proxy brand, RAM size, or CGNAT fact was supplied. The script takes the domain as an argument. Proxy mode is the default. Nothing was invented for DNS.
|
||||||
|
- Email, Stripe, ClamAV, Cloudflare cache purge, extra voice regions, and an external S3 bucket are in the environment page and were left at the bundle defaults (off or empty).
|
||||||
|
- `rust-server.compose.yml` collapses the Rust services into one container and might use less RAM. It was not turned on. Combining it with the Unraid volume file needs a `docker compose config` against that exact release before it is the default.
|
||||||
|
- No Community Apps template, no `rexctl` install, no copy of Fluxer's images into a private registry.
|
||||||
|
|
||||||
|
## How to extend this without making a mess
|
||||||
|
|
||||||
|
- A new durable setting belongs in the "create `.env`" branch of `scripts/prepare-unraid.sh`, not in a second env file. Compose reads `stack/.env`.
|
||||||
|
- A new volume in an upstream bundle needs a bind in `unraid/docker-compose.unraid.yml` and a `mkdir` in the prepare script, or its data goes into `docker.img`.
|
||||||
|
- Do not commit `stack/.env`, `stack/`, or `backups/`. They hold the database keys and the admin setup token.
|
||||||
|
- If the install is later handed to `rexctl`, point `rexctl takeover` at `stack/` and keep the same project name.
|
||||||
|
|
||||||
|
## Publishing
|
||||||
|
|
||||||
|
Target remote: `https://git.masengr.com/Michael-A-Sloan/Fluxer-selfhost-unraid` public.
|
||||||
|
|
||||||
|
On 2026-11-23, before the first push, `https://git.masengr.com/` returned HTTP 502 for the site, `/api/v1/version`, and `git ls-remote` of the existing Neon Sign Converter repo. A 502 is the host being down, not a missing repository. Push again once that URL returns something other than 502.
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Dump Postgres and tar the bind-mounted data. Fluxer is stopped while the
|
||||||
|
# files are copied, then started again. The backup contains stack/.env.
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||||
|
STACK="${FLUXER_STACK:-$ROOT/stack}"
|
||||||
|
APPDATA="${FLUXER_APPDATA:-/mnt/user/appdata/fluxer}"
|
||||||
|
|
||||||
|
if [[ -f "$STACK/.env" ]]; then
|
||||||
|
from_env="$(awk -F= '$1=="FLUXER_APPDATA" { print substr($0, index($0, "=") + 1); exit }' "$STACK/.env")"
|
||||||
|
if [[ -n "$from_env" ]]; then
|
||||||
|
APPDATA="$from_env"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -f "$STACK/docker-compose.yml" ]]; then
|
||||||
|
echo "No stack at $STACK. Run scripts/prepare-unraid.sh first." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
STAMP="$(date +%Y%m%d-%H%M%S)"
|
||||||
|
DEST="${1:-$ROOT/backups/$STAMP}"
|
||||||
|
mkdir -p "$DEST"
|
||||||
|
|
||||||
|
started=0
|
||||||
|
bring_back() {
|
||||||
|
if [[ "$started" -eq 1 ]]; then
|
||||||
|
docker compose --project-directory "$STACK" up -d || true
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
trap bring_back EXIT
|
||||||
|
|
||||||
|
echo "Writing database dump to $DEST/fluxer.dump"
|
||||||
|
docker compose --project-directory "$STACK" exec -T postgres \
|
||||||
|
sh -c 'pg_dump -U "$POSTGRES_USER" -d "$POSTGRES_DB" --format=custom' \
|
||||||
|
> "$DEST/fluxer.dump"
|
||||||
|
|
||||||
|
echo "Stopping Fluxer to copy data files"
|
||||||
|
docker compose --project-directory "$STACK" stop
|
||||||
|
started=1
|
||||||
|
|
||||||
|
tar -C "$APPDATA" -czf "$DEST/appdata.tar.gz" \
|
||||||
|
edge-data edge-config postgres valkey nats meilisearch seaweedfs media-proxy-tmp
|
||||||
|
|
||||||
|
cp "$STACK/.env" "$DEST/env"
|
||||||
|
chmod 600 "$DEST/env"
|
||||||
|
|
||||||
|
echo "Starting Fluxer again"
|
||||||
|
docker compose --project-directory "$STACK" up -d
|
||||||
|
started=0
|
||||||
|
|
||||||
|
echo "Backup is in $DEST"
|
||||||
|
echo "Copy that folder off this server. It contains the database, uploads, and secrets."
|
||||||
@@ -0,0 +1,346 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Prepare a Fluxer compose stack on Unraid.
|
||||||
|
# Downloads the official bundle, generates .env once, and bind-mounts data
|
||||||
|
# outside docker.img. Does not start Fluxer unless you pass --up.
|
||||||
|
#
|
||||||
|
# Usage (on the Unraid server, from a clone of this repo):
|
||||||
|
# sh scripts/prepare-unraid.sh chat.example.com
|
||||||
|
# sh scripts/prepare-unraid.sh chat.example.com --up
|
||||||
|
# sh scripts/prepare-unraid.sh chat.example.com --direct
|
||||||
|
# sh scripts/prepare-unraid.sh chat.example.com --update
|
||||||
|
#
|
||||||
|
# --proxy (default) plain HTTP on 0.0.0.0:18080 for Nginx Proxy Manager,
|
||||||
|
# SWAG, or Traefik. Use this when 80/443 are already taken.
|
||||||
|
# --direct Fluxer's own Caddy binds 80, 443/tcp, and 443/udp and gets a
|
||||||
|
# certificate. Only if those ports are free and the domain points here.
|
||||||
|
# --update re-download https://fluxer.dev/compose/latest over the stack files.
|
||||||
|
# Keeps .env and the data directories.
|
||||||
|
# --up run `docker compose up -d` after a successful prepare.
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||||
|
STACK="${FLUXER_STACK:-$ROOT/stack}"
|
||||||
|
APPDATA="${FLUXER_APPDATA:-/mnt/user/appdata/fluxer}"
|
||||||
|
BUNDLE_URL="${FLUXER_BUNDLE_URL:-https://fluxer.dev/compose/latest}"
|
||||||
|
|
||||||
|
DOMAIN=""
|
||||||
|
MODE="proxy"
|
||||||
|
EXPLICIT_MODE=0
|
||||||
|
DO_UPDATE=0
|
||||||
|
DO_UP=0
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo "Usage: sh scripts/prepare-unraid.sh <domain> [--proxy|--direct] [--update] [--up]" >&2
|
||||||
|
echo "Example: sh scripts/prepare-unraid.sh chat.example.com" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
for arg in "$@"; do
|
||||||
|
case "$arg" in
|
||||||
|
--proxy) MODE="proxy"; EXPLICIT_MODE=1 ;;
|
||||||
|
--direct) MODE="direct"; EXPLICIT_MODE=1 ;;
|
||||||
|
--update) DO_UPDATE=1 ;;
|
||||||
|
--up) DO_UP=1 ;;
|
||||||
|
-h|--help) usage ;;
|
||||||
|
--*) echo "Unknown option: $arg" >&2; usage ;;
|
||||||
|
*)
|
||||||
|
if [[ -n "$DOMAIN" ]]; then
|
||||||
|
echo "Only one domain is accepted." >&2
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
DOMAIN="$arg"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -z "$DOMAIN" ]]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
DOMAIN="${DOMAIN#https://}"
|
||||||
|
DOMAIN="${DOMAIN#http://}"
|
||||||
|
DOMAIN="${DOMAIN%%/*}"
|
||||||
|
DOMAIN="${DOMAIN%%:*}"
|
||||||
|
|
||||||
|
if [[ ! "$DOMAIN" =~ ^[A-Za-z0-9]([A-Za-z0-9.-]*[A-Za-z0-9])?$ ]]; then
|
||||||
|
echo "Domain must be a hostname such as chat.example.com, with no scheme or path." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$APPDATA" in
|
||||||
|
/boot|/boot/*)
|
||||||
|
echo "Refusing to store Fluxer data on the Unraid USB flash drive ($APPDATA)." >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
case "$STACK" in
|
||||||
|
/boot|/boot/*)
|
||||||
|
echo "Refusing to unpack the compose bundle onto the Unraid USB ($STACK)." >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [[ "${FLUXER_ALLOW_ANY_PATH:-0}" != "1" ]]; then
|
||||||
|
if [[ ! -d /mnt/user ]]; then
|
||||||
|
echo "This script is meant to run on Unraid (/mnt/user is missing)." >&2
|
||||||
|
echo "Set FLUXER_ALLOW_ANY_PATH=1 only for a local dry run." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${FLUXER_SKIP_DOCKER_CHECK:-0}" != "1" ]]; then
|
||||||
|
if ! command -v docker >/dev/null 2>&1 || ! docker compose version >/dev/null 2>&1; then
|
||||||
|
echo "Docker Compose is not available." >&2
|
||||||
|
echo "Install Unraid's Compose Manager plugin, then run this again." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
COMPOSE_VERSION="$(docker compose version --short | tr -d 'v')"
|
||||||
|
OLDEST="$(printf '%s\n%s\n' "2.24.0" "$COMPOSE_VERSION" | sort -V | head -n 1)"
|
||||||
|
if [[ "$OLDEST" != "2.24.0" ]]; then
|
||||||
|
echo "Docker Compose $COMPOSE_VERSION is too old." >&2
|
||||||
|
echo "Fluxer's proxy file uses compose tags that need 2.24 or newer." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
need_cmd() {
|
||||||
|
if ! command -v "$1" >/dev/null 2>&1; then
|
||||||
|
echo "Missing command: $1" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
need_cmd curl
|
||||||
|
need_cmd tar
|
||||||
|
need_cmd openssl
|
||||||
|
need_cmd awk
|
||||||
|
|
||||||
|
mkdir -p "$STACK" "$APPDATA"
|
||||||
|
|
||||||
|
for dir in edge-data edge-config postgres valkey nats meilisearch seaweedfs media-proxy-tmp; do
|
||||||
|
mkdir -p "$APPDATA/$dir"
|
||||||
|
done
|
||||||
|
|
||||||
|
download_bundle() {
|
||||||
|
local tmp archive
|
||||||
|
tmp="$(mktemp -d)"
|
||||||
|
archive="$tmp/fluxer-compose.tar.gz"
|
||||||
|
echo "Downloading official compose bundle from $BUNDLE_URL"
|
||||||
|
curl -fsSL "$BUNDLE_URL" -o "$archive"
|
||||||
|
tar -xzf "$archive" -C "$STACK"
|
||||||
|
rm -rf "$tmp"
|
||||||
|
date -u +"%Y-%m-%dT%H:%M:%SZ" > "$STACK/.bundle-fetched"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ ! -f "$STACK/docker-compose.yml" || "$DO_UPDATE" -eq 1 ]]; then
|
||||||
|
download_bundle
|
||||||
|
else
|
||||||
|
echo "Keeping existing bundle in $STACK (pass --update to replace it)."
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -f "$STACK/docker-compose.yml" || ! -f "$STACK/.env.example" ]]; then
|
||||||
|
echo "The bundle did not contain docker-compose.yml and .env.example." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cp "$ROOT/unraid/docker-compose.unraid.yml" "$STACK/docker-compose.unraid.yml"
|
||||||
|
|
||||||
|
# Set or replace one KEY=value line. Matches a commented "# KEY=" form too.
|
||||||
|
set_env() {
|
||||||
|
local key="$1"
|
||||||
|
local value="$2"
|
||||||
|
local file="$3"
|
||||||
|
local tmp
|
||||||
|
tmp="$(mktemp)"
|
||||||
|
# Only a real assignment line: "KEY=" or the bundle's "# KEY=" slot.
|
||||||
|
# A looser match also rewrites comment examples such as
|
||||||
|
# "# COMPOSE_FILE=docker-compose.yml:...".
|
||||||
|
awk -v k="$key" -v v="$value" '
|
||||||
|
BEGIN { found = 0 }
|
||||||
|
$0 ~ ("^" k "=") || $0 ~ ("^# " k "=") {
|
||||||
|
if (found == 0) {
|
||||||
|
print k "=" v
|
||||||
|
found = 1
|
||||||
|
}
|
||||||
|
next
|
||||||
|
}
|
||||||
|
{ print }
|
||||||
|
END {
|
||||||
|
if (found == 0) print k "=" v
|
||||||
|
}
|
||||||
|
' "$file" > "$tmp"
|
||||||
|
mv "$tmp" "$file"
|
||||||
|
}
|
||||||
|
|
||||||
|
env_value() {
|
||||||
|
local key="$1"
|
||||||
|
local file="$2"
|
||||||
|
awk -F= -v k="$key" '$1 == k { print substr($0, index($0, "=") + 1); exit }' "$file"
|
||||||
|
}
|
||||||
|
|
||||||
|
fill_if_empty() {
|
||||||
|
local key="$1"
|
||||||
|
local value="$2"
|
||||||
|
local file="$3"
|
||||||
|
local current
|
||||||
|
current="$(env_value "$key" "$file")"
|
||||||
|
if [[ -z "$current" ]]; then
|
||||||
|
set_env "$key" "$value" "$file"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
hex32() {
|
||||||
|
openssl rand -hex 32
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ ! -f "$STACK/.env" ]]; then
|
||||||
|
echo "Creating $STACK/.env and generating secrets."
|
||||||
|
cp "$STACK/.env.example" "$STACK/.env"
|
||||||
|
chmod 600 "$STACK/.env"
|
||||||
|
NEW_ENV=1
|
||||||
|
|
||||||
|
for key in \
|
||||||
|
POSTGRES_PASSWORD \
|
||||||
|
MEILI_MASTER_KEY \
|
||||||
|
FLUXER_S3_SECRET_KEY \
|
||||||
|
LIVEKIT_API_SECRET \
|
||||||
|
FLUXER_SUDO_MODE_SECRET \
|
||||||
|
FLUXER_CONNECTION_INITIATION_SECRET \
|
||||||
|
FLUXER_PROFILE_PSEUDONYM_SECRET \
|
||||||
|
FLUXER_GATEWAY_RPC_AUTH_TOKEN \
|
||||||
|
FLUXER_ERLANG_COOKIE \
|
||||||
|
FLUXER_MEDIA_PROXY_SECRET_KEY \
|
||||||
|
FLUXER_ADMIN_SECRET_KEY_BASE \
|
||||||
|
FLUXER_ADMIN_OAUTH_CLIENT_SECRET \
|
||||||
|
FLUXER_SETUP_TOKEN
|
||||||
|
do
|
||||||
|
fill_if_empty "$key" "$(hex32)" "$STACK/.env"
|
||||||
|
done
|
||||||
|
|
||||||
|
fill_if_empty "FLUXER_MEDIA_PROXY_UPLOAD_RELAY_SECRET_BASE64" \
|
||||||
|
"$(openssl rand -base64 32 | tr -d '\n')" "$STACK/.env"
|
||||||
|
|
||||||
|
fill_if_empty "FLUXER_ACTIVITYPUB_SIGNING_KEY_BASE64" \
|
||||||
|
"$(openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -outform DER 2>/dev/null | base64 | tr -d '\n')" \
|
||||||
|
"$STACK/.env"
|
||||||
|
|
||||||
|
if [[ -z "$(env_value FLUXER_VAPID_PUBLIC_KEY "$STACK/.env")" || -z "$(env_value FLUXER_VAPID_PRIVATE_KEY "$STACK/.env")" ]]; then
|
||||||
|
vapid="$STACK/vapid.pem"
|
||||||
|
openssl ecparam -name prime256v1 -genkey -noout -out "$vapid" 2>/dev/null
|
||||||
|
pub="$(openssl ec -in "$vapid" -pubout -outform DER 2>/dev/null | tail -c 65 | base64 | tr '/+' '_-' | tr -d '=\n')"
|
||||||
|
priv="$(openssl ec -in "$vapid" -outform DER 2>/dev/null | tail -c +8 | head -c 32 | base64 | tr '/+' '_-' | tr -d '=\n')"
|
||||||
|
rm -f "$vapid"
|
||||||
|
set_env "FLUXER_VAPID_PUBLIC_KEY" "$pub" "$STACK/.env"
|
||||||
|
set_env "FLUXER_VAPID_PRIVATE_KEY" "$priv" "$STACK/.env"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Home-server sizes. The bundle's defaults cap Postgres at 5 GB and reserve
|
||||||
|
# 3 GB, which is rexctl's large-machine tune, not a quiet Unraid box.
|
||||||
|
# Applied only while creating .env, so later edits are kept.
|
||||||
|
set_env "FLUXER_POSTGRES_MEMORY_LIMIT" "1gb" "$STACK/.env"
|
||||||
|
set_env "FLUXER_POSTGRES_MEMORY_RESERVATION" "256mb" "$STACK/.env"
|
||||||
|
set_env "FLUXER_POSTGRES_SHM_SIZE" "256mb" "$STACK/.env"
|
||||||
|
set_env "FLUXER_POSTGRES_SHARED_BUFFERS" "128MB" "$STACK/.env"
|
||||||
|
set_env "FLUXER_POSTGRES_EFFECTIVE_CACHE_SIZE" "512MB" "$STACK/.env"
|
||||||
|
set_env "FLUXER_POSTGRES_MAINTENANCE_WORK_MEM" "64MB" "$STACK/.env"
|
||||||
|
set_env "FLUXER_POSTGRES_MAX_WAL_SIZE" "512MB" "$STACK/.env"
|
||||||
|
set_env "FLUXER_API_MEMORY_LIMIT" "768mb" "$STACK/.env"
|
||||||
|
set_env "FLUXER_API_MEMORY_RESERVATION" "256mb" "$STACK/.env"
|
||||||
|
set_env "FLUXER_WORKER_MEMORY_LIMIT" "768mb" "$STACK/.env"
|
||||||
|
set_env "FLUXER_WORKER_MEMORY_RESERVATION" "256mb" "$STACK/.env"
|
||||||
|
set_env "FLUXER_GATEWAY_MEMORY_LIMIT" "512mb" "$STACK/.env"
|
||||||
|
set_env "FLUXER_GATEWAY_MEMORY_RESERVATION" "256mb" "$STACK/.env"
|
||||||
|
set_env "FLUXER_MEILISEARCH_MEMORY_LIMIT" "512mb" "$STACK/.env"
|
||||||
|
set_env "FLUXER_MEILISEARCH_MAX_INDEXING_MEMORY" "128mb" "$STACK/.env"
|
||||||
|
set_env "FLUXER_SEAWEEDFS_MEMORY_LIMIT" "512mb" "$STACK/.env"
|
||||||
|
set_env "FLUXER_SEAWEEDFS_GOMEMLIMIT" "384MiB" "$STACK/.env"
|
||||||
|
set_env "FLUXER_MEDIA_PROXY_MEMORY_LIMIT" "512mb" "$STACK/.env"
|
||||||
|
else
|
||||||
|
echo "Keeping existing secrets in $STACK/.env"
|
||||||
|
chmod 600 "$STACK/.env"
|
||||||
|
NEW_ENV=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
set_env "FLUXER_SETTINGS_LOADED" "true" "$STACK/.env"
|
||||||
|
set_env "FLUXER_DOMAIN" "$DOMAIN" "$STACK/.env"
|
||||||
|
set_env "COMPOSE_PROJECT_NAME" "fluxer" "$STACK/.env"
|
||||||
|
set_env "COMPOSE_PATH_SEPARATOR" ":" "$STACK/.env"
|
||||||
|
set_env "FLUXER_APPDATA" "$APPDATA" "$STACK/.env"
|
||||||
|
|
||||||
|
# Mode is applied when .env is new, or when this run was given --proxy/--direct.
|
||||||
|
# A plain --update leaves a hand-edited COMPOSE_FILE alone.
|
||||||
|
if [[ "$NEW_ENV" -eq 1 || "$EXPLICIT_MODE" -eq 1 ]]; then
|
||||||
|
if [[ "$MODE" == "proxy" ]]; then
|
||||||
|
set_env "COMPOSE_FILE" "docker-compose.yml:docker-compose.proxy.yml:docker-compose.unraid.yml" "$STACK/.env"
|
||||||
|
set_env "FLUXER_EDGE_BIND" "0.0.0.0:18080" "$STACK/.env"
|
||||||
|
else
|
||||||
|
set_env "COMPOSE_FILE" "docker-compose.yml:docker-compose.unraid.yml" "$STACK/.env"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -d "$APPDATA/postgres" ]] && [[ -n "$(ls -A "$APPDATA/postgres" 2>/dev/null || true)" ]]; then
|
||||||
|
echo "Postgres data already exists. Changing FLUXER_DOMAIN does not move old links."
|
||||||
|
echo "Do not change POSTGRES_PASSWORD, MEILI_MASTER_KEY, or the VAPID keys."
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${FLUXER_SKIP_DOCKER_CHECK:-0}" != "1" ]]; then
|
||||||
|
echo "Checking compose file against Docker Compose $COMPOSE_VERSION"
|
||||||
|
config_out="$(mktemp)"
|
||||||
|
if ! docker compose --project-directory "$STACK" config >"$config_out"; then
|
||||||
|
rm -f "$config_out"
|
||||||
|
echo "docker compose config failed. Fix the error above before starting." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
rm -f "$config_out"
|
||||||
|
|
||||||
|
if docker volume inspect fluxer_postgres-data >/dev/null 2>&1; then
|
||||||
|
mountpoint="$(docker volume inspect -f '{{ .Options.device }}' fluxer_postgres-data 2>/dev/null || true)"
|
||||||
|
echo "Docker volume fluxer_postgres-data already exists (device: ${mountpoint:-not a bind})."
|
||||||
|
echo "If that volume was created without this Unraid file, Postgres will ignore $APPDATA/postgres."
|
||||||
|
echo "On a brand new install, remove the empty fluxer_* volumes before the first up."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
compose_file="$(env_value COMPOSE_FILE "$STACK/.env")"
|
||||||
|
case "$compose_file" in
|
||||||
|
*docker-compose.proxy.yml*) SHOW_MODE="proxy" ;;
|
||||||
|
*) SHOW_MODE="direct" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Prepared Fluxer for $DOMAIN"
|
||||||
|
echo " Stack: $STACK"
|
||||||
|
echo " Data: $APPDATA"
|
||||||
|
echo " Mode: $SHOW_MODE"
|
||||||
|
if [[ "$SHOW_MODE" == "proxy" ]]; then
|
||||||
|
echo " Edge: http://<unraid-lan-ip>:18080"
|
||||||
|
echo "Point the reverse proxy at that address. See README.md and unraid/npm-advanced.conf."
|
||||||
|
echo "Still forward TCP 7881 and UDP 7882 to this server for voice and video."
|
||||||
|
else
|
||||||
|
echo " Edge: ports 80, 443/tcp, and 443/udp must reach this server."
|
||||||
|
echo "Also forward TCP 7881 and UDP 7882 for voice and video."
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
echo "The admin setup token is FLUXER_SETUP_TOKEN in:"
|
||||||
|
echo " $STACK/.env"
|
||||||
|
echo "Show it with:"
|
||||||
|
echo " awk -F= '\$1==\"FLUXER_SETUP_TOKEN\"{print \$2}' \"$STACK/.env\""
|
||||||
|
echo
|
||||||
|
echo "Back up that .env somewhere off the server before you start."
|
||||||
|
echo "Postgres, Meilisearch, and the VAPID keys cannot be changed after the first start."
|
||||||
|
|
||||||
|
if [[ "$DO_UP" -eq 1 ]]; then
|
||||||
|
echo
|
||||||
|
echo "Starting Fluxer. The first pull is large."
|
||||||
|
docker compose --project-directory "$STACK" up -d
|
||||||
|
echo
|
||||||
|
echo "Watch startup with:"
|
||||||
|
echo " docker compose --project-directory \"$STACK\" ps"
|
||||||
|
echo " docker compose --project-directory \"$STACK\" logs -f api"
|
||||||
|
else
|
||||||
|
echo
|
||||||
|
echo "Start it when DNS and the proxy or port forwards are in place:"
|
||||||
|
echo " docker compose --project-directory \"$STACK\" up -d"
|
||||||
|
fi
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Re-download the official Fluxer compose bundle and recreate containers.
|
||||||
|
# Keeps stack/.env and the data directories. Make a backup first.
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||||
|
STACK="${FLUXER_STACK:-$ROOT/stack}"
|
||||||
|
|
||||||
|
if [[ ! -f "$STACK/.env" ]]; then
|
||||||
|
echo "No $STACK/.env yet. Run scripts/prepare-unraid.sh first." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
DOMAIN="$(awk -F= '$1=="FLUXER_DOMAIN" { print substr($0, index($0, "=") + 1); exit }' "$STACK/.env")"
|
||||||
|
if [[ -z "$DOMAIN" ]]; then
|
||||||
|
echo "FLUXER_DOMAIN is empty in $STACK/.env" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Updating the bundle for $DOMAIN. Existing .env choices are left in place."
|
||||||
|
echo "Stop here and run scripts/backup-unraid.sh first if you have not backed up."
|
||||||
|
exec sh "$ROOT/scripts/prepare-unraid.sh" "$DOMAIN" --update "$@"
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
# Unraid bind mounts for the official Fluxer compose bundle.
|
||||||
|
#
|
||||||
|
# Loaded only when COMPOSE_FILE lists this file after docker-compose.yml.
|
||||||
|
# Named volumes otherwise land inside Unraid's docker.img and will fill it
|
||||||
|
# once people upload files. These binds keep that data on the array or cache.
|
||||||
|
#
|
||||||
|
# FLUXER_APPDATA must already exist, one directory per volume, before the
|
||||||
|
# first `docker compose up`. scripts/prepare-unraid.sh creates them.
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
edge-data:
|
||||||
|
driver: local
|
||||||
|
driver_opts:
|
||||||
|
type: none
|
||||||
|
o: bind
|
||||||
|
device: ${FLUXER_APPDATA:?Set FLUXER_APPDATA in .env}/edge-data
|
||||||
|
edge-config:
|
||||||
|
driver: local
|
||||||
|
driver_opts:
|
||||||
|
type: none
|
||||||
|
o: bind
|
||||||
|
device: ${FLUXER_APPDATA}/edge-config
|
||||||
|
postgres-data:
|
||||||
|
driver: local
|
||||||
|
driver_opts:
|
||||||
|
type: none
|
||||||
|
o: bind
|
||||||
|
device: ${FLUXER_APPDATA}/postgres
|
||||||
|
valkey-data:
|
||||||
|
driver: local
|
||||||
|
driver_opts:
|
||||||
|
type: none
|
||||||
|
o: bind
|
||||||
|
device: ${FLUXER_APPDATA}/valkey
|
||||||
|
nats-data:
|
||||||
|
driver: local
|
||||||
|
driver_opts:
|
||||||
|
type: none
|
||||||
|
o: bind
|
||||||
|
device: ${FLUXER_APPDATA}/nats
|
||||||
|
meilisearch-data:
|
||||||
|
driver: local
|
||||||
|
driver_opts:
|
||||||
|
type: none
|
||||||
|
o: bind
|
||||||
|
device: ${FLUXER_APPDATA}/meilisearch
|
||||||
|
seaweedfs-data:
|
||||||
|
driver: local
|
||||||
|
driver_opts:
|
||||||
|
type: none
|
||||||
|
o: bind
|
||||||
|
device: ${FLUXER_APPDATA}/seaweedfs
|
||||||
|
media-proxy-tmp:
|
||||||
|
driver: local
|
||||||
|
driver_opts:
|
||||||
|
type: none
|
||||||
|
o: bind
|
||||||
|
device: ${FLUXER_APPDATA}/media-proxy-tmp
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# Paste into Nginx Proxy Manager → Proxy Host → Advanced.
|
||||||
|
# The proxy host itself must be:
|
||||||
|
# Scheme: http
|
||||||
|
# Forward hostname: the Unraid server's LAN IP (not 127.0.0.1)
|
||||||
|
# Forward port: 18080
|
||||||
|
# Websockets support: on
|
||||||
|
# Block common exploits: off
|
||||||
|
# Do not add a Content-Security-Policy header. Fluxer sends its own.
|
||||||
|
#
|
||||||
|
# X-Forwarded-For is replaced with the address NPM actually saw. Keeping a
|
||||||
|
# visitor-supplied value lets people share one rate limit or dodge a ban.
|
||||||
|
|
||||||
|
client_max_body_size 512m;
|
||||||
|
proxy_read_timeout 3600s;
|
||||||
|
proxy_send_timeout 3600s;
|
||||||
|
proxy_request_buffering off;
|
||||||
|
proxy_buffering off;
|
||||||
|
proxy_set_header X-Forwarded-For $remote_addr;
|
||||||
Reference in new issue
Block a user