Quickstart

See Heroku dev center article for an official quick-start guide. Below is a short version:

$ heroku addons:create dockhero        # provision the add-on
$ heroku plugins:install dockhero      # install CLI plugin
$ heroku dh:generate helloworld        # prepare dockhero-compose.yml
$ heroku dh:compose up -d              # run the stack

Provisioning the add-on

$ heroku addons:create dockhero

It takes 2-3 minutes to spin up and configure an EC2 instance with Docker server and monitoring tools. You can track the provisioning status in add-on dashboard. When the provisioning is done, the following environment variables are set in Heroku config:

  • DOCKHERO_HOST - this is the address of the machine. It can be used to connect to the services you will launch there
  • DOCKHERO_CERTS_URL - this one is used internally by the CLI plugin to download the certificates and connect to Docker
  • DOCKHERO_FULL_SSL_URL and DOCKHERO_FLEXIBLE_SSL_URL - two HTTP/2 SSL endpoints which proxy traffic to your stack (see SSL Endpoints)

Installing CLI plugin

$ heroku plugins:install dockhero

The plugin configures your Docker client to talk to Dockhero rather than your default machine. Most of the time you will use heroku dh:compose shortcut. See other commands in CLI Plugin docs.

Prepare dockhero-compose.yml

$ heroku dh:generate helloworld

This command writes a stack definition into dockhero-compose.yml:

# dockhero-compose.yml
version: "2"
services:
 web:
   image: dockhero/dockhero-docs:hello
   ports:
     - "80:8080"

See a list of available generators here.

Running the stack

$ heroku dh:compose up -d
WARNING: The Docker Engine you're using is running in swarm mode 
Compose does not use swarm mode to deploy services to multiple nodes in a swarm. All containers will be scheduled on the current node.

Creating network "dockhero_default" with driver "bridge"
Creating dockhero_web_1

$ heroku dh:compose ps
Name              Command                        State        Ports
-----------------------------------------------------------------------------------
dockhero_web_1    /bin/sh -c http-server /app    Up      54.174.36.199:80->8080/tcp

$ heroku logs -p dockhero --tail

This launches your stack on the EC2 instance. Please note this WARNING about Swarm Mode. It is harmless, it's just because Dockhero actually provides you with a Swarm cluster consisting of a single node.

results matching ""

    No results matching ""