Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Shell script modifications for agent spin-up #190

Merged
merged 3 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ PLATFORM_ID=

AFJ_AGENT_ENDPOINT_PATH=/apps/agent-provisioning/AFJ/endpoints/
DATABASE_URL="postgresql://postgres:xxxxxx@localhost:5432/postgres?schema=public" #Provide supabase postgres url and Use the correct user/pwd, IP Address
CLUSTER_NAME="" # ecs cluster
TESKDEFINITION_FAMILY="" # ecs task-definition
AGENT_PROTOCOL=http

# This was inserted by prisma init:
# Environment variables declared in this file are automatically made available to Prisma.
Expand Down
5 changes: 3 additions & 2 deletions apps/agent-provisioning/AFJ/scripts/start_agent_ecs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ INDY_LEDGER=${15}
AGENT_HOST=${16}
AWS_ACCOUNT_ID=${17}
S3_BUCKET_ARN=${18}
CLUSTER_NAME=${19}
TESKDEFINITION_FAMILY=${20}
ADMIN_PORT=$((8000 + AGENCY))
INBOUND_PORT=$((9000 + AGENCY))
CONTROLLER_PORT=$((3000 + AGENCY))
POSTGRES_PORT=$((5432 + AGENCY))

SERVICE_NAME="${AGENCY}-${CONTAINER_NAME}-service"
CLUSTER_NAME='agent-spinup'
DESIRED_COUNT=1

EXTERNAL_IP=$(echo "$2" | tr -d '[:space:]')
Expand Down Expand Up @@ -132,7 +133,7 @@ EOF
TASK_DEFINITION=$(
cat <<EOF
{
"family": "AGENT",
"family": "$TESKDEFINITION_FAMILY",
"containerDefinitions": $CONTAINER_DEFINITIONS,
"executionRoleArn": "arn:aws:iam::${AWS_ACCOUNT_ID}:role/ecsTaskExecutionRole",
"volumes": [
Expand Down
2 changes: 1 addition & 1 deletion apps/agent-provisioning/src/agent-provisioning.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class AgentProvisioningService {
if (agentType === AgentType.AFJ) {
// The wallet provision command is used to invoke a shell script
const walletProvision = `${process.cwd() + process.env.AFJ_AGENT_SPIN_UP
} ${orgId} "${externalIp}" "${walletName}" "${walletPassword}" ${seed} ${webhookEndpoint} ${walletStorageHost} ${walletStoragePort} ${walletStorageUser} ${walletStoragePassword} ${containerName} ${protocol} ${tenant} ${afjVersion} ${indyLedger} ${process.env.AGENT_HOST} ${process.env.AWS_ACCOUNT_ID} ${process.env.S3_BUCKET_ARN}`;
} ${orgId} "${externalIp}" "${walletName}" "${walletPassword}" ${seed} ${webhookEndpoint} ${walletStorageHost} ${walletStoragePort} ${walletStorageUser} ${walletStoragePassword} ${containerName} ${protocol} ${tenant} ${afjVersion} ${indyLedger} ${process.env.AGENT_HOST} ${process.env.AWS_ACCOUNT_ID} ${process.env.S3_BUCKET_ARN} ${process.env.CLUSTER_NAME} ${process.env.TESKDEFINITION_FAMILY}`;

const spinUpResponse: object = new Promise(async (resolve) => {

Expand Down
2 changes: 1 addition & 1 deletion apps/agent-service/src/agent-service.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export class AgentServiceService {
orgName: orgData.name,
indyLedger: escapedJsonString,
afjVersion: process.env.AFJ_VERSION,
protocol: process.env.API_GATEWAY_PROTOCOL,
protocol: process.env.AGENT_PROTOCOL,
tenant: agentSpinupDto.tenant
};

Expand Down
2 changes: 1 addition & 1 deletion apps/connection/src/connection.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class ConnectionService {
multiUseInvitation: multiUseInvitation || true,
autoAcceptConnection: autoAcceptConnection || true,
alias: alias || undefined,
imageUrl: logoImageUrl ? logoImageUrl : '',
imageUrl: logoImageUrl ? logoImageUrl : undefined,
label: label || undefined
};

Expand Down