diff options
| author | Your Name <you@example.com> | 2025-12-29 20:01:17 +0800 |
|---|---|---|
| committer | Your Name <you@example.com> | 2025-12-29 20:01:17 +0800 |
| commit | 7bd52ea1ae10870cc2ff8aa5c237679c30ffda72 (patch) | |
| tree | af72b9290a5e0cb7d2ae43752fb4ea3dba55bc1c /README | |
| parent | 745ca5a613d3dbac8143a62e4a90e9833422e023 (diff) | |
Diffstat (limited to 'README')
| -rw-r--r-- | README | 29 |
1 files changed, 14 insertions, 15 deletions
| @@ -1,12 +1,11 @@ | |||
| 1 | CGIT-CADDY CONTAINER | 1 | CGIT CONTAINER |
| 2 | 2 | ||
| 3 | Cgit with automatic HTTPS (cgit + caddy + Let's Encrypt). | 3 | Cgit with automatic HTTPS (cgit + caddy + Let's Encrypt). |
| 4 | 4 | ||
| 5 | Requirements: | 5 | Requirements: |
| 6 | - Public IPv4 address pointed to this machine | 6 | - Public IPv4 address |
| 7 | - /git directory on host for bare git repos | 7 | - Domain pointing to the IP |
| 8 | - Domain name pointing to the public IP | 8 | - /git directory for bare repos |
| 9 | TLS certificates are auto-generated by Caddy and stored in a container volume. | ||
| 10 | 9 | ||
| 11 | Host setup (one-time): | 10 | Host setup (one-time): |
| 12 | cat > /etc/sysctl.d/99-container-routing.conf << 'EOF' | 11 | cat > /etc/sysctl.d/99-container-routing.conf << 'EOF' |
| @@ -14,12 +13,9 @@ Host setup (one-time): | |||
| 14 | net.ipv4.conf.enp1s0.proxy_arp=1 | 13 | net.ipv4.conf.enp1s0.proxy_arp=1 |
| 15 | EOF | 14 | EOF |
| 16 | sysctl -p /etc/sysctl.d/99-container-routing.conf | 15 | sysctl -p /etc/sysctl.d/99-container-routing.conf |
| 17 | mkdir -p /git | 16 | mkdir -p /git/.ssh |
| 18 | 17 | ||
| 19 | Build: | 18 | Run: |
| 20 | podman build -t cgit-caddy . | ||
| 21 | |||
| 22 | Run (first time or after changes): | ||
| 23 | ./start_container.sh | 19 | ./start_container.sh |
| 24 | 20 | ||
| 25 | Run (manual): | 21 | Run (manual): |
| @@ -31,19 +27,25 @@ Run (manual): | |||
| 31 | --env-file config.env \ | 27 | --env-file config.env \ |
| 32 | -v cgit_data:/data \ | 28 | -v cgit_data:/data \ |
| 33 | -v /git:/git \ | 29 | -v /git:/git \ |
| 34 | localhost/cgit-caddy | 30 | localhost/cgit |
| 35 | 31 | ||
| 36 | sleep 2 | 32 | sleep 2 |
| 37 | podman exec cgit ip addr add 37.27.166.242/32 dev eth0 | 33 | podman exec cgit ip addr add 37.27.166.242/32 dev eth0 |
| 38 | ip route add 37.27.166.242/32 via 10.89.0.2 | 34 | ip route add 37.27.166.242/32 via 10.89.0.2 |
| 39 | 35 | ||
| 36 | SSH keys: | ||
| 37 | Drop .pub files in /git/.ssh/, they're combined into authorized_keys on run. | ||
| 38 | |||
| 39 | Create repo: | ||
| 40 | git init --bare /git/myrepo | ||
| 41 | |||
| 40 | Restart: | 42 | Restart: |
| 41 | podman restart cgit | 43 | podman restart cgit |
| 42 | 44 | ||
| 43 | Stop: | 45 | Stop: |
| 44 | podman stop cgit && podman rm cgit && ip route del 37.27.166.242/32 | 46 | podman stop cgit && podman rm cgit && ip route del 37.27.166.242/32 |
| 45 | 47 | ||
| 46 | Cleanup (remove everything): | 48 | Cleanup: |
| 47 | podman stop cgit | 49 | podman stop cgit |
| 48 | podman rm cgit | 50 | podman rm cgit |
| 49 | podman volume rm cgit_data | 51 | podman volume rm cgit_data |
| @@ -55,6 +57,3 @@ Logs: | |||
| 55 | 57 | ||
| 56 | Shell: | 58 | Shell: |
| 57 | podman exec -it cgit sh | 59 | podman exec -it cgit sh |
| 58 | |||
| 59 | Create repo: | ||
| 60 | git init --bare /git/myrepo | ||
