Subida a producción

This commit is contained in:
David Arranz 2026-01-14 17:50:24 +01:00
parent 1a33dbac0c
commit b41f4de7d7
21 changed files with 106 additions and 75 deletions

View File

@ -16,6 +16,15 @@ ENV CI=1 \
NODE_ENV=production NODE_ENV=production
RUN corepack enable && corepack prepare pnpm@${PNPM_VERSION} --activate RUN corepack enable && corepack prepare pnpm@${PNPM_VERSION} --activate
# Librería para FastReport .NET CLI
RUN apt-get update && apt-get -y install libgdiplus
# Instalación de Java & AutoFirma para Debian
RUN apt-get -y install curl unzip default-jre libnss3-tools
RUN curl https://firmaelectronica.gob.es/content/dam/firmaelectronica/descargas-software/autofirma19/Autofirma_Linux_Debian.zip --output /tmp/autofirma.zip
RUN unzip /tmp/autofirma.zip autofirma_*.deb -d /tmp
RUN dpkg -i /tmp/autofirma_*.deb
WORKDIR /repo WORKDIR /repo
######################## ########################
@ -43,11 +52,6 @@ FROM base AS builder
COPY --from=pruner /repo/out/full/ ./ COPY --from=pruner /repo/out/full/ ./
COPY --from=pruner /repo/out/pnpm-lock.yaml ./pnpm-lock.yaml COPY --from=pruner /repo/out/pnpm-lock.yaml ./pnpm-lock.yaml
#COPY --from=pruner /repo/modules/customer-invoices/src/api/application/use-cases/proformas/report-proforma/reporter/templates ./templates
# Reutilizamos la store prefetch
#COPY --from=installer /root/.local/share/pnpm/store /root/.local/share/pnpm/store
# Instalamos solo lo necesario para prod de los workspaces # Instalamos solo lo necesario para prod de los workspaces
RUN pnpm install --frozen-lockfile --prefer-offline RUN pnpm install --frozen-lockfile --prefer-offline
@ -61,28 +65,31 @@ RUN pnpm -w turbo run build --filter=@erp/factuges-server...
#FROM ${NODE_IMAGE} AS runner #FROM ${NODE_IMAGE} AS runner
FROM base AS runner FROM base AS runner
# Puppeteer / Chrome dependencies - BEGIN
#
# Configure default locale (important for chrome-headless-shell). # Configure default locale (important for chrome-headless-shell).
ENV NODE_ENV=production TZ=UTC LANG=es_ES.UTF-8 #ENV NODE_ENV=production TZ=UTC LANG=es_ES.UTF-8
# Install Google Chrome Stable and fonts # Install Google Chrome Stable and fonts
# Note: this installs the necessary libs to make the browser work with Puppeteer. # Note: this installs the necessary libs to make the browser work with Puppeteer.
# Install latest chrome dev package and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others) # Install latest chrome dev package and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others)
# Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer # Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer
# installs, work. # installs, work.
RUN apt-get update \ #RUN apt-get update \
&& apt-get install -y wget gnupg \ # && apt-get install -y wget gnupg \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ # && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \ # && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \ # && apt-get update \
&& apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 \ # && apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 \
--no-install-recommends \ # --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* # && rm -rf /var/lib/apt/lists/*
# PUPPETEER CONFIG # PUPPETEER CONFIG
ENV PUPPETEER_SKIP_DOWNLOAD=true \ #ENV PUPPETEER_SKIP_DOWNLOAD=true \
PUPPETEER_EXECUTABLE_PATH=/usr/bin/google-chrome # PUPPETEER_EXECUTABLE_PATH=/usr/bin/google-chrome
#
# Puppeteer / Chrome dependencies - END
# Don't run production as root # Don't run production as root
#RUN addgroup --system --gid 1001 expressjs #RUN addgroup --system --gid 1001 expressjs
@ -97,12 +104,14 @@ COPY --from=builder /repo/pnpm-lock.yaml ./pnpm-lock.yaml
COPY --from=builder /repo/pnpm-workspace.yaml ./pnpm-workspace.yaml COPY --from=builder /repo/pnpm-workspace.yaml ./pnpm-workspace.yaml
COPY --from=builder /repo/apps/server/dist ./apps/server/dist COPY --from=builder /repo/apps/server/dist ./apps/server/dist
COPY --from=builder /repo/apps/server/.env.${COMPANY} ./apps/server/dist/.env #COPY --from=builder /repo/apps/server/.env.${COMPANY} ./apps/server/dist/.env
COPY --from=builder /repo/apps/server/node_modules ./apps/server/node_modules COPY --from=builder /repo/apps/server/node_modules ./apps/server/node_modules
COPY --from=builder /repo/apps/server/package.json ./apps/server/package.json COPY --from=builder /repo/apps/server/package.json ./apps/server/package.json
# Las plantillas estarán en un volumen apuntando a /repo/apps/server/templates COPY tools/fastreport-cli/publish/linux/FastReportCliGenerator ./tools/FastReportCliGenerator
#COPY --from=builder /repo/templates ./apps/server/dist/templates RUN chmod +x ./tools/FastReportCliGenerator
# Las plantillas estarán en un volumen apuntando a /shared/templates
# Salud del contenedor (ajusta puerto/endpoint) # Salud del contenedor (ajusta puerto/endpoint)

View File

@ -1,6 +1,6 @@
{ {
"name": "@erp/factuges-server", "name": "@erp/factuges-server",
"version": "0.1.1", "version": "0.1.4",
"private": true, "private": true,
"scripts": { "scripts": {
"build": "tsup src/index.ts --config tsup.config.ts", "build": "tsup src/index.ts --config tsup.config.ts",

View File

@ -1,7 +1,7 @@
{ {
"name": "@erp/factuges-web", "name": "@erp/factuges-web",
"private": true, "private": true,
"version": "0.1.1", "version": "0.1.4",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite --host --clearScreen false", "dev": "vite --host --clearScreen false",

View File

@ -1,6 +1,6 @@
{ {
"name": "@erp/auth", "name": "@erp/auth",
"version": "0.1.1", "version": "0.1.4",
"private": true, "private": true,
"type": "module", "type": "module",
"sideEffects": false, "sideEffects": false,

View File

@ -1,6 +1,6 @@
{ {
"name": "@erp/core", "name": "@erp/core",
"version": "0.1.1", "version": "0.1.4",
"private": true, "private": true,
"type": "module", "type": "module",
"sideEffects": false, "sideEffects": false,

View File

@ -1,6 +1,6 @@
{ {
"name": "@erp/customer-invoices", "name": "@erp/customer-invoices",
"version": "0.1.1", "version": "0.1.4",
"private": true, "private": true,
"type": "module", "type": "module",
"sideEffects": false, "sideEffects": false,

View File

@ -1,6 +1,6 @@
{ {
"name": "@erp/customers", "name": "@erp/customers",
"version": "0.1.1", "version": "0.1.4",
"private": true, "private": true,
"type": "module", "type": "module",
"sideEffects": false, "sideEffects": false,

View File

@ -1,6 +1,6 @@
{ {
"name": "@erp/doc-numbering", "name": "@erp/doc-numbering",
"version": "0.1.1", "version": "0.1.4",
"private": true, "private": true,
"type": "module", "type": "module",
"sideEffects": false, "sideEffects": false,

View File

@ -1,6 +1,6 @@
{ {
"name": "@repo/rdx-criteria", "name": "@repo/rdx-criteria",
"version": "0.1.1", "version": "0.1.4",
"private": true, "private": true,
"type": "module", "type": "module",
"sideEffects": false, "sideEffects": false,

View File

@ -1,6 +1,6 @@
{ {
"name": "@repo/rdx-ddd", "name": "@repo/rdx-ddd",
"version": "0.1.1", "version": "0.1.4",
"private": true, "private": true,
"type": "module", "type": "module",
"sideEffects": false, "sideEffects": false,

View File

@ -1,6 +1,6 @@
{ {
"name": "@repo/rdx-logger", "name": "@repo/rdx-logger",
"version": "0.1.1", "version": "0.1.4",
"private": true, "private": true,
"type": "module", "type": "module",
"sideEffects": false, "sideEffects": false,

View File

@ -1,6 +1,6 @@
{ {
"name": "@repo/rdx-utils", "name": "@repo/rdx-utils",
"version": "0.1.1", "version": "0.1.4",
"private": true, "private": true,
"type": "module", "type": "module",
"sideEffects": false, "sideEffects": false,

View File

@ -238,7 +238,7 @@ if [[ "$LOAD" == true ]]; then
[[ "$MODE" == "web" || "$MODE" == "all" ]] && scp -r -P "${SSH_PORT}" "${OUT_WEB_DIR}" "${SSH_USER}@${SSH_HOST}:/opt/factuges/${COMPANY}/" [[ "$MODE" == "web" || "$MODE" == "all" ]] && scp -r -P "${SSH_PORT}" "${OUT_WEB_DIR}" "${SSH_USER}@${SSH_HOST}:/opt/factuges/${COMPANY}/"
[[ "$MODE" == "api" || "$MODE" == "all" ]] && scp -r -P "${SSH_PORT}" "${OUT_API_DIR}" "${SSH_USER}@${SSH_HOST}:/opt/factuges/${COMPANY}/" [[ "$MODE" == "api" || "$MODE" == "all" ]] && scp -r -P "${SSH_PORT}" "${OUT_API_DIR}" "${SSH_USER}@${SSH_HOST}:/opt/factuges/${COMPANY}/"
[[ "$MODE" == "api" || "$MODE" == "all" ]] && scp -r -P "${SSH_PORT}" "${TEMPLATES_DIR}" "${SSH_USER}@${SSH_HOST}:/opt/factuges/${COMPANY}/" [[ "$MODE" == "api" || "$MODE" == "all" ]] && scp -r -P "${SSH_PORT}" "${TEMPLATES_DIR}" "${SSH_USER}@${SSH_HOST}:/opt/factuges/${COMPANY}/volumes/"
if [[ "$MODE" == "api" || "$MODE" == "all" ]]; then if [[ "$MODE" == "api" || "$MODE" == "all" ]]; then
RESULT=$(ssh -p "${SSH_PORT}" "${SSH_USER}@${SSH_HOST}" \ RESULT=$(ssh -p "${SSH_PORT}" "${SSH_USER}@${SSH_HOST}" \

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
SCRIPT_VERSION="0.0.1" SCRIPT_VERSION="0.0.2"
# ===================================================== # =====================================================
# TEMPLATES Build Script # TEMPLATES Build Script
@ -9,7 +9,7 @@ SCRIPT_VERSION="0.0.1"
# Recopilas plantillas de los módulos (por compañía) # Recopilas plantillas de los módulos (por compañía)
# ===================================================== # =====================================================
# Uso: # Uso:
# ./build_templates.sh <company> [--api|web|all] [--load] # ./build_templates.sh <company>
# #
# Funcionalidades: # Funcionalidades:
# - # -

View File

@ -86,8 +86,12 @@ services:
DB_PASS: ${DB_PASS} DB_PASS: ${DB_PASS}
FRONTEND_URL: ${FRONTEND_URL} FRONTEND_URL: ${FRONTEND_URL}
TEMPLATES_PATH: ${TEMPLATES_PATH} TEMPLATES_PATH: ${TEMPLATES_PATH}
DOCUMENTS_PATH: ${DOCUMENTS_PATH}
FASTREPORT_BIN: ${FASTREPORT_BIN}
volumes: volumes:
- ./templates:/repo/apps/server/templates:ro - ./volumes/templates:/shared/templates:ro
- ./volumes/certificates:/shared/certificates:ro
- ./volumes/documents:/shared/documents:rw
networks: networks:
- internal - internal
- edge - edge
@ -134,8 +138,8 @@ services:
factuges_sync: factuges_sync:
image: "factuges-sync:rodax-latest" image: "factuges-sync-factuges:rodax-latest"
container_name: "factuges_rodax_sync" container_name: "factuges_rodax_sync_factuges"
restart: "no" restart: "no"
environment: environment:
ENV: "production" ENV: "production"
@ -178,6 +182,50 @@ services:
- ./volumes/db_sync:/app/rodax - ./volumes/db_sync:/app/rodax
verifactu_sync:
image: "factuges-sync-verifactu:rodax-latest"
container_name: "factuges_rodax_sync_verifactu"
restart: "no"
environment:
ENV: "production"
LOCAL_TZ: "Europe/Madrid"
STATE_PATH: "${STATE_PATH}"
FACTUGES_HOST: "${FACTUGES_HOST}"
FACTUGES_PORT: "${FACTUGES_PORT}"
FACTUGES_DATABASE: "${FACTUGES_DATABASE}"
FACTUGES_USER: "${FACTUGES_USER}"
FACTUGES_PASSWORD: "${FACTUGES_PASSWORD}"
FWEB_MYSQL_HOST: "db"
FWEB_MYSQL_PORT: "${DB_PORT}"
FWEB_MYSQL_DATABASE: "${DB_NAME}"
FWEB_MYSQL_USER: "${DB_USER}"
FWEB_MYSQL_PASSWORD: "${DB_PASS}"
CTE_COMPANY_ID: "${CTE_COMPANY_ID}"
CTE_SERIE: "${CTE_SERIE}"
CTE_STATUS_INVOICE: "${CTE_STATUS_INVOICE}"
CTE_IS_PROFORMA: "${CTE_IS_PROFORMA}"
CTE_STATUS_VERIFACTU: "${CTE_STATUS_VERIFACTU}"
CTE_LANGUAGE_CODE: "${CTE_LANGUAGE_CODE}"
CTE_COUNTRY_CODE: "${CTE_COUNTRY_CODE}"
CTE_IS_COMPANY: "${CTE_IS_COMPANY}"
CTE_SYNC_RESULT_OK: "${CTE_SYNC_RESULT_OK}"
CTE_SYNC_RESULT_FAIL: "${CTE_SYNC_RESULT_FAIL}"
VERIFACTU_API_KEY: "${VERIFACTU_API_KEY}"
VERIFACTU_BASE_URL: "${VERIFACTU_BASE_URL}"
VERIFACTU_NIFS_API_KEY: "${VERIFACTU_NIFS_API_KEY}"
depends_on:
db:
condition: service_healthy
networks:
- internal
- edge
volumes:
- ./volumes/db_sync:/app/rodax
networks: networks:
edge: edge:
name: edge name: edge

View File

@ -14,9 +14,15 @@ DB_PORT=3306
# API # API
API_PORT=3002 API_PORT=3002
API_IMAGE=factuges-server:rodax-latest API_IMAGE=factuges-server:rodax-latest
TEMPLATES_PATH=/repo/apps/server/templates
FRONTEND_URL=factuges.rodax-software.local FRONTEND_URL=factuges.rodax-software.local
# Plantillas
TEMPLATES_PATH=/shared/templates
# Documentos generados
FASTREPORT_BIN=/repo/tools/FastReportCliGenerator
DOCUMENTS_PATH=/shared/documents
# SYNC # SYNC
ENV = development ENV = development
@ -37,7 +43,7 @@ FWEB_MYSQL_USER = acana # ${DB_USER}
FWEB_MYSQL_PASSWORD = r@U8%GJ+2e/AWR # ${DB_PASS} FWEB_MYSQL_PASSWORD = r@U8%GJ+2e/AWR # ${DB_PASS}
CTE_COMPANY_ID = '5e4dc5b3-96b9-4968-9490-14bd032fec5f' CTE_COMPANY_ID = '5e4dc5b3-96b9-4968-9490-14bd032fec5f'
CTE_SERIE = 'F25' CTE_SERIE = 'F26'
CTE_STATUS_INVOICE = 'issued' CTE_STATUS_INVOICE = 'issued'
CTE_IS_PROFORMA = 0 CTE_IS_PROFORMA = 0
CTE_STATUS_VERIFACTU = 'Pendiente' CTE_STATUS_VERIFACTU = 'Pendiente'
@ -47,6 +53,7 @@ CTE_IS_COMPANY = 1
CTE_SYNC_RESULT_OK = 1 CTE_SYNC_RESULT_OK = 1
CTE_SYNC_RESULT_FAIL = 2 CTE_SYNC_RESULT_FAIL = 2
#VERIFACTU_API_KEY = vf_test_C03HL2F0X5OXSDRunjNFoMxD4IrRfK3kCC8PfcvCENI=
VERIFACTU_API_KEY = vf_prod_yfjonNPv2E4Fij+5J0hct0zCgUeFYT2dZzb23UZlM+Q= VERIFACTU_API_KEY = vf_prod_yfjonNPv2E4Fij+5J0hct0zCgUeFYT2dZzb23UZlM+Q=
VERIFACTU_BASE_URL = https://api.verifacti.com/ VERIFACTU_BASE_URL = https://api.verifacti.com/
VERIFACTU_NIFS_API_KEY = vfn_osYpNdqSzAdTAHpazXG2anz4F3o0gfbSb5FFrCBZcno= VERIFACTU_NIFS_API_KEY = vfn_osYpNdqSzAdTAHpazXG2anz4F3o0gfbSb5FFrCBZcno=

View File

@ -11,9 +11,9 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<Version>1.1</Version> <Version>1.2</Version>
<AssemblyVersion>1.1.0.9</AssemblyVersion> <AssemblyVersion>1.2.0.0</AssemblyVersion>
<FileVersion>1.1.0.9</FileVersion> <FileVersion>1.2.0.0</FileVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -58,7 +58,6 @@ class Program
foreach (var conn in report.Dictionary.Connections) foreach (var conn in report.Dictionary.Connections)
{ {
Console.WriteLine($"Connection found: {conn.ToString()} ({conn.GetType().Name})");
if (conn is JsonDataSourceConnection jdc) if (conn is JsonDataSourceConnection jdc)
{ {
jsonConn = jdc; jsonConn = jdc;

View File

@ -1,32 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.2.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{07C2787E-EAC7-C090-1BA3-A61EC2A24D84}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "fastreport-cli", "fastreport-cli", "{1C34789F-0E1A-CA83-9858-BEAA929278B6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FastReportCliGenerator", "tools\fastreport-cli\FastReportCliGenerator.csproj", "{A8ED47CA-7B74-F26D-058D-6D6FD981B253}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A8ED47CA-7B74-F26D-058D-6D6FD981B253}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A8ED47CA-7B74-F26D-058D-6D6FD981B253}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A8ED47CA-7B74-F26D-058D-6D6FD981B253}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A8ED47CA-7B74-F26D-058D-6D6FD981B253}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{1C34789F-0E1A-CA83-9858-BEAA929278B6} = {07C2787E-EAC7-C090-1BA3-A61EC2A24D84}
{A8ED47CA-7B74-F26D-058D-6D6FD981B253} = {1C34789F-0E1A-CA83-9858-BEAA929278B6}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {AF858B63-A8CD-4661-B6E0-451742E4C40E}
EndGlobalSection
EndGlobal