Created
May 21, 2022 06:10
-
-
Save PeterHindes/d53811d57fbf9fddecacf7bf2c54a21a to your computer and use it in GitHub Desktop.
Docker Compose With Haproxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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