WIP proxy #3

Open
garbelo wants to merge 65 commits from proxy into main
Showing only changes of commit fe0c2de0d4 - Show all commits

View File

@@ -1,6 +1,15 @@
#!/usr/bin/env bash
set -euo pipefail
step() {
echo
echo "=================================================="
echo " 👉 $1"
echo "=================================================="
}
require_root() {
if [ "$(id -u)" -ne 0 ]; then
echo "Este script debe ejecutarse como root (o con sudo)."
@@ -44,8 +53,7 @@ apt-get install -y \
containerd.io \
docker-buildx-plugin \
docker-compose-plugin \
git \
certbot
git
systemctl enable docker
systemctl start docker
@@ -61,7 +69,7 @@ fi
# Creamos carpeta del proxy con docker compose.
mkdir -p /opt/beyonxcx/traefik
mkdir -p /opt/beyondcx/traefik
cat > /opt/beyondcx/traefik/docker-compose.yaml <<EOF
services:
@@ -73,22 +81,32 @@ services:
- "443:443"
- "8080:8080"
environment:
- DO_AUTH_TOKEN=${DO_AUTH_TOKEN}
- DO_AUTH_TOKEN=\${DO_AUTH_TOKEN}
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./config/traefik.yml:/etc/traefik/traefik.yaml:ro
- ./data/certs:/var/traefik/certs/:rw
- ./config/conf:/etc/traefik/conf/:rw
- ./logs:/var/traefik/logs:rw
logging:
driver: "json-file"
options:
max-size: "100m"
networks:
- frontend
restart: unless-stopped
networks:
frontend:
external: true
EOF
mkdir -p /opt/beyondcx/traefik/config
mkdir -p /opt/beyondcx/traefik/logs
mkdir -p /opt/beyondcx/traefik/config/conf
echo "DO_AUTH_TOKEN=" > /opt/beyondcx/traefik/.env
cat > /opt/beyondcx/traefik/config/traefik.yml <<EOF
global:
checkNewVersion: false
@@ -127,9 +145,13 @@ EOF
cd /opt/beyondcx/traefik
docker network create frontend
PROXY_NETWORK="frontend"
docker network ls
if docker network inspect $PROXY_NETWORK > /dev/null 2>&1; then
echo "red de traefik existe"
else
docker network create $PROXY_NETWORK
fi
docker compose up -d