-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
68 additions
and
60 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,17 @@ | ||
```bash | ||
#################### | ||
# Create a cluster # | ||
#################### | ||
docker network create -d overlay proxy | ||
|
||
curl -o swarm-cluster.sh \ | ||
https://raw.githubusercontent.com/vfarcic/docker-flow-proxy/master/scripts/swarm-cluster.sh | ||
docker stack deploy -c stack.yml test | ||
|
||
chmod +x swarm-cluster.sh | ||
# DFP > jboss | ||
|
||
./swarm-cluster.sh | ||
open "http://localhost" | ||
|
||
docker-machine ssh node-1 | ||
# DFP > tomcat | ||
|
||
############## | ||
# Deploy DFP # | ||
############## | ||
curl -i "http://localhost/tomcat" | ||
|
||
docker network create --driver overlay proxy | ||
# tomcat | ||
|
||
curl -o docker-compose-stack.yml \ | ||
https://raw.githubusercontent.com/\ | ||
vfarcic/docker-flow-proxy/master/docker-compose-stack.yml | ||
|
||
docker stack deploy -c docker-compose-stack.yml proxy | ||
|
||
docker stack ps proxy | ||
|
||
# Remember the node of one of the machines where DFP is running (e.g. node-3) | ||
|
||
######################### | ||
# Deploy a demo service # | ||
######################### | ||
|
||
curl -o docker-compose-go-demo.yml \ | ||
https://raw.githubusercontent.com/\ | ||
vfarcic/go-demo/master/docker-compose-stack.yml | ||
|
||
docker stack deploy -c docker-compose-go-demo.yml go-demo | ||
|
||
docker stack ps go-demo # Wait until all the replicas are running | ||
|
||
######## | ||
# Test # | ||
######## | ||
|
||
exit | ||
|
||
curl -i "$(docker-machine ip node-1)/demo/hello" | ||
|
||
docker-machine rm -f node-3 # Replace node-3 with the node where a DFP replica is running | ||
|
||
curl -i "$(docker-machine ip node-1)/demo/hello" | ||
|
||
# It might take a while until Swarm detects that a node is down. | ||
# After a while, curl should respond fast. | ||
|
||
########### | ||
# Cleanup # | ||
########### | ||
|
||
docker-machine rm -f $(docker-machine ls -q) | ||
open "http://localhost:8080" | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
version: "3" | ||
services: | ||
|
||
jboss: | ||
image: jboss/wildfly | ||
networks: | ||
- proxy | ||
deploy: | ||
replicas: 1 | ||
update_config: | ||
parallelism: 1 | ||
delay: 10s | ||
labels: | ||
- com.df.notify=true | ||
- com.df.servicePath=/ | ||
- com.df.port=8080 | ||
|
||
tomcat: | ||
image: tomcat:8.0 | ||
networks: | ||
- proxy | ||
ports: | ||
- 8080:8080 # New | ||
deploy: | ||
replicas: 1 | ||
update_config: | ||
parallelism: 1 | ||
delay: 10s | ||
labels: | ||
- com.df.notify=true | ||
- com.df.servicePath=/tomcat | ||
- com.df.reqPathSearchReplace=/tomcat,/ | ||
- com.df.port=8080 | ||
|
||
proxy: | ||
image: vfarcic/docker-flow-proxy | ||
ports: | ||
- 80:80 | ||
- 443:443 | ||
networks: | ||
- proxy | ||
environment: | ||
- LISTENER_ADDRESS=swarm-listener | ||
|
||
swarm-listener: | ||
image: vfarcic/docker-flow-swarm-listener | ||
networks: | ||
- proxy | ||
volumes: | ||
- /var/run/docker.sock:/var/run/docker.sock | ||
environment: | ||
- DF_NOTIFY_CREATE_SERVICE_URL=http://proxy:8080/v1/docker-flow-proxy/reconfigure | ||
- DF_NOTIFY_REMOVE_SERVICE_URL=http://proxy:8080/v1/docker-flow-proxy/remove | ||
deploy: | ||
placement: | ||
constraints: [node.role == manager] | ||
|
||
networks: | ||
proxy: | ||
external: true |
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
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