typress
An editorial workshop.日本語

Manual deployment

These are the steps the installer performs, done by hand. Use them outside Debian and Ubuntu, or when you want to choose the setup yourself. The systemd unit and the other source files are in the repo's packaging/.

1. User and folders

sudo useradd -r -s /usr/sbin/nologin -d /var/lib/typress typress
sudo mkdir -p /opt/typress /var/lib/typress /etc/typress
sudo chown typress:typress /var/lib/typress
sudo chmod 0700 /var/lib/typress
sudo install -m 0755 typress /opt/typress/typress

2. Settings file

sudo cp packaging/typress.env.example /etc/typress/typress.env
sudoedit /etc/typress/typress.env   # set the master key and public URL
sudo chown root:typress /etc/typress/typress.env
sudo chmod 0640 /etc/typress/typress.env

See Configuration for each setting.

3. The first admin

On a public server, create the admin before the site is reachable, because whoever visits first can create it. The installer does this for you. When doing it by hand, start typress before configuring nginx, while it can't be reached from outside, and create the admin at /admin.

4. systemd

sudo cp packaging/typress.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now typress

The unit file includes extensive hardening. MemoryDenyWriteExecute is left out on purpose because it stops Bun's JIT from running.

5. nginx and HTTPS

typress doesn't terminate HTTPS itself. Put nginx (or Caddy) in front.

server {
    listen 443 ssl;
    http2 on;
    server_name blog.example.com;
    ssl_certificate     /etc/letsencrypt/live/typress/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/typress/privkey.pem;
    client_max_body_size 0;
    location / {
        proxy_pass http://127.0.0.1:4321;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header X-Forwarded-Proto https;
    }
}

Get the certificate with certbot. For an IP address, use Let's Encrypt's short-lived certificates (valid 6 days) and renew every 12 hours with packaging/typress-le-renew.timer.

A note on building

Build Linux binaries on Linux. Binaries cross-compiled from macOS have a known problem that exhausts memory on Linux. See Build from source.