DEV Community

James Murdza
James Murdza

Posted on • Edited on

3

Host your own PaaS (platform as a service) on Amazon Web Services

Dokku is an open-source PaaS that allows you to deploy and host multiple applications on a single server. Its functionality is similar to the backend of a service like Heroku, managing tasks such as scaling, load balancing, and database management.

Here's how you can set up Dokku from scratch on AWS:

Deployment

1. Launch the server

In the AWS control panel, create a new EC2 instance.

  • Select Ubuntu 12
  • Create a new SSH key pair
  • Allow public SSH, HTTP, and HTTPS access to the server

2. Configure DNS

Let's assume your domain is mydomain.com, and you want to host applications as appname.mydomain.com.

In your DNS control panel, create two records:

  • A Record pointing @ to the EC2 instance's public IP address
  • A Record pointing * to the EC2 instance's public IP address

3. Setup the server

SSH into the EC2 instance and install Dokku:

wget -NP . https://dokku.com/bootstrap.sh
sudo DOKKU_TAG=v0.34.6 bash bootstrap.sh
dokku domains:set-global mydomain.com
cat ~/.ssh/authorized_keys | dokku ssh-keys:add admin
Enter fullscreen mode Exit fullscreen mode

Your Dokku server should now be up and running! If you want, you can use the following steps to test your installation and see how Dokku works.

Testing that it works

1. Create a test application

On the same EC2 instance, run:

dokku apps:create myapp
sudo dokku plugin:install https://github.com/dokku/dokku-postgres.git
dokku postgres:create railsdatabase
dokku postgres:link railsdatabase ruby-getting-started
Enter fullscreen mode Exit fullscreen mode

2. Set up SSH authentication

On your local machine, add the following to .ssh/config:

Host mydomain.com
    HostName mydomain.com
    User dokku
    IdentityFile ~/ServerKey.pem
Enter fullscreen mode Exit fullscreen mode

3. Deploy a test application

Then, on your local machine, run these commands to deploy a test application:

git clone https://github.com/heroku/ruby-getting-started
cd ruby-getting-started
git remote add dokku dokku@example.com:myapp
git push
Enter fullscreen mode Exit fullscreen mode

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

Top comments (0)

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay