alicante-infra/reparar_core.sh

171 lines
3.6 KiB
Bash

#!/bin/bash
# Ir a la carpeta del proyecto
cd /root/alicante-infra || cd /sc/alicante-infra
echo "🔧 Reparando plantillas del Core..."
# --- 1. INFRA SHARED (Postgres, Redis, MariaDB) ---
cat > roles/core/templates/infra-shared-compose.j2 <<EOF
services:
postgres:
image: postgres:{{ pg_version }}
container_name: postgres-core
environment:
POSTGRES_PASSWORD: {{ global_db_root_pass }}
ports:
- "5432:5432"
volumes:
- pg_data:/var/lib/postgresql/data
networks:
- alicante_net
redis:
image: redis:alpine
container_name: redis-core
command: redis-server --requirepass {{ global_redis_pass }}
networks:
- alicante_net
mariadb:
image: mariadb:10.6
container_name: mariadb-core
environment:
MYSQL_ROOT_PASSWORD: {{ global_db_root_pass }}
networks:
- alicante_net
networks:
alicante_net:
external: true
volumes:
pg_data:
EOF
# --- 2. BUSINESS APPS (Dolibarr, Teable, Activepieces) ---
cat > roles/core/templates/apps-business-compose.j2 <<EOF
services:
dolibarr:
image: tuxg/dolibarr:latest
environment:
DOLI_DB_HOST: postgres-core
DOLI_DB_PASSWORD: {{ global_db_root_pass }}
DOLI_ADMIN_LOGIN: admin
networks:
- alicante_net
ports:
- "8080:80"
teable:
image: teableio/teable:latest
environment:
PRISMA_DATABASE_URL: "postgresql://postgres:{{ global_db_root_pass }}@postgres-core:5432/teable"
REDIS_URL: "redis://:{{ global_redis_pass }}@redis-core:6379/0"
networks:
- alicante_net
ports:
- "3000:3000"
activepieces:
image: activepieces/activepieces:latest
environment:
AP_POSTGRES_HOST: postgres-core
AP_POSTGRES_PASSWORD: {{ global_db_root_pass }}
AP_REDIS_HOST: redis-core
AP_REDIS_PASSWORD: {{ global_redis_pass }}
networks:
- alicante_net
ports:
- "8081:80"
networks:
alicante_net:
external: true
EOF
# --- 3. DOCS & BI (Metabase, Bookstack, Carbone) ---
cat > roles/core/templates/apps-docs-compose.j2 <<EOF
services:
metabase:
image: metabase/metabase:latest
environment:
MB_DB_TYPE: postgres
MB_DB_HOST: postgres-core
MB_DB_USER: postgres
MB_DB_PASS: {{ global_db_root_pass }}
MB_DB_DBNAME: metabase
networks:
- alicante_net
ports:
- "3001:3000"
bookstack:
image: lscr.io/linuxserver/bookstack:latest
environment:
DB_HOST: mariadb-core
DB_USER: root
DB_PASS: {{ global_db_root_pass }}
networks:
- alicante_net
ports:
- "6875:80"
gotenberg:
image: gotenberg/gotenberg:8
networks:
- alicante_net
carbone:
image: carbone/carbone-sdk-rs
environment:
GOTENBERG_URL: "http://gotenberg:3000"
networks:
- alicante_net
ports:
- "4200:4200"
networks:
alicante_net:
external: true
EOF
# --- 4. DASHBOARD (Homarr, Dockge) ---
cat > roles/core/templates/dashboard-compose.j2 <<EOF
services:
homarr:
image: ghcr.io/ajnart/homarr:latest
volumes:
- /var/run/docker.sock:/var/run/docker.sock
networks:
- alicante_net
ports:
- "7575:7575"
dockge:
image: louislam/dockge:1
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /opt/stacks:/opt/stacks
environment:
- DOCKGE_STACKS_DIR=/opt/stacks
networks:
- alicante_net
ports:
- "5001:5001"
networks:
alicante_net:
external: true
EOF
echo "✅ Plantillas del Core reparadas."
# --- SUBIR A GIT ---
git add .
git commit -m "Reparacion plantillas Core vacias"
git push
echo "🚀 Listo. Dale al RUN en Semaphore."