add: start of doh ex06

This commit is contained in:
Haletran 2026-02-25 23:00:13 +01:00
parent 3474548912
commit 2ad9b6bf9c
7 changed files with 62 additions and 61 deletions

View file

@ -1,9 +0,0 @@
FROM alpine:3.21
RUN apk add --no-cache wget unzip
COPY config/ /caddyfiles/
COPY init.sh /init.sh
RUN chmod +x /init.sh
CMD ["/init.sh"]

View file

@ -0,0 +1,8 @@
http://doh.ft-chatons.local {
tls internal
handle /dns-query {
reverse_proxy doh:8053
}
}

View file

@ -1,22 +0,0 @@
#!/bin/sh
set -e
cp -r /caddyfiles/. /etc/caddy/
echo "Caddyfiles copied."
if [ -z "$DRAWIO_VERSION" ]; then
echo "ERROR: DRAWIO_VERSION is not set"
exit 1
fi
echo "Downloading diagrams.net v${DRAWIO_VERSION}..."
mkdir -p /srv/diagrams
wget -v \
"https://github.com/jgraph/drawio/releases/download/v${DRAWIO_VERSION}/draw.war" \
-O /tmp/drawio.war
echo "Extracting..."
unzip -q /tmp/drawio.war -d /srv/diagrams/
rm /tmp/drawio.war
echo "Done."

8
core/doh/compose.yml Normal file
View file

@ -0,0 +1,8 @@
services:
doh:
container_name: doh
networks:
proxy:
name: proxy
external: true

View file

@ -3,18 +3,26 @@ default:
## Start the compose of the param
start container="":
#!/bin/sh
if [ "{{container}}" = "caddy" ]; then
bash core/tools/caddy-init.sh
fi
docker compose -f core/{{container}}/compose.yml up -d
## Stop the compose of the param
down container="caddy":
down container="":
docker compose -f core/{{container}}/compose.yml down
## Restart all the compose
re: down
## Delete all container, volumes, etc...
clean container="": (down container)
docker volume rm $(docker volume ls -q) || true
docker system prune -af
docker volume prune -f
just start caddy
## Restart all the compose
re container="": (down container) (clean container)
just start {{container}}
tests:
bash core/tools/test-caddy

25
run
View file

@ -1,25 +0,0 @@
#!/usr/bin/env bash
case "$1" in
vm)
qemu-system-x86_64 \
-nographic -serial mon:stdio \
-enable-kvm -cpu host -smp 4 -m 4G \
-device e1000,netdev=net0 \
-netdev user,id=net0,hostfwd=tcp::2222-:22 \
-drive if=pflash,format=raw,readonly=on,file=/usr/share/OVMF/OVMF_CODE.fd \
-hda ft_chatons.qcow2
;;
command)
ansible -i ansible/inventory ft_chatons -a "$2"
;;
setup)
ansible-playbook -i ansible/inventory ansible/playbooks/install.yml -K
;;
*)
echo "Usage: $0 {vm|command|setup} [command]"
exit 1
esac

33
startup Normal file
View file

@ -0,0 +1,33 @@
#!/usr/bin/env
local opt=$1
case "$1" in
vm)
qemu-system-x86_64 \
-nographic -serial mon:stdio \
-enable-kvm -cpu host -smp 4 -m 4G \
-device e1000,netdev=net0 \
-netdev user,id=net0,hostfwd=tcp::2222-:22 \
-drive if=pflash,format=raw,readonly=on,file=/usr/share/OVMF/OVMF_CODE.fd \
-hda ft_chatons.qcow2
;;
command)
ansible -i ansible/inventory ft_chatons -a "$2"
;;
setup)
ansible-playbook -i ansible/inventory ansible/playbooks/install.yml -K
;;
start)
just start caddy
just start doh
;;
stop)
just stop caddy
just stop doh
;;
restart)
just re caddy
just re doh
;;
esac