Hi,
I’ve recently set up an instance with Dokku, and deployed a Rails application running on PostgreSQL with the help of dokku-pg-plugin. Everything works perfect.
However, I would like to spin up another droplet to specifically run the database in a container, without forgoing Dokku. Anyone has experience doing something like that? From what I see dokku-pg-plugin does not have documentation on how to link apps across servers.
Thank you!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
If you are running the database on a separate server, your best bet would be to design your app in such a way that it determines the Postgres connection information from environment variables. This way you are able to use Dokku’s built in config managment. It is also a general best practice.
Your database.yml would look something like:
production:
adapter: postgresql
encoding: unicode
database: dbname
pool: 5
username: user
password: <%= ENV['DB_PWD'] %>
host: <%= ENV['DB_HOST] %>
port: <%= ENV['DB_PORT'] %>
You would then set the configuration in Dokku with:
dokku config:set myapp DB_HOST=1.1.1.1 DB_PWD=thisisasecret DB_PORT=5432
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.