Skip to content

Commit

Permalink
add tenant deployment handler to orchestrator service
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamp-sf committed Aug 26, 2024
1 parent 276e842 commit 73a9a45
Show file tree
Hide file tree
Showing 22 changed files with 1,616 additions and 367 deletions.
Binary file modified .DS_Store
Binary file not shown.
1,146 changes: 914 additions & 232 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/migrations/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Check out https://hub.docker.com/_/node to select a new base image
FROM public.ecr.aws/docker/library/node:18-alpine
FROM node:18-alpine

# Bundle app source code
COPY . ./migrations
Expand Down
Binary file not shown.
Binary file not shown.
191 changes: 191 additions & 0 deletions services/orchestrator-service/object-to-json.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
/* eslint-disable @typescript-eslint/naming-convention */
const format = [
{
Source: 'shubham-manual',
Detail: JSON.stringify({
CODEBUILD_VPC_AZ: 'us-west-2a',
PYTHON_312_VERSION: '3.12.2',
CLIENT_ID: 'aug14feat-f859-bd99-91eb-b0553032d95e-gwpeu1',
CODEBUILD_LAST_EXIT: '0',
TF_VAR_user_callback_secret: '',
CODEBUILD_START_TIME: '1723631794739',
NODE_20_VERSION: '20.11.1',
PHP_BUILD_EXTRA_MAKE_ARGUMENTS: '-j4',
DOMAIN_NAME: 'arc-saas.net',
CLIENT_SECRET: 'f859-bd99-91eb-b0553032d95e-bnhbb7',
TF_VAR_karpenter_instance_category: 't',
CODEBUILD_BMR_URL: 'https://CODEBUILD_AGENT:3000',
JRE_8_HOME: '/usr/lib/jvm/java-1.8.0-amazon-corretto',
TENANT_NAME: 'as',
TF_VAR_tenant_name: 'as',
CODEBUILD_SOURCE_VERSION: 'refs/heads/main',
JDK_17_HOME: '/usr/lib/jvm/java-17-amazon-corretto',
CODEBUILD_AGENT_ENDPOINT: 'http://127.0.0.1:7831',
HOSTNAME: 'ip-10-0-142-68.us-west-2.compute.internal',
CODEBUILD_BUILD_ID:
'sf-arc-saas-dev-premium-codebuild-project:8f168599-17ae-4752-8a58-d14d6538a754',
CODEBUILD_KMS_KEY_ID: 'arn:aws:kms:us-west-2:471112653618:alias/aws/s3',
CTS_LINK_LOCAL_ADDR: '169.254.170.3',
PYTHON_PIP_VERSION: '24.0',
JRE_11_HOME: '/usr/lib/jvm/java-11-amazon-corretto',
TF_VAR_cluster_name: 'sf-arc-saas-dev-eks-cluster',
PHP_BUILD_CONFIGURE_OPTS:
'--with-curl --with-password-argon2 --with-pdo-pgsql --with-libedit',
JRE_21_HOME: '/usr/lib/jvm/java-21-amazon-corretto',
HOME: '/root',
TENANT_CLIENT_ID: 'gwpeu1',
OLDPWD:
'/codebuild/output/src1062924985/src/git-codecommit.us-west-2.amazonaws.com/v1/repos/sf-arc-saas-dev-premium-plan-repository/terraform/bootstrap',
TF_VAR_alb_url:
'alb-external-ingress-201954913.us-west-2.elb.amazonaws.com',
TF_VAR_environment: 'dev',
JRE_HOME: '/usr/lib/jvm/java-17-amazon-corretto',
CODEBUILD_GOPATH: '/codebuild/output/src1062924985',
CB_ROLE:
'arn:aws:iam::471112653618:role/sf-arc-saas-dev-codebuild-iam-role',
ENVIRONMENT: 'dev',
TENANT_CLIENT_SECRET: 'bnhbb7',
CODEBUILD_CI: 'true',
NODE_18_VERSION: '18.19.1',
GOENV_DISABLE_GOPATH: '1',
CODEBUILD_RESOLVED_SOURCE_VERSION:
'de960431b80a8dcf96df13ec9aeee3470d0037a5',
CODEBUILD_BUILD_NUMBER: '102',
CODEBUILD_BUILD_SUCCEEDING: '1',
INSTANCE_CATEGORY: 't',
APP_PLANE_ENDPOINT_FEATURE_SERVICE:
'https://aug14feat.arc-saas.net/feature-service',
RANDOM_SECRET: '',
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI:
'/v2/credentials/cd9fc734-99e0-4f67-9eb1-45a132005835',
CODEBUILD_BUILD_ARN:
'arn:aws:codebuild:us-west-2:471112653618:build/sf-arc-saas-dev-premium-codebuild-project:8f168599-17ae-4752-8a58-d14d6538a754',
LC_CTYPE: 'C.UTF-8',
tenant:
'{"deleted":false,"deletedOn":null,"deletedBy":null,"createdOn":"2024-08-14T10:36:33.839Z","modifiedOn":"2024-08-14T10:36:33.839Z","createdBy":"b439829b-57e7-49d8-bb23-8ccb2ca97127","modifiedBy":"b439829b-57e7-49d8-bb23-8ccb2ca97127","id":"afb2c17f-f859-bd99-91eb-b0553032d95e","name":"as","status":1,"key":"aug14feat","spocUserId":null,"domains":["sourcefuse.com"],"leadId":null,"addressId":"64c23117-7b63-5232-caaf-518c2c92734a","contacts":[{"deleted":false,"deletedOn":null,"deletedBy":null,"createdOn":"2024-08-14T10:36:33.842Z","modifiedOn":"2024-08-14T10:36:33.842Z","createdBy":"b439829b-57e7-49d8-bb23-8ccb2ca97127","modifiedBy":"b439829b-57e7-49d8-bb23-8ccb2ca97127","id":"ceb2f082-d258-fde3-bb67-39a0da837c3e","firstName":"as","lastName":"as","email":"[email protected]","isPrimary":true,"type":null,"tenantId":"afb2c17f-f859-bd99-91eb-b0553032d95e"}],"address":{"deleted":false,"deletedOn":null,"deletedBy":null,"createdOn":"2024-08-14T10:36:33.829Z","modifiedOn":"2024-08-14T10:36:33.829Z","createdBy":"b439829b-57e7-49d8-bb23-8ccb2ca97127","modifiedBy":"b439829b-57e7-49d8-bb23-8ccb2ca97127","id":"64c23117-7b63-5232-caaf-518c2c92734a","address":"l","city":null,"state":null,"zip":"l","country":"l"}}',
TENANT_ID: 'afb2c17f-f859-bd99-91eb-b0553032d95e',
AWS_EXECUTION_ENV: 'AWS_ECS_EC2',
JRE_17_HOME: '/usr/lib/jvm/java-17-amazon-corretto',
ALB_DNS: 'alb-external-ingress-201954913.us-west-2.elb.amazonaws.com',
CODEBUILD_BUILD_POSTBUILD: '1',
CREATE_USER: '0',
PARAMETER_VALUE: '',
CODEBUILD_ACTION_RUNNER_URL:
'https://codefactory-us-west-2-prod-default-build-agent-executor.s3.us-west-2.amazonaws.com/cawsrunner.zip',
RUBY_BUILD_SRC_DIR: '/usr/local/rbenv/plugins/ruby-build',
ACCESS_TOKEN_EXPIRATION: '3600',
VPC_ID: 'vpc-0c000dd15b500b2fb',
API_ENDPOINT: 'https://arc-saas.net/tenant-mgmt-facade/webhook',
TF_VAR_rds_instance_allocated_storage: '20',
CODEBUILD_INITIATOR:
'sf-arc-saas-dev-decoupling-orchestrator-function/sf-arc-saas-dev-decoupling-orchestrator-function',
DOTNET_6_SDK_VERSION: '6.0.420',
DOTNET_6_GLOBAL_JSON_SDK_VERSION: '6.0.0',
WEBHOOK_PATH: 'webhook.js',
DOTNET_8_SDK_VERSION: '8.0.203',
TF_STATE_TABLE: 'sf-arc-saas-dev-aug14feat-terraform-state-lock',
TF_VAR_namespace: 'sf-arc-saas',
AWS_DEFAULT_REGION: 'us-west-2',
DOTNET_8_GLOBAL_JSON_SDK_VERSION: '8.0.0',
AUTH_CODE_EXPIRATION: '3600',
EKS_CLUSTER_NAME: 'sf-arc-saas-dev-eks-cluster',
RUBY_31_VERSION: '3.1.4',
context: 'bf338f61-c371-4437-8252-c70ddb8992ea',
jobName: 'sf-arc-saas-dev-premium-codebuild-project',
COGNITO_AUTH_ID: '38419370-9091-7001-2196-8199fca8e57d',
TF_VAR_tenant_client_id: 'aug14feat-f859-bd99-91eb-b0553032d95e-gwpeu1',
TF_VAR_tenant_host_domain: 'aug14feat.arc-saas.net',
ECS_CONTAINER_METADATA_URI_V4:
'http://169.254.170.2/v4/2eff8e15-13a1-4751-b0f5-2b9a75ebaf2f',
RUBY_32_VERSION: '3.2.3',
PHP_82_VERSION: '8.2.17',
USERNAME: 'aug14feat',
ECS_CONTAINER_METADATA_URI:
'http://169.254.170.2/v3/2eff8e15-13a1-4751-b0f5-2b9a75ebaf2f',
DOTNET_ROOT: '/root/.dotnet',
RUBY_33_VERSION: '3.3.0',
PHP_83_VERSION: '8.3.4',
EVENT_BUS_NAME: 'sf-arc-saas-dev-DecouplingEventBus',
CODEBUILD_EXECUTION_ROLE_BUILD: 'true',
POSTGRES_SIZE: '20',
PATH: '/codebuild/output/src1062924985/src/git-codecommit.us-west-2.amazonaws.com/v1/repos/sf-arc-saas-dev-premium-plan-repository/:/usr/local/bin/sbt/bin:/root/.goenv/shims:/root/.goenv/bin:/go/bin:/root/.phpenv/shims:/root/.phpenv/bin:/root/.pyenv/shims:/root/.pyenv/bin:/root/.rbenv/shims:/usr/local/rbenv/bin:/usr/local/rbenv/shims:/root/.dotnet/:/root/.dotnet/tools/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/tools:/codebuild/user/bin',
FE_REPORT_LINK_LOCAL_ADDR: '169.254.170.8',
REDIRECT_URL: 'https://arc-saas.net/main/home',
TF_VAR_jwt_issuer: 'aug14feat',
CODEBUILD_LOG_PATH: 'log-stream/8f168599-17ae-4752-8a58-d14d6538a754',
PYYAML_VERSION: '5.4.1',
KUBECONFIG: '/root/.kube/config',
TENANT_ADMIN_EMAIL: '[email protected]',
CODEBUILD_BUILD_IMAGE: 'aws/codebuild/standard:7.0',
CODEBUILD_SOURCE_REPO_URL:
'https://git-codecommit.us-west-2.amazonaws.com/v1/repos/sf-arc-saas-dev-premium-plan-repository',
KARPENTER_ROLE:
'karpenter-sf-arc-saas-dev-eks-cluster-20240620060226029000000005',
TF_STATE_BUCKET: 'sf-arc-saas-dev-aug14feat-terraform-state-paf40c',
TF_VAR_domain_name: 'arc-saas.net',
TF_VAR_tenant_id: 'afb2c17f-f859-bd99-91eb-b0553032d95e',
AWS_ACCOUNT_ID: '471112653618',
APP_PLANE_REDIRECT_URL: 'https://aug14feat.arc-saas.net/main/home',
REFRESH_TOKEN_EXPIRATION: '3600',
PYTHON_CONFIGURE_OPTS:
'--enable-shared --enable-loadable-sqlite-extensions',
GOPATH: '/go:/codebuild/output/src1062924985',
TF_VAR_tenant_email: '[email protected]',
CODEBUILD_BUILD_URL:
'https://us-west-2.console.aws.amazon.com/codebuild/home?region=us-west-2#/builds/sf-arc-saas-dev-premium-codebuild-project:8f168599-17ae-4752-8a58-d14d6538a754/view/new',
JAVA_8_HOME: '/usr/lib/jvm/java-1.8.0-amazon-corretto',
CODEBUILD_SRC_DIR:
'/codebuild/output/src1062924985/src/git-codecommit.us-west-2.amazonaws.com/v1/repos/sf-arc-saas-dev-premium-plan-repository',
AWS_REGION: 'us-west-2',
AWS_ACCESS_KEY_ID: 'ASIAW3MEATMZLTRRZZ4N',
CODEBUILD_PROJECT_UUID: 'e88531cf-2f68-4663-a190-2f0b7b81c550',
NAMESPACE: 'sf-arc-saas',
secret: '1e77e98e72f20561209aae2983e8f397',
KEY: 'aug14feat',
TF_VAR_karpenter_role:
'karpenter-sf-arc-saas-dev-eks-cluster-20240620060226029000000005',
TF_VAR_tenant_client_secret: 'f859-bd99-91eb-b0553032d95e-bnhbb7',
CODEBUILD_AUTH_TOKEN: 'fd60e83e-60b0-4e0f-9836-2e3de74fe32b',
CODEBUILD_CONTAINER_NAME: 'default',
tier: 'PREMIUM',
TF_VAR_region: 'us-west-2',
JAVA_11_HOME: '/usr/lib/jvm/java-11-amazon-corretto',
JAVA_21_HOME: '/usr/lib/jvm/java-21-amazon-corretto',
TF_KEY: 'aug14feat/aug14feat.tfstate',
USER_CALLBACK_ENDPOINT:
'https://aug14feat.arc-saas.net/user-tenant-service/user-callback',
JDK_8_HOME: '/usr/lib/jvm/java-1.8.0-amazon-corretto',
JAVA_HOME: '/usr/lib/jvm/java-17-amazon-corretto',
PWD: '/codebuild/output/src1062924985/src/git-codecommit.us-west-2.amazonaws.com/v1/repos/sf-arc-saas-dev-premium-plan-repository/terraform',
TF_VAR_user_name: 'aug14feat',
is_bootstrap_creation: '1',
CODEBUILD_FE_REPORT_ENDPOINT:
'https://codebuild.us-west-2.amazonaws.com/',
VPC_CIDR_BLOCK: '10.0.0.0/16',
GOLANG_20_VERSION: '1.20.13',
plan: `{"deleted":false,"deletedOn":null,"deletedBy":null,"createdOn":"2024-08-13T14:01:41.899Z","modifiedOn":"2024-08-13T14:01:41.899Z","createdBy":"b439829b-57e7-49d8-bb23-8ccb2ca97127","modifiedBy":"b439829b-57e7-49d8-bb23-8ccb2ca97127","id":"b29c3a1f-2609-2551-e110-7a6c8392332f","name":"Plan test","description":"hit test plan","tier":"PREMIUM","size":"SMALL","price":"200.00","metaData":null,"billingCycleId":"4d6d0d74-37ab-b627-e8b1-947d7247dc27","currencyId":"9061d3e8-3c09-7ee3-045b-c10270bf8b3b","sizeConfig":{"POSTGRES_SIZE":"20","INSTANCE_CATEGORY":"t"},"features":[{"id":"435ce575-1e7f-6a1c-a815-6716012fcd68","name":"Video Call","key":"VIDEO_CALL","description":"Whether to allow video call facility in the application.","defaultValue":"false","type":"boolean","metadata":{},"value":{"id":"482ce235-9099-6c37-7e02-5bdf74fb82f4","featureKey":"435ce575-1e7f-6a1c-a815-6716012fcd68","strategyKey":"Plan","strategyEntityId":"b29c3a1f-2609-2551-e110-7a6c8392332f","status":true,"value":"true"}},{"id":"cc804f47-b851-2664-8a9b-4f605bcfbeb8","name":"Commission Rate","key":"COMMISSION","description":"% Commission that goes to the SaaS Provider, for each call paid call that gets scheduled via the tenant's application.","defaultValue":"0.5","type":"number","metadata":{},"value":{"id":"2152da2b-6c14-7907-80d6-6ed6a824ccce","featureKey":"cc804f47-b851-2664-8a9b-4f605bcfbeb8","strategyKey":"Plan","strategyEntityId":"b29c3a1f-2609-2551-e110-7a6c8392332f","status":true,"value":"20"}},{"id":"f7966749-0f33-5332-5fd5-1051e8a8fbe2","name":"Monthly Consultation Limit","key":"MONTHLY_CONSULTATION","description":"Number of consultation that can be scheduled in a month across customers.","defaultValue":null,"type":"number","metadata":{},"value":{"id":"0df4b98f-2c52-9578-5f51-6c4c273b7d31","featureKey":"f7966749-0f33-5332-5fd5-1051e8a8fbe2","strategyKey":"Plan","strategyEntityId":"b29c3a1f-2609-2551-e110-7a6c8392332f","status":true,"value":"20"}},{"id":"fd12ffe7-86e2-4d26-25b4-47f7ad3147fb","name":"Online Medicine Store","key":"MEDICINE_STORE","description":"Feature to publish a medicine store page in the app.","defaultValue":"false","type":"boolean","metadata":{},"value":{"id":"bde67b43-669f-f4c8-b940-82b20f2e3f7f","featureKey":"fd12ffe7-86e2-4d26-25b4-47f7ad3147fb","strategyKey":"Plan","strategyEntityId":"b29c3a1f-2609-2551-e110-7a6c8392332f","status":true,"value":"true"}}]}`,
AWS_EXPIRATION: '2024-08-14T11:38:16+00:00',
PYTHON_39_VERSION: '3.9.18',
GOLANG_21_VERSION: '1.21.8',
JDK_11_HOME: '/usr/lib/jvm/java-11-amazon-corretto',
CONTROL_PLANE_HOST: 'https://arc-saas.net',
TF_VAR_tenant: 'aug14feat',
TF_VAR_tenant_secret: '',
RBENV_SRC_DIR: '/usr/local/rbenv',
PYTHON_310_VERSION: '3.10.13',
GOLANG_22_VERSION: '1.22.1',
JAVA_17_HOME: '/usr/lib/jvm/java-17-amazon-corretto',
JDK_21_HOME: '/usr/lib/jvm/java-21-amazon-corretto',
NUGET_XMLDOC_MODE: 'skip',
PYTHON_311_VERSION: '3.11.8',
JDK_HOME: '/usr/lib/jvm/java-17-amazon-corretto',
}),
Resources: ['resource1', 'resource2'],
EventBusName: 'sf-arc-saas-dev-DecouplingEventBus',
DetailType: 'TENANT_DEPROVISIONING',
},
];

// save the format object to a file called putevent.json
const fs = require('fs');
fs.writeFileSync('putEvent.json', JSON.stringify(format, null, 2));
3 changes: 2 additions & 1 deletion services/orchestrator-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@
"!*/__tests__"
],
"dependencies": {
"@arc-saas/orchestrator-service": "file:arc-saas-orchestrator-service-0.0.1.tgz",
"@arc-saas/orchestrator-service": "file:arc-saas-orchestrator-service-0.1.0.tgz",
"@aws-sdk/client-codebuild": "^3.616.0",
"@aws-sdk/client-dynamodb": "^3.616.0",
"@aws-sdk/client-eventbridge": "^3.626.0",
"@aws-sdk/util-dynamodb": "^3.616.0",
"@loopback/boot": "^7.0.4",
"@loopback/core": "^6.1.1",
Expand Down
Loading

0 comments on commit 73a9a45

Please sign in to comment.