diff --git a/core/caddy/Dockerfile b/core/caddy/Dockerfile deleted file mode 100644 index b1d88ed..0000000 --- a/core/caddy/Dockerfile +++ /dev/null @@ -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"] \ No newline at end of file diff --git a/core/caddy/config/sites/unbound.caddy b/core/caddy/config/sites/unbound.caddy new file mode 100644 index 0000000..c9bc80f --- /dev/null +++ b/core/caddy/config/sites/unbound.caddy @@ -0,0 +1,8 @@ +http://doh.ft-chatons.local { + + tls internal + + handle /dns-query { + reverse_proxy doh:8053 + } +} \ No newline at end of file diff --git a/core/caddy/init.sh b/core/caddy/init.sh deleted file mode 100644 index 4c13704..0000000 --- a/core/caddy/init.sh +++ /dev/null @@ -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." \ No newline at end of file diff --git a/core/doh/compose.yml b/core/doh/compose.yml new file mode 100644 index 0000000..8ce710b --- /dev/null +++ b/core/doh/compose.yml @@ -0,0 +1,8 @@ +services: + doh: + container_name: doh + +networks: + proxy: + name: proxy + external: true \ No newline at end of file diff --git a/justfile b/justfile index 2e55874..0bcba89 100644 --- a/justfile +++ b/justfile @@ -3,18 +3,26 @@ default: ## Start the compose of the param start container="": - docker compose -f core/{{container}}/compose.yml up -d + #!/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 diff --git a/run b/run deleted file mode 100755 index 942e51a..0000000 --- a/run +++ /dev/null @@ -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 - - - diff --git a/startup b/startup new file mode 100644 index 0000000..0ede1dc --- /dev/null +++ b/startup @@ -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 \ No newline at end of file