Mantra how-to guide

Deploy a Mantra project with Digital Ocean

Digital Ocean is a cloud provider featured by being fast with competitive costs and reliable.

14-Mar-2022
A  A  A 

Among all cloud providers out there (Azure, AWS, Google Cloud, etc.), Digital Ocean is a good option to try because it is fast, easy to use and trustworthy.

You can install Mantra in any environment: from local premises to cloud or in an hybrid solution. According to your project requirements and scalability, you need to use the best deployment environment that fits better to it.

Obviously, you can also configure your Mantra project to run in a docker instance image.

This site, for instance, is deployed at Digital Ocean, a simple cloud service featured by its good costs and easy to use. We also like Digital Ocean because it has lots of articles and a very good documentation with lots of samples.

What we want to point out in this how-to, is just to show that the deployment process can be done in a few steps.

In Digital Ocean, you can create a new instance of a virtual machine with some clics; in this environment, they call it a droplet. The costs of a simple droplet (1GB of RAM, 25GB SSD and 1000GB of data transfer), based on any Linux flavour, is around 5$/month at the time of writing this.

Here are the basic steps to deploy a Mantra project in a new machine:

  • Install GIT as your version control tool.

  • Install NPM.

  • Download and install Mantra.

  • Download the project to install.

  • According to your data persistance type, install it (MySql, MariaDB, PostgreSql, etc.). Sqlite doesn't need to be installed because Mantra incorporates it. You can also use a managed database from Digital Ocean.

  • Install the version of Node.js you need.

  • Finally, download your project and install it after modifying entities providers configuration, if needed, just with:

$ mantrad install

If your project implements a web user interface (or someones), then you'll need to install a reverse proxy to route the domains to the port to each application. We usually do this with Nginx. Just install it and configure the site with the right params. Read this good article to start with Nginx.

Finally, check some security recomendations according to your Linux distribution, like those ones in this other article.