All Projects → damsonn → node-docker-compose

damsonn / node-docker-compose

Licence: MIT License
A production oriented dockerized node.js/express.js app

Programming Languages

javascript
184084 projects - #8 most used programming language
Nginx
273 projects
HTML
75241 projects
CSS
56736 projects

node-docker-compose

A production oriented dockerized node.js/express.js app. Explained in more details on my blog

Architecture

This app uses the following stack:

  • node.js and express.js
  • MongoDB database
  • nginx frontend server
  • redis
  • Kue worker

Prerequisites

This required docker, docker-machine and docker-compose installed on your local machine. More informations on Docker's website

Running locally

# creates a local host for docker containers, only do once
docker-machine create -d virtualbox local

# create your config secrets
cp .env.docker.sample .env.docker

# load the docker env
eval "$(docker-machine env local)"

# build web image
docker-compose build

docker-compose up -d

# run commands to load some test data
docker-compose run --rm app node bin/load-data

How can I make sure it works ?

  1. first you need to know your local docker machine ip, using docker-machine ls.
  2. Visit http://LOCAL_IP
  3. Check app or worker logs docker-compose logs app or docker-compose logs worker

Tutum

The big news is tutum has been acquired by Docker. Tutum is a could service to manage and deploy Docker applications. It uses a stack descriptor, which is compatible with docker-compose yaml format. So you can use my example project to deploy and mange your app with Tutum.

Considerations

docker compose is not deemed production ready. There are some limitations, mainly related to scalability. But I think it is fine for small applications. It is obviously much better to understand how docker compose works. more info on docker's website.

This template doesn't include tests or a build script. This is on purpose, to keep focus what's important here (docker).

Because of the way user gets created at startup on the mongo container, There will be a few exceptions on the app upon first start.

Credits

The template is based on node generator and node-express-mongoose-demo

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].