Deployment
v0.1
Server layout
A system user without a login shell runs the app. It reads the app's files and writes only storage/ and
database/:
sudo useradd --system --home-dir /srv/myapp --shell /usr/sbin/nologin myapp
sudo mkdir -p /srv/myapp/storage /srv/myapp/database
# copy the binary and public/ (see "Updating" for rsync / scp), then:
sudo chown -R root:root /srv/myapp
sudo chown -R myapp:myapp /srv/myapp/storage /srv/myapp/database
sudo chmod 750 /srv/myapp/storage /srv/myapp/database
sudo chmod 755 /srv/myapp/myapp
sudo chmod -R u=rwX,go=rX /srv/myapp/public
sudo install -o root -g myapp -m 640 /dev/null /srv/myapp/.env
| Path | Owner | Mode | Why |
|---|---|---|---|
/srv/myapp/myapp |
root |
755 |
the app cannot replace its own binary |
/srv/myapp/.env |
root:myapp |
640 |
holds APP_KEY and passwords; only the app's group reads it |
/srv/myapp/public/ |
root |
folders 755, files 644 |
served read-only |
/srv/myapp/storage/ |
myapp |
750 |
uploads, logs, sessions, cache: no other local user may read them |
/srv/myapp/database/ |
myapp |
750 |
SQLite creates the file and its -wal / -shm files here (0600); they hold password hashes and sessions |
On Unix Smeltery creates its own files private: the SQLite database 0600, the log 0640, cache entries and
session files 0600, and the log and cache folders it creates 0750 and 0700. The systemd unit below also sets
UMask=0027 for everything else the process writes. A database.sqlite from an older setup keeps its mode:
sudo chmod 600 /srv/myapp/database/database.sqlite*.