Skip to content

Instantly share code, notes, and snippets.

@PeterHindes
Created May 21, 2022 06:10
Show Gist options
  • Save PeterHindes/d53811d57fbf9fddecacf7bf2c54a21a to your computer and use it in GitHub Desktop.
Save PeterHindes/d53811d57fbf9fddecacf7bf2c54a21a to your computer and use it in GitHub Desktop.
Docker Compose With Haproxy
version : '3'
services:
ha:
image: haproxy
ports:
- "8080:8080"
- "8081:8081"
volumes:
- ./haproxy:/usr/local/etc/haproxy
ws1:
# image: wsapp
build: ws
# depends_on:
# redis:
# condition: service_healthy
environment:
- APPID=0001
volumes:
- ./ws/app/src:/home/node/app/src
ws2:
# image: wsapp
build: ws
# depends_on:
# redis:
# condition: service_healthy
environment:
- APPID=0002
volumes:
- ./ws/app/src:/home/node/app/src
ws3:
# image: wsapp
build: ws
# depends_on:
# redis:
# condition: service_healthy
environment:
- APPID=0003
volumes:
- ./ws/app/src:/home/node/app/src
ws4:
# image: wsapp
build: ws
# depends_on:
# redis:
# condition: service_healthy
environment:
- APPID=0004
volumes:
- ./ws/app/src:/home/node/app/src
redis:
image: redis
frontend ws
bind *:8080
mode http
timeout client 1000s
use_backend wsServers
backend wsServers
mode http
timeout server 1000s
timeout connect 1000s
server s1 ws1:8081
server s2 ws2:8081
server s3 ws3:8081
server s4 ws4:8081
# FOR DEV ENVIRONMENT
FROM node:latest
WORKDIR /home/node/app
# handled in compose with vol for dynamic remounts
# COPY ./app /home/node/app
RUN npm install npm@latest -g
# for hot reloading on save
RUN npm install nodemon -g
ADD ./app/package.json ./
RUN npm install
CMD npm run hotapp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment