Skip to content
On this page

Getting started

What is dist-server?

A self-hosted CD tool, a few of its tasks include:

  • Clone repositories.
  • Optionally run a build script.
  • Branch-specific NGINX configuration.
  • Deploy dist/ directories.
  • Create SSL certificates with certbot.
  • Auto-revert if a build fails.

Repository requirements

An overview of files deployed repository should contain at the very least:

A dist/ directory

Either just include it in the repo or build it during the deployment.

A vhost file

vhost.<branch> | vhost-<branch> | vhost

TODO: Improve docs

A CNAME file

CNAME.<branch> | CNAME (contains hostname, e.g. hello.example.io)

TODO: Improve docs

Bash scripts: pre-deploy.sh/post-deploy.sh

TODO: Improve docs

Available Bash environment variables:

  • $DIST_SERVER_CURRENT_DEPLOYMENT_SSH_URL
  • $DIST_SERVER_CURRENT_DEPLOYMENT_REPO_URL
  • $DIST_SERVER_CURRENT_DEPLOYMENT_REPO_OWNER: user or organization name that owns the repository, e.g. "Anoesj".
  • $DIST_SERVER_CURRENT_DEPLOYMENT_REPO_NAME: name of the repository, e.g. "dist-server".
  • $DIST_SERVER_CURRENT_DEPLOYMENT_REPO_NAME_FULL: repository owner + / + repository name, e.g. "Anoesj/dist-server".
  • $DIST_SERVER_CURRENT_DEPLOYMENT_BRANCH: the name of the currently deployed branch, e.g. "feature/new-dashboard".
  • $DIST_SERVER_CURRENT_DEPLOYMENT_COMMIT_ID: the full ID of the currently deployed commit, e.g. "e4e4039674fbb0e9029e3f23f5704e4fb801c2f5".
  • $DIST_SERVER_CURRENT_DEPLOYMENT_COMMIT_MESSAGE: the message of the currently deployed commit, e.g. "feat(dashboard): implement redesign".
  • $DIST_SERVER_CURRENT_DEPLOYMENT_COMMIT_TIMESTAMP
  • $DIST_SERVER_CURRENT_DEPLOYMENT_COMMIT_URL: an URL to the commit on the Git provider, e.g. "https://github.com/Anoesj/dist-server/commit/e4e4039674fbb0e9029e3f23f5704e4fb801c2f5".
  • $DIST_SERVER_CURRENT_DEPLOYMENT_REPO_NAME_SAFE: safe version of the current deployments repository name, e.g. re/mix becomes re_mix.
  • $DIST_SERVER_CURRENT_DEPLOYMENT_BRANCH_SAFE: safe version of the current deployments branch name, e.g. feature/new-dashboard becomes feature_new-dashboard.