From 055d9bbf8d2053a1e03aafa03f392006b4b5ac85 Mon Sep 17 00:00:00 2001 From: Sahil Kamble Date: Mon, 1 Sep 2025 11:48:19 +0530 Subject: [PATCH] feat/credo-spinup-script (#1417) * feat: script changes to spinup credo-controller -using docker Signed-off-by: Sahil Kamble * typo error - agent spin-up issue Signed-off-by: Sahil Kamble * removed unwanted values Signed-off-by: Sahil Kamble --------- Signed-off-by: Sahil Kamble --- .env.demo | 2 +- .../AFJ/scripts/docker_start_agent.sh | 18 ++++++++----- .../AFJ/scripts/start_agent.sh | 2 +- .../AFJ/scripts/start_agent_ecs.sh | 27 +++++++++---------- .../src/agent-provisioning.service.ts | 5 ++-- .../src/agent-service.service.ts | 2 +- 6 files changed, 28 insertions(+), 28 deletions(-) diff --git a/.env.demo b/.env.demo index 51e70592b..798d80260 100644 --- a/.env.demo +++ b/.env.demo @@ -110,7 +110,7 @@ KEYCLOAK_MANAGEMENT_CLIENT_ID=adminClient KEYCLOAK_MANAGEMENT_CLIENT_SECRET= KEYCLOAK_REALM=credebl-platform -SCHEMA_FILE_SERVER_URL='https://schema.credebl.id/schemas/' +SCHEMA_FILE_SERVER_URL= SCHEMA_FILE_SERVER_TOKEN= GEO_LOCATION_MASTER_DATA_IMPORT_SCRIPT=/prisma/scripts/geo_location_data_import.sh diff --git a/apps/agent-provisioning/AFJ/scripts/docker_start_agent.sh b/apps/agent-provisioning/AFJ/scripts/docker_start_agent.sh index 291fef3d3..1b1269ab2 100644 --- a/apps/agent-provisioning/AFJ/scripts/docker_start_agent.sh +++ b/apps/agent-provisioning/AFJ/scripts/docker_start_agent.sh @@ -17,6 +17,13 @@ PROTOCOL=${12} TENANT=${13} AFJ_VERSION=${14} INDY_LEDGER=${15} +INBOUND_ENDPOINT=${16} +SCHEMA_FILE_SERVER_URL=${17} +AGENT_API_KEY=${18} +ADMIN_PORT_FILE="$PWD/agent-provisioning/AFJ/port-file/last-admin-port.txt" +INBOUND_PORT_FILE="$PWD/agent-provisioning/AFJ/port-file/last-inbound-port.txt" +ADMIN_PORT=8001 +INBOUND_PORT=9001 echo "AGENCY: $AGENCY" echo "EXTERNAL_IP: $EXTERNAL_IP" @@ -34,11 +41,6 @@ echo "TENANT: $TENANT" echo "AFJ_VERSION: $AFJ_VERSION" echo "INDY_LEDGER: $INDY_LEDGER" -ADMIN_PORT_FILE="$PWD/agent-provisioning/AFJ/port-file/last-admin-port.txt" -INBOUND_PORT_FILE="$PWD/agent-provisioning/AFJ/port-file/last-inbound-port.txt" -ADMIN_PORT=8001 -INBOUND_PORT=9001 - increment_port() { local port="$1" local lower_limit="$2" @@ -144,7 +146,9 @@ cat <${CONFIG_FILE} ], "webhookUrl": "$WEBHOOK_HOST/wh/$AGENCY", "adminPort": $ADMIN_PORT, - "tenancy": $TENANT + "tenancy": $TENANT, + "schemaFileServerURL": "$SCHEMA_FILE_SERVER_URL", + "apiKey": "$AGENT_API_KEY" } EOF @@ -225,7 +229,7 @@ if [ $? -eq 0 ]; then container_logs=$(docker logs $(docker ps -q --filter "name=${AGENCY}_${CONTAINER_NAME}")) # Extract the token from the logs using sed - token=$(echo "$container_logs" | sed -nE 's/.*API Token: ([^ ]+).*/\1/p') + token=$(echo "$container_logs" | sed -nE 's/.*** API Key: ([^ ]+).*/\1/p') # Print the extracted token echo "Token: $token" diff --git a/apps/agent-provisioning/AFJ/scripts/start_agent.sh b/apps/agent-provisioning/AFJ/scripts/start_agent.sh index e46a87073..715a9baa6 100755 --- a/apps/agent-provisioning/AFJ/scripts/start_agent.sh +++ b/apps/agent-provisioning/AFJ/scripts/start_agent.sh @@ -19,7 +19,7 @@ AFJ_VERSION=${14} INDY_LEDGER=${15} INBOUND_ENDPOINT=${16} SCHEMA_FILE_SERVER_URL=${17} -AGENT_API_KEY="${18}" +AGENT_API_KEY=${18} ADMIN_PORT_FILE="$PWD/apps/agent-provisioning/AFJ/port-file/last-admin-port.txt" INBOUND_PORT_FILE="$PWD/apps/agent-provisioning/AFJ/port-file/last-inbound-port.txt" ADMIN_PORT=8001 diff --git a/apps/agent-provisioning/AFJ/scripts/start_agent_ecs.sh b/apps/agent-provisioning/AFJ/scripts/start_agent_ecs.sh index 372552e82..a26a68845 100644 --- a/apps/agent-provisioning/AFJ/scripts/start_agent_ecs.sh +++ b/apps/agent-provisioning/AFJ/scripts/start_agent_ecs.sh @@ -19,11 +19,12 @@ AFJ_VERSION=${14} INDY_LEDGER=${15} INBOUND_ENDPOINT=${16} SCHEMA_FILE_SERVER_URL=${17} -AGENT_HOST=${18} -AWS_ACCOUNT_ID=${19} -S3_BUCKET_ARN=${20} -CLUSTER_NAME=${21} -TESKDEFINITION_FAMILY=${22} +AGENT_API_KEY=${18} +AGENT_HOST=${19} +AWS_ACCOUNT_ID=${20} +S3_BUCKET_ARN=${21} +CLUSTER_NAME=${22} +TASKDEFINITION_FAMILY=${23} DESIRED_COUNT=1 @@ -37,7 +38,7 @@ random_string=$(generate_random_string) # Print the generated random string echo "Random String: $random_string" -SERVICE_NAME="${CONTAINER_NAME}-service-test" +SERVICE_NAME="${CONTAINER_NAME}-service" EXTERNAL_IP=$(echo "$2" | tr -d '[:space:]') ADMIN_PORT_FILE="$PWD/agent-provisioning/AFJ/port-file/last-admin-port.txt" INBOUND_PORT_FILE="$PWD/agent-provisioning/AFJ/port-file/last-inbound-port.txt" @@ -197,9 +198,9 @@ CONTAINER_DEFINITIONS=$( "logConfiguration": { "logDriver": "awslogs", "options": { - "awslogs-group": "/ecs/$TESKDEFINITION_FAMILY", + "awslogs-group": "/ecs/$TASKDEFINITION_FAMILY", "awslogs-create-group": "true", - "awslogs-region": "ap-south-1", + "awslogs-region": "$AWS_PUBLIC_REGION", "awslogs-stream-prefix": "ecs" }, "ulimits": [] @@ -212,7 +213,7 @@ EOF TASK_DEFINITION=$( cat < { await exec(walletProvision, async (err, stdout, stderr) => { this.logger.log(`shell script output: ${stdout}`); diff --git a/apps/agent-service/src/agent-service.service.ts b/apps/agent-service/src/agent-service.service.ts index 5fb66e6e6..c690870f0 100644 --- a/apps/agent-service/src/agent-service.service.ts +++ b/apps/agent-service/src/agent-service.service.ts @@ -527,7 +527,7 @@ export class AgentServiceService { socket.emit('invitation-url-creation-started', { clientId: agentSpinupDto.clientSocketId }); } const agentBaseWalletToken = await this.commonService.getBaseAgentToken( - agentDetails.gentEndPoint, + agentDetails.agentEndPoint, agentDetails?.agentToken ); if (!agentBaseWalletToken) {