25 Commits

Author SHA1 Message Date
985c85da59 Colas persistentes 2026-05-12 13:37:48 +02:00
23c61097a8 Env por defecto para NOS 2026-05-12 13:18:24 +02:00
5372045bd7 Error path 2026-05-12 12:51:06 +02:00
72d61b8376 Error path 2026-05-12 12:04:32 +02:00
526c094494 Crear dir de certificados 2026-05-12 11:13:14 +02:00
474f7b7c68 nombre 2026-05-12 08:56:37 +02:00
f8692e3e2e cert 2026-05-12 08:46:08 +02:00
62715fae34 Fix jenkisfile 2026-05-12 08:34:23 +02:00
f8678a68bb compose 2026-05-11 17:37:35 +02:00
8f8ae22f23 tado p12 2026-05-11 17:35:47 +02:00
2611147eb3 debug 2026-05-11 17:25:48 +02:00
b0b3badd5c test path 2026-05-11 16:59:16 +02:00
2b812098fb Ruta 2026-05-11 16:56:29 +02:00
3146efec64 Faltaba alai 2026-05-11 16:49:38 +02:00
44e4b98e35 errata 2026-05-11 15:54:13 +02:00
6adb4d5c95 Codigo no usable 2026-05-11 15:52:40 +02:00
bcb1a28164 build limpia 2026-05-11 15:30:51 +02:00
d5798602e2 Error nombre paquete 2026-05-11 15:16:09 +02:00
1f94a89520 Ordern correcto de operaciones 2026-05-11 13:08:35 +02:00
44bbc8f17c Scripts distintos para prod 2026-05-11 12:51:13 +02:00
9e6877c329 Cambiado a cp -P para mantener symlink 2026-05-11 12:42:47 +02:00
d5883ba75e Links simbolicos para .env 2026-05-11 12:36:29 +02:00
421d0aa705 Probando con links simbolicos 2026-05-11 12:24:29 +02:00
69b5958296 Merge branch 'main' of git.savefamilygps.net:SaveFamily/sf-sim 2026-05-11 12:16:36 +02:00
b9e3e1784f Merge pull request 'WEBINT-335_migracion_alai' (#4) from WEBINT-335_migracion_alai into main
Reviewed-on: #4
2026-05-11 08:12:54 +00:00
15 changed files with 151 additions and 128 deletions

View File

@@ -6,6 +6,8 @@ networks:
external: true external: true
internal: internal:
driver: bridge driver: bridge
volumes:
rabbitmq_data:
services: services:
rabbitmq-sim-broker: rabbitmq-sim-broker:
@@ -28,6 +30,7 @@ services:
entrypoint: ["bash", "/usr/local/bin/docker-entrypoint-wrapper.sh"] entrypoint: ["bash", "/usr/local/bin/docker-entrypoint-wrapper.sh"]
command: ["rabbitmq-server"] command: ["rabbitmq-server"]
volumes: volumes:
- rabbitmq_data:/var/lib/rabbitmq
- ./rabbit/docker-entrypoint-wrapper.sh:/usr/local/bin/docker-entrypoint-wrapper.sh:ro - ./rabbit/docker-entrypoint-wrapper.sh:/usr/local/bin/docker-entrypoint-wrapper.sh:ro
- ./rabbitmq_plugins/enabled_plugins:/etc/rabbitmq/enabled_plugins:ro - ./rabbitmq_plugins/enabled_plugins:/etc/rabbitmq/enabled_plugins:ro
- ./rabbit/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf:ro - ./rabbit/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf:ro
@@ -73,7 +76,9 @@ services:
volumes: volumes:
- ./.env:/home/node/app/.env:ro - ./.env:/home/node/app/.env:ro
- ./sim-consumidor-nos.env:/home/node/app/packages/sim-consumidor-nos/.env:ro - ./sim-consumidor-nos.env:/home/node/app/packages/sim-consumidor-nos/.env:ro
- ./sim-consumidor-alai.env:/home/node/app/packages/sim-consumidor-alai/.env:ro
- ./sim-consumidor-objenious.env:/home/node/app/packages/sim-consumidor-objenious/.env:ro - ./sim-consumidor-objenious.env:/home/node/app/packages/sim-consumidor-objenious/.env:ro
- ./wsaccess_alaisecure_com_cert_client_new.p12:/home/node/app/packages/sim-consumidor-alai/certificates/wsaccess_alaisecure_com_cert_client_new.p12:ro
- ./sim-objenious-cron.env:/home/node/app/packages/sim-objenious-cron/.env:ro - ./sim-objenious-cron.env:/home/node/app/packages/sim-objenious-cron/.env:ro
- ./obj.pem:/home/node/app/packages/sim-consumidor-objenious/obj.pem:ro - ./obj.pem:/home/node/app/packages/sim-consumidor-objenious/obj.pem:ro
- ./obj.pem:/home/node/app/packages/sim-objenious-cron/obj.pem:ro - ./obj.pem:/home/node/app/packages/sim-objenious-cron/obj.pem:ro

View File

@@ -23,7 +23,7 @@ pipeline {
stage("🧱 Building") { stage("🧱 Building") {
steps { steps {
sh 'rm -rf dist/' sh 'rm -rf dist/'
sh 'yarn run build' sh 'yarn run build:prod'
} }
} }
stage("🏗 Deploying") { stage("🏗 Deploying") {
@@ -40,31 +40,11 @@ pipeline {
), ),
sshTransfer( sshTransfer(
cleanRemote: false, cleanRemote: false,
execCommand: "ln -sf $BASE_REMOTE_PATH/vault/savefamily/sf-sims/.env $APP_REMOTE_PATH/.env" execCommand: "rm -rf $APP_REMOTE_PATH/dist"
), ),
sshTransfer( sshTransfer(
cleanRemote: false, cleanRemote: false,
execCommand: "ln -sf $BASE_REMOTE_PATH/vault/savefamily/sf-sims/sim-consumidor-objenious.env $APP_REMOTE_PATH/packages/sim-consumidor-objenious/.env" execCommand: "ls -la $BASE_REMOTE_PATH/vault/savefamily/sf-sims/"
),
sshTransfer(
cleanRemote: false,
execCommand: "ln -sf $BASE_REMOTE_PATH/vault/savefamily/sf-sims/sim-consumidor-nos.env $APP_REMOTE_PATH/packages/sim-consumidor-nos/.env"
),
sshTransfer(
cleanRemote: false,
execCommand: "ln -sf $BASE_REMOTE_PATH/vault/savefamily/sf-sims/sim-consumidor-alai.env $APP_REMOTE_PATH/packages/sim-consumidor-alai/.env"
),
sshTransfer(
cleanRemote: false,
execCommand: "ln -sf $BASE_REMOTE_PATH/vault/savefamily/sf-sims/wsaccess_alaisecure_com_cert_client_new.p12 $APP_REMOTE_PATH/packages/wsaccess_alaisecure_com_cert_client_new.p12"
),
sshTransfer(
cleanRemote: false,
execCommand: "ln -sf $BASE_REMOTE_PATH/vault/savefamily/sf-sims/sim-objenious-cron.env $APP_REMOTE_PATH/packages/sim-objenious-cron/.env"
),
sshTransfer(
cleanRemote: false,
execCommand: "ln -sf $BASE_REMOTE_PATH/vault/savefamily/sf-sims/obj.pem $APP_REMOTE_PATH/packages/sim-consumidor-objenious/obj.pem"
), ),
sshTransfer( sshTransfer(
cleanRemote: false, cleanRemote: false,
@@ -72,6 +52,34 @@ pipeline {
sourceFiles: "dist/**/*", sourceFiles: "dist/**/*",
excludes: "dist/**/node_modules/**" excludes: "dist/**/node_modules/**"
), ),
sshTransfer(
cleanRemote: false,
execCommand: "ln -sf $BASE_REMOTE_PATH/vault/savefamily/sf-sims/.env $APP_REMOTE_PATH/.env"
),
sshTransfer(
cleanRemote: false,
execCommand: "ln -sf $BASE_REMOTE_PATH/vault/savefamily/sf-sims/wsaccess_alaisecure_com_cert_client_new.p12 $APP_REMOTE_PATH/wsaccess_alaisecure_com_cert_client_new.p12"
),
sshTransfer(
cleanRemote: false,
execCommand: "ln -sf $BASE_REMOTE_PATH/vault/savefamily/sf-sims/sim-consumidor-objenious.env $APP_REMOTE_PATH/sim-consumidor-objenious.env"
),
sshTransfer(
cleanRemote: false,
execCommand: "ln -sf $BASE_REMOTE_PATH/vault/savefamily/sf-sims/sim-consumidor-nos.env $APP_REMOTE_PATH/sim-consumidor-nos.env"
),
sshTransfer(
cleanRemote: false,
execCommand: "ln -sf $BASE_REMOTE_PATH/vault/savefamily/sf-sims/sim-consumidor-alai.env $APP_REMOTE_PATH/sim-consumidor-alai.env"
),
sshTransfer(
cleanRemote: false,
execCommand: "ln -sf $BASE_REMOTE_PATH/vault/savefamily/sf-sims/sim-objenious-cron.env $APP_REMOTE_PATH/sim-objenious-cron.env"
),
sshTransfer(
cleanRemote: false,
execCommand: "ln -sf $BASE_REMOTE_PATH/vault/savefamily/sf-sims/obj.pem $APP_REMOTE_PATH/obj.pem"
),
sshTransfer( sshTransfer(
cleanRemote: false, cleanRemote: false,
remoteDirectory: "$APP_REMOTE_PATH", remoteDirectory: "$APP_REMOTE_PATH",

View File

@@ -1,90 +1,92 @@
{ {
"rabbit_version": "4.2.2", "rabbit_version": "4.2.2",
"rabbitmq_version": "4.2.2", "rabbitmq_version": "4.2.2",
"product_name": "RabbitMQ", "product_name": "RabbitMQ",
"product_version": "4.2.2", "product_version": "4.2.2",
"users": [ "users": [
{ {
"name": "RABBITMQ_USER_PLACEHOLDER", "name": "RABBITMQ_USER_PLACEHOLDER",
"password": "RABBITMQ_PASSWORD_PLACEHOLDER", "password": "RABBITMQ_PASSWORD_PLACEHOLDER",
"tags": ["administrator"] "tags": [
} "administrator"
], ]
"vhosts": [ }
{ ],
"name": "sim-vhost" "vhosts": [
} {
], "name": "sim-vhost"
"permissions": [ }
{ ],
"user": "RABBITMQ_USER_PLACEHOLDER", "permissions": [
"vhost": "sim-vhost", {
"configure": ".*", "user": "RABBITMQ_USER_PLACEHOLDER",
"write": ".*", "vhost": "sim-vhost",
"read": ".*" "configure": ".*",
} "write": ".*",
], "read": ".*"
"topic_permissions": [], }
"parameters": [], ],
"global_parameters": [ "topic_permissions": [],
{ "parameters": [],
"name": "cluster_name", "global_parameters": [
"value": "rabbit@a8d5c6e08439" {
}, "name": "cluster_name",
{ "value": "rabbit@a8d5c6e08439"
"name": "internal_cluster_id", },
"value": "rabbitmq-cluster-id-gXeBLbsUC2W2tU0Bx_QY_w" {
} "name": "internal_cluster_id",
], "value": "rabbitmq-cluster-id-gXeBLbsUC2W2tU0Bx_QY_w"
"policies": [ }
{ ],
"vhost": "sim-vhost", "policies": [
"name": "pol.sim.dlx", {
"pattern": "sim.*", "vhost": "sim-vhost",
"apply-to": "queues", "name": "pol.sim.dlx",
"definition": { "pattern": "sim.*",
"dead-letter-exchange": "sim.dlx" "apply-to": "queues",
}, "definition": {
"priority": 7 "dead-letter-exchange": "sim.dlx"
} },
], "priority": 7
"exchanges": [ }
{ ],
"name": "sim.exchange", "exchanges": [
"vhost": "sim-vhost", {
"type": "topic", "name": "sim.exchange",
"durable": true, "vhost": "sim-vhost",
"auto_delete": false, "type": "topic",
"internal": false, "durable": true,
"argurments": {} "auto_delete": false,
}, "internal": false,
{ "argurments": {}
"name": "sim.dlx", },
"vhost": "sim-vhost", {
"type": "topic", "name": "sim.dlx",
"durable": true, "vhost": "sim-vhost",
"auto_delete": false, "type": "topic",
"internal": false, "durable": true,
"argurments": {} "auto_delete": false,
} "internal": false,
], "argurments": {}
"queues": [ }
{ ],
"name": "sim.logs", "queues": [
"vhost": "sim-vhost", {
"durable": true, "name": "sim.logs",
"auto_delete": false, "vhost": "sim-vhost",
"arguments": {} "durable": true,
} "auto_delete": false,
], "arguments": {}
"bindings": [ }
{ ],
"source": "sim.exchange", "bindings": [
"vhost": "sim-vhost", {
"destination": "sim.logs", "source": "sim.exchange",
"destination_type": "queue", "vhost": "sim-vhost",
"routing_key": "sim.#", "destination": "sim.logs",
"arguments": {} "destination_type": "queue",
} "routing_key": "sim.#",
] "arguments": {}
} }
]
}

View File

@@ -8,6 +8,7 @@
"scripts": { "scripts": {
"test": "vitest watch", "test": "vitest watch",
"build": "rm -rf ./dist && yarn workspaces foreach -Api run build && yarn setup:runtime", "build": "rm -rf ./dist && yarn workspaces foreach -Api run build && yarn setup:runtime",
"build:prod": "rm -rf ./dist && yarn workspaces foreach -Api run build:prod && yarn setup:runtime",
"setup:runtime": "mkdir -p dist/packages/node_modules && ln -sf ../sim-shared dist/packages/node_modules/sim-shared && ln -sf ../sf-consumidor-objenious dist/packages/node_modules/sim-consumidor-objenious", "setup:runtime": "mkdir -p dist/packages/node_modules && ln -sf ../sim-shared dist/packages/node_modules/sim-shared && ln -sf ../sf-consumidor-objenious dist/packages/node_modules/sim-consumidor-objenious",
"start": "yarn workspaces foreach -Apiv run start", "start": "yarn workspaces foreach -Apiv run start",
"typecheck": "npx tsc --noEmit", "typecheck": "npx tsc --noEmit",

View File

@@ -144,6 +144,8 @@ export class SimAlaiUsecases {
const applyOrder = await this.alaiRepository.applyOrder(orderId) const applyOrder = await this.alaiRepository.applyOrder(orderId)
if (applyOrder.error != undefined) { if (applyOrder.error != undefined) {
// TODO: gestion del error
// reusar el orderId
return applyOrder return applyOrder
} }

View File

@@ -39,9 +39,10 @@
}, },
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"build": "yarn tsc --project tsconfig.json && yarn tsc-alias && cp package.json ../../dist/packages/sim-consumidor-nos/ && cp -r certificates/ ../../dist/packages/sim-consumidor-alai/", "build": "yarn tsc --project tsconfig.json && yarn tsc-alias && cp -P .env package.json ../../dist/packages/sim-consumidor-alai/ && cp -r certificates/ ../../dist/packages/sim-consumidor-alai/",
"build:prod": "yarn tsc --project tsconfig.json && yarn tsc-alias && cp -P package.json ../../dist/packages/sim-consumidor-alai/ && mkdir ../../dist/packages/sim-consumidor-alai/certificates",
"esbuild": "esbuild index.ts --platform=node", "esbuild": "esbuild index.ts --platform=node",
"start": "node ../../dist/packages/sim-consumidor-nos/index.js", "start": "node ../../dist/packages/sim-consumidor-alai/index.js",
"dev": "tsx watch index.ts" "dev": "tsx watch index.ts"
}, },
"author": "", "author": "",

View File

@@ -29,8 +29,8 @@ export const env = {
RABBITMQ_RETRY_INTERVAL: process.env.RABBITMQ_INTERVAL, RABBITMQ_RETRY_INTERVAL: process.env.RABBITMQ_INTERVAL,
RABBITMQ_VHOST: String(process.env.RABBITMQ_VHOST), RABBITMQ_VHOST: String(process.env.RABBITMQ_VHOST),
APP_PORT: Number(process.env.NOS_PORT), APP_PORT: Number(process.env.NOS_PORT ?? 3001),
APP_HOST: String(process.env.NOS_HOST), APP_HOST: String(process.env.NOS_HOST ?? "0.0.0.0"),
// ESPECIFICO NOS // ESPECIFICO NOS
NOS_BASE_URL: String(process.env.NOS_BASE_URL), NOS_BASE_URL: String(process.env.NOS_BASE_URL),

View File

@@ -39,7 +39,8 @@
}, },
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"build": "yarn tsc --project tsconfig.json && yarn tsc-alias && cp package.json ../../dist/packages/sim-consumidor-nos/", "build": "yarn tsc --project tsconfig.json && yarn tsc-alias && cp -P .env package.json ../../dist/packages/sim-consumidor-nos/",
"build:prod": "yarn tsc --project tsconfig.json && yarn tsc-alias && cp -P package.json ../../dist/packages/sim-consumidor-nos/",
"esbuild": "esbuild index.ts --platform=node", "esbuild": "esbuild index.ts --platform=node",
"start": "node ../../dist/packages/sim-consumidor-nos/index.js", "start": "node ../../dist/packages/sim-consumidor-nos/index.js",
"dev": "tsx watch index.ts" "dev": "tsx watch index.ts"

View File

@@ -46,8 +46,8 @@ async function buildQueues(channel: Channel) {
await channel.assertExchange(EXCHANGES.DLX, "topic") await channel.assertExchange(EXCHANGES.DLX, "topic")
await channel.assertExchange(EXCHANGES.MAIN, "topic") await channel.assertExchange(EXCHANGES.MAIN, "topic")
await channel.assertQueue(QUEUES.OBJ) await channel.assertQueue(QUEUES.OBJ, { durable: true })
await channel.assertQueue(QUEUES.OBJDLX) await channel.assertQueue(QUEUES.OBJDLX, { durable: true })
await channel.assertQueue(QUEUES.OBJDEL, { await channel.assertQueue(QUEUES.OBJDEL, {
durable: true, durable: true,
arguments: { arguments: {

View File

@@ -55,7 +55,8 @@
"scripts": { "scripts": {
"test": "node --import tsx --test ./**/*.test.ts", "test": "node --import tsx --test ./**/*.test.ts",
"dev": "tsx watch index.ts", "dev": "tsx watch index.ts",
"build": "tsc --build && yarn tsc-alias -p tsconfig.json && cp .env package.json ../../dist/packages/sim-consumidor-objenious/", "build": "tsc --build && yarn tsc-alias -p tsconfig.json && cp -P ./.env ./package.json ../../dist/packages/sim-consumidor-objenious/",
"build:prod": "tsc --build && yarn tsc-alias -p tsconfig.json && cp -P ./package.json ../../dist/packages/sim-consumidor-objenious/",
"start": "node ../../dist/packages/sim-consumidor-objenious/index.js", "start": "node ../../dist/packages/sim-consumidor-objenious/index.js",
"type:test": "tsc --noEmit" "type:test": "tsc --noEmit"
}, },

View File

@@ -41,6 +41,7 @@
"scripts": { "scripts": {
"test": "node --import tsx --test ./**/*.test.ts", "test": "node --import tsx --test ./**/*.test.ts",
"build": "tsc --build && tsc-alias -p tsconfig.json && cp package.json ../../dist/packages/sim-entrada-eventos/", "build": "tsc --build && tsc-alias -p tsconfig.json && cp package.json ../../dist/packages/sim-entrada-eventos/",
"build:prod": "yarn build",
"dev": "tsx watch index.ts", "dev": "tsx watch index.ts",
"start": "node ../../dist/packages/sim-entrada-eventos/index.js" "start": "node ../../dist/packages/sim-entrada-eventos/index.js"
}, },

View File

@@ -33,6 +33,7 @@
"scripts": { "scripts": {
"test": "node --import tsx --test ./**/*.test.ts", "test": "node --import tsx --test ./**/*.test.ts",
"build": "tsc --build && tsc-alias -p tsconfig.json && cp .env package.json ../../dist/packages/sim-objenious-cron/", "build": "tsc --build && tsc-alias -p tsconfig.json && cp .env package.json ../../dist/packages/sim-objenious-cron/",
"build:prod": "yarn build",
"dev": "tsx watch index.ts", "dev": "tsx watch index.ts",
"start": "node ../../dist/packages/sim-objenious-cron/index.js" "start": "node ../../dist/packages/sim-objenious-cron/index.js"
}, },

View File

@@ -40,7 +40,8 @@
"scripts": { "scripts": {
"test": "node --import tsx --test ./**/*.test.ts", "test": "node --import tsx --test ./**/*.test.ts",
"dev": "echo \" Shared no es un modulo ejecutable \" ", "dev": "echo \" Shared no es un modulo ejecutable \" ",
"build": "tsc --build && tsc-alias -p tsconfig.json && cp package.json ../../dist/packages/sim-shared/" "build": "tsc --build && tsc-alias -p tsconfig.json && cp package.json ../../dist/packages/sim-shared/",
"build:prod": "yarn build"
}, },
"author": "", "author": "",
"license": "ISC", "license": "ISC",

View File

@@ -1,35 +1,34 @@
import { NosHttpClient } from "./packages/sim-consumidor-nos/infrastructure/NosHttpClient.js"; import { NosHttpClient } from "./packages/sim-consumidor-nos/infrastructure/NosHttpClient.js";
import { NosRepository } from "./packages/sim-consumidor-nos/infrastructure/NosRepository.js";
import { env } from "./packages/sim-consumidor-nos/config/env/env.js"; import { env } from "./packages/sim-consumidor-nos/config/env/env.js";
async function main() { async function main() {
console.log("NOS_BASE_URL", env.NOS_BASE_URL); console.log("NOS_BASE_URL", env.NOS_BASE_URL);
const client = new NosHttpClient(env.NOS_BASE_URL); const client = new NosHttpClient(env.NOS_BASE_URL);
// Try to get a subscriber // Try to get a subscriber
const res = await client.get("/subscribers", { params: { limit: 1 } }); const res = await client.get("/subscribers", { params: { limit: 1 } });
console.log("SUBSCRIBER:", res.data.content[0].physicalId); console.log("SUBSCRIBER:", res.data.content[0].physicalId);
const iccid = res.data.content[0].physicalId; const iccid = res.data.content[0].physicalId;
try { try {
const history = await client.get(`/subscribers/${iccid}/history`); const history = await client.get(`/subscribers/${iccid}/history`);
console.log("HISTORY:", history.data); console.log("HISTORY:", history.data);
} catch(e) { } catch (e) {
console.error("HISTORY ERROR"); console.error("HISTORY ERROR");
} }
try { try {
const audit = await client.get(`/subscribers/${iccid}/audit`); const audit = await client.get(`/subscribers/${iccid}/audit`);
console.log("AUDIT:", audit.data); console.log("AUDIT:", audit.data);
} catch(e) { } catch (e) {
console.error("AUDIT ERROR"); console.error("AUDIT ERROR");
} }
try { try {
const actions = await client.get(`/subscribers/${iccid}/actions`); const actions = await client.get(`/subscribers/${iccid}/actions`);
console.log("ACTIONS:", actions.data); console.log("ACTIONS:", actions.data);
} catch(e) { } catch (e) {
console.error("ACTIONS ERROR"); console.error("ACTIONS ERROR");
} }
} }