cft

How to Set Up Your Own PaaS Within Hours

Five simple steps to quickly set up your very own private PaaS environment using available free open-source technologies


user

Jimmy Soh

3 years ago | 3 min read

There are many useful and free open-source software on the Internet, we just need to know where to look.

The PaaS setup that I’m going to recommend works well for private/on-premise setup as well. There’s no coding involved, just some CLI configurations.

Having your own PaaS is useful if you’re running a team of engineers requiring flexibility, privacy, and data ownership. I mainly use it for rapid prototyping purposes and hosting my own suite of web applications with minimal traffic.

I would not recommend this setup for production purposes with high load unless you really know what you’re doing.

I’ll keep the article short and list down the high-level steps as the instructions on the websites are very easy to follow. I’ve done a couple of setups with minimal issues and they are usually done within a few hours.

Assuming you’re starting from scratch with the intent to deploy in the cloud, here are the five simple steps:

  1. Setup a cloud account and rent a VM (e.g. AWS/EC2)
  2. Register a domain from a provider (e.g. AWS Route53)
  3. Set up the PaaS by following simple steps (CapRover)
  4. Create and deploy open-source applications out of the box (Wordpress, Jenkins, GitLab, and many more)
  5. Configure backups just in case

Please note that I’m not paid in any way by any of the companies listed in this article. I’m recommending them soley based on positive experiences.

#1: Setup a cloud account and rent a VM

You’ll need a virtual machine to host the applications. There are a variety of cloud providers that you can choose from. Here are some of the popular ones with 1-year free-tier option(s)/credits:

You can click on any of the above links to set up a new free account.

After creating the account, provision a virtual machine—recommended server setup to be Ubuntu 18.04 with at least 1GB RAM.

#2: Register a domain name

Applications will be deployed under a sub-domain, e.g. appone.apps.domain.com, apptwo.apps.domain.com, etc. so it’s essential to have your own domain.

Here are some websites which I’ve used for my domains:

If you’re using a cloud provider, e.g. AWS/Azure, it may be more convenient to register your domain with them to have everything managed centrally.

#3: Set up the PaaS

This section forms the main bulk of the setup. Although there are a number of available open-source PaaS available, e.g. Dokku, CapRover, Flynn, etc. I’ll be using CapRover as an example.

I’ll further break down this portion into four steps:

  1. SSH into your VM
  2. Install and setup docker
  3. Install npm
  4. Install and setup CapRover

The steps above should get your PaaS up and running.

#4: Create and deploy applications

Here comes the fun part. After logging into the CapRover dashboard, navigate to the Apps screen via “Apps” at the left sidebar.

Click on the “One-Click Apps/Databases” button.

Image by Author
Image by Author

You can then select from a list of applications to deploy by following the wizard—instructions vary from app to app.

Image by Author
Image by Author

If you prefer to deploy an application that’s not in the list, e.g. Kong API Gateway, SuiteCRM, etc. You’ll mainly need the Docker file for the application. Here are the steps:

Step 1: Create a New App

Image by Author
Image by Author

Step 2: Navigate to “Deployment”

Image by Author
Image by Author

Step 3: Paste Docker File Contents in Method 4 and Click Deploy

Below is the sample of the docker file I pasted.
Below is the sample of the docker file I pasted.

Do note that you’ve to first create a PostgresDB via “One-Click-Apps” and update the KONG_PG_* parameters in the docker file. The PostgresDB URL can be obtained via the “HTTP Settings” tab of your PostgresDB App in CapRover.

FROM kong

USER root

RUN apk add --no-cache git

ENV KONG_DATABASE postgres
ENV KONG_PG_HOST <<YOUR PG URL>> e.g. srv-captain--kong-database-db
ENV KONG_PG_PASSWORD <<YOUR PG PASSWORD>> e.g. k0ngPas5
ENV KONG_PG_USER <<YOUR PG USER>> e.g. kong
ENV KONG_PROXY_ACCESS_LOG "/dev/stdout"
ENV KONG_ADMIN_ACCESS_LOG "/dev/stdout"
ENV KONG_PROXY_ERROR_LOG "/dev/stderr"
ENV KONG_ADMIN_ERROR_LOG "/dev/stderr"
ENV KONG_ADMIN_LISTEN "0.0.0.0:8001, 0.0.0.0:8444 ssl"

CMD ["kong", "start", "--v"]

That’s all! You can also deploy apps via other methods, e.g. via Github/Bitbucket/Gitlab, etc. by stitching up with your DevOps pipeline.

#5: Configure backups

There are times whereby I messed up my configurations, especially when playing around with the “cluster setup” feature. Having backups configured has saved me a ton of time troubleshooting and resolving issues—especially related to docker swarm.

For AWS platform users, you can configure automatic backups for your EBS volumes via Lifecycle Manager. I’ve adopted a simple daily backup policy with 2 days retention period. You may wish to configure more frequent backups with longer retention period during the experimentation phase as there’s a higher chance of things going wrong.

Users from other platforms can search for the respective backup methods and policies online. The idea is to configure frequent backups—I’ve learnt things the hard way and I hope you don’t have to go through the same problems.

Upvote


user
Created by

Jimmy Soh

In perpetual beta—playing at the intersection between digital technology and business.


people
Post

Upvote

Downvote

Comment

Bookmark

Share


Related Articles