Dokku is an open-source Platform as a Service (PaaS) that simplifies application deployment using Docker containers. Dokku is one of the available operating systems for VPS at Hostinger. Installing the Dokku template on your VPS allows you to easily manage and deploy applications.
If you don’t have a VPS yet, check the available options here: Dokku VPS hosting
Here’s a step-by-step guide to get you started, with a sample Getting Started Ruby App:
Step 1 – Connect to your VPS
Use SSH to access your VPS. Open your terminal and run:
ssh root@your_vps_ipReplace your_vps_ip with your VPS’s IP address. Enter your VPS password when prompted.
Step 2 – Verify Dokku Installation
After logging in, ensure Dokku is installed by checking its version:
dokku versionIf Dokku is installed correctly, this command will display the installed version.
Step 3 – Finish configuring Dokku for VPS
you can use any domain you already have access to, this domain should have an A record or CNAME pointing at your server’s IP:
dokku domains:set-global example.vpsor you can also use the IP of your server:
dokku domains:set-global 222.222.22.22On your local machine (not VPS) run:
cat ~/.ssh/your_key.pub | ssh root@your_vps_ip dokku ssh-keys:add namereplace your_key.pub with your local SSH public key, your_vps_ip with your VPS IP and name with a preferred name. Enter your VPS password when prompted.
Step 4 – Create a Dokku Application
Download Ruby Getting Started application on your local machine:
git clone https://github.com/heroku/ruby-getting-startedReturn to your VPS terminal and run this command:
dokku apps:create ruby-getting-startedThis initializes an app on Dokku with the specified name (replace ruby-getting-started with your desired app name)
Dokku by default does not provide datastores (e.g. MySQL, PostgreSQL) on a newly created app.
The Getting Started app requires a PostgreSQL service, so install the plugin and create the related service as follows:
sudo dokku plugin:install https://github.com/dokku/dokku-postgres.gitAfter that, run the following:
dokku postgres:create railsdatabaseReplace railsdatabase with a preferred name.
Then link your app with a database:
dokku postgres:link railsdatabase ruby-getting-startedOn your local machine run:
cd ruby-getting-started
git remote add dokku dokku@your_vps_ip:your_application_name
git push dokku mainReplace your_vps_ip with a your VPS IP address and your_application_name with your created application name.
The remote username must be dokku or pushes will fail
After running git push dokku main, it should start building the app and give you a domain or IP address to enter your app.
Step 5 – Access Your Application
Once Dokku completes the build and deployment, your app should be accessible at:
-
http://your_server_ip:portif you don’t have a domain set up. -
http://your_app_name.yourdomain.comif you’ve configured a domain for Dokku.
You can also check the terminal and search for the Application deployed: http://your_server_ip:port
That it! Your Getting Started application is ready to be accessed!
For comprehensive documentation and advanced configurations, visit the Dokku Documentation.