Skip to content

Instantly share code, notes, and snippets.

@mrob11
Created December 16, 2016 13:40
Show Gist options
  • Save mrob11/f494517ffec39830fb64920bb4e5c133 to your computer and use it in GitHub Desktop.
Save mrob11/f494517ffec39830fb64920bb4e5c133 to your computer and use it in GitHub Desktop.
My multi-process node.js project setup
# I run the other services I need (database, redis, etc.) using Docker
# and I orchestrate them with this docker-compose.yml file.
version: '2'
services:
data:
image: busybox
volumes:
- rethinkdb:/data
rethinkdb:
image: rethinkdb:2.3.5
depends_on:
- data
volumes_from:
- data
ports:
- 8080:8080
- 28015:28015
redis:
image: redis:3.0.7-alpine
ports:
- 6379:6379
volumes:
rethinkdb:
apps:
- script: ./api/index.js
name: api
watch: true
ignore_watch:
# in each app, I ignore the files of other apps so that changes to one
# don't trigger unnecesarry restarts in others
- .git/**/*
- ./sockets/**/*
- ./queue/**/*
- ./admin/**/*
env:
NODE_ENV: development
- script: ./sockets/index.js
name: sockets
watch: true
ignore_watch:
- .git/**/*
- ./queue/**/*
- ./api/**/*
- ./admin/**/*
env:
NODE_ENV: development
DEBUG: socket.io:*,sockets
- script: ./queue/index.js
name: queue
watch: true
env:
NODE_ENV: development
DEBUG: queue
ignore_watch:
- .git/**/*
- ./sockets/**/*
- ./api/**/*
- ./admin/**/*
- ./queue/node_modules/kue/**/*
- script: ./admin/index.js
name: admin
watch: true
cwd: ./admin/
env:
NODE_ENV: development
ignore_watch:
- .git/**/*
- ./sockets/**/*
- ./api/**/*
- ./queue/**/*
- app/**/*
# here I ignore the app/ folder because this is a
# front-end application and I don't want to restart the node process.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment