Coder Social home page Coder Social logo

jasiri_node's Introduction

JASIRI SIMULATION

  • Nodejs and HAPIJS project for managing users and their contacts

PROCESS AND STEP FOR HOSTING THIS APPLICATION ON UBUNTU LINUX SERVER

STEP 1: INSTALL REQUIRED LIBRARIES

INSTALL NODEJS

install NodeSource PPA

  curl -sL https://deb.nodesource.com/setup_14.x -o nodesource_setup.sh 

  sudo bash nodesource_setup.sh

  sudo apt install nodejs

Check node version

 node -v

Install build-essential for packages that require compiling from source

sudo apt install build-essential

Pull application from git


Enter in project root directory and install all dependencies

  npm install

Try to run the project to check if it will start

 npm start
  • after project start you try access it on server IP ADDRESS on port 4000 If it works you can stop it for the next process

STEP 2 PREPARE .env File


  • This project Use Mongodb as DBMS,DATABASE_URL should be a link to mongoDB database

    Below are the required environment variables

PORT=[PORT]
DATABASE_URL=[LINK_TO_CONNECT_TO_DB]
SESSION_PASSWORD=[PROJECT_SESSION_PASSWORD]

STEP 3: Install PM2 (Process manager for Nodejs)

Install PM2 while still in projects root folder

sudo npm install pm2@latest -g

Allow project to be managed by PM2

start the application With PM2

 pm2 start app.js
  • It should output a table which has a column status=online Enable application to run on system startup

    pm2 startup systemd

  • With a new version of PM2 it will create and save PM2 process list no additional steps Start PM2 service which will in turn run the projects

sudo systemctl start pm2-[current system user]

check PM2 service status

systemctl status pm2-sammy

Check project status with pm2

pm2 monit
  • At this point if everything is okay the project is accessible on server public IP

STEP 4: SET UP NGINX FOR REVERSE Proxy and assign domain if you have one

Create NGINX CONFIG FILE

sudo nano /etc/nginx/sites-available/jasiri.com
  • copy following in the file
 server {
 location / {
 proxy_pass http://localhost:[port];
 proxy_http_version 1.1;
 proxy_set_header Upgrade $http_upgrade;
 proxy_set_header Connection 'upgrade';
 proxy_set_header Host $host;
 proxy_cache_bypass $http_upgrade;
 }
 }

Load configurations

sudo nginx -t

restart NGINX

sudo systemctl restart nginx

Application should be accessible on public IP Address or server domain name

jasiri_node's People

Contributors

ndahigeze avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.