dust

Deploying dust

Introduction

This guide is about deploying dust itself: the framework, the documentation site, and the demo application. It is a maintainer's guide, not the guide for deploying an application you built with dust; that one is Deployment.

The framework, the documentation, and the demo deploy to the Aegis server at server.inhive.ro. Aegis serves public traffic through Whisp Edge (io-edge) on ports 80 and 443, keeps its vhosts in /aegis/config/edge/vhosts, and runs nginx on ports 8080 and 8081 as a fallback. The dust deploy therefore installs edge vhosts and reloads edge, not nginx.

The whole deploy is one script, scripts/deploy, driven by three environment variables:

Variable Default What it sets
DUST_DEPLOY_HOST server.inhive.ro The server to deploy to.
DUST_DEPLOY_PORT 2244 The SSH port.
DUST_DEPLOY_USER root The SSH user.

What the server runs

Path What it is
/var/www/html/dust-framework The framework source, the landing page, /install, /docs, and the source tarball.
/var/www/html/dust-framework/build/docs The rendered guides served at https://dustapp.dev/docs.
/var/www/html/dust-framework-demo The demo application, served by dust-demo.service on 127.0.0.1:8100.
/usr/local/bin/dust The CLI, built from the deployed source.
/etc/systemd/system/dust-demo.service The demo's web process.
/etc/systemd/system/dust-relay.service The demo's relay server, proxying /app and /apps.
/aegis/config/edge/vhosts/dustapp.dev.toml The static site, the guides, and the installer.
/aegis/config/edge/vhosts/demo.dustapp.dev.toml The reverse proxy to the demo and its relay.

dustapp.dev serves the static site, and demo.dustapp.dev proxies to the demo. Both names resolve to the server and use the wildcard *.dustapp.dev certificate in /aegis/data/certbot/live/dustapp.dev.

The demo keeps its own .env, database, uploads, and logs. The deploy copies the demo's source but not those files, so a redeploy never erases the demo's data. Its .env is created from .env.example on first deploy and gets a generated APP_KEY; later deploys leave the existing file alone.

Once

The script authenticates with your SSH key, so install it on the server before the first deploy:

shell
ssh-copy-id -p 2244 root@server.inhive.ro

You also need rsync locally. The server needs tar and curl, and a C toolchain for crates that build native code. The script installs the Rust toolchain with rustup when cargo is missing; it does not install rsync, so that has to be on the host image.

Every deploy

From the framework repository, with your changes committed or at least saved to disk:

shell
./scripts/deploy

The script stops on the first failure, so a broken build never replaces a working binary. Run it again after fixing the cause; it is safe to repeat.

What the script does

The script works in five stages:

  1. Copies the framework source to /var/www/html/dust-framework, excluding target, .git, archive, and editor files.
  2. Builds and copies the site. It renders the guides locally with the docs site's Node build, copies the rendered guides to build/docs, copies site/ to the webroot, and rebuilds dust-framework-src.tar.gz for the installer.
  3. Builds the CLI. It installs the Rust toolchain when it is missing, builds dust-cli, installs dust to /usr/local/bin, and prints its version.
  4. Updates the demo. It copies examples/demo, points its Cargo.toml at the deployed framework source, fills in any missing .env keys, builds the demo with dust build --release, and runs bin/dust-demo install --force as aegis-www.
  5. Installs services and edge vhosts. It copies the systemd units and both edge vhost files, enables and restarts dust-demo and dust-relay, and reloads edge with io-edge reload.

The order matters. The CLI is installed before the demo builds, so the demo uses the new CLI. The demo is built and its services restarted before edge reloads, so the proxy never points at a process that hasn't started.

Verifying a deploy

The script checks the three public entry points when it finishes:

  • https://dustapp.dev shows the landing page.
  • https://dustapp.dev/docs/commands shows a guide through a clean URL.
  • https://demo.dustapp.dev shows the demo application.

Then check the services on the server:

shell
systemctl status dust-demo dust-relayjournalctl -u dust-demo -n 50 --no-pager

dust status inside /var/www/html/dust-framework-demo reports the demo's database, queue, cache, cron, relay, and io/ui version. If a page loads but its styles don't, check that /var/www/html/dust-framework-demo/public/vendor/io-ui exists and that edge serves it through the demo proxy.

The installer on the site is part of the deploy too. Download it once and check that it still finds its tarball:

shell
curl -fsSL https://dustapp.dev/install.sh | head -20

Rolling back

The script leaves the previous binaries in place until the new build succeeds, but it does not keep a version history. To roll back, check out the previous commit in your local repository and run the script again. The framework source, CLI, site, and demo all move together, which is why a rollback is a redeploy rather than a file copy.

The demo's database is not versioned with the deploy. A rollback that also reverts a migration needs a database backup; take one before deploying a migration you may need to undo.

Installing from the site

The site hosts an installer that builds the CLI from the deployed source:

shell
curl -fsSL https://dustapp.dev/install.sh | sh

The script installs Rust when needed, downloads dust-framework-src.tar.gz from the site, builds dust-cli, and puts dust in ~/.cargo/bin. It needs curl, tar, and a C toolchain, and it does not modify your shell profile; make sure ~/.cargo/bin is on your PATH.

Troubleshooting

Symptom What to check
SSH asks for a password ssh-copy-id didn't run, or it used another port or user.
The CLI build fails on the server cargo exists but is too old, or the server can't reach crates.io. Run rustup update on the server.
The docs site build fails The docs build runs on your machine, not the server. Run it locally to see the error.
The demo starts but pages 502 dust-demo isn't listening on 127.0.0.1:8100; check journalctl -u dust-demo.
Styles are missing in the demo public/vendor/io-ui wasn't copied or the demo service can't read it.
The edge reload fails Run io-edge config or io-edge status; the error names the vhost and line that is wrong.
The site serves an old guide The docs were not re-rendered; check that the local docs build succeeded before rsync.
A guide URL returns 404 The rendered guide must have <slug>/index.html; rebuild the docs instead of copying only the flat .html file.

Do not restart the system nginx on Aegis. Edge owns :80 and :443; reload it with /aegis/apps/web/edge/0.1/bin/io-edge reload.