We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Learn how to – How To Setup your Heroku PaaS using CapRover

Learn how to – How To Setup your Heroku PaaS using CapRover.

“If you have two friends in your lifetime, you’re lucky. If you have one good friend, you’re more than lucky.”
― S.E. Hinton

If this is not one of the most robust, free, rich and informative era ever then I cannot think of any other time in history adorned with the wealth of technology as this one. If you would wish to accomplish anything, this era wields the most virile grounds to nourish, nurture and aid the sprouting, the growth and the maturity of your dreams. You can literaly learn to be what you would wish to be in this age.

That being said, this disquisition takes on a quest to get you into setting up something similar to Heroku on your own environment. We shall get to know what Heroku is then get off the dock and sail off towards our goal of having such an environment.

The proliferation of cloud technologies brought with it many opportunities in terms of service offerings. First and foremost, users had the ability to get as much infrastructure as they could afford. Users can spawn servers, storage and network resources ad libitum which is popularly known as Infrastructure as a service. Then comes the second layer that sits on the infrastructure. It could be anything, cloud identity service, cloud monitoring server et cetera. This layer provides ready made solutions to people who might need them. This is known as software as a service. I hope we are flowing together this far.

In addition to that there is another incredible layer that is the focus of this guide. It is a layer that targets developers majorly by making their lives easier on the cloud. In this layer , developers only concentrate on writing code and when they are ready to deploy, they only need to commit their ready project in a source control platform like GitHub/GitLab and the rest is done for them automatically. This layer provides a serverless layer to the developers since they do not have to touch the messy server side stuff. This layer as you might already have guessed is known as Platform as a Service (PaaS). Heroku is one of the solutions that sits on this layer.

In this guide, are going to setup a platform that is similar to Heroku on your own infrastructure. As you know, you cannot download and install Heroku on your server. It is an online cloud service that you subscribe to. We will use Caprover to setup our own private Platform as a service (PaaS).

CapRover is an extremely easy to use app/database deployment & web server manager for your NodeJS, Python, PHP, ASP.NET, Ruby, MySQL, MongoDB, Postgres, WordPress and even more applications.

Features of Caprover

  • CLI for automation and scripting
  • Web GUI for ease of access and convenience
  • No lock-in! Remove CapRover and your apps keep working!
  • Docker Swarm under the hood for containerization and clustering
  • Nginx (fully customizable template) under the hood for load-balancing
  • Let’s Encrypt under the hood for free SSL (HTTPS)
  • One-Click Apps: Deploying one-click apps is a matter of seconds! MongoDB, Parse, MySQL, WordPress, Postgres and many more.
  • Fully Customizable: Optionally fully customizable nginx config allowing you to enable HTTP2, specific caching logic, custom SSL certs and etc
  • Cluster Ready: Attach more nodes and create a cluster in seconds! CapRover automatically configures nginx to load balance.
  • Increase Productivity: Focus on your apps! Not the bells and whistles just to run your apps!
  • Easy Deploy: Many ways to deploy. You can upload your source from dashboard, use command line caprover deploy, use webhooks and build upon git push

Caprover Pre-requisites

Caprover runs as a container in your server which can be any that supports containerization. Depending on your preferences, you can use Podman or Docker to pull and run Caprover image. For this example, we are going to use Docker. In case you do not have Docker installed, the following guides listed below will be there to help you set it up as fast as possible.

Once Docker Engine has been installed, add your user account to docker group:

sudo usermod -aG docker $USER
newgrp docker

Another pre-requisite is a wildcard domain name pointed to the IP of your server where Caprover Server will be running.

Setup your Heroku PaaS using CapRover

Once the pre-requisites are out of the way, the only task remaining now is to set up our Caprover and poke around its rooms just to see what it has to offer. The following steps will be invaluable as you try to get it up and running.

Step 1: Prepare your server

Once Docker is installed, you can install all of the applications you need during your stay in the server. They include an editor and such kind of stuff.

##On CentOS
sudo yum update
sudo yum install vim git curl 

##On Ubuntu
sudo apt update
sudo apt install vim git curl

That was straingtforward. Next, let us pull Caprover image to set the stone rolling

Step 2: Pull and execute Caprover Image

We are going to cover the installation of Caprover depending on where your server sits.

Scenario 1: Installation on a local server without Public IP

Install dnsmasq

After all, as mentioned in the pre-requisites section, we shall need a small DNS server to resolve domain names since Caprover is so particular with it. In case you have a local DNS server that supports wildcard domains, then you are good to go. You can skip the DNS setup part. In case you do not have it, install lightweight dnsmasq as follows:

sudo yum -y install dnsmasq

After dnsmasq is successfully installed, start and enable the service.

sudo systemctl start dnsmasq 
sudo systemctl enable dnsmasq 

Add Wildcard DNS Recod

Once dnsmasq is running as expected, we can go ahead and add the configs and wildcard domain name as shown below:

$ sudo vim /etc/dnsmasq.conf

Replace the IPs therein with yours accordingly.

Then restart dnsmasq

sudo systemctl restart dnsmasq

Test if it works

We shall use the dig utility to test if our configuration works

$ dig @ test.caprover.example.com

; <<>> DiG 9.11.20-RedHat-9.11.20-5.el8 <<>> @ test.caprover.example.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 32435
;; flags: qr aa rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;test.caprover.example.com.     IN      A

test.caprover.example.com. 0    IN      A

And it does!!

Next, since we are going to install Caprover on a local server, we will have to tweak our installation a little bit. We will create a directory and inject some configs into it then run our image with an environment variable that will represent the Public IP though it is a private IP. Proceed as follows

sudo mkdir -p /captain/data/
echo  "{"skipVerifyingDomains"":""true""}"" | sudo tee -a  /captain/data/config-override.json

After that


Your Cart is Empty

Back To Shop