For Website Developers

External Builds

Install sfly and publish a static website built outside Dash

Publish an external build

Build your website locally, then publish it with sfly. External-build websites do not have a Dash-managed Git repository or CMS. The client transfers your prepared files, admits the release, and activates the configured destination in one command. It does not run your build or rewrite HTML, CSS, or asset URLs.

1. Usage

Once sfly is installed and you have completed the one-time connection and token setup, you can publish with no project configuration file.

  1. Prepare your finished build with this all-default layout:

    hello-example/
    └── _site/
        ├── index.html
        └── assets/       # required; can be empty
    

    _site/ contains the generated website files, not your source files. For a minimal Hello World page, _site/index.html can contain:

    <!doctype html>
    <title>Hello</title>
    <h1>Hello, world!</h1>
    

    No dash-upload.yaml is needed. With no project file, the current folder supplies the site slug (hello-example), the build directory is _site/, the target is live, and CDN directories default to ['assets/']. Default _site/assets/ must exist even when empty. If it contains files, they go to the CDN rather than the static release; prepare their URLs before publishing.

    Choose an available site slug or use one of your existing external websites. sfly creates a missing external website and a missing named target, subject to your account's permissions. It reuses an accessible external website and enabled target; a conflicting slug, wrong website type, disabled target, or authorization failure stops publishing.

  2. From the directory containing hello-example/, publish:

    cd hello-example
    sfly
    

    The default target is live: a successful upload activates the live website automatically, without a confirmation prompt. To publish a preview instead, use an optional project override with target: preview.

  3. Check the announced site and target. On success, sfly prints the activated URL and release ID. Open that URL to see Hello, world!.

For later updates, finish your build and rerun sfly from the project directory. Without --config, an existing ./dash-upload.yaml overrides the defaults; an invalid or unreadable file stops publishing rather than falling back to defaults.

The client validates local configuration and selected files before remote changes, creates a fresh SSH key and upload session, generates the manifest in a private temporary copy, transfers the files, admits the release, and activates the target. Do not create release.json in your build directory; the client creates it for you without changing the build.

Transferring files alone does not publish them. Admission validates the candidate; activation switches the destination to that release. An asset-upload, CDN-check, transfer, or admission failure prevents activation. Earlier releases and CDN assets are not pruned.

The whole build root is published, excluding the subtrees selected for CDN uploads. Empty and CDN-only builds are supported; no HTML or other release file is required. They generate a manifest with files: []. Activating such a release replaces the selected destination with a release that has no pages to serve.

2. Install

You need Python 3.11 or newer with venv support, ssh-keygen, rsync, and ssh, plus network access to install PyYAML. Builds containing CDN assets also need s5cmd; an empty assets/ directory does not.

  1. If you have a Dash checkout, run this from its root:

    just install-sfly
    

    Without a checkout, obtain install-sfly.sh and sfly.py from your deployment administrator, keep both files in the same directory, and run:

    bash install-sfly.sh
    

    Both methods install the command at ~/.local/bin/sfly, copy the uploader into ~/.local/lib/sfly, and create a dedicated Python environment with PyYAML. After installation, publishing needs neither a Dash checkout nor its development virtualenv. The installer does not install the SSH tools or s5cmd.

  2. Ensure the command is available in your shell:

    export PATH="$HOME/.local/bin:$PATH"
    sfly --help
    

    Add that PATH setting to your shell startup file if needed. If you have an old sfly Bash alias pointing into a checkout, remove it from your startup file and run unalias sfly in the current shell before checking the command.

An optional installation prefix is supported: just install-sfly /path/to/prefix or bash install-sfly.sh /path/to/prefix. Add that prefix's bin directory to PATH instead. To update the installed copy, rerun just install-sfly (or the same installer command with your chosen prefix).

3. Configure

The global connection file and a user API token are required even when you publish without project YAML. You need a Dash account authorized to publish your external website, plus the restricted SSH transfer hostname from your deployment administrator. This hostname is separate from the dashboard address; external-release transfers must be enabled on that host.

Create an API token

  1. Sign in to Dash and open Settings → API Tokens.
  2. Click Create token, give it a name, choose an expiration, and click Create token.
  3. Copy the token immediately. Dash shows the secret only once. Keep it out of your source repository and YAML configuration files.

The publishing client uses this user API token, not a website token or SSH key.

Set up the connection once

  1. Create the user configuration directory:

    mkdir -p "${XDG_CONFIG_HOME:-$HOME/.config}/dash"
    
  2. Create ${XDG_CONFIG_HOME:-$HOME/.config}/dash/external-upload.yaml with these three fields. Replace your-ssh-transfer-host with the hostname supplied by your administrator, without a username:

    dash_url: https://r2ware.dev
    ssh_host: your-ssh-transfer-host
    token_env: DASH_TOKEN
    

    dash_url is the Dash origin, without an API path. token_env names the environment variable containing your token; it is not the token itself. If you set XDG_CONFIG_HOME, use an absolute path. This connection file is shared by all your website projects.

  3. In Bash, enter your token without echoing it or placing it in shell history:

    set +x
    read -r -s -p 'Dash API token: ' DASH_TOKEN; echo
    export DASH_TOKEN
    

    Repeat this in each new publishing shell, or use your existing secure environment-variable setup.

Optional project overrides

Create dash-upload.yaml in the website project only if you want to override defaults. For example:

site: another-example
target: preview
build_root: dist
s3_directories: []

Without --config, sfly loads ./dash-upload.yaml when present; if absent, it uses defaults based on the current project directory. An empty YAML file or {} also uses all defaults. An existing file with invalid YAML, invalid fields, or a read error fails instead of silently using defaults.

To select a project's configuration from another directory:

sfly --config /path/to/hello-example/dash-upload.yaml

An explicit --config requires that file to exist; a missing file is an error. With a selected project file, the default site name and relative build paths come from that file's directory, not your invocation directory or the installed script.

Setting Meaning
site Optional; defaults to the current project folder's basename when no project file is used, or the selected YAML file's directory basename when one is used. Override with the exact external-website slug to create or reuse.
target Optional; defaults to live, activating the live website automatically on success. Set a named target such as preview to publish a preview instead.
build_root Optional; defaults to _site/. Relative paths resolve against the current project directory without a project file, or the selected YAML file's directory with one. An absolute path is also accepted.
s3_directories Optional; defaults to ['assets/']. Recursive directories of CDN assets, relative to the build root. Every configured directory must exist, including default _site/assets/. Use [] for no CDN uploads.

Defaults apply to omitted fields only; explicit null and invalid values are rejected. Unknown keys are rejected, including the removed ssh_directories setting. Site and target names must be valid slugs: lowercase ASCII letters, digits, and hyphens, beginning with a letter or digit, with at most 64 characters. Override site if the project folder's name is unsuitable.

CDN assets

By default, files under _site/assets/ are uploaded only to the CDN; every other build file enters the static release. With s3_directories: [], all build files are served from the static release instead: _site/assets/logo.png is served at /assets/logo.png, not from the CDN.

For CDN-hosted media:

  1. Install s5cmd and arrange temporary Spaces-key permissions with your deployment administrator. sfly requests a temporary key from Dash using your user API token. A permission denial stops the upload; the client does not bypass Dash authorization.

  2. Put assets in _site/assets/ to use the default selection, or select directories in project YAML:

    s3_directories:
      - assets/
    

    All configured S3 directories must exist, even if empty. A single trailing slash (assets/) is accepted. Directory paths cannot escape the build root, and duplicate or overlapping S3 selections are rejected. Symlinks and special files anywhere in the build are invalid.

  3. Before publishing, give assets content-revisioned names and generate HTML/CSS with their final CDN URLs. For example, _site/assets/logo.a1b2c3.png uses https://cdn.r2ware.dev/hello-example/prod/assets-rev/assets/logo.a1b2c3.png in production. CDN paths retain their full build-root-relative path, including the assets/ prefix; the selected directory name is not stripped. Dash supplies the environment namespace (prod or staging) with the temporary key; use the namespace for your deployment. Asset paths must use URL-safe ASCII: letters, digits, -, _, ., ~, and / separators.

  4. Run sfly. It uploads assets to the Dash-supplied destination, checks that each public CDN URL returns HTTP 200, and includes the URLs in the release manifest before transferring and publishing the remaining build files.

sfly does not generate content revisions or rewrite references. A build that still references local /assets/ URLs will not be fixed by uploading those files to the CDN. Dash also checks declared CDN assets at admission and activation.

Troubleshooting

  • sfly is missing or still uses a checkout: Check that the installation's bin directory is on PATH and remove any old sfly alias. Run type -a sfly and sfly --help.
  • Configuration or token error: The global connection YAML requires exactly dash_url, ssh_host, and token_env. Confirm the variable named by token_env is exported in the publishing shell; do not put the token value in YAML. Project YAML is optional unless you pass --config; a selected file must be readable and valid. An empty file or {} is valid; explicit null, invalid values, and unknown keys such as ssh_directories are not.
  • Missing asset directory: Default _site/assets/ must exist even if empty. Prepare the configured asset directories, or use s3_directories: [] to serve all build files from the release without CDN uploads.
  • Build files are rejected: Remove any build-root release.json. Symlinks and special files are not accepted anywhere in the build. Empty builds are valid, but the build directory and configured S3 directories must exist. If the default project-folder basename is not a valid slug, set site explicitly.
  • Website, target, or Spaces-key authorization fails: Confirm the exact slug, website type, enabled target, and user permissions in Dash. Ask your administrator about CDN-key permissions if your build contains CDN assets.
  • SSH or rsync fails: Confirm the restricted transfer host with your administrator. The client uses the dash-upload account and a fresh per-upload key; the session lasts one hour. Rerun sfly to start a new upload after fixing the transfer problem.
  • CDN check or admission fails: Confirm your asset URLs and environment namespace, and that public URLs are reachable. Correct the build or configuration and rerun sfly.
  • Provider revocation warning: Local cleanup does not prove that a temporary Spaces key was revoked. Follow your deployment administrator's key-revocation procedure.
  • The live website has not changed: Check whether you published to preview rather than live, and whether the command printed a successful activation. Transferring or admitting a release alone does not publish it.

For other ways to authenticate to Dash, see API v2. The sfly external-release workflow uses Dash's /api/v1/ endpoints.