Publishing

Publish over SSH

Send the site from your computer, or your pipeline, to a server you reach over SSH. Only changed files travel, and the new site goes live in one step.

Use this for a VPS or a server of your own, when you publish from somewhere else: your computer, or your git platform's pipeline.

What you need

  • A server you can reach with ssh, and a user on it that can write the web server's folder. A separate user just for publishing, such as deploy, is a good idea.
  • SSH keys set up, so ssh deploy@your-server works without a password. HotDog never asks for, or stores, passwords.
  • rsync on both your computer and the server. Most Linux servers have it; on macOS it's there already.

Write publish.yaml

targets:
  server:
    type: rsync
    host: deploy@${DEPLOY_HOST}
    path: /var/www/example.org
    # port: 2222
  • host is the user and server, as you'd type after ssh. ${DEPLOY_HOST} reads it from the environment, so the server's name isn't written in your repository. Set it before publishing: export DEPLOY_HOST=web.example.org.
  • path is the web server's folder.
  • port is only needed if SSH isn't on the usual port, 22.

Publish

hotdog-cms publish server

Only the files that changed are sent, into a staging folder on the server, which then replaces the live folder in one swap. Like the dir target, it only replaces a folder HotDog wrote.

From your pipeline

The pipeline files hotdog-cms ci writes publish over SSH with a deploy key and the server's known_hosts entry, kept as your platform's secrets. They never turn off checking the server's identity. See Your platform's pipeline.