Skip to content

Installation

sonsoleslp edited this page Aug 19, 2020 · 6 revisions

Dependencies

sudo apt install git-all
  • Install node (10.x.x) with npm.
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt update
sudo apt -y install nodejs
  • Install postgres or any other supported DB (MySQL, MariaDB, SQLite and Microsoft SQL Server).
sudo apt-get update
sudo apt-get install postgresql postgresql-contrib

External services

Download and install Escapp

  • Clone this repository:
git clone http://github.com/ging/escapp
cd escapp
  • Install code dependencies:
npm install
  • Create user and database:
sudo -i -u postgres
psql
create database escapp_prod;
create user loguser with encrypted password 'xxxxxx';
grant all privileges on database escapp_prod to loguser;
\q
exit
  • Create database tables:
npm run migrate_local
  • [ Optional ] Seed database (only in development):
npm run seed_local
  • Configure environment variables in .env file:
DATABASE_URL=postgres://xxxxxx@localhost/escapp_prod
CLOUDINARY_URL=...
SENDGRID_API_KEY=...
APP_NAME=myserverurl.com
PORT=80
  • Run the server in development mode
npm run dev

Deploy to production

  • Save SSL certificates in:
/etc/ssl/private/key.pem
/etc/ssl/certs/cert.pem
/etc/ssl/certs/DigiCertCA.pem
  • Set the NODE_ENV environment variable to production:
export NODE_ENV=production
  • Run the server:
npm run start_production
  • [ Optional ] Install foreverand run the server with forever:
sudo npm install -g forever forever-monitor
sudo npm run start_production_forever

# Update escapp to the latest version

cd escapp
git pull origin master
npm install
npm run migrate_local
sudo forever stopall
sudo npm run start_production_forever