Skip to content

Commit 64bf47f

Browse files
committed
Add the env files and a list of commands to run the services
[refs #4359b29ceee4]
1 parent c66df67 commit 64bf47f

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

swarm/swarm-demo/app.env

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
POSTGRES_USER=demo
2+
POSTGRES_PASSWORD=secret
3+
POSTGRES_DB=demo
4+
POSTGRES_HOST=demo-db

swarm/swarm-demo/commands.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
## The commands
2+
```sh
3+
#Make sure we don't have existing resources that would conflict with our commands
4+
docker network ls
5+
docker service ls
6+
7+
# Create the network
8+
docker network create --driver overlay demo-net
9+
10+
# Create the demo-db
11+
docker service create --name demo-db --reserve-memory 256M --constraint node.hostname==node1 \
12+
--mount src=demo-data,dst=/var/lib/postgresql/data \
13+
--env-file db.env \
14+
--network demo-net \
15+
jfahrer/swarm-demo-db:v1
16+
17+
# Create the frontend
18+
docker service create --name demo-frontend --env-file app.env --network demo-net jfahrer/swarm-demo-frontend:v5
19+
20+
# Create the lb
21+
docker service create --name demo-lb --publish 80:80 --env PROXY_UPSTREAM=demo-frontend:8080 \
22+
--network demo-net jfahrer/swarm-demo-lb:v1
23+
24+
# Scale the services
25+
docker service update --replicas 10 demo-frontend
26+
docker service update --replicas 3 demo-lb
27+
```

swarm/swarm-demo/db.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
POSTGRES_USER=demo
2+
POSTGRES_PASSWORD=secret
3+
POSTGRES_DB=demo

0 commit comments

Comments
 (0)