QUIC protocol example app
In this example we are going to deploy to Heroku a simple NodeJS CRUD app rendered via Caddy proxy to support QUIC protocol. This protocol is experimental, but is already used by Google when you visit Gmail, Google docs and other services in your Chrome browser.
Deployment to Heroku
First checkout the repo and deploy it to Herokung git push
. Make sure the app is available via *.herokuapp.com
URL:
git clone https://github.com/dockhero/quic-protocol-demo.git
cd quic-protocol-demo
heroku create
git push heroku master
heroku open
Then install Dockhero addon and the CLI plugin
heroku addons:create dockhero
heroku plugins:install dockhero
As the server comes up, take a minute to look at dockhero-compose.yml in the root of the repository:
version: "2"
services:
proxy:
image: dockhero/caddy-proxy
ports:
- "80:80"
- "80:80/udp"
- "443:443"
- "443:443/udp"
volumes:
- caddy_certificates:/srv
environment:
VIRTUAL_HOST: ${DOCKHERO_HOST}
TARGET_URL: ${HEROKU_APP_URL}
volumes:
caddy_certificates:
driver: local
The only service defined is Caddy proxy. It's configured to send all incoming traffic to TARGET_URL (see Caddyfile in Github). During startup it also generates a trusted SSL certificate via Let's Encrypt service - that's why we need to define a volume to store the certificates and not re-generate them at every startup. The stack relies on two environment variables: DOCKHERO_HOST and HEROKU_APP_URL. You don't need to set them manually - the CLI plugin will take care of them.
Now spin up the stack described by dockhero-compose.yml
heroku dh:compose up -d
and check the logs with
heroku logs --tail -p dockhero
If everything went fine, you should be able to see the app via Dockhero URL:
heroku dh:open
PS: you need to enable QUIC protocol support in Chrome in order to test this in your browser.
PS2: you may want to populate the list of pets via CURL - just put proper URL into the command below
curl -H "Content-Type: application/json" -X POST -d '{"name":"kitty","species":"cat"}' https://vital-sun-4864.dockhero.io/pets