docker network working

main
Thomas Hintz 1 month ago
parent bdb24a565b
commit 3c37ce8981

@ -5,14 +5,17 @@ systemd:
- name: lb.service
enabled: true
contents_local: lb/lb.service
# - name: thintz-com.service
# enabled: true
# contents_local: thintz-com/thintz-com.service
- name: docker-network.service
enabled: true
contents_local: docker-network/docker-network.service
- name: thintz-com.service
enabled: true
contents_local: thintz-com/thintz-com.service
storage:
files:
- path: /var/lb/caddy/Caddyfile
contents:
local: lb/Caddyfile
# - path: /var/caddy/Caddyfile
# contents:
# local: lb/Caddyfile
- path: /var/thintz-com/caddy/Caddyfile
contents:
local: thintz-com/Caddyfile

@ -0,0 +1,11 @@
[Unit]
Description=Docker Network Setup
After=docker.service
Requires=docker.service
[Service]
TimeoutStartSec=0
ExecStart=/usr/bin/docker network create -d bridge nassella
ExecStop=-/usr/bin/docker network rm nassella
Restart=never
[Install]
WantedBy=multi-user.target

@ -1 +1 @@
{"ignition":{"version":"3.4.0"},"storage":{"files":[{"path":"/var/lb/caddy/Caddyfile","contents":{"compression":"","source":"data:,localhost%0A%0Arespond%20%22Hello%2C%20again!%22"}}]},"systemd":{"units":[{"contents":"[Unit]\nDescription=NGINX example\nAfter=docker.service\nRequires=docker.service\n[Service]\nTimeoutStartSec=0\nExecStartPre=-/usr/bin/docker rm --force caddy2\nExecStart=/usr/bin/docker run --name caddy2 --pull always --log-driver=journald --net host -v /var/lb/caddy:/etc/caddy docker.io/caddy:2\nExecStop=/usr/bin/docker stop caddy2\nRestart=always\nRestartSec=5s\n[Install]\nWantedBy=multi-user.target","enabled":true,"name":"lb.service"}]}}
{"ignition":{"version":"3.4.0"},"storage":{"files":[{"path":"/var/lb/caddy/Caddyfile","contents":{"compression":"","source":"data:,localhost%0A%0Arespond%20%22Hello%2C%20again!%22"}},{"path":"/var/thintz-com/caddy/Caddyfile","contents":{"compression":"","source":"data:,localhost%0A%0Arespond%20%22thintz-com!%22"}}]},"systemd":{"units":[{"contents":"[Unit]\nDescription=Caddy Load Balancer\nAfter=docker-network.service\nRequires=docker.service\nRequires=docker-network.service\n[Service]\nTimeoutStartSec=0\nExecStartPre=-/usr/bin/docker rm --force lb\nExecStart=/usr/bin/docker run --name lb --pull always --log-driver=journald --net nassella -p 8081:443 -p 8080:80 -v /var/lb/caddy:/etc/caddy docker.io/caddy:2\nExecStop=/usr/bin/docker stop lb\nRestart=always\nRestartSec=5s\n[Install]\nWantedBy=multi-user.target","enabled":true,"name":"lb.service"},{"contents":"[Unit]\nDescription=Docker Network Setup\nAfter=docker.service\nRequires=docker.service\n[Service]\nTimeoutStartSec=0\nExecStart=/usr/bin/docker network create -d bridge nassella\nExecStop=-/usr/bin/docker network rm nassella\nRestart=never\n[Install]\nWantedBy=multi-user.target","enabled":true,"name":"docker-network.service"},{"contents":"[Unit]\nDescription=thintz.com static site\nAfter=docker-network.service\nRequires=docker.service\nRequires=docker-network.service\n[Service]\nTimeoutStartSec=0\nExecStartPre=-/usr/bin/docker rm --force thintz-com\nExecStart=/usr/bin/docker run --name thintz-com --pull always --log-driver=journald --net nassella -p 8082:80 -p 8083:443 -v /var/thintz-com/caddy:/etc/caddy -v /var/thintz-com/site:/var/site docker.io/caddy:2\nExecStop=/usr/bin/docker stop thintz-com\nRestart=always\nRestartSec=5s\n[Install]\nWantedBy=multi-user.target","enabled":true,"name":"thintz-com.service"}]}}

@ -1,12 +1,13 @@
[Unit]
Description=NGINX example
After=docker.service
Description=Caddy Load Balancer
After=docker-network.service
Requires=docker.service
Requires=docker-network.service
[Service]
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker rm --force caddy2
ExecStart=/usr/bin/docker run --name caddy2 --pull always --log-driver=journald --net host -v /var/lb/caddy:/etc/caddy docker.io/caddy:2
ExecStop=/usr/bin/docker stop caddy2
ExecStartPre=-/usr/bin/docker rm --force lb
ExecStart=/usr/bin/docker run --name lb --pull always --log-driver=journald --net nassella -p 8081:443 -p 8080:80 -v /var/lb/caddy:/etc/caddy docker.io/caddy:2
ExecStop=/usr/bin/docker stop lb
Restart=always
RestartSec=5s
[Install]

@ -0,0 +1,3 @@
localhost
respond "thintz-com!"

@ -0,0 +1,14 @@
[Unit]
Description=thintz.com static site
After=docker-network.service
Requires=docker.service
Requires=docker-network.service
[Service]
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker rm --force thintz-com
ExecStart=/usr/bin/docker run --name thintz-com --pull always --log-driver=journald --net nassella -p 8082:80 -p 8083:443 -v /var/thintz-com/caddy:/etc/caddy -v /var/thintz-com/site:/var/site docker.io/caddy:2
ExecStop=/usr/bin/docker stop thintz-com
Restart=always
RestartSec=5s
[Install]
WantedBy=multi-user.target
Loading…
Cancel
Save