DEV Community

vanishingstar
vanishingstar

Posted on

I found this tool that helps you migrate your apps from Heroku to DigitalOcean in 10min and save money!

Any backend developer knows that Heroku provides an awesome and easy platform for deploying app. You simply create an account, create an app, and git push takes care of the rest! You app automatically becomes accessible on the web.

The main problem with Heroku is their pricing. Once you are past the free tier, the pricing sky rockets and gets really really really expensive. Another problem is the rigidness of the platform. It’s very opinionated and doesn’t let you to do custom things such as adding nginx caching and etc.

For these reasons, I started looking into moving my apps to a simple VPS (virtual private server). DigitalOcean is the most user-friendly VPS provider. Other players in the market, such as AWS, do not provide an easy to use interface for beginners. Compared to Heroku, DigitalOcean is super cheap. On Heroku you pay 25$ for 1GB RAM, on DigitalOcean, you pay $5. That’s it! Long story short, although DigitalOcean is cheaper, but you have to manually setup nginx, setup routing and etc. It’s a relatively straightforward process, but it’s tedious.

This was the case, until I found CapRover. This tool auto-magically turns a DigitalOcean instance to a Heroku clone instance! I am currently paying 5$ for 1GB of RAM and I host multiple apps and databases on my VPS. The entire setup took around 10 minutes for me!

Step 1) Setup your Server

CapRover installation is super easy on DigitalOcean. You can just click on this link (from CapRover docs) to create a CapRover instance. It also comes with $100 free credit if you don’t have a DigitalOcean account.

https://marketplace.digitalocean.com/apps/caprover?action=deploy&refcode=6410aa23d3f3

After you create your droplet, go to DigitalOcean dashboard and you will see this:

do1

Now, open your browser and type http://IP-ADDRESS:3000 and log in with the default password: captain42

Make sure to replace IP-ADDRESS with the IP address of your VPS, the yellow box in the screenshot above. After logging in, you see a dashboard like this:

sc1

If you can see this dashboard, installation was good. Now, you need to update our domain.

Step 2) Setup your Domain

You need to setup a wildcard A record entry in your DNS. If that sounds complicated to you, don’t worry, steps are pretty simple. Assuming you already have a domain name registered, you can set up a wildcard entry on your DNS settings. For example, on GoDaddy, you simply click on Manage DNS from the “Manage Domain” page.

gd

Then, you just add an A record pointing to your server. Host or name value should be *.vps , IP or value should be the IP address of your VPS. Type should be “A”. And TTL can be anything, usually 600sec. Assuming IP address of your VPS is 123.123.123.123, this is the result that you will see on GoDaddy:

records

Now that you’ve set up the wildcard domain, you can finish the setup using CLI.

Step 3) Final setup

Install CapRover command line tool using npm i -g caprover and run caprover serversetup . Just answer questions and your server will be set up for you!

PROTIP: If you are unfamiliar with npm, you can also use the dashboard to setup your server (setup the root domain, enable https, force https, and change password).

Congratulations! You now have a fully functional clone of Heroku!

Let’s create a test app from the dashboard:

app

Next, download one of the CapRover sample apps. NodeJS, Python, and etc are available for download from here:

https://github.com/caprover/caprover/tree/master/captain-sample-apps

Click on the sample app and then click on download button. Once you’ve downloaded the tar file, go to the deployment tabs, and drag and drop, one of the CapRover test apps into the upload box.

deploy

Wait a few seconds until the app is built. Then you can access your app using http://appname.server.domain.com

This is just the tip of the iceberg. CapRover has many other functionalities, one-click enabling of https for your apps, supporting many custom domains for your app, one-click database and app deployments (such as wordpress) and many more.

See more details on https://caprover.com/

this article was originally published on Medium

Top comments (0)