Home
Softono
Express-Postgres-Nginx-Docker

Express-Postgres-Nginx-Docker

Open source JavaScript
16
Stars
7
Forks
0
Issues
0
Watchers
8 years
Last Commit

About Express-Postgres-Nginx-Docker

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

Platforms

Web Self-hosted Docker

Languages

JavaScript

Links

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