Dokku - Add domain after setup

user3215609 picture user3215609 · Feb 14, 2014 · Viewed 11.3k times · Source

I installed Dokku on my Digital Ocean droplet, but did it before setting my dns records, so Dokku was installed on IP. Now I changed my dns record, so site can be accessed through site.com. I can access my previously created Dokku containers through site.com:port, how can I change Dokku settings to access my app like this - appname.site.com

Answer

shirkey picture shirkey · Mar 11, 2014

Per https://github.com/progrium/dokku:

Set up a domain and a wildcard domain pointing to that host. Make sure /home/dokku/VHOST is set to this domain. By default it's set to whatever hostname the host has. This file is only created if the hostname can be resolved by dig (dig +short $(hostname -f)). Otherwise you have to create the file manually and set it to your preferred domain. If this file still is not present when you push your app, dokku will publish the app with a port number (i.e. http://example.com:49154 - note the missing subdomain).

To fix the issue, you will first need to update the /home/dokku/VHOST file, adding the domain name -- this will fix any newly generated deployments, but existing apps will need to be deleted from the /home/dokku directory by name (/home/dokku/foo, /home/dokku/bar, etc.) and redeployed for this change to take effect, since each Dokku application has a separate nginx.conf within those /home/dokku/ paths and those will need to be re-written.