I recently moved all my NodeJS App development hosting to Digital Ocean, i've been with them for around one month now and its been nothing short of amazing. They are so affordable and cutting edge at the same time, you can spin up/down, scale up/down using their simple dashboard and this makes scaling horizontally and vertically a breeze.
If you want to try them out, you can use the link below to get 10$ with which you can spin up two small servers (they call them Droplets) if you want or try one server for two months.
So, as mentioned I use Digital Ocean for my NodeJS app hosting. The specific Full Stack I use is very close to MEAN (but I currently dont use Angular).
I love how the Heroku platform lets you push to your server using GIT so I installed Dokku on the Digital Ocean server. Dokku pretty much lets you do all the things that Heroku lets you, and Digital Ocean even has this as a pre-built "Application Image" as well, which means you can spin up a new Linux machine with Dokku installed in around 1 min :) Amazing huh!
Also you should know that Dokku is built on top of Docker (which is the IN thing right now and it gives us isolated containers in a Linux machine, which is pretty amazing)
After I spun up a new "Droplet" with Dokku installed, the next step I had to do was to install MongoDB to work with the Dokku containers.
There are plenty of articles and walkthroughs on how to get started using Dokku, MongoDB in your Digital Ocean server so I don't want to reproduce any of this again. What I wanted to do was to list all the articles, tutorials, and solutions (to problems I encountered) so it will help others who are getting started.
Walkthroughs and Articles on the entire process to boot up a Digital Ocean Droplet with Dokku installed:
* Disclaimer: Most of these articles are at least a year old and should be followed with caution. Read all and then look for any new articles before attempting it. I found that they were enough for me to work things out but were a little out of date when it came to dealing with dokku and domain name configs.
After you have Dokku working, configure Dokku to work with Domains:
* Disclaimer: as mentioned the articles above are a bit old. The latest versions of Dokku have domain control built into it.
DO NOT install this dokku-mongodb-plugin as instructed by various articles as it will casue issues with your Dokku web server (Nginx). In case you accidentally installed it, read this topic on how to remove it safely.
After Dokku is running on the domain you want, and you want to move to MongoDB installation:
How to fix the dreaded "cannot allocate heap metadata" error when using Dokku:
After you have it all up and running, and are pushing your apps via Dokku to Digital Ocean, chances are that after a few days (or hours like it happened for me) you will come across this error when you try and push your code via GIT
This looks scary as hell, but all it means is that your have run out of working memory of your Droplet. Its very common if you are running multiple Dokku apps on one server. Dont worry, you can use what us known as a Linux Swap to increase your meomery and the errors goes away immediately.
OK, so thats the full list of links I used to get up and running to launch my new NodeJS Blogging Platform. The platform is powering this wisdomtoinspire.com blog in case you want to try it out, but more on this later :)
Happy coding everyone!
The best NodeJS Hosting Platform I've used so far... |
If you want to try them out, you can use the link below to get 10$ with which you can spin up two small servers (they call them Droplets) if you want or try one server for two months.
So, as mentioned I use Digital Ocean for my NodeJS app hosting. The specific Full Stack I use is very close to MEAN (but I currently dont use Angular).
I love how the Heroku platform lets you push to your server using GIT so I installed Dokku on the Digital Ocean server. Dokku pretty much lets you do all the things that Heroku lets you, and Digital Ocean even has this as a pre-built "Application Image" as well, which means you can spin up a new Linux machine with Dokku installed in around 1 min :) Amazing huh!
Also you should know that Dokku is built on top of Docker (which is the IN thing right now and it gives us isolated containers in a Linux machine, which is pretty amazing)
After I spun up a new "Droplet" with Dokku installed, the next step I had to do was to install MongoDB to work with the Dokku containers.
There are plenty of articles and walkthroughs on how to get started using Dokku, MongoDB in your Digital Ocean server so I don't want to reproduce any of this again. What I wanted to do was to list all the articles, tutorials, and solutions (to problems I encountered) so it will help others who are getting started.
Walkthroughs and Articles on the entire process to boot up a Digital Ocean Droplet with Dokku installed:
* Disclaimer: Most of these articles are at least a year old and should be followed with caution. Read all and then look for any new articles before attempting it. I found that they were enough for me to work things out but were a little out of date when it came to dealing with dokku and domain name configs.
- Dokku on digitalocean: Deploying Nodejs & MongoDB app
- This is a very useful video that I went back to multiple times as it helped to work out the series of steps needed for this.
After you have Dokku working, configure Dokku to work with Domains:
* Disclaimer: as mentioned the articles above are a bit old. The latest versions of Dokku have domain control built into it.
DO NOT install this dokku-mongodb-plugin as instructed by various articles as it will casue issues with your Dokku web server (Nginx). In case you accidentally installed it, read this topic on how to remove it safely.
After Dokku is running on the domain you want, and you want to move to MongoDB installation:
- dokku-mongodb-plugin
- This is the plugin you will need to have MongoDB working with Dokku.
- Dokku on digitalocean: Deploying Nodejs & MongoDB app
- This video again is very useful
How to fix the dreaded "cannot allocate heap metadata" error when using Dokku:
After you have it all up and running, and are pushing your apps via Dokku to Digital Ocean, chances are that after a few days (or hours like it happened for me) you will come across this error when you try and push your code via GIT
runtime: panic before malloc heap initialized fatal error: runtime: cannot allocate heap metadata
This looks scary as hell, but all it means is that your have run out of working memory of your Droplet. Its very common if you are running multiple Dokku apps on one server. Dont worry, you can use what us known as a Linux Swap to increase your meomery and the errors goes away immediately.
OK, so thats the full list of links I used to get up and running to launch my new NodeJS Blogging Platform. The platform is powering this wisdomtoinspire.com blog in case you want to try it out, but more on this later :)
Happy coding everyone!
No comments:
Post a Comment