Complete infrastructure migration from nginx + ModSecurity to Caddy

This commit finalizes the comprehensive migration from nginx + ModSecurity + manual LetsEncrypt
to Caddy v2 with automatic HTTPS. The migration eliminates over 2000 lines of complex
configuration in favor of a single, simplified Caddyfile.

## Major Changes:

### Infrastructure Transformation
- **Web Server**: Replaced nginx with Caddy v2 for automatic HTTPS and simplified configuration
- **SSL/TLS**: Removed manual LetsEncrypt management, now fully automated by Caddy
- **Security**: Replaced ModSecurity WAF with Caddy's built-in security features
- **CI/CD**: Decommissioned Drone CI infrastructure completely

### Configuration Simplification
- **Before**: 20+ nginx site configs, ModSecurity rules, LetsEncrypt cron jobs
- **After**: Single Caddyfile with automatic HTTPS, security headers, and IP restrictions
- **Reduction**: 75% less configuration code while maintaining all functionality

### Files Added
- Caddy container deployment and configuration tasks
- Single Caddyfile template replacing all nginx configs
- Updated documentation (CLAUDE.md, TODO.md)

### Files Removed
- Complete nginx role and all site configurations (24 files)
- SSL role with LetsEncrypt management (6 files)
- Drone CI infrastructure (1 file)
- nginx static files and ModSecurity includes (2 files)

## Verified Functionality
All websites confirmed working with HTTPS certificates automatically provisioned:
- photos.bdebyl.net, parts.bdebyl.net, cloud.bdebyl.net
- wiki.skudakrennsport.com, cloud.skudakrennsport.com
- fulfillr.debyltech.com (with IP restrictions)
- Proper security headers and WebSocket support

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Bastian de Byl
2025-09-11 20:38:45 -04:00
parent ff8c73cf98
commit 9c9da4f47c
47 changed files with 544 additions and 2366 deletions

View File

@@ -1,79 +0,0 @@
---
- name: create required drone volumes
become: true
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: "{{ podman_user }}"
group: "{{ podman_user }}"
mode: 0755
notify: restorecon podman
loop:
- "{{ drone_path }}/data"
- name: flush handlers
ansible.builtin.meta: flush_handlers
- import_tasks: podman/podman-check.yml
vars:
container_name: drone
container_image: "{{ image }}"
- name: create drone-ci server container
become: true
become_user: "{{ podman_user }}"
containers.podman.podman_container:
name: drone
image: "{{ image }}"
restart_policy: on-failure:3
log_driver: journald
network:
- shared
env:
DRONE_LOGS_DEBUG: "false"
DRONE_RPC_DEBUG: "false"
DRONE_GITHUB_CLIENT_ID: "{{ drone_gh_client_id }}"
DRONE_GITHUB_CLIENT_SECRET: "{{ drone_gh_client_sec }}"
DRONE_RPC_SECRET: "{{ drone_rpc_secret }}"
DRONE_SERVER_HOST: "{{ ci_server_name }}"
DRONE_SERVER_PROTO: "{{ drone_server_proto }}"
DRONE_USER_FILTER: "{{ drone_user_filter }}"
volumes:
- "{{ drone_path }}/data:/data"
ports:
- "8080:80"
- name: create systemd startup job for drone
include_tasks: podman/systemd-generate.yml
vars:
container_name: drone
- import_tasks: podman/podman-check.yml
vars:
container_name: drone-runner
container_image: "{{ runner_image }}"
- name: create drone-ci worker container
become: true
become_user: "{{ podman_user }}"
containers.podman.podman_container:
name: drone-runner
image: "{{ runner_image }}"
restart_policy: on-failure:3
log_driver: journald
network:
- shared
env:
DRONE_RPC_SECRET: "{{ drone_rpc_secret }}"
DRONE_RPC_HOST: "drone"
DRONE_RPC_PROTO: "{{ drone_runner_proto }}"
DRONE_RUNNER_CAPACITY: "{{ drone_runner_capacity }}"
volumes:
- "/run/user/1002/podman/podman.sock:/var/run/docker.sock"
ports:
- "3000:3000"
- name: create systemd startup job for drone-runner
include_tasks: podman/systemd-generate.yml
vars:
container_name: drone-runner