Skip to content

DigitalOcean

[object Object]

deployments/digitalocean/tessra-droplet.sh turns a fresh Ubuntu Droplet into a Tessra server: Docker, Tessra, Caddy with automatic HTTPS, a firewall that allows only ports 22, 80 and 443, and daily backups.

Install

  1. Create a Droplet with Ubuntu 24.04. The smallest plan is enough to start.
  2. Under Advanced options › Add initialization scripts, paste the whole script and fill in DOMAIN at the top. Optionally set ACME_EMAIL for certificate expiry notices, and the S3_ values to keep files in a bucket.
  3. Point an A record for the domain at the Droplet's IP.
  4. After a few minutes, open the Droplet's Console and run cat /root/tessra-setup.txt. It has the one-time setup secret. Open your domain and create the administrator.

TESSRA_IMAGE near the end of the settings defaults to the current release line (ghcr.io/brostro/tessra:0.1), which picks up patch releases on update. Change it to pin an exact release (:0.1.0), follow unreleased work (:main), or run your own fork. See image tags. The default image is public, so no registry login is needed. For a private image, set REGISTRY_USER and REGISTRY_TOKEN (for GHCR, a token with read:packages); the script logs in to the image's registry only when both are set.

You can also run the script over SSH (sudo bash tessra-droplet.sh); it asks for anything left blank. Running it again keeps your data and settings. The install log is /var/log/tessra-install.log.

Files in a bucket

By default uploaded files live on the Droplet's disk. To keep them in an S3-compatible bucket instead, fill in the S3_ values at the top of the script before the first run. The script writes them into /opt/tessra/.env. Leave S3_REGION, S3_PATH_STYLE and S3_CONDITIONAL_WRITES empty and the script picks the right values for Cloudflare R2, DigitalOcean Spaces and AWS from the endpoint.

The script writes .env only on its first run. To change storage later, edit /opt/tessra/.env (see Storage settings) and run docker compose up -d. Switching storage does not move existing files; see Moving between local and S3 storage.

After setup, check the bucket from Settings › Storage › Test storage.

Cloudflare R2

  1. In the Cloudflare dashboard, open R2 Object Storage and create a bucket, e.g. tessra. Leave public access off: Tessra serves files itself.
  2. On the R2 Overview page, copy your Account ID.
  3. Next to API Tokens, choose Manage, then Create Account API token (or Create User API token).
  4. Set Permissions to Object Read & Write, and under Specify bucket(s) choose Apply to specific buckets only and pick your bucket. Leave the TTL as forever unless you plan to rotate it, and create the token.
  5. Copy the Access Key ID and Secret Access Key. The secret is shown only once.

Then fill in:

S3_ENDPOINT="https://<account_id>.r2.cloudflarestorage.com"
S3_BUCKET="tessra"
S3_ACCESS_KEY="<Access Key ID>"
S3_SECRET_KEY="<Secret Access Key>"

That becomes region auto, path-style addressing and conditional writes on. For a bucket created with a jurisdiction, use its endpoint instead, e.g. https://<account_id>.eu.r2.cloudflarestorage.com.

R2 removes incomplete multipart uploads after 7 days by default, and Tessra also cleans up its own. R2 does not charge for egress, so serving and backing up files costs only R2's per-request fees.

DigitalOcean Spaces

Create a Spaces bucket and a Spaces access key limited to that bucket, then fill in:

S3_ENDPOINT="https://<region>.digitaloceanspaces.com"
S3_BUCKET="<bucket>"
S3_ACCESS_KEY="<key>"
S3_SECRET_KEY="<secret>"

The script turns off path-style addressing and conditional writes for Spaces.

Other services

Set S3_ENDPOINT to the service's https endpoint. Unknown endpoints get region us-east-1, path-style addressing and conditional writes on; set S3_REGION, S3_PATH_STYLE="false" or S3_CONDITIONAL_WRITES="false" if your service needs otherwise.

Backups with a bucket

The daily backup reads every file back out of the bucket into the archive, so it protects you even if the bucket or the account is lost. Each archive holds a full copy of your files, so with BACKUP_KEEP="7" the Droplet's disk needs room for about seven copies of the bucket.

If your files outgrow that, set BACKUP_FILES="false" before the run. The daily backup then adds --no-blobs and holds only the database and keys, and protecting the bucket is up to you (see S3 storage). To change it on an installed Droplet, edit /etc/cron.d/tessra-backup.

Layout

PathContents
/opt/tessra/compose.yamlTessra and Caddy
/opt/tessra/.envTessra settings, including bucket credentials (readable by root only)
/opt/tessra/CaddyfileHTTPS and proxy settings
/opt/tessra/backups/Daily backups
Docker volume tessra_tessra-dataTessra's /data

Backups

The script installs /etc/cron.d/tessra-backup, which runs a backup at 03:30 UTC every day into /opt/tessra/backups and keeps the newest 7 (BACKUP_KEEP at the top of the script; 0 turns it off). The log is /var/log/tessra-backup.log.

Those backups are on the Droplet's own disk, so they cover mistakes and corruption but not losing the Droplet. Also copy them elsewhere (see Off-site copies), or at least enable Droplet backups, which snapshot the whole disk including /opt/tessra/backups. With a bucket, the backups include the files from the bucket too, unless BACKUP_FILES is false (see Backups with a bucket).

To restore on the same Droplet:

cd /opt/tessra
docker compose stop tessra
docker compose run --rm tessra admin restore /backups/tessra-backup-<time>.tar --force
docker compose up -d

To move to a new Droplet, create it with the script and the same DOMAIN, skip the setup step, then follow Move to a new server.

Updates

Patch releases on the tag you run (for example 0.1):

cd /opt/tessra && docker compose pull && docker compose up -d

For a new minor version, back up first (see Upgrades), change the tag on the image: line of /opt/tessra/compose.yaml (for example :0.1 to :0.2), then run the same command. Running the script again also rewrites compose.yaml with its TESSRA_IMAGE, so set that to the tag you want if you rerun it.

An install made before releases existed runs :latest, which now means the newest release rather than the newest main build. Change it to :0.1 to stay on the 0.1 line.