Skip to content

A complete ready to go boilerplate api and docs with 3 express workers behind Nginx load balancer and a shared Postgres database across workers, all containerized using Docker

KorayGocmen/Express-Postgres-Nginx-Docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Express-Postgres-Nginx-Docker

Dependencies:

Install Docker

[Docker] https://www.docker.com/ 

Running the app:

First Time:

Builds the app and starts all the containers

$ bash run.sh build

Running:

Runs all the containers

$ bash run.sh run

Recreate Apidocs

Recreates apidocs from the controllers under /routes

$ bash run.sh apidoc

Run Dev Server

Runs the database container and one app instance

$ bash run.sh dev

Deploying to Digital Ocean

You only need to run three commands on the droplet you create

You will need at least 1GB box (postgres needs at least 1GB to handle 3 connections)
I suggest a Ubuntu 16.04x64 box (1GB/1CPU, 30GB SSD, 2TB Transfer)
$ git clone https://github.com/KorayGocmen/Express-Postgres-Nginx-Docker.git app
$ cd app
$ bash deploy.sh

  • App containers do not start with npm start, they start with pm2-docker start
  • Migrations are runned automatically by starting the app sequelize db:migrate

by Koray Gocmen

About

A complete ready to go boilerplate api and docs with 3 express workers behind Nginx load balancer and a shared Postgres database across workers, all containerized using Docker

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published