Skip to main content
All CollectionsVPSVPS OS and Templates
Getting Started guide with Dokku template on a VPS
Getting Started guide with Dokku template on a VPS

How to get started with Dokku template on Hostinger VPS

Updated over a week ago

Dokku is an open-source Platform as a Service (PaaS) that simplifies application deployment using Docker containers. Installing the Dokku template on your VPS allows you to easily manage and deploy applications. 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_ip

Replace 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 version

If 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.vps

or you can also use the IP of your server:

dokku domains:set-global 222.222.22.22

On your local machine (not VPS) run:

cat ~/.ssh/your_key.pub | ssh root@your_vps_ip dokku ssh-keys:add name

replace 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-started

Return to your VPS terminal and run this command:

dokku apps:create ruby-getting-started

This 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.git

After that, run the following:

dokku postgres:create railsdatabase

Replace railsdatabase with a preferred name.

Then link your app with a database:

dokku postgres:link railsdatabase ruby-getting-started

On your local machine run:

cd ruby-getting-started
git remote add dokku dokku@your_vps_ip:your_application_name
git push dokku main

Replace your_vps_ip with a your VPS IP address and your_application_name with your created application name.

Note: 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:port if you don’t have a domain set up.

  • http://your_app_name.yourdomain.com if 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.

Did this answer your question?