This is an updated version of this older repository that shows how to get plumber to work with nginx and Let's Encrypt. That works fine, but it takes a lot of configuration and a whole separate process for getting and renewing HTTPS certificates. The newer (and magical) Caddy webserver handles HTTPS automatically and it only involves very minimal configuration, so I recommend using it instead of nginx.
Caddy makes everything like a billion times easier.
This repository shows a basic barebones example, with just two services or containers defined in docker-compose.yml
:
plumber
: This runs a simple plumber app inplumber-thing/
that exposes the API on port 8000. This is exposed on an internal local network that only Docker Compose can see—the broader internet can't see it.caddy
: This is a web server that automatically makes HTTPS work. When you run stuff locally, it creates self-signed SSL certificates; when you run it on a publicly accessible server, it creates SSL certificates through Let's Encrypt. The server configuration incaddy/Caddyfile
forwards all traffic tohttps://api.localhost
to the plumber app that's running on port 8000.
And that's it!
So to do this yourself on DigitalOcean, create a new cheapo Droplet (use this link to create a DigitalOcean account and get $200 for free, if you want), and follow these guides to get it set up:
- Initial server setup for setting up SSH, correct user groups, firewall, etc.
- Installing Docker for installing, um, Docker
- Installing Docker Compose for installing Docker Compose
Then, using a DNS service (iwantmyname, GoDaddy, whatever), point a domain name (like api.example.com) to the new DigitalOcean server's IP address.
Put this repository on the server and edit caddy/Caddyfile
with the domain name.
From your server's terminal, run this
docker compose -f docker-compose.yml -d up
Go to https://api.example.com/__docs__/
and you should see the Plumber documentation page, and you're done!