Enamored with the idea of rapid deployment, I've been running trying out Dokku for the site I'm currently working on - reactorbase.com. Now is a better time than ever, as you can get a droplet with dokku preinstalled up and running in mere seconds on Digital Ocean.

It's truly magic, and deploying apps is amazingly easy...except for one thing:

My app would always start up on a sequentially increasing port, ie reactorbase.com:4915, reactorbase.com:4916, etc.

This is due to the fact that dokku, as installed at Digital Ocean, uses nginx for routing. When the nginx instance in the install sees that the app is running without a virtual host file, it will automagically assign a sequential port to process.env.PORT, which your app is likely (and should be) using to access.

However, I was determined to solve this since my

My process:
  • My app was running under the name hackers-node, instead of being named after the domain name (reactorbase.com), as recommended in this great article I regrooved my git dokku remote to push to an app named reactorbase.com as below:
    git remote rm dokku
    git remote add dokku dokku@[myip]:reactorbase.com and created an appropriate db on dokku dokku mongodb:create reactorbase.com Unfortunately, I still had a few issues, so...

  • Digital Ocean recommended that I look at my nginx config file, and referred me to this github article. Within it's recommended that you edit the nginx.conf for your site. However, I noticed I didn't have one, which lead me to...

  • The final key for me was creating a VHOST file for my app in the dokku home directory. I found this article after searching a fair bit, and it seems that this file will tell nginx that it should run the app under the default http port (80) for the domain.
    The actual process was easy enough:
    cd /home/dokku vim VHOST
    then editing the VHOST file I just created to contain the single line
    reactorbase.com and restarted nginx to reload all config
    nginx -s quit nginx

After the steps above, it was just a push away - I repushed to dokku from my git repository (git push dokku master), and voilĂ  - movie sign.


dokku , deployment

About the author
comments powered by Disqus