Skip to content
A production oriented dockerized node.js/express.js app
JavaScript Nginx HTML CSS
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
config
models
nginx
public/stylesheets
routes
views
.dockerignore
.env.docker.sample
.env.sample
.gitignore
Dockerfile
LICENSE
README.md
app.js
docker-compose.yml
package.json
worker.js

README.md

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

You can’t perform that action at this time.