mirror of
https://github.com/funkypenguin/geek-cookbook/
synced 2026-11-02 13:58:18 +00:00
Merge with master
This commit is contained in:
171 files changed
+7103
-551
No files matched your search
@@ -51,7 +51,7 @@ Assuming 3 nodes, under normal circumstances the following is illustrated:
|
||||
* The **traefik** service (in swarm mode) receives incoming requests (on http and https), and forwards them to individual containers. Traefik knows the containers names because it's able to access the docker socket.
|
||||
* All 3 nodes run keepalived, at different priorities. Since traefik is running as a swarm service and listening on TCP 80/443, requests made to the keepalived VIP and arriving at **any** of the swarm nodes will be forwarded to the traefik container (no matter which node it's on), and then onto the target backend.
|
||||
|
||||

|
||||

|
||||
|
||||
### Node failure
|
||||
|
||||
@@ -63,7 +63,7 @@ In the case of a failure (or scheduled maintenance) of one of the nodes, the fol
|
||||
* The **traefik** service is either restarted or unaffected, and as the backend containers stop/start and change IP, traefik is aware and updates accordingly.
|
||||
* The keepalived VIP continues to function on the remaining nodes, and docker swarm continues to forward any traffic received on TCP 80/443 to the appropriate node.
|
||||
|
||||

|
||||

|
||||
|
||||
### Node restore
|
||||
|
||||
@@ -75,7 +75,7 @@ When the failed (or upgraded) host is restored to service, the following is illu
|
||||
* Keepalived VIP regains full redundancy
|
||||
|
||||
|
||||

|
||||

|
||||
|
||||
### Total cluster failure
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 314 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 333 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 310 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 43 KiB |
@@ -6,7 +6,7 @@ While Docker Swarm is great for keeping containers running (_and restarting thos
|
||||
|
||||
### Why GlusterFS?
|
||||
|
||||
This GlusterFS recipe was my original design for shared storage, but I [found it to be flawed](ha-docker-swarm/shared-storage-ceph/#why-not-glusterfs), and I replaced it with a [design which employs Ceph instead](http://localhost:8000/ha-docker-swarm/shared-storage-ceph/#why-ceph). This recipe is an alternate to the Ceph design, if you happen to prefer GlusterFS.
|
||||
This GlusterFS recipe was my original design for shared storage, but I [found it to be flawed](shared-storage-ceph/#why-not-glusterfs), and I replaced it with a [design which employs Ceph instead](shared-storage-ceph/#why-ceph). This recipe is an alternate to the Ceph design, if you happen to prefer GlusterFS.
|
||||
|
||||
## Ingredients
|
||||
|
||||
|
||||
@@ -21,6 +21,9 @@ To deal with these gaps, we need a front-end load-balancer, and in this design,
|
||||
|
||||
The traefik container is aware of the __other__ docker containers in the swarm, because it has access to the docker socket at **/var/run/docker.sock**. This allows traefik to dynamically configure itself based on the labels found on containers in the swarm, which is hugely useful. To make this functionality work on our SELinux-enabled Atomic hosts, we need to add custom SELinux policy.
|
||||
|
||||
!!! tip
|
||||
The following is only necessary if you're using SELinux!
|
||||
|
||||
Run the following to build and activate policy to permit containers to access docker.sock:
|
||||
|
||||
```
|
||||
@@ -37,7 +40,7 @@ make && semodule -i dockersock.pp
|
||||
|
||||
While it's possible to configure traefik via docker command arguments, I prefer to create a config file (traefik.toml). This allows me to change traefik's behaviour by simply changing the file, and keeps my docker config simple.
|
||||
|
||||
Create /var/data/traefik/traefik.toml as follows:
|
||||
Create ```/var/data/traefik/```, and then create ```traefik.toml``` inside it as follows:
|
||||
|
||||
```
|
||||
checkNewVersion = true
|
||||
@@ -76,9 +79,14 @@ watch = true
|
||||
swarmmode = true
|
||||
```
|
||||
|
||||
|
||||
### Prepare the docker service config
|
||||
|
||||
Create /var/data/traefik/docker-compose.yml as follows:
|
||||
!!! tip
|
||||
I share (_with my [patreon patrons](https://www.patreon.com/funkypenguin)_) a private "_premix_" git repository, which includes necessary docker-compose and env files for all published recipes. This means that patrons can launch any recipe with just a ```git pull``` and a ```docker stack deploy``` 👍
|
||||
|
||||
|
||||
Create /var/data/config/traefik/docker-compose.yml as follows:
|
||||
|
||||
```
|
||||
version: "3"
|
||||
@@ -123,12 +131,14 @@ networks:
|
||||
- subnet: 10.1.0.0/24
|
||||
```
|
||||
|
||||
Docker won't start an image with a bind-mount to a non-existent file, so prepare acme.json (_with the appropriate permissions_) by running:
|
||||
Docker won't start an image with a bind-mount to a non-existent file, so prepare an empty acme.json (_with the appropriate permissions_) by running:
|
||||
|
||||
```
|
||||
touch /var/data/traefik/acme.json
|
||||
chmod 600 /var/data/traefik/acme.json
|
||||
```.
|
||||
```
|
||||
|
||||
Traefik will populate acme.json itself when it runs, but it needs to exist before the container will start (_Chicken, meet egg._)
|
||||
|
||||
### Launch
|
||||
|
||||
|
||||
Reference in new issue
Block a user