How to install Mongo Express in your guebs hosting plan

11 de febrero, 2019 @ 16:52 — 0 comentariosDownload PDF

If you have reached this guide through a search engine, please note that this guide is intended for accommodation services nodejs from guebs.com. The general concepts remain valid for any application, but the specific steps apply to the guebs.com service.

This guide, developed around August 2017, is intended for version 0.42.1 of Mongo Express, which is a MongoDB collection management tool.

First we must create a subdomain to host the application. This subdomain will be called "mexpress" throughout this guide. Therefore, the subdomain will be called mexpress.yourdomain.com.

How to access your Hosting Panel

Once you have created your domain, you must create the nodejs application from the hosting panel.call it also mexpress .

How to deploy a NodeJs application

Today it is possible to use the latest LTS version of this software to launch this application, so you can use version 6 of this software. Now you just need to log in via ssh to your hosting plan to launch the application.

How to access your hosting via SSH

Now you must enter the nodejs/mexpress directory and clone the application:

cd ~/nodejs/ ; rm -rf mexpress ; git clone https://github.com/mongo-express/mongo-express.git mexpress ; cd mexpress

Now npm will install the necessary modules:

npm install

With this, we'll have everything we need installed. Now we have to prepare the static files and the connection configuration.

  • In order for the system to find the static resources that come as standard in the Mongo Express distribution, in such a way that the situation is adapted to the public/ directory from which they will be served, we must execute this command:
cp -a build public/public
  • To configure the connection to the database, we will use the method through a connection url. First copy the default configuration file and then edit the configuration file:
cp -a config.default.js config.js

We are looking for the following line

connectionString: process.env.ME_CONFIG_MONGODB_SERVER ? '' : process.env.ME_CONFIG_MONGODB_URL,

and leave it as follows:

connectionString: 'mongodb://usuario:password@mongodb.guebs.net/colection',

Where in the place of user and password you will have to put the data corresponding to a real MongoDB user that you have created previously from the Hosting Panel.

Once we call the subdomain, we will find the application connected to our database. By default there is an additional authentication with the user name 'admin' and the password 'pass', which you can modify by editing the following lines of the config.js file

basicAuth: {
 username: process.env.ME_CONFIG_BASICAUTH_USERNAME || 'admin',
 password: process.env.ME_CONFIG_BASICAUTH_PASSWORD || 'pass',
 },

Following these steps, the application will be available:

Translated with www.DeepL.com/Translator

Etiquetas: