Перейти к содержимому

Changing settings

Settings control how Squad runs, like its domain, email server and storage. Most of the rest, such as its name, sign-up rules and limits, are in the admin panel.

Every Squad setting is spelled the same on every way of running it, like FLUXER_DOMAIN.

How you run SquadWhere settings go
Docker without rexctlfluxer.env
systemd without rexctl/etc/fluxer/fluxer.env
KubernetesUnder config in the Helm chart
rexctl, on Docker, Podman or systemdrexctl config set

Edit fluxer.env, then apply it.

Окно терминала
docker compose up -d

Compose recreates the container with the new settings, which restarts Squad. With docker run, run docker stop fluxer && docker rm fluxer, then the same docker run line again. The volume keeps your data.

To check a settings file without starting anything, run fluxerd check-config, for example docker compose exec fluxer fluxerd check-config with the compose file or docker exec fluxer fluxerd check-config with docker run.

Every setting also takes its value from a file. Add _FILE to the setting’s name, set it to the path of a file with the value, and leave the plain name unset. This keeps passwords out of fluxer.env and works with Docker and Kubernetes secrets.

fluxer.env
FLUXER_EMAIL_SMTP_PASSWORD_FILE=/run/secrets/smtp-password

With the compose file, add the file as a Compose secret, which Docker puts at /run/secrets/smtp-password in the container.

compose.yaml
services:
fluxer:
secrets: [smtp-password]
secrets:
smtp-password:
file: ./smtp-password.txt

With docker run, add -v ./smtp-password.txt:/run/secrets/smtp-password:ro to the line, which mounts the file at the same path.

The file has to be readable by the account Squad runs as, which is user ID 65532 in the container. Docker keeps the file’s owner and mode, so give that account the file.

Окно терминала
sudo chown 65532 smtp-password.txt && sudo chmod 400 smtp-password.txt

Compose treats $ in fluxer.env as the start of a variable. Keep any password that has a $ in it in a file like this one, never in fluxer.env itself.

With a MaxMind GeoLite2 or GeoIP2 City or Country database, Squad can look up which country an IP address is in. With rexctl, pass the .mmdb file.

Окно терминала
rexctl config set geoip.database=/root/GeoLite2-City.mmdb

rexctl checks that the file is a MaxMind database, copies it into the geoip folder of the instance and sets FLUXER_GEOIP_DB_PATH for the api and worker. The copy is in every backup and stays through upgrades. For a newer database, run the same command with the new file. rexctl copies the file only when it changed, and removes the copy it no longer uses.

To stop using a GeoIP database, run rexctl config unset geoip.database. That also clears a FLUXER_GEOIP_DB_PATH you set by hand.

On the older layout with Docker Compose, rexctl doesn’t copy the file. Mount its folder into the api and worker with rexctl config edit --compose, then set geoip.database to the path inside the containers.

Without rexctl, put the file where Squad can read it and set FLUXER_GEOIP_DB_PATH to its path.

Squad keeps its database, uploads and search index in one data folder. To keep them on a second disk, a RAID or a ZFS dataset, give Squad a folder there. Use a local disk with a Linux file system like ext4, XFS, Btrfs or ZFS. On NTFS, a FUSE file system like mergerfs, or a network share over NFS or SMB, PostgreSQL can lose data or fail to lock its files, and rexctl refuses a folder there. If you accept that risk, pass --force with the folder, and rexctl doctor then warns about it instead of failing. rexctl always refuses a RAM disk, FAT and exFAT.

A dataset or subvolume root can have a snapshot folder, such as .zfs with ZFS snapdir=visible, .snapshots from Snapper, #snapshot on Synology or .snapshot on a NetApp share. rexctl and Squad leave these folders alone when they check, copy, back up, restore or delete the data. A folder with only a snapshot folder in it counts as empty.

Add the disk to /etc/fstab, which mounts it before Docker, Podman or Squad starts when the machine boots.

To keep only the uploads somewhere else, put them in an S3-compatible store with the file storage settings instead. The database and search index then stay on this machine. For an instance that already has uploads, see Move uploads to S3 and back.

Create the folder and give it to the user Squad runs as, which is user ID 65532 in the container.

Окно терминала
sudo mkdir -p /mnt/disk/fluxer && sudo chown 65532:65532 /mnt/disk/fluxer && sudo chmod 700 /mnt/disk/fluxer

In compose.yaml, mount the folder in place of the volume, and remove fluxer-data from the volumes list at the end of the file. On a machine with SELinux, such as Fedora or RHEL, add :z to the end of the line.

compose.yaml
services:
fluxer:
volumes:
- /mnt/disk/fluxer:/var/lib/fluxer

With docker run, pass -v /mnt/disk/fluxer:/var/lib/fluxer in place of -v fluxer-data:/var/lib/fluxer. For an instance that already runs, make a backup first, change the mount, then restore the backup into the empty folder.

On one container that rexctl runs, rexctl migrate moves the uploads an instance already has from plain files in its data folder to an S3-compatible store, such as MinIO, SeaweedFS, Garage, Backblaze B2 or Amazon S3, and back again. Under systemd, rexctl can’t make this move yet.

Create the buckets in the store first and leave them empty. Squad uses four of them, for processed media, raw uploads, abuse report evidence and data exports. They are fluxer, fluxer-uploads, fluxer-reports and fluxer-harvests, or the buckets you set with --set. On Amazon S3, no two accounts can have a bucket with the same name, and there you usually need your own. Then run the move with the address and keys of the store. With - as the value, rexctl asks for the secret key on a terminal or takes it from stdin, which keeps it out of your shell history.

Окно терминала
rexctl migrate --migrate s3 --dry-run \
--set storage.endpoint=https://s3.eu-central-1.amazonaws.com \
--set storage.region=eu-central-1 \
--set storage.path_style=false \
--set storage.access_key=AKIAIOSFODNN7EXAMPLE \
--set storage.secret_key=- \
--set FLUXER_S3_BUCKET_CDN=example-fluxer \
--set FLUXER_S3_BUCKET_UPLOADS=example-fluxer-uploads \
--set FLUXER_S3_BUCKET_REPORTS=example-fluxer-reports \
--set FLUXER_S3_BUCKET_HARVESTS=example-fluxer-harvests

--set takes storage.endpoint, storage.public_endpoint, storage.region, storage.path_style, storage.access_key, storage.secret_key and the four FLUXER_S3_BUCKET_* settings. The dry run signs in to the store, checks that each bucket exists, is empty and takes a test write, counts the files and shows the plan. Some stores refuse a key with a part longer than 255 bytes, such as SeaweedFS unless max_file_name_length in its filer.toml is higher. When some of your files have such a name, the dry run tests that too. Without --dry-run, rexctl then does this:

  1. Backs up your instance.
  2. Stops the api, worker, media proxy and gateway while the files move.
  3. Copies every file to its bucket with its full key and content type.
  4. Checks that the store has every file with the same size, and compares the SHA-256 checksums of a sample that includes every file with a long name.
  5. Switches Squad to the store and starts it.
  6. Loads a sample of attachments through the media proxy, with signed links when signed attachments are on.

If a step fails, rexctl deletes what it copied, switches Squad back to the plain files and starts it again. When Squad had already started on the store, rexctl first copies the files people uploaded since then back into the folder.

The plain files stay in the data folder after the move. rexctl migrate --undo s3 copies the files people uploaded after the move into the folder, switches Squad back to the plain files and deletes the objects in the buckets. Once uploads look right, rexctl migrate --clean-up deletes the plain files. Backups of an instance on S3 leave out the uploads, and the store needs a backup of its own.

To move the uploads from the store to plain files, run rexctl migrate --migrate files. rexctl checks that the data folder is empty and has room for the files, copies them into the folder in the layout Squad writes and checks them the same way. rexctl migrate --undo files copies the files people uploaded after the move into the buckets and switches Squad back to the store. rexctl migrate --clean-up finishes the move and forgets the keys of the store. rexctl never deletes objects in your own store after this move. Delete the buckets yourself once you no longer need them.

Don’t copy the objects folder to the buckets by hand, or the buckets to the folder, with tools such as aws s3 sync, rclone or mc mirror. In the folder, Squad shortens file names longer than 255 bytes and keeps the full key and the content type of a file in the .meta folder. A copy by hand gives those files the wrong keys and many files the wrong content type. Squad then can’t find them, or serves them as the wrong kind of file.

Squad’s container can join a Docker or Podman network you already made, such as a macvlan or ipvlan network that gives it its own address on your LAN, or a bridge network that your reverse proxy is on.

On a macvlan or ipvlan network, Docker doesn’t publish ports. Squad then listens on its own address on that network: ports 80 and 443 for HTTP and HTTPS, or 8080 behind a proxy, and 7881 on TCP and 7882 on UDP for voice. Forward the voice ports from your router to that address, not to the machine. The machine itself can’t connect to a macvlan container unless you add a macvlan shim on the machine.

In compose.yaml, add the network to the service, with a fixed address if you want one, and mark the network as external. Leave out the ports list.

compose.yaml
services:
fluxer:
networks:
br0:
ipv4_address: 192.168.1.50
networks:
br0:
external: true

On its first start, Squad creates its own passwords and keys and keeps them in secrets.env in its data folder. You never need to set them. Every backup includes them.

Set one only to replace the value Squad made, and check what each one changes first.