Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move 'stacks' directory to 'compose' and refactor slides accordingly #519

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
1 change: 1 addition & 0 deletions compose/dockercoins/dockercoins
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion elk/docker-compose.yml → compose/elk/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "2"
version: "3"

services:
elasticsearch:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: "3"
services:

prometheus:
build: ../prom
build: .
image: 127.0.0.1:5000/prom
ports:
- "9090:9090"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ services:

configs:
prometheus:
file: ../prom/prometheus.yml
file: ./prometheus.yml
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions slides/containers/Logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ will have equal success with Fluent or other logging stacks!*
```bash
$ git clone https://github.com/jpetazzo/container.training
$ cd container.training
$ cd compose
$ cd elk
$ docker-compose up
```
Expand Down
10 changes: 5 additions & 5 deletions slides/k8s/buildshiprun-selfhosted.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,22 +145,22 @@ The curl command should now output:

.exercise[

- Go to the `stacks` directory:
- Go to this directory:
```bash
cd ~/container.training/stacks
cd ~/container.training/compose/dockercoins
```

- Build and push the images:
```bash
export REGISTRY
export TAG=v0.1
docker-compose -f dockercoins.yml build
docker-compose -f dockercoins.yml push
docker-compose build
docker-compose push
```

]

Let's have a look at the `dockercoins.yml` file while this is building and pushing.
Let's have a look at the `docker-compose.yml` file while this is building and pushing.

---

Expand Down
6 changes: 3 additions & 3 deletions slides/k8s/rollout.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,16 @@ If you are using images from the Docker Hub (`dockercoins/worker:v0.1`), skip th

.exercise[

- Go to the `stacks` directory (`~/container.training/stacks`)
- Go to the directory `~/container.training/compose/dockercoins`)

- Edit `dockercoins/worker/worker.py`; update the first `sleep` line to sleep 1 second

- Build a new tag and push it to the registry:
```bash
#export REGISTRY=localhost:3xxxx
export TAG=v0.2
docker-compose -f dockercoins.yml build
docker-compose -f dockercoins.yml push
docker-compose build
docker-compose push
```

]
Expand Down
6 changes: 3 additions & 3 deletions slides/swarm/firstservice.md
Original file line number Diff line number Diff line change
Expand Up @@ -441,11 +441,11 @@ class: extra-details

- Run this simple-yet-beautiful visualization app:
```bash
cd ~/container.training/stacks
docker-compose -f visualizer.yml up -d
cd ~/container.training/compose/visualizer
docker-compose up -d
```

<!-- ```longwait Creating dockerswarmvisualizer_viz_1``` -->
<!-- ```longwait Creating visualizer_viz_1``` -->

]

Expand Down
6 changes: 3 additions & 3 deletions slides/swarm/gui.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ What about web interfaces to control and manage Swarm?

.exercise[

- Make sure we are in the stacks directory:
- Make sure we are in the right directory:
```bash
cd ~/container.training/stacks
cd ~/container.training/compose/portainer
```

- Deploy the Portainer stack:
```bash
docker stack deploy -c portainer.yml portainer
docker stack deploy -c docker-compose.yml portainer
```

]
Expand Down
15 changes: 9 additions & 6 deletions slides/swarm/healthchecks.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ docker service update \

## Implementing auto-rollback in practice

We will use the following Compose file (`stacks/dockercoins+healthcheck.yml`):
We will use the following Compose file,
<br/>
`compose/dockercoins/stack-with-healthcheck.yml`:


```yaml
...
Expand Down Expand Up @@ -117,14 +120,14 @@ We need to update our services with a healthcheck.

.exercise[

- Go to the `stacks` directory:
- Go to the directory:
```bash
cd ~/container.training/stacks
cd ~/container.training/compose/dockercoins
```

- Deploy the updated stack with healthchecks built-in:
```bash
docker stack deploy --compose-file dockercoins+healthcheck.yml dockercoins
docker stack deploy --compose-file stack-with-healthcheck.yml dockercoins
```

]
Expand All @@ -149,8 +152,8 @@ We need to update our services with a healthcheck.
- Build, ship, and run the new image:
```bash
export TAG=v0.3
docker-compose -f dockercoins+healthcheck.yml build
docker-compose -f dockercoins+healthcheck.yml push
docker-compose build
docker-compose push
docker service update --image=127.0.0.1:5000/hasher:$TAG dockercoins_hasher
```

Expand Down
10 changes: 5 additions & 5 deletions slides/swarm/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,17 +185,17 @@ class: elk-auto

- Build, ship, and run our ELK stack:
```bash
docker-compose -f elk.yml build
docker-compose -f elk.yml push
docker stack deploy -c elk.yml elk
cd ~/container.training/compose/elk
docker stack deploy -c docker-compose.yml elk
```

]

Note: the *build* and *push* steps are not strictly necessary, but they don't hurt!
Note: we didn't need the *build* and *push* steps here, since
we are only using images from the Docker Hub.

Let's have a look at the [Compose file](
https://@@GITREPO@@/blob/master/stacks/elk.yml).
https://@@GITREPO@@/blob/master/compose/elk/docker-compose.yml).

---

Expand Down
18 changes: 9 additions & 9 deletions slides/swarm/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -1153,16 +1153,16 @@ class: prom-auto

.exercise[

- Make sure we are in the stacks directory:
- Go to the directory of the Prometheus stack:
```bash
cd ~/container.training/stacks
cd ~/container.training/compose/prometheus
```

- Build, ship, and run the Prometheus stack:
```bash
docker-compose -f prometheus.yml build
docker-compose -f prometheus.yml push
docker stack deploy -c prometheus.yml prometheus
docker-compose build
docker-compose push
docker stack deploy -c docker-compose.yml prometheus
```

]
Expand Down Expand Up @@ -1237,7 +1237,7 @@ class: prom-auto, config

## Deploying Prometheus with a `config`

The following Compose file (`prometheus+config.yml`) achieves
The following Compose file (`stack-with-config.yml`) achieves
the same result, but by using a `config` instead of baking the
configuration into the image.

Expand All @@ -1259,7 +1259,7 @@ prometheus:

configs:
prometheus:
file: ../prom/prometheus.yml
file: ./prometheus.yml
```
]

Expand Down Expand Up @@ -1291,13 +1291,13 @@ class: prom-auto, config

## Re-deploying Prometheus with a config

- We will update the existing stack using `prometheus+config.yml`
- We will update the existing stack using `stack-with-config.yml`

.exercise[

- Redeploy the `prometheus` stack:
```bash
docker stack deploy -c prometheus+config.yml prometheus
docker stack deploy -c stack-with-config.yml prometheus
```

- Check that Prometheus still works as intended
Expand Down
11 changes: 6 additions & 5 deletions slides/swarm/operatingswarm.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ for N in $(seq 2 5); do
DOCKER_HOST=tcp://node$N:2375 docker swarm join --token $TOKEN node1:2377
done
git clone https://@@GITREPO@@
cd container.training/stacks
docker stack deploy --compose-file registry.yml registry
docker-compose -f dockercoins.yml build
docker-compose -f dockercoins.yml push
docker stack deploy --compose-file dockercoins.yml dockercoins
cd container.training/compose/registry
docker stack deploy --compose-file docker-compose.yml registry
cd container.training/compose/dockercoins
docker-compose build
docker-compose push
docker stack deploy --compose-file docker-compose.yml dockercoins
```

You should now be able to connect to port 8000 and see the DockerCoins web UI.
27 changes: 15 additions & 12 deletions slides/swarm/stacks.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Without a stack file, it would be deployed with the following command:
docker service create --publish 5000:5000 registry
```

Now, we are going to deploy it with the following stack file:
Now, we are going to deploy it with the following Compose file:

```yaml
version: "3"
Expand All @@ -80,20 +80,22 @@ services:

---

## Checking our stack files
## Checking our Compose file

- All the stack files that we will use are in the `stacks` directory
- The Compose file for the registry is in its own directory

(like the other Compose files that we will use)

.exercise[

- Go to the `stacks` directory:
- Go to the `compose/registry` directory:
```bash
cd ~/container.training/stacks
cd ~/container.training/compose/registry
```

- Check `registry.yml`:
- Check the Compose file:
```bash
cat registry.yml
cat docker-compose.yml
```

]
Expand All @@ -114,7 +116,7 @@ services:

- Deploy our local registry:
```bash
docker stack deploy --compose-file registry.yml registry
docker stack deploy --compose-file docker-compose.yml registry
```

]
Expand Down Expand Up @@ -263,13 +265,14 @@ The curl command should now output:

- Try it:
```bash
docker-compose -f dockercoins.yml build
docker-compose -f dockercoins.yml push
cd ~/container.training/compose/dockercoins
docker-compose build
docker-compose push
```

]

Let's have a look at the `dockercoins.yml` file while this is building and pushing.
Let's have a look at the `docker-compose.yml` file while this is building and pushing.

---

Expand Down Expand Up @@ -304,7 +307,7 @@ services:

- Create the application stack:
```bash
docker stack deploy --compose-file dockercoins.yml dockercoins
docker stack deploy --compose-file docker-compose.yml dockercoins
```

]
Expand Down
1 change: 0 additions & 1 deletion stacks/dockercoins

This file was deleted.

40 changes: 0 additions & 40 deletions stacks/elk.yml

This file was deleted.