Last active
October 10, 2019 19:26
-
-
Save Servuc/a63fbe84bdafa614e4cdff9debf2bb81 to your computer and use it in GitHub Desktop.
docker-swarm
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: | |
webapp: | |
image: YOUR_PHP | |
ports: | |
- 12345:12345 | |
deploy: | |
replicas: 10 | |
restart_policy: | |
max_attempts: 3 | |
condition: on-failure | |
update_config: | |
parallelism: 2 | |
delay: 1m | |
networks: | |
- balance | |
proxy: | |
image: YOUR_NGINX | |
ports: | |
- 80:80 | |
depends_on: | |
- webapp | |
deploy: | |
placement: | |
constraints: [node.role == manager] | |
networks: | |
- balance | |
networks: | |
balance: | |
driver: overlay |
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
http { | |
upstream myCluster { | |
server IP_1:1324; | |
server IP_2:1234; | |
server IP_n:1234; | |
} | |
server { | |
listen 80; | |
location / { | |
proxy_pass http://myCluster; | |
} | |
} | |
} |
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
FROM nginx | |
COPY nginx.conf /etc/nginx/conf.d/ | |
EXPOSE 80 |
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
FROM php:cli-alpine | |
RUN echo "<?php echo gethostname() . ' - ' . gethostbyname(gethostname()) . ' - Version 1';" > index.php | |
EXPOSE 12345 | |
CMD php -S 0.0.0.0:12345 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment