One of Waddle’s main ideas is that your server runs the same setup as your computer. Your project already describes every service, version, and setting it needs, so deploying means copying that project to a server and starting it there. No separate server configuration, and no “but it worked locally.”
This walkthrough deploys a project to a production server for the first time, then shows how to push updates afterwards.
What you need
- A Linux server you can log into over SSH, such as a VPS from any hosting provider, with the same CPU architecture (see note above) as your computer.
- Docker with the Compose plugin, Git, and
jqinstalled on the server. Waddle checks for these before it deploys and tells you if any are missing. Run Docker on your server in rootless mode if you can, it is the safer choice. - Free ports 80 and 443 on the server. The project’s own web server answers on them directly, so nothing else on the server may already be using them.
- A domain name whose DNS points at your server, for example
myblog.com. - A project that builds and runs locally. Waddle deploys what you have built, so build the project and check it in your browser first.
Add the server to the project
Click the paintbrush icon on the project’s row to open the project settings, and click the Remotes tab. A yellow notice at the top repeats the beta warning above.
There are three sections, Production, Stage, and Dev, one per server you might deploy to. They all work the same. Fill in Production:
- Domain. The domain the site will live at, such as
myblog.com. An IP address isn’t accepted. - Username. The user you log into the server as, for example
deployif you normally runssh deploy@myblog.com. - SSH Port. Leave it at
22unless your server uses a different one. Some servers move SSH to another port to cut down on automated login attempts. - Authentication Method. Choose SSH Key. (Password also works, but it is less secure and
needs the
sshpasstool installed on your computer. Waddle runs its SSH commands in the background, where it can’t answer a password prompt, sosshpasspasses the password on for it). - Key File. Click New Key to have Waddle create a key pair for this server. It fills in the
path and shows you the public key. Copy it, and add it as a new line to
~/.ssh/authorized_keysfor your user on the server. If you already log into the server with your own key, enter that key’s path instead, or leave the field empty to let SSH pick a key the way it normally does (from your SSH agent,~/.ssh/config, or a default key such as~/.ssh/id_ed25519). A key with a passphrase must be loaded in your SSH agent, since Waddle can’t answer the prompt. - Project Path. Where the project should live on the server, such as
/home/deploy/myblog. The folder must be empty or not exist yet, and your user must be able to create it. - Basic Auth Password (htpasswd). Optional. Puts the whole site behind a password, handy for a staging server. Leave it empty for a public site.
- Use SMTP relay. Leave it on if your site sends email. It delivers mail through the provider you set in the Mail tab’s SMTP relay (remotes) section. See Test Your Site’s Emails Locally for how mail works locally.
Click Save.
Generated keys are stored in the project’s
ssh/keys/folder and are never committed to the project repository.
Set up HTTPS
This section only applies if your project serves HTTPS, which it does by default. If you have cleared the HTTPS Port field on the Nginx tab, skip ahead to Deploy.
Locally, Waddle signs your certificates with mkcert. A real server needs a real certificate, and there are two ways to get one:
- Let’s Encrypt (recommended). Open the Nginx tab and switch on Use Let’s Encrypt, then save and build the project locally. The server requests and renews its own free certificate. This needs your domain’s DNS to already point at the server, and port 80 to be reachable from the internet, since Let’s Encrypt checks that you control the domain by visiting your site over port 80 before it issues the certificate. If a firewall blocks port 80, the certificate is never issued. Opening port 80 doesn’t expose your site over plain HTTP. The project’s web server answers the Let’s Encrypt check itself and redirects every other request on port 80 to HTTPS.
- Your own certificate. Place it in the project at
remotes/production/ssl/cert.crtandcert.key. See SSL Certificates on Remotes for more details.
Without one of these, the web server on the server can’t start.
Deploy
- Make sure all your changes are committed. Waddle refuses to deploy with uncommitted changes, so nothing half-finished reaches the server.
- Build the project locally if you have changed anything since the last build.
- In the project list, a dropdown showing Local has appeared on your project’s row. Switch it to Production. The row now shows the server’s status and the actions you can run on it.
- Open the remote actions dropdown and choose Deploy to remote.
- Waddle reminds you to take a backup. Do so if the server holds anything you care about, then click Proceed.
The first deploy does a lot, so give it time:
- Checks that the server is reachable and has Docker, Git, and
jq. - Pushes the project’s Git repository to the project path.
- Uploads the private settings and config files that Git doesn’t carry, such as database
passwords and
wp-config.php. - Uploads your locally built Docker images, so the server doesn’t have to compile anything.
- Starts every service, uploads your local database, and updates the site’s URLs from your local domain to the server’s.
When it finishes, the status dot should turn green within a minute. Open your domain in a browser, and your site is live.
Push updates
After the first deploy, Deploy to remote is greyed out and Push project to remote takes its place. The routine for every update is:
- Commit your changes and build locally.
- Take a backup of the server.
- If your site supports it, choose Toggle maintenance mode from the remote actions dropdown, so visitors see a maintenance page instead of a half-updated site.
- Choose Push project to remote and click Proceed.
- Check the site, then turn maintenance mode off again.
A push sends your new commits and the project’s Docker images, restarts the services, and runs
the project’s update scripts. Files committed to the project, including its server
configuration, are replaced by the versions you push. Your website’s own config files, such
as wp-config.php, are never committed, so Waddle only uploads them on the first deploy and
leaves them alone after that. Changes made to them on the server, such as a production-only
setting, survive. For some platforms the update scripts still set the site’s domain in these
files on every push, since you can change it in the project settings.
Moving databases
The remote actions dropdown has two database actions. Both replace the database on the receiving end, so double-check which environment you have selected before you click.
- Download database copies the server’s database to your computer, replacing your local one. This is the usual way to work with real content locally.
- Upload database copies your local database to the server, replacing the live one. It is rarely what you want once a site has real visitors, orders, or comments. One good use is fixing a problem in the live database. Turn on maintenance mode first if your site supports it, then download the database, fix it locally, and upload it again. Maintenance mode keeps visitors from making new changes in the meantime, which the upload would otherwise wipe out.
Waddle fixes the site’s URLs after either one, so your local copy keeps working on your local domain. Domain Handling on Deploy explains how.
Going further
The whole deployment is ordinary shell scripts inside your project, so you can adjust it to fit your server. See customising a Remote Deployment for more information.
And once more, since this feature is still in beta, please report any problems you may discover.