43 Commits

Author SHA1 Message Date
Guillermo
081ff7a331 script t parse the docker compose template with some values requested to the user 2026-02-17 16:48:44 +00:00
Guillermo
044434c642 New Worflow deploy 2026-02-17 16:10:17 +00:00
Guillermo
15ed12f0c6 wrong copy and paste
All checks were successful
Tag Release / new images (release) Successful in 1m6s
2026-02-17 11:08:35 +00:00
5b3bd631cb typo fixed
Some checks failed
Tag Release / new images (release) Failing after 10s
2026-02-17 10:50:41 +00:00
Guillermo
3ea406044b change docker image tag build process
Some checks failed
Tag Release / new images (release) Failing after 11s
2026-02-17 10:47:11 +00:00
Guillermo
4cd49d8c9a change docker image tag build process 2026-02-17 10:42:21 +00:00
Guillermo
7a931d32ba Update actions
Some checks failed
Tag Release / new images (release) Failing after 12s
2026-02-17 10:39:24 +00:00
01853b41ba two steps
All checks were successful
Tag Release / new images (release) Successful in 4s
2026-02-16 16:59:16 +00:00
8c2ffaae55 typo? 2026-02-16 16:57:23 +00:00
Guillermo
1976432a95 Changing workflows triggers
Some checks failed
Tag Release / create new images with tag (release) Failing after 0s
2026-02-16 16:50:00 +00:00
Guillermo
c25c6c2916 action for tag creation
All checks were successful
Workflow de prueba / Build and push images (push) Successful in 1m7s
2026-02-16 16:17:26 +00:00
Guillermo
1a682c121e reduced at 468
All checks were successful
Workflow de prueba / Build and push images (push) Successful in 1m8s
2026-02-16 14:44:43 +00:00
c633124454 Reduccion 1
All checks were successful
Workflow de prueba / Build and push images (push) Successful in 1m36s
2026-02-15 15:08:56 +00:00
1030fa994c Reducción 1
Some checks failed
Workflow de prueba / Build and push images (push) Has been cancelled
2026-02-15 15:08:25 +00:00
5707b1fbc4 back to original
All checks were successful
Workflow de prueba / Build and push images (push) Successful in 1m32s
2026-02-15 15:01:52 +00:00
Guillermo
d6db3d3e70 trying to reduce image size 2 fix typo
All checks were successful
Workflow de prueba / Build and push images (push) Successful in 1m39s
2026-02-15 11:28:20 +00:00
Guillermo
768e384ed6 trying to reduce image size 2
Some checks failed
Workflow de prueba / Build and push images (push) Failing after 32s
2026-02-15 11:24:09 +00:00
Guillermo
b6dc8485c0 trying to reduce image size
Some checks failed
Workflow de prueba / Build and push images (push) Failing after 35s
2026-02-15 11:11:36 +00:00
Guillermo
47070f71db trying to reduce image size
Some checks failed
Workflow de prueba / Build and push images (push) Failing after 34s
2026-02-15 11:06:09 +00:00
Guillermo
5e688aa1fa vuelta a node par aservir frontend
All checks were successful
Workflow de prueba / Build and push images (push) Successful in 1m29s
2026-02-15 10:38:22 +00:00
232a687942 ignore more files
All checks were successful
Workflow de prueba / Build and push images (push) Successful in 1m26s
2026-02-14 23:21:46 +00:00
b50e3c756c reduce image
All checks were successful
Workflow de prueba / Build and push images (push) Successful in 1m25s
2026-02-14 23:04:32 +00:00
8cfce22f1d slimer image
Some checks failed
Workflow de prueba / Build and push images (push) Has been cancelled
2026-02-14 23:03:29 +00:00
2433b48c35 image frontend reduction
All checks were successful
Workflow de prueba / Build and push images (push) Successful in 1m27s
2026-02-14 22:50:49 +00:00
c5064383fe fix typo in image name
All checks were successful
Workflow de prueba / Build and push images (push) Successful in 1m28s
2026-02-14 19:04:01 +00:00
77b61d3f33 Change backend build context
All checks were successful
Workflow de prueba / Build and push images (push) Successful in 1m34s
2026-02-14 18:41:30 +00:00
Guillermo
070af13d86 push differents images
Some checks failed
Workflow de prueba / Build and push images (push) Failing after 33s
2026-02-14 11:57:57 +00:00
Guillermo
2a070ab921 new tag of image
All checks were successful
Workflow de prueba / Build and push images (push) Successful in 1m22s
2026-02-14 11:39:18 +00:00
Guillermo
7923b8c13e new test
Some checks failed
Workflow de prueba / Build and push images (push) Failing after 1m20s
2026-02-14 11:23:44 +00:00
Guillermo
d924636def new registry
Some checks failed
Workflow de prueba / Build and push images (push) Failing after 1m24s
2026-02-14 10:45:41 +00:00
Guillermo
8bb952eba5 branch
Some checks failed
Workflow de prueba / Build and push images (push) Failing after 1m19s
2026-02-13 14:04:11 +00:00
Guillermo
80df1368b1 branch
Some checks failed
Workflow de prueba / Build and push images (push) Failing after 1m22s
2026-02-13 14:01:07 +00:00
Guillermo
a5fe8414de branch
Some checks failed
Workflow de prueba / Build and push images (push) Failing after 10s
2026-02-13 13:56:26 +00:00
Guillermo
5edfd256c1 branch
Some checks failed
Workflow de prueba / Build and push images (push) Failing after 10s
2026-02-13 13:55:42 +00:00
Guillermo
9f04467a6d bad user to push
Some checks failed
Workflow de prueba / Build and push images (push) Failing after 11s
2026-02-13 13:53:31 +00:00
Guillermo
f8323ea419 bad user to push
Some checks failed
Workflow de prueba / Build and push images (push) Failing after 10s
2026-02-13 13:51:41 +00:00
Guillermo
1cc463f659 bad user to push
Some checks failed
Workflow de prueba / Build and push images (push) Failing after 1m28s
2026-02-13 13:46:11 +00:00
Guillermo
caa7cfb564 remove amr64
Some checks failed
Workflow de prueba / Build and push images (push) Failing after 1m19s
2026-02-13 13:42:27 +00:00
Guillermo
559f49db8a remove amr64
Some checks failed
Workflow de prueba / Build and push images (push) Failing after 1m22s
2026-02-13 13:29:50 +00:00
Guillermo
57d2bcdd07 remove amr64 2026-02-13 13:28:37 +00:00
Guillermo
807bcc8034 registry problems
Some checks failed
Workflow de prueba / Build and push images (push) Has been cancelled
2026-02-13 13:23:01 +00:00
Guillermo
46b85f5ee7 without QEMU & pushing to registry
Some checks failed
Workflow de prueba / Build and push images (push) Failing after 9m31s
2026-02-13 13:06:16 +00:00
Guillermo
d252607c79 without QEMU 2026-02-13 12:53:43 +00:00
7 changed files with 261 additions and 39 deletions

View File

@@ -0,0 +1,21 @@
name: Deploy solution
on:
workflow_dispatch:
inputs:
domain:
description: 'Seleccione destino:'
required: true
default: 'demo.analytics.beyondcx.org'
tag:
description: 'Indique el tag/release'
required: true
default: 'latest'
jobs:
log-the-inputs:
runs-on: ubuntu-latest
steps:
- run: echo "${{ inputs.domain }} con la imagen ${{ inputs.tag }}"

View File

@@ -1,11 +1,13 @@
name: Workflow de prueba name: Workflow de prueba
on: on:
- push pull_request_review:
types: [submitted]
env: env:
DOCKER_ORG: beyondcx DOCKER_ORG: beyondcx
BRANCH_NAME: main BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
jobs: jobs:
Build and push images: Build and push images:
@@ -14,33 +16,37 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Extract Branch Name
run: echo "BRANCH_NAME=${{ gitea.ref_name }}" >> env.BRANCH_NAME
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Buildx - name: Setup Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
with: with:
driver-opts: network=host driver-opts: network=host
- name: Login to Registry
uses: docker/login-action@v3
with:
registry: git.beyondcx.org
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PWD }}
- name: Echo the Tag - name: Echo the Tag
run: echo "Tag ${{ env.DOCKER_ORG }}/beyondcx:${{ env.BRANCH_NAME }}" run: echo "Tag ${{ env.DOCKER_ORG }}/beyondcx:${{ env.BRANCH_NAME }}"
- name: Build - name: Login to Registry
uses: docker/build-push-action@v3 uses: docker/login-action@v3
with: with:
context: . registry: ${{ secrets.REGISTRY_URL }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PWD }}
- name: Build frontend and push it to registry
uses: docker/build-push-action@v5
with:
context: frontend
push: false push: false
tags: ${{ env.DOCKER_ORG }}/beyondcx:${{ env.BRANCH_NAME }} tags: ${{ secrets.REGISTRY_URL }}/${{ env.DOCKER_ORG }}/frontend-analytics-demo:${{ env.BRANCH_NAME }}
platforms: linux/amd64,linux/arm64 platforms: linux/amd64
file: frontend/Dockerfile
- name: Build backend and push it to registry
uses: docker/build-push-action@v5
with:
context: backend
push: false
tags: ${{ secrets.REGISTRY_URL }}/${{ env.DOCKER_ORG }}/backend-analytics-demo:${{ env.BRANCH_NAME }}
platforms: linux/amd64
file: backend/Dockerfile

52
.gitea/workflows/tag.yaml Normal file
View File

@@ -0,0 +1,52 @@
name: Tag Release
on:
release:
types: [created,edited,published]
env:
DOCKER_ORG: beyondcx
jobs:
new images:
runs-on: ubuntu-latest
steps:
- name: Extract Tag Name
uses: olegtarasov/get-tag@v2.1.4
id: tagName
- name: Show tag
run: echo "$GIT_TAG_NAME";
- name: Checkout
uses: actions/checkout@v4
- name: Setup Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: network=host
- name: Login to Registry
uses: docker/login-action@v3
with:
registry: ${{ secrets.REGISTRY_URL }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PWD }}
- name: Build frontend and push it to registry
uses: docker/build-push-action@v5
with:
context: frontend
push: true
tags: ${{ secrets.REGISTRY_URL }}/${{ env.DOCKER_ORG }}/frontend-analytics-demo:${{ steps.tagName.outputs.tag }}
platforms: linux/amd64
file: frontend/Dockerfile
- name: Build backend and push it to registry
uses: docker/build-push-action@v5
with:
context: backend
push: true
tags: ${{ secrets.REGISTRY_URL }}/${{ env.DOCKER_ORG }}/backend-analytics-demo:${{ steps.tagName.outputs.tag }}
platforms: linux/amd64
file: backend/Dockerfile

View File

@@ -11,3 +11,8 @@ build
data/output data/output
*.zip *.zip
.DS_Store .DS_Store
*.log
Dockerfile
docker-compose.yml
.env
tests

View File

@@ -1,31 +1,50 @@
# backend/Dockerfile # ---------------------------
FROM python:3.11-slim # Builder stage
# ---------------------------
FROM python:3.13-bookworm AS builder
# Evitar .pyc y buffering # Solo herramientas necesarias para compilar dependencias
ENV PYTHONDONTWRITEBYTECODE=1 RUN apt-get update && apt-get install -y --no-install-recommends \
ENV PYTHONUNBUFFERED=1 build-essential && apt-get clean && rm -rf /var/lib/apt/lists/*
ADD https://astral.sh/uv/install.sh /install.sh
RUN chmod -R 655 /install.sh && /install.sh && rm /install.sh
ENV PATH="/root/.local/bin:$PATH"
WORKDIR /app WORKDIR /app
# Dependencias del sistema mínimas # Copiamos solo archivos de dependencias (mejor cache)
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Copiamos pyproject y lock si lo hubiera
COPY pyproject.toml ./ COPY pyproject.toml ./
# Instalamos dependencias # Cambiamos pip por uv más moderno y rápido
RUN pip install --upgrade pip && \ RUN uv sync
pip install .
# ---------------------------
# Runtime stage
# ---------------------------
FROM python:3.13-slim-bookworm AS production
# Copiamos el resto del código (respetando .dockerignore)
COPY . .
# Variables de autenticación básica
ENV BASIC_AUTH_USERNAME=admin ENV BASIC_AUTH_USERNAME=admin
ENV BASIC_AUTH_PASSWORD=admin ENV BASIC_AUTH_PASSWORD=admin
WORKDIR /app
# Crear usuario no-root
RUN useradd --create-home appuser
# Copiamos código y producto uv
COPY . .
COPY --from=builder /app/.venv .venv
# Cambiar permisos
#RUN chown -R appuser:appuser /app
#USER appuser
ENV PATH="/app/.venv/bin:$PATH"
EXPOSE 8000 EXPOSE 8000
CMD ["python", "-m", "uvicorn", "beyond_api.main:app", "--host", "0.0.0.0", "--port", "8000"] CMD ["uvicorn", "beyond_api.main:app", "--host", "0.0.0.0", "--port", "8000"]

View File

@@ -20,17 +20,22 @@ ENV VITE_API_BASE_URL=${VITE_API_BASE_URL}
# Construimos el bundle # Construimos el bundle
RUN npm run build RUN npm run build
# 2) Fase de servidor estático # 2) Fase de servidor estático. Tenemos que revisar
FROM node:20-alpine FROM node:20-alpine
#FROM nginx:alpine
WORKDIR /app WORKDIR /app
#RUN rm -rf /usr/share/nginx/html/*
# Copiamos el build # Copiamos el build
#COPY --from=build /app/dist /usr/share/nginx/html
COPY --from=build /app/dist ./dist COPY --from=build /app/dist ./dist
# Server estático muy simple # Server estático muy simple
RUN npm install -g serve RUN npm install -g serve
#EXPOSE 80
EXPOSE 4173 EXPOSE 4173
#CMD ["nginx", "-g", "daemon off;"]
CMD ["serve", "-s", "dist", "-l", "4173"] CMD ["serve", "-s", "dist", "-l", "4173"]

114
generate_compose.sh Executable file
View File

@@ -0,0 +1,114 @@
#!/usr/bin/env bash
set -euo pipefail
###############################################
# CONFIGURACIÓN BÁSICA EDITA ESTO
###############################################
# TODO: pon aquí la URL real de tu repo (sin credenciales)
REPO_URL_DEFAULT="ssh://git@git.beyondcx.org:2424/susana/BeyondCXAnalytics-Demo.git"
INSTALL_BASE="/opt/beyondcx"
###############################################
# UTILIDADES
###############################################
step() {
echo
echo "=================================================="
echo " 👉 $1"
echo "=================================================="
}
###############################################
# 1. COMPROBACIONES INICIALES
###############################################
step "Recogiendo datos de configuración"
read -rp "Dominio para la aplicación (ej: app.cliente.com): " DOMAIN
if [ -z "$DOMAIN" ]; then
echo "El dominio no puede estar vacío."
exit 1
fi
SUBDOMAIN=${DOMAIN%%.*}
if [[ $DOMAIN == $SUBDOMAIN ]]; then
DOMAIN=$DOMAIN".analytics.beyondcx.org"
fi
echo "el dominio es $DOMAIN y el subdominio $SUBDOMAIN"
INSTALL_DIR=$INSTALL_BASE"/"$SUBDOMAIN
read -rp "Usuario de acceso (Basic Auth / login): " API_USER
if [ -z "$API_USER" ]; then
echo "El usuario no puede estar vacío."
exit 1
fi
read -rsp "Contraseña de acceso: " API_PASS
echo
if [ -z "$API_PASS" ]; then
echo "La contraseña no puede estar vacía."
exit 1
fi
echo
echo "Resumen de configuración:"
echo " Dominio: $DOMAIN"
echo " Usuario API: $API_USER"
read -rp "¿Continuar con la instalación? [s/N]: " CONFIRM
CONFIRM=${CONFIRM:-N}
if [[ ! "$CONFIRM" =~ ^[sS]$ ]]; then
echo "Instalación cancelada."
exit 0
fi
# COMENZAMOS ...
###############################################
# 4. CONFIGURAR docker-compose.yml (credenciales y nginx)
###############################################
step "Aplicando credenciales al docker-compose.yml"
if ! grep -q "BASIC_AUTH_USERNAME" docker-compose.yml; then
echo "⚠ No encuentro BASIC_AUTH_USERNAME en docker-compose.yml. Revisa el archivo a mano."
else
sed -i "s/BASIC_AUTH_USERNAME:.*/BASIC_AUTH_USERNAME: \"$API_USER\"/" docker-compose.yml
fi
if ! grep -q "BASIC_AUTH_PASSWORD" docker-compose.yml; then
echo "⚠ No encuentro BASIC_AUTH_PASSWORD en docker-compose.yml. Revisa el archivo a mano."
else
sed -i "s/BASIC_AUTH_PASSWORD:.*/BASIC_AUTH_PASSWORD: \"$API_PASS\"/" docker-compose.yml
fi
if ! grep -q "XXX" docker-compose.yml; then
echo "⚠ No encuentro XXX en docker-compose.yml. Revisa el archivo a mano."
else
sed -i "s/XXX/$SUBDOMAIN/g" docker-compose.yml
fi
if [[ $DOMAIN == $SUBDOMAIN ]]; then
set DOMAIN=$DOMAIN".analytics.beyondcx.org"
fi
if ! grep -q "DDD" docker-compose.yml; then
echo "⚠ No encuentro DDD en docker-compose.yml. Revisa el archivo a mano."
else
sed -i "s/DDD/$DOMAIN/" docker-compose.yml
fi
step "Arrancando contenedores"
docker compose up -d
###############################################
# 8. FIN
###############################################
step "Instalación completada"
echo "La aplicación debería estar disponible en: https://$DOMAIN"
echo
echo "Servicios levantados:"
docker compose ps