DocumentationDeployment

Rust · 0.1.0

Run a binary

Build a release containing the web interface, then select explicit paths and ports.

Build with source access

Install the pinned Rust toolchain, Node.js 24 and pnpm 11.0.1, plus a C/C++ toolchain and CMake. Run the repository build script; it installs locked frontend dependencies and creates the release binary with the SPA embedded. A development placeholder is not a deployable web interface.

sh scripts/build.sh
./build/memos --version
unset MEMOS_UNIX_SOCK MEMOS_DEMO
./build/memos --addr 127.0.0.1 --port 5230 --data ./memos-data

Run under supervision

Use a dedicated unprivileged account and absolute data paths in your service manager. Native startup defaults to port 8081, so set the port rather than assuming the container default. On Unix, --unix-sock can select a socket instead of TCP; an existing socket path is not silently replaced. Use an artifact built for the target platform and verify it there. These docs do not promise public binaries or certify untested architectures.

Linux service-manager example

For a Linux host using systemd, first build and verify the native binary, install it at /opt/memos/memos, and prepare an existing dedicated memos user and group. Save this example as /etc/systemd/system/memos.service. StateDirectory creates /var/lib/memos with the service identity; it is the persistent data path. This is a local SQLite starting configuration and listens only on loopback. Other operating systems need their own service-manager definition. Review your installed systemd service behavior before adapting the template. Review any files at /etc/secrets before starting: the native service loads them from this host. The unit explicitly selects SQLite and an empty DSN so an inherited network-database setting cannot redirect it.

[Unit]
Description=Memos Rust server
After=network.target

[Service]
Type=simple
User=memos
Group=memos
StateDirectory=memos
WorkingDirectory=/var/lib/memos
UnsetEnvironment=MEMOS_UNIX_SOCK MEMOS_DEMO MEMOS_DRIVER MEMOS_DSN
ExecStart=/opt/memos/memos --addr 127.0.0.1 --port 5230 --data /var/lib/memos --driver sqlite --dsn "" --demo=false
Restart=on-failure
RestartSec=5
TimeoutStopSec=60
UMask=0077

[Install]
WantedBy=multi-user.target

Start, inspect and stop deliberately

Validate the unit before enabling it. Expect the service to become active and /healthz to return a successful status. Open the local URL, complete setup, save a disposable memo, restart the service and confirm the same memo remains. If startup fails, inspect the journal for a missing executable, wrong service identity, unwritable data directory or failed database migration. Use systemctl stop for maintenance so SIGTERM reaches the process; do not replace graceful shutdown with a forced kill as the normal procedure.

sudo systemd-analyze verify /etc/systemd/system/memos.service
sudo systemctl daemon-reload
sudo systemctl enable --now memos.service
systemctl status memos.service --no-pager
journalctl -u memos.service -n 100 --no-pager
curl --fail http://127.0.0.1:5230/healthz
# During an approved maintenance window:
# sudo systemctl stop memos.service