add: caddy config

This commit is contained in:
Haletran 2026-02-21 17:53:45 +01:00
parent b405eb4a14
commit fb2fa75f90
5 changed files with 51 additions and 15 deletions

0
core/caddy/buildtime.env Normal file
View file

View file

@ -1,16 +1,17 @@
services: services:
container_name: caddy caddy:
image: caddy:2.10.2-alpine container_name: caddy
restart: unless-stopped image: caddy:2.10.2-alpine
ports: restart: unless-stopped
- "80:80" ports:
- "443:443" - "80:80"
volumes: - "443:443"
- caddy-caddyfiles:/etc/caddy volumes:
- caddy-data:/data - caddy-caddyfiles:/etc/caddy
- caddy-config:/config - caddy-data:/data
networks: - caddy-config:/config
- web networks:
- proxy
volumes: volumes:
caddy-caddyfiles: caddy-caddyfiles:
@ -19,5 +20,5 @@ volumes:
caddy-config: caddy-config:
networks: networks:
web: proxy:
name: web name: proxy

View file

@ -0,0 +1,25 @@
outils.localhost {
local_certs
header X-Chatons "miaou"
respond /healthcheck "OK"
#handle_path or handle are the same except you need to prefix things instead of already having it uri strip_prefix /prefix
handle_path /hello/* {
respond "Hello {path.0}!"
close
}
handle /date {
respond "{http.date} {http.time}"
close
}
handle /ip {
respond {{.ClientIP}}
}
handle_path /b64/encode {
}
handle_path /b64/decode {
}
}

View file

@ -0,0 +1 @@
#!/usr/bin/env bash

11
run
View file

@ -1,6 +1,15 @@
#!/usr/bin/env bash #!/usr/bin/env bash
case "$1" in 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) command)
ansible -i ansible/inventory ft_chatons -a "$2" ansible -i ansible/inventory ft_chatons -a "$2"
;; ;;
@ -8,7 +17,7 @@ case "$1" in
ansible-playbook -i ansible/inventory ansible/playbooks/install.yml -K ansible-playbook -i ansible/inventory ansible/playbooks/install.yml -K
;; ;;
*) *)
echo "Usage: $0 {start|delete|status|logs|restart|scale}" echo "Usage: $0 {vm|command|setup} [command]"
exit 1 exit 1
esac esac