Install the server
Run Home Space with Docker Compose from the pre-built image. This guide sets up sign-in with a username and password; single sign-on is an optional step afterwards.
homespace-ctl install sets up the same thing for you, with Docker or Podman, secrets in files and data in host folders if you like. This page shows each step by hand.
You end up with two containers: db (PostgreSQL 18) and server (the API and the web client, from homespaceapp/home-space on Docker Hub). The server listens on 127.0.0.1:8080 only, and nginx on the same machine serves it to the world over HTTPS.
What you need
- A Linux machine (x86-64) with Docker Engine and the Compose plugin. Podman works too: use
podman composewherever this guide saysdocker compose. - A domain name pointing at the machine, for example
files.example.com. This guide uses that name throughout: replace it with yours. - Port 443 open to the clients, for HTTPS. Port 80 too, but only so nginx can redirect to HTTPS and Let's Encrypt can renew the certificate.
Never open Home Space to others over plain http:// on port 80 (or 8080). Passwords, access tokens and every file would cross the network unencrypted, readable and changeable by anyone on the way: the Wi-Fi, the ISP, a hotel network. Get a certificate and serve it on port 443, as in the nginx guide; Let's Encrypt certificates are free. Plain http is fine only on 127.0.0.1, where nothing leaves the machine.
1. Get the compose file
Create a directory for Home Space and download compose.yaml into it:
sudo mkdir -p /opt/homespace && cd /opt/homespace sudo curl -fsSLO https://home-space.app/docs/compose.yaml
This is the whole file. The database and the files live in two named volumes, db and files; every setting comes from a .env file next to it. To keep the data in host folders owned by a dedicated user instead, see Data in host folders.
# Home Space: the database and the server.
# Guide: https://home-space.app/docs/
#
# Put this file in its own directory (e.g. /opt/homespace) next to a .env file holding at least
# HOMESPACE_DB_PASSWORD password of the database user: openssl rand -hex 24
# HOMESPACE_JWT_SECRET signs the access tokens: openssl rand -base64 48
# and, for two-factor sign-in with an authenticator app,
# HOMESPACE_SECRETS_KEY seals the authenticator apps: openssl rand -base64 48
# Every other setting in .env reaches the server too: https://home-space.app/docs/configuration/
#
# docker compose up -d
# docker compose exec server homespace-ctl user add me --admin
services:
db:
# A new major version cannot read the files of the one before: upgrade deliberately.
image: docker.io/library/postgres:18
restart: unless-stopped
environment:
POSTGRES_USER: homespace
POSTGRES_PASSWORD: ${HOMESPACE_DB_PASSWORD:?set HOMESPACE_DB_PASSWORD in .env}
POSTGRES_DB: homespace
volumes:
- db:/var/lib/postgresql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U homespace -d homespace"]
interval: 5s
timeout: 3s
retries: 30
server:
image: docker.io/homespaceapp/home-space:latest
restart: unless-stopped
depends_on:
db:
condition: service_healthy
env_file: .env
environment:
# No password in the URL: the server reads HOMESPACE_DB_PASSWORD from .env itself.
DATABASE_URL: postgres://homespace@db:5432/homespace
HOMESPACE_JWT_SECRET: ${HOMESPACE_JWT_SECRET:?set HOMESPACE_JWT_SECRET in .env}
# Loopback only: nginx on this machine is the way in.
ports:
- "127.0.0.1:${HOMESPACE_PORT:-8080}:8080"
volumes:
- files:/data
volumes:
db:
files:2. Create the .env file
The .env file holds the secrets and the settings. This creates one with a random database password, a random signing secret and a random secrets key:
[ -e .env ] && echo ".env already exists, edit it instead" || sudo tee .env > /dev/null <<EOF # The address users open in the browser HOMESPACE_PUBLIC_URL=https://files.example.com # nginx sets X-Forwarded-For, so failed sign-ins are counted per client HOMESPACE_TRUST_FORWARDED_FOR=true HOMESPACE_DB_PASSWORD=$(openssl rand -hex 24) HOMESPACE_JWT_SECRET=$(openssl rand -base64 48) # Seals the authenticator apps of two-factor sign-in; keep it apart from the JWT secret HOMESPACE_SECRETS_KEY=$(openssl rand -base64 48) RUST_LOG=info EOF sudo chmod 600 .env
Edit HOMESPACE_PUBLIC_URL to your domain. Any other variable from the configuration reference can go into the same file, for example a larger upload limit.
.env only once
The random values are written into the file and reused on every restart. Running the command again would create a new database password that no longer matches the one stored in the db volume, and the server could not connect. That is why it stops if .env already exists. To change a setting later, edit the file: sudo nano .env.
HOMESPACE_JWT_SECRET secret, long and random
It signs the access tokens and the one-time tickets for downloads and live updates. Anyone who knows it can sign tokens the server trusts, so treat it like a root password:
- Generate it, never type it:
openssl rand -base64 48. The server refuses to start with a secret shorter than 32 characters, a placeholder such aschange-me…, or one made of only a few different characters. - Keep
.envreadable by root only (chmod 600) and out of version control and backups that others can read. - Prefer a file? Mount it as a Docker secret and set
HOMESPACE_JWT_SECRET_FILEinstead (set only one of the two). - Change it only with
homespace-ctl secrets rotate. Old values stop working at once; there is no "previous" secret any more.
HOMESPACE_SECRETS_KEY
It seals the secrets of the authenticator apps that users add for two-factor sign-in, so a database backup does not give them away. Without it everything works except adding an authenticator app. Authenticator apps sealed with one key open with no other, and the server refuses to start with a different key than the one it sealed with: change it only with homespace-ctl secrets rotate. It must differ from the JWT secret, and can come from a file with HOMESPACE_SECRETS_KEY_FILE.
The server reads the database password from HOMESPACE_DB_PASSWORD itself, so it no longer has to be safe in a URL; a hex value as above is the simplest. Postgres takes it only when the database is first created; changing it later in .env alone locks the server out (change it inside Postgres with ALTER USER first).
3. Start Home Space
sudo docker compose up -d sudo docker compose logs -f server
The server applies the database migrations on start. When the log shows it listening, check it from the machine itself (plain http is fine here: the address is only reachable from this machine):
curl -fsS http://127.0.0.1:8080/api/v1/health
4. Create your administrator
There is no public sign-up: accounts are created by an administrator. Create the first one with homespace-ctl, the administration tool that comes in the image; it prompts for the password:
sudo docker compose exec server homespace-ctl user add me --admin
From then on you can add, disable and delete users, reset passwords and reset two-factor sign-in in the web administration. The command line has the same tools:
| Command | Does |
|---|---|
homespace-ctl user add NAME [--admin] | Creates a user; prompts for the password. |
homespace-ctl user list | Lists the users, marking administrators, disabled users and users marked for deletion. |
homespace-ctl user admin NAME [--revoke] | Makes a user an administrator, or a regular user again. |
homespace-ctl user passwd NAME | Sets a new password and signs the user out everywhere. A single sign-on user becomes a local account. |
homespace-ctl user reset-2fa NAME | Removes the authenticator app and recovery codes of a user who lost both, and signs them out everywhere. |
homespace-ctl secrets rotate | Replaces the JWT secret and the secrets key; see Rotate the secrets. |
homespace-ctl search reindex [--all] | Rebuilds the search index. |
Run each one as sudo docker compose exec server homespace-ctl …. The server binary itself, homespace, takes no commands any more. homespace-ctl is also on every release for Linux, Windows and macOS; with DATABASE_URL set it works on the database directly.
5. Put nginx in front
The server only answers on the machine itself. Follow Reverse proxy with nginx to get a certificate and serve it at https://files.example.com. Then open that address and sign in.
6. Install the apps
The web client is already there at your address. The desktop app (Linux tarball, .deb, .rpm and Flatpak, macOS, and a Windows zip) and the Android app are attached to every release:
Download the apps from the latest release
In each app, enter https://files.example.com as the server address. The app opens your server's sign-in page in the browser, where passwords, two-factor sign-in, passkeys and single sign-on all work, and returns once you approve. Each app shows whether it matches the server's version and names any feature an older server is missing.
Two-factor sign-in and passkeys
Each user turns these on for their own account in the web client, under Settings:
- Authenticator app with one-time recovery codes. It needs
HOMESPACE_SECRETS_KEYon the server. A user who lost both is reset by an administrator in the user's panel, or withhomespace-ctl user reset-2fa NAME. - Passkeys and security keys as a second step after the password, or a passkey to sign in on its own. They need no setting, but browsers allow them only on the server's
https://address (orlocalhost), never on an IP address. A passkey belongs to the host name it was made on: one made onfiles.example.comdoes not work when the server is reached ascloud.example.com.
With two-factor sign-in on, changing the password or the second factors asks to confirm with one of them first. Single sign-on users get their second factors and passkeys from the provider instead.
Protected folders
Users can lock a folder with a password or with a security key such as a YubiKey. The app encrypts the names and the content before they leave the device, so the server, its backups and its administrator see only ciphertext. Password folders open on the web, the desktop and Android. Security-key folders open in the desktop app (Linux and macOS) and on Android; the web client shows them locked, with a link that opens them in the desktop app.
The web client's code comes from the server it protects against: whoever controls the server could serve a changed client that sends the password back. The desktop and mobile apps do not have this limit, so use them for folders that must stay safe even from the server.
Running it
Update
cd /opt/homespace sudo docker compose pull sudo docker compose up -d
latest follows the newest release. To decide when to upgrade, pin a version instead, for example homespaceapp/home-space:0.15 (newest 0.15.x) or homespaceapp/home-space:0.15.1 in compose.yaml. Administrators see a notice in the web client when a new release is out.
Back up
Back up both the database and the files, ideally at the same time:
cd /opt/homespace sudo docker compose exec -T db pg_dump -U homespace -Fc homespace > homespace-db.dump sudo docker run --rm -v homespace_files:/data:ro -v "$PWD":/backup debian:stable-slim \ tar -C /data -czf /backup/homespace-files.tar.gz .
The volume names start with the directory name (homespace_ for /opt/homespace); docker volume ls shows them. Keep a copy of .env somewhere safe as well: without its HOMESPACE_SECRETS_KEY the authenticator apps in the backup cannot be opened.
Rotate the secrets
Rotate after a leak, or when someone who knew them leaves. homespace-ctl secrets rotate replaces the JWT secret and the secrets key together, seals everything again with the new key in one transaction, and signs every user out on every device. The old values open nothing afterwards.
With this guide's compose file it guides you through it. The server must stay stopped meanwhile, so the command runs in a one-off container of its own:
cd /opt/homespace sudo docker compose stop server sudo docker compose run --rm --no-deps --entrypoint homespace-ctl server secrets rotate
It shows the new HOMESPACE_JWT_SECRET and HOMESPACE_SECRETS_KEY. Put them into .env in place of the old ones (in a second terminal: sudo nano .env), type the new key back when it asks, and confirm. Then start the server with the new values:
sudo docker compose up -d --force-recreate server
On a server set up by homespace-ctl install, homespace-ctl secrets rotate on the host does all of this itself. A run that was cut short is finished by running it again.
The server refuses to start while HOMESPACE_JWT_SECRET_PREVIOUS or HOMESPACE_SECRETS_KEY_PREVIOUS from earlier versions is set. Remove HOMESPACE_JWT_SECRET_PREVIOUS from .env; if HOMESPACE_SECRETS_KEY_PREVIOUS is set, run secrets rotate with it still there first.
Stop
sudo docker compose down stops both containers and keeps the data. Adding -v also deletes the database and every file.