In this part we are going to deploy our Docker container to hyper.sh (Affiliate Link). It's a relatively new platform that makes it very easy to deploy containers.
You will need the hyper cli to get started. Refer to the official documentation for details.
We will start by starting an instance of our container. By the time of writing this blog post, the latest version of time_tracking is
hyper run -d --size=s2 -e PORT=8080 -e PRODUCTION_COOKIE=secret -e REPLACE_OS_VARS=true -p 8080:8080 --name timetracking leifg/time_tracking:1.8.3
Now our app is technically running. There is just no way to access it. For outside access you need to assign and IP address. Hyper has something called floating IP. You will get an IP that you can then assign to single containers.
hyper fip allocate 1 126.96.36.199
In addition to that we will assign a name to our created ip:
hyper fip name 188.8.131.52 timetrackingip
The last step is to attach our running container.
hyper fip attach timetrackingip timetracking
Now the container is accessible from the internet. Let's test it:
$ curl -I 184.108.40.206:8080 HTTP/1.1 401 Unauthorized server: Cowboy date: Sun, 06 Aug 2017 19:22:27 GMT content-length: 0 cache-control: max-age=0, private, must-revalidate x-request-id: rpo580p0hg64g7cbrkg97o3b5amsiacv www-authenticate: Basic realm="Private Area"
This is a very simple solution, as all the HTTP handling is done directly by Cowboy. In a real world scenario you probably want to have an nginx in front of your application server. You also probably want to have some kind of load balancing. Hyper's Service Solution is something to consider for that.
For now we will stick with a static IP addriss exposed via HTTP.