diff --git a/.data/.env.template b/.data/.env.template index 09880fcd..3c1e555a 100644 --- a/.data/.env.template +++ b/.data/.env.template @@ -1,9 +1,3 @@ -CONTAINER_PREFIX=axiomdata MONGO_PASSWORD=hbGciOiJIUzI1NiIsInR5cCI6IkpX POSTGRES_PASSWORD=hbGciOiJIUzI1NiIsInR5cCI6IkpX -CLICKHOUSE_PASSWORD=hbGciOiJIUzI1NiIsInR5cCI6IkpX -CACHING_PLUGIN_SECRET="zZkhKqFjqXR4g5MZCsJUZCnhCcoPyZ" -CACHING_PLUGIN_REDIS_URL="redis://local.hasura.dev:6379" -RESTIFIED_EXPORTER_OTLP_ENDPOINT="http://local.hasura.dev:4317" -RESTIFIED_GRAPHQL_SERVER_URL="http://local.hasura.dev:3280/graphql" -RESTIFIED_PLUGIN_SECRET="zZkhKqFjqXR4g5MZCsJUZCnhCcoPyZ" \ No newline at end of file +CLICKHOUSE_PASSWORD=hbGciOiJIUzI1NiIsInR5cCI6IkpX \ No newline at end of file diff --git a/.data/aml/compose.yaml b/.data/aml/compose.yaml index 59f911b9..03ca826d 100644 --- a/.data/aml/compose.yaml +++ b/.data/aml/compose.yaml @@ -1,9 +1,9 @@ -name: ${CONTAINER_PREFIX} +name: axiomaml services: # Databases postgres: image: postgres - container_name: ${CONTAINER_PREFIX}_postgres + container_name: axiomaml_postgres restart: unless-stopped volumes: - postgres-data:/var/lib/postgresql/data @@ -22,7 +22,7 @@ services: mongodb: image: mongo - container_name: ${CONTAINER_PREFIX}_mongodb + container_name: axiomaml_mongodb restart: unless-stopped ports: - "27017:27017" @@ -39,6 +39,7 @@ services: mongo-seed: env_file: - .env + container_name: axiomaml_mongo_seed build: context: ./mongo_seed dockerfile: Dockerfile @@ -51,45 +52,6 @@ services: extra_hosts: - local.hasura.dev=host-gateway - redis: - image: redis:latest - restart: unless-stopped - ports: - - 6379:6379 - - caching: - build: - context: https://github.com/hasura/engine-plugin-caching.git#64b184d2ea530e6314900c5177e822d2384b8fd3 - restart: unless-stopped - ports: - - 8787:8787 - environment: - CACHING_PLUGIN_SECRET: ${CACHING_PLUGIN_SECRET} - CACHING_PLUGIN_REDIS_URL: ${CACHING_PLUGIN_REDIS_URL} - extra_hosts: - - local.hasura.dev=host-gateway - volumes: - - ../plugins/caching/aml-config.js:/app/src/config.js - - restified: - container_name: ${CONTAINER_PREFIX}_restified - build: - context: https://github.com/hasura/engine-plugin-restified-endpoint.git#paritosh/express-server - target: base - restart: unless-stopped - ports: - - "8788:8788" - environment: - OTEL_EXPORTER_OTLP_ENDPOINT: ${RESTIFIED_EXPORTER_OTLP_ENDPOINT} - GRAPHQL_SERVER_URL: ${RESTIFIED_GRAPHQL_SERVER_URL} - RESTIFIED_PLUGIN_SECRET: ${RESTIFIED_PLUGIN_SECRET} - PORT: 8788 - extra_hosts: - - local.hasura.dev=host-gateway - volumes: - - ../plugins/restified/aml-config.ts:/app/src/config.ts - command: ["bash", "-c", "npm run build && npm run serve"] - volumes: postgres-data: mongodb-data: diff --git a/.data/cpg/compose.yaml b/.data/cpg/compose.yaml index 028bc689..775047bd 100644 --- a/.data/cpg/compose.yaml +++ b/.data/cpg/compose.yaml @@ -1,4 +1,4 @@ -name: cpg +name: axiomcpg services: # Databases postgres: @@ -20,46 +20,5 @@ services: timeout: 5s retries: 30 - redis: - container_name: axiomcpg_redis - image: redis:latest - restart: unless-stopped - ports: - - 6379:6379 - - caching: - container_name: axiomcpg_caching - build: - context: https://github.com/hasura/engine-plugin-caching.git#64b184d2ea530e6314900c5177e822d2384b8fd3 - restart: unless-stopped - ports: - - 8787:8787 - environment: - CACHING_PLUGIN_SECRET: ${CACHING_PLUGIN_SECRET} - CACHING_PLUGIN_REDIS_URL: ${CACHING_PLUGIN_REDIS_URL} - extra_hosts: - - local.hasura.dev=host-gateway - volumes: - - ../plugins/caching/cpg-config.js:/app/src/config.js - - restified: - container_name: axiomcpg_restified - build: - context: https://github.com/hasura/engine-plugin-restified-endpoint.git#paritosh/express-server - target: base - restart: unless-stopped - ports: - - "8788:8788" - environment: - OTEL_EXPORTER_OTLP_ENDPOINT: ${RESTIFIED_EXPORTER_OTLP_ENDPOINT} - GRAPHQL_SERVER_URL: ${RESTIFIED_GRAPHQL_SERVER_URL} - RESTIFIED_PLUGIN_SECRET: ${RESTIFIED_PLUGIN_SECRET} - PORT: 8788 - extra_hosts: - - local.hasura.dev=host-gateway - volumes: - - ../plugins/restified/cpg-config.ts:/app/src/config.ts - command: ["bash", "-c", "npm run build && npm run serve"] - volumes: postgres-data: diff --git a/.data/diligence/compose.yaml b/.data/diligence/compose.yaml index 860c6815..89f7a190 100644 --- a/.data/diligence/compose.yaml +++ b/.data/diligence/compose.yaml @@ -20,44 +20,5 @@ services: timeout: 5s retries: 30 - redis: - image: redis:latest - restart: unless-stopped - ports: - - 6379:6379 - - caching: - build: - context: https://github.com/hasura/engine-plugin-caching.git#64b184d2ea530e6314900c5177e822d2384b8fd3 - restart: unless-stopped - ports: - - 8787:8787 - environment: - CACHING_PLUGIN_SECRET: ${CACHING_PLUGIN_SECRET} - CACHING_PLUGIN_REDIS_URL: ${CACHING_PLUGIN_REDIS_URL} - extra_hosts: - - local.hasura.dev=host-gateway - volumes: - - ../plugins/caching/diligence-config.js:/app/src/config.js - - restified: - container_name: ${CONTAINER_PREFIX}_restified - build: - context: https://github.com/hasura/engine-plugin-restified-endpoint.git#paritosh/express-server - target: base - restart: unless-stopped - ports: - - "8788:8788" - environment: - OTEL_EXPORTER_OTLP_ENDPOINT: ${RESTIFIED_EXPORTER_OTLP_ENDPOINT} - GRAPHQL_SERVER_URL: ${RESTIFIED_GRAPHQL_SERVER_URL} - RESTIFIED_PLUGIN_SECRET: ${RESTIFIED_PLUGIN_SECRET} - PORT: 8788 - extra_hosts: - - local.hasura.dev=host-gateway - volumes: - - ../plugins/restified/diligence-config.ts:/app/src/config.ts - command: ["bash", "-c", "npm run build && npm run serve"] - volumes: postgres-data: diff --git a/.data/gtm/compose.yaml b/.data/gtm/compose.yaml index a7d2c831..17da4ca6 100644 --- a/.data/gtm/compose.yaml +++ b/.data/gtm/compose.yaml @@ -1,9 +1,9 @@ -name: gtm +name: axiomgtm services: # Databases postgres: image: postgres - container_name: gtm_postgres + container_name: axiomgtm_postgres restart: unless-stopped volumes: - postgres-data:/var/lib/postgresql/data @@ -22,7 +22,7 @@ services: pgvector: image: ankane/pgvector:latest - container_name: gtm_pgvector + container_name: axiomgtm_pgvector restart: unless-stopped ports: - "5433:5432" @@ -39,45 +39,6 @@ services: timeout: 5s retries: 30 - redis: - image: redis:latest - restart: unless-stopped - ports: - - 6379:6379 - - caching: - build: - context: https://github.com/hasura/engine-plugin-caching.git#64b184d2ea530e6314900c5177e822d2384b8fd3 - restart: unless-stopped - ports: - - 8787:8787 - environment: - CACHING_PLUGIN_SECRET: ${CACHING_PLUGIN_SECRET} - CACHING_PLUGIN_REDIS_URL: ${CACHING_PLUGIN_REDIS_URL} - extra_hosts: - - local.hasura.dev=host-gateway - volumes: - - ../plugins/caching/gtm-config.js:/app/src/config.js - - restified: - container_name: ${CONTAINER_PREFIX}_restified - build: - context: https://github.com/hasura/engine-plugin-restified-endpoint.git#paritosh/express-server - target: base - restart: unless-stopped - ports: - - "8788:8788" - environment: - OTEL_EXPORTER_OTLP_ENDPOINT: ${RESTIFIED_EXPORTER_OTLP_ENDPOINT} - GRAPHQL_SERVER_URL: ${RESTIFIED_GRAPHQL_SERVER_URL} - RESTIFIED_PLUGIN_SECRET: ${RESTIFIED_PLUGIN_SECRET} - PORT: 8788 - extra_hosts: - - local.hasura.dev=host-gateway - volumes: - - ../plugins/restified/gtm-config.ts:/app/src/config.ts - command: ["bash", "-c", "npm run build && npm run serve"] - volumes: postgres-data: pgvector-data: diff --git a/.data/healthcare/compose.yaml b/.data/healthcare/compose.yaml index d1ef7d44..953a1fd7 100644 --- a/.data/healthcare/compose.yaml +++ b/.data/healthcare/compose.yaml @@ -1,9 +1,9 @@ -name: ${CONTAINER_PREFIX} +name: axiomhealthcare services: # Databases postgres: image: postgres - container_name: ${CONTAINER_PREFIX}_postgres + container_name: axiomhealthcare_postgres restart: unless-stopped volumes: - postgres-data:/var/lib/postgresql/data @@ -20,44 +20,5 @@ services: timeout: 5s retries: 30 - redis: - image: redis:latest - restart: unless-stopped - ports: - - 6379:6379 - - caching: - build: - context: https://github.com/hasura/engine-plugin-caching.git#64b184d2ea530e6314900c5177e822d2384b8fd3 - restart: unless-stopped - ports: - - 8787:8787 - environment: - CACHING_PLUGIN_SECRET: ${CACHING_PLUGIN_SECRET} - CACHING_PLUGIN_REDIS_URL: ${CACHING_PLUGIN_REDIS_URL} - extra_hosts: - - local.hasura.dev=host-gateway - volumes: - - ../plugins/caching/healthcare-config.js:/app/src/config.js - - restified: - container_name: ${CONTAINER_PREFIX}_restified - build: - context: https://github.com/hasura/engine-plugin-restified-endpoint.git#paritosh/express-server - target: base - restart: unless-stopped - ports: - - "8788:8788" - environment: - OTEL_EXPORTER_OTLP_ENDPOINT: ${RESTIFIED_EXPORTER_OTLP_ENDPOINT} - GRAPHQL_SERVER_URL: ${RESTIFIED_GRAPHQL_SERVER_URL} - RESTIFIED_PLUGIN_SECRET: ${RESTIFIED_PLUGIN_SECRET} - PORT: 8788 - extra_hosts: - - local.hasura.dev=host-gateway - volumes: - - ../plugins/restified/healthcare-config.ts:/app/src/config.ts - command: ["bash", "-c", "npm run build && npm run serve"] - volumes: postgres-data: diff --git a/.data/plugins/caching/aml-config.js b/.data/plugins/caching/aml-config.js deleted file mode 100644 index f7bff37d..00000000 --- a/.data/plugins/caching/aml-config.js +++ /dev/null @@ -1,13 +0,0 @@ -export const Config = { - headers: { "hasura-m-auth": process.env.CACHING_PLUGIN_SECRET }, - redis_url: process.env.CACHING_PLUGIN_REDIS_URL, - otel_endpoint: process.env.OTLP_ENDPOINT, - otel_headers: {}, - - queries_to_cache: [ - { - query: `{sanctions {address entityName entityType id listType listedDate program}}`, - time_to_live: 1800 - } - ], -}; diff --git a/.data/plugins/caching/gtm-config.js b/.data/plugins/caching/gtm-config.js deleted file mode 100644 index 4f4bf54f..00000000 --- a/.data/plugins/caching/gtm-config.js +++ /dev/null @@ -1,13 +0,0 @@ -export const Config = { - headers: { "hasura-m-auth": process.env.CACHING_PLUGIN_SECRET }, - redis_url: process.env.CACHING_PLUGIN_REDIS_URL, - otel_endpoint: process.env.OTLP_ENDPOINT, - otel_headers: {}, - - queries_to_cache: [ - { - query: `{accounts {annual_revenue contacts {campaign_members {campaign {name type} net_new_lead_c} ddn_signup_date_c} opportunities {amount close_date} became_customer_date_c annual_revenue account_tier_c}}`, - time_to_live: 300 - } - ], -}; diff --git a/.data/plugins/caching/healthcare-config.js b/.data/plugins/caching/healthcare-config.js deleted file mode 100644 index 40148ad9..00000000 --- a/.data/plugins/caching/healthcare-config.js +++ /dev/null @@ -1,13 +0,0 @@ -export const Config = { - headers: { "hasura-m-auth": process.env.CACHING_PLUGIN_SECRET }, - redis_url: process.env.CACHING_PLUGIN_REDIS_URL, - otel_endpoint: process.env.OTLP_ENDPOINT, - otel_headers: {}, - - queries_to_cache: [ - { - query: `{drugReference {activeIngredientsInfo dosageFormName labelerName routeName substanceName proprietaryName productNdc nonproprietaryName}}`, - time_to_live: 1800 - } - ], -}; diff --git a/.data/plugins/caching/telco-config.js b/.data/plugins/caching/telco-config.js deleted file mode 100644 index c15e3bbd..00000000 --- a/.data/plugins/caching/telco-config.js +++ /dev/null @@ -1,21 +0,0 @@ -export const Config = { - headers: { "hasura-m-auth": process.env.CACHING_PLUGIN_SECRET }, - redis_url: process.env.CACHING_PLUGIN_REDIS_URL, - otel_endpoint: process.env.OTLP_ENDPOINT, - otel_headers: {}, - - queries_to_cache: [ - { - query: `{customers(where: {state: {_in: ["WA", "ACT"]}}) {firstName lastName postcode state country city address}}`, - time_to_live: 1800 - }, - { - query: `{ usersById(id: 1) { email formatCreatedAtTimestamp } customers(limit: 1) { firstName lastName email segment customerLinks { customerPreferences { socialMedia { linkedin } } supportDB { supportHistory { date status } } } creditCards { maskCreditCard expiry cvv } billings { formatBillingDate paymentStatus totalAmount } } calls(limit: 1) { callid } cdr(limit: 1) { guid } documents(limit: 1) { uuid } }`, - time_to_live: 600 - }, - { - query: `{ customers(limit: 1) { customerId } }`, - time_to_live: 300 - } - ], -}; diff --git a/.data/plugins/restified/aml-config.ts b/.data/plugins/restified/aml-config.ts deleted file mode 100644 index 6fab51ff..00000000 --- a/.data/plugins/restified/aml-config.ts +++ /dev/null @@ -1,33 +0,0 @@ -export const Config = { - graphqlServer: { - headers: { - additional: { - "Content-Type": "application/json", - }, - forward: ["X-Hasura-Role", "Authorization", "X-Hasura-ddn-token"], - }, - }, - headers: { - "hasura-m-auth": process.env.RESTIFIED_PLUGIN_SECRET, - }, - restifiedEndpoints: [ - { - path: "/v1/api/rest/customers", - methods: ["GET"], - query: ` - query CustomersAndAccounts($limit: Int = 10, $offset: Int = 0) { - customers (limit: $limit, offset: $offset) { - name - dob - nationality - account_details { - name - risk - } - } - } - `, - }, - ], -}; - \ No newline at end of file diff --git a/.data/plugins/restified/gtm-config.ts b/.data/plugins/restified/gtm-config.ts deleted file mode 100644 index 2f939309..00000000 --- a/.data/plugins/restified/gtm-config.ts +++ /dev/null @@ -1,36 +0,0 @@ -export const Config = { - graphqlServer: { - headers: { - additional: { - "Content-Type": "application/json", - }, - forward: ["X-Hasura-Role", "Authorization", "X-Hasura-ddn-token"], - }, - }, - headers: { - "hasura-m-auth": process.env.RESTIFIED_PLUGIN_SECRET, - }, - restifiedEndpoints: [ - { - path: "/v1/api/rest/stale-opps", - methods: ["GET"], - query: ` - query CustomersAndAccounts($close_date: varchar = "2025-03-20", ) { - opportunities( - where: {_and: {close_date: {_lte: $close_date}, stage: {_not: {_eq: "Closed Won"}}}} - ) { - close_date - account_id - amount - created_date - name - id - probability - stage - } - } - `, - }, - ], -}; - \ No newline at end of file diff --git a/.data/plugins/restified/healthcare-config.ts b/.data/plugins/restified/healthcare-config.ts deleted file mode 100644 index 20104aee..00000000 --- a/.data/plugins/restified/healthcare-config.ts +++ /dev/null @@ -1,32 +0,0 @@ -export const Config = { - graphqlServer: { - headers: { - additional: { - "Content-Type": "application/json", - }, - forward: ["X-Hasura-Role", "Authorization", "X-Hasura-ddn-token"], - }, - }, - headers: { - "hasura-m-auth": process.env.RESTIFIED_PLUGIN_SECRET, - }, - restifiedEndpoints: [ - { - path: "/v1/api/rest/cases", - methods: ["GET"], - query: ` - query UrgentCases($limit: Int = 10, $offset: Int = 0) { - cases(where: {urgencyLevel: {_eq: "critical"}}, limit: $limit, offset: $offset) { - caseId - createdAt - status - urgencyLevel - recommendedDate - operatorId - } - } - `, - }, - ], -}; - \ No newline at end of file diff --git a/.data/plugins/restified/telco-config.ts b/.data/plugins/restified/telco-config.ts deleted file mode 100644 index 4b9dd10b..00000000 --- a/.data/plugins/restified/telco-config.ts +++ /dev/null @@ -1,100 +0,0 @@ -export const Config = { - graphqlServer: { - headers: { - additional: { - "Content-Type": "application/json", - }, - forward: ["X-Hasura-Role", "Authorization", "X-Hasura-ddn-token"], - }, - }, - headers: { - "hasura-m-auth": process.env.RESTIFIED_PLUGIN_SECRET, - }, - restifiedEndpoints: [ - { - path: "/v1/api/rest/users", - methods: ["GET"], - query: ` - query UsersEndpoint($limit: Int = 10, $offset: Int = 0) { - users(limit: $limit, offset: $offset) { - id - email - roles - } - } - `, - }, - { - path: "/v1/api/rest/user/:user", - methods: ["GET"], - query: ` - query RetrieveSingleUser($user: Customer_Int4!) { - customersByCustomerId(customerId: $user) { - firstName - lastName - creditCards { - maskCreditCard - } - customerPlans { - cellNumber - customerPlanDevices { - device { - brand - model - } - } - } - billings { - paymentStatus - totalAmount - } - } -} - `, - }, - { - path: "/v1/api/rest/users", - methods: ["POST"], - query: ` - mutation CreateUser($email: Auth_Varchar = "", $id: Auth_Int4 = "", $password: Auth_Varchar = "", $roles: Auth_Varchar = "") { - InsertUsers( - objects: {email: $email, id: $id, password: $password, roles: $roles} - postCheck: {} - ) { - affectedRows - } - } - `, - }, - { - path: "/v1/api/rest/users/:id/password", - methods: ["PUT"], - query: ` - mutation UpdateUserPassword($id: Auth_Int4!, $password: Auth_Varchar!) { - UpdateUsersById( - keyId: $id - postCheck: {} - preCheck: {} - updateColumns: {password: {set: $password}} - ) { - affectedRows - } - } - `, - }, - { - path: "/v1/api/rest/users/:id", - methods: ["DELETE"], - query: ` - mutation DeleteUser($id: Auth_Int4!) { - DeleteUsersById( - keyId: $id - preCheck: {} - ) { - affectedRows - } - } - `, - }, - ], -}; diff --git a/.data/starter/compose.yaml b/.data/starter/compose.yaml index c6e27d3d..aae12a70 100644 --- a/.data/starter/compose.yaml +++ b/.data/starter/compose.yaml @@ -1,9 +1,9 @@ -name: ${CONTAINER_PREFIX} +name: axiomstarter services: # Databases postgres: image: postgres - container_name: ${CONTAINER_PREFIX}_postgres + container_name: axiomstarter_postgres restart: unless-stopped volumes: - postgres-data:/var/lib/postgresql/data @@ -20,25 +20,5 @@ services: timeout: 5s retries: 30 - redis: - image: redis:latest - restart: unless-stopped - ports: - - 6379:6379 - - caching: - build: - context: https://github.com/hasura/engine-plugin-caching.git - restart: unless-stopped - ports: - - 8787:8787 - environment: - CACHING_PLUGIN_SECRET: ${CACHING_PLUGIN_SECRET} - CACHING_PLUGIN_REDIS_URL: ${CACHING_PLUGIN_REDIS_URL} - extra_hosts: - - local.hasura.dev=host-gateway - volumes: - - ../plugins/caching-config.js:/app/src/config.js - volumes: postgres-data: diff --git a/.data/telco/compose.yaml b/.data/telco/compose.yaml index 6b0f61fd..680a01a2 100644 --- a/.data/telco/compose.yaml +++ b/.data/telco/compose.yaml @@ -1,9 +1,9 @@ -name: ${CONTAINER_PREFIX} +name: axiomtelco services: # Databases postgres: image: postgres - container_name: ${CONTAINER_PREFIX}_postgres + container_name: axiomtelco_postgres restart: unless-stopped volumes: - postgres-data:/var/lib/postgresql/data @@ -22,7 +22,7 @@ services: pgvector: image: ankane/pgvector:latest - container_name: ${CONTAINER_PREFIX}_pgvector + container_name: axiomtelco_pgvector restart: unless-stopped ports: - "5433:5432" @@ -41,7 +41,7 @@ services: mongodb: image: mongo - container_name: ${CONTAINER_PREFIX}_mongodb + container_name: axiomtelco_mongodb restart: unless-stopped ports: - "27017:27017" @@ -62,6 +62,7 @@ services: mongo-seed: env_file: - .env + container_name: axiomtelco_mongo_seed build: context: ./mongo_seed dockerfile: Dockerfile @@ -76,7 +77,7 @@ services: clickhouse: image: clickhouse/clickhouse-server - container_name: ${CONTAINER_PREFIX}_clickhouse + container_name: axiomtelco_clickhouse restart: unless-stopped user: "101:101" ports: @@ -92,45 +93,6 @@ services: - clickhouse_data:/var/lib/clickhouse - ./clickhouse/scripts/:/docker-entrypoint-initdb.d/ - redis: - image: redis:latest - restart: unless-stopped - ports: - - 6379:6379 - - caching: - build: - context: https://github.com/hasura/engine-plugin-caching.git#64b184d2ea530e6314900c5177e822d2384b8fd3 - restart: unless-stopped - ports: - - 8787:8787 - environment: - CACHING_PLUGIN_SECRET: ${CACHING_PLUGIN_SECRET} - CACHING_PLUGIN_REDIS_URL: ${CACHING_PLUGIN_REDIS_URL} - extra_hosts: - - local.hasura.dev=host-gateway - volumes: - - ../plugins/caching/telco-config.js:/app/src/config.js - - restified: - container_name: ${CONTAINER_PREFIX}_restified - build: - context: https://github.com/hasura/engine-plugin-restified-endpoint.git#paritosh/express-server - target: base - restart: unless-stopped - ports: - - "8788:8788" - environment: - OTEL_EXPORTER_OTLP_ENDPOINT: ${RESTIFIED_EXPORTER_OTLP_ENDPOINT} - GRAPHQL_SERVER_URL: ${RESTIFIED_GRAPHQL_SERVER_URL} - RESTIFIED_PLUGIN_SECRET: ${RESTIFIED_PLUGIN_SECRET} - PORT: 8788 - extra_hosts: - - local.hasura.dev=host-gateway - volumes: - - ../plugins/restified/telco-config.ts:/app/src/config.ts - command: ["bash", "-c", "npm run build && npm run serve"] - volumes: postgres-data: pgvector-data: diff --git a/.github/workflows/ddn-deploy.yaml b/.github/workflows/ddn-deploy.yaml index 522cded8..9dee64a4 100644 --- a/.github/workflows/ddn-deploy.yaml +++ b/.github/workflows/ddn-deploy.yaml @@ -94,14 +94,21 @@ jobs: --no-interaction fi - - name: Extract URLs from JSON + - name: Extract Information from JSON if: env.no_op != 'true' run: | cat $RUNNER_TEMP/axiom.json BUILD_URLS=$(jq -r '.build_url' $RUNNER_TEMP/axiom.json | tr '\n' ',') - CONSOLE_URLS=$(jq -r '.console_url' $RUNNER_TEMP/axiom.json | tr '\n' ',') + PROJECT_NAME=$(jq -r '.project_name' $RUNNER_TEMP/axiom.json) + BUILD_VERSION=$(jq -r '.build_version' $RUNNER_TEMP/axiom.json) + PROMPTQL_URL=$(jq -r '.promptql_url // ""' $RUNNER_TEMP/axiom.json) + DESCRIPTION=$(jq -r '.description // ""' $RUNNER_TEMP/axiom.json) + echo "build_urls=${BUILD_URLS%,}" >> $GITHUB_ENV - echo "console_urls=${CONSOLE_URLS%,}" >> $GITHUB_ENV + echo "project_name=$PROJECT_NAME" >> $GITHUB_ENV + echo "build_version=$BUILD_VERSION" >> $GITHUB_ENV + echo "promptql_url=$PROMPTQL_URL" >> $GITHUB_ENV + echo "description=$DESCRIPTION" >> $GITHUB_ENV - name: Add PR comment with build details if: env.no_op != 'true' @@ -109,23 +116,39 @@ jobs: with: script: | const buildUrls = process.env.build_urls.split(',').map(url => url.trim()); - const consoleUrls = process.env.console_urls.split(',').map(url => url.trim()); const prNumber = context.payload.pull_request.number; const commitId = context.payload.pull_request.head.sha; const buildUrlsList = buildUrls.map(url => `- [${url}](${url})`).join('\n'); - const consoleUrlsList = consoleUrls.map(url => `- [${url}](${url})`).join('\n'); + const projectName = process.env.project_name || 'Unknown Project'; + const buildVersion = process.env.build_version || 'Unknown Version'; + const promptqlUrl = process.env.promptql_url || ''; + const description = process.env.description || ''; + + // Extract PR number from description or context + const prMatch = description.match(/\[PR-(\d+)\]/); + const prNumberFromDesc = prMatch ? prMatch[1] : null; + + // Create a more visually appealing comment const commentBody = ` - Supergraph build was successful! 🎉 + # 🚀 Axiom Deployment Successful! + + ## 📊 Build Information + - **Project:** \`${projectName}\` + - **Build Version:** \`${buildVersion}\` + - **PR:** [#${prNumberFromDesc || prNumber}](${context.payload.pull_request.html_url}) + - **Commit:** \`${commitId.substring(0, 7)}\` + + ## 🔗 Access Points - **Build URLs:** + ### GraphQL Endpoints ${buildUrlsList} - **Console URLs:** - ${consoleUrlsList} + ${promptqlUrl ? `### PromptQL Playground\n- [${promptqlUrl}](${promptqlUrl})` : ''} - **Commit ID:** ${commitId} + --- + *Deployed from commit ${commitId.substring(0, 7)}* `; github.rest.issues.createComment({ diff --git a/.github/workflows/ddn-test.yaml b/.github/workflows/ddn-test.yaml index bd8b4cb7..76545818 100644 --- a/.github/workflows/ddn-test.yaml +++ b/.github/workflows/ddn-test.yaml @@ -103,19 +103,3 @@ jobs: echo "Got: $RESPONSE" exit 1 fi - - - name: Query RESTified endpoint and validate response - if: env.no_op != 'true' - run: | - EXPECTED_RESPONSE='{"data":{"users":[{"id":7,"email":"alexis.smith@gmail.com","roles":"customer"}]}}' - RESPONSE=$(curl -s -X GET "http://localhost:3280/v1/api/rest/users?limit=1&offset=6" -H "Content-Type: application/json") - - # Compare the actual response with the expected response - if echo "$RESPONSE" | jq -e --argjson expected "$EXPECTED_RESPONSE" '. == $expected' > /dev/null; then - echo "✅ Response matches expected output." - else - echo "❌ Response does not match expected output." - echo "Expected: $EXPECTED_RESPONSE" - echo "Got: $RESPONSE" - exit 1 - fi \ No newline at end of file diff --git a/hasura/.env.aml.template b/hasura/.env.aml.template index 765c1efd..7c77ddef 100644 --- a/hasura/.env.aml.template +++ b/hasura/.env.aml.template @@ -19,10 +19,6 @@ APP_BANKING_CORE_OTEL_EXPORTER_OTLP_ENDPOINT="http://local.hasura.dev:4317" APP_BANKING_CORE_OTEL_SERVICE_NAME="app_banking_core" APP_BANKING_CORE_READ_URL="http://local.hasura.dev:5544" APP_BANKING_CORE_WRITE_URL="http://local.hasura.dev:5544" -CACHING_PLUGIN_PRE_PARSE_URL="http://local.hasura.dev:8787/pre-parse" -CACHING_PLUGIN_PRE_RESPONSE_URL="http://local.hasura.dev:8787/pre-response" -CACHING_PLUGIN_REDIS_URL="redis://local.hasura.dev:6379" -CACHING_PLUGIN_SECRET="zZkhKqFjqXR4g5MZCsJUZCnhCcoPyZ" GLOBALS_GLOBAL_FUNCTIONS_AUTHORIZATION_HEADER="Bearer YQ==" GLOBALS_GLOBAL_FUNCTIONS_HASURA_CONNECTOR_PORT=5756 GLOBALS_GLOBAL_FUNCTIONS_HASURA_SERVICE_TOKEN_SECRET="YQ==" @@ -31,5 +27,3 @@ GLOBALS_GLOBAL_FUNCTIONS_OTEL_SERVICE_NAME="globals_global_functions" GLOBALS_GLOBAL_FUNCTIONS_READ_URL="http://local.hasura.dev:5756" GLOBALS_GLOBAL_FUNCTIONS_WRITE_URL="http://local.hasura.dev:5756" JWT_SECRET="hptj8supNeslwet7nhGGr5Uu5MombVVjDmcGMOyrWa8" -RESTIFIED_ENDPOINTS_URL="http://local.hasura.dev:8788" -RESTIFIED_PLUGIN_SECRET="zZkhKqFjqXR4g5MZCsJUZCnhCcoPyZ" diff --git a/hasura/.env.cpg.template b/hasura/.env.cpg.template index 4f6c96c1..fc470492 100644 --- a/hasura/.env.cpg.template +++ b/hasura/.env.cpg.template @@ -1,10 +1,4 @@ -CACHING_PLUGIN_PRE_PARSE_URL="http://local.hasura.dev:8787/pre-parse" -CACHING_PLUGIN_PRE_RESPONSE_URL="http://local.hasura.dev:8787/pre-response" -CACHING_PLUGIN_REDIS_URL="redis://local.hasura.dev:6379" -CACHING_PLUGIN_SECRET="zZkhKqFjqXR4g5MZCsJUZCnhCcoPyZ" JWT_SECRET="hptj8supNeslwet7nhGGr5Uu5MombVVjDmcGMOyrWa8" -RESTIFIED_ENDPOINTS_URL="http://local.hasura.dev:8788" -RESTIFIED_PLUGIN_SECRET="zZkhKqFjqXR4g5MZCsJUZCnhCcoPyZ" RETAIL_ACTIONS_RETAIL_EXECUTION_AUTHORIZATION_HEADER="Bearer gTpOP_9SXA8I54HOXYTKSw==" RETAIL_ACTIONS_RETAIL_EXECUTION_HASURA_CONNECTOR_PORT=6279 RETAIL_ACTIONS_RETAIL_EXECUTION_HASURA_SERVICE_TOKEN_SECRET="gTpOP_9SXA8I54HOXYTKSw==" diff --git a/hasura/.env.diligence.template b/hasura/.env.diligence.template index fced8bc3..03593daf 100644 --- a/hasura/.env.diligence.template +++ b/hasura/.env.diligence.template @@ -1,7 +1,4 @@ -CACHING_PLUGIN_PRE_PARSE_URL="http://local.hasura.dev:8787/pre-parse" -CACHING_PLUGIN_PRE_RESPONSE_URL="http://local.hasura.dev:8787/pre-response" -CACHING_PLUGIN_REDIS_URL="redis://local.hasura.dev:6379" -CACHING_PLUGIN_SECRET="zZkhKqFjqXR4g5MZCsJUZCnhCcoPyZ" + DILIGENCE_VALUATION_OPERATIONS_AUTHORIZATION_HEADER="Bearer pOAbhpq0UitIY7VgxAuEIg==" DILIGENCE_VALUATION_OPERATIONS_HASURA_CONNECTOR_PORT=4477 DILIGENCE_VALUATION_OPERATIONS_HASURA_SERVICE_TOKEN_SECRET="pOAbhpq0UitIY7VgxAuEIg==" @@ -26,5 +23,3 @@ ERP_OPERATIONS_OTEL_SERVICE_NAME="erp_operations" ERP_OPERATIONS_READ_URL="http://local.hasura.dev:6552" ERP_OPERATIONS_WRITE_URL="http://local.hasura.dev:6552" JWT_SECRET="hptj8supNeslwet7nhGGr5Uu5MombVVjDmcGMOyrWa8" -RESTIFIED_ENDPOINTS_URL="http://local.hasura.dev:8788" -RESTIFIED_PLUGIN_SECRET="zZkhKqFjqXR4g5MZCsJUZCnhCcoPyZ" \ No newline at end of file diff --git a/hasura/.env.gtm.template b/hasura/.env.gtm.template index 1d741e2d..38c1be23 100644 --- a/hasura/.env.gtm.template +++ b/hasura/.env.gtm.template @@ -1,15 +1,3 @@ -JWT_SECRET="KGOUts9A6hU2dWQQiQHdNN5VZBixs+BAh74RwDElxps" -CACHING_PLUGIN_SECRET="zZkhKqFjqXR4g5MZCsJUZCnhCcoPyZ" -CACHING_PLUGIN_PRE_PARSE_URL="http://local.hasura.dev:8787/pre-parse" -CACHING_PLUGIN_PRE_RESPONSE_URL="http://local.hasura.dev:8787/pre-response" -CACHING_PLUGIN_REDIS_URL="redis://local.hasura.dev:6379" -GLOBALS_GLOBAL_FUNCTIONS_AUTHORIZATION_HEADER="Bearer YQ==" -GLOBALS_GLOBAL_FUNCTIONS_HASURA_CONNECTOR_PORT=5756 -GLOBALS_GLOBAL_FUNCTIONS_HASURA_SERVICE_TOKEN_SECRET="YQ==" -GLOBALS_GLOBAL_FUNCTIONS_OTEL_EXPORTER_OTLP_ENDPOINT="http://local.hasura.dev:4317" -GLOBALS_GLOBAL_FUNCTIONS_OTEL_SERVICE_NAME="globals_global_functions" -GLOBALS_GLOBAL_FUNCTIONS_READ_URL="http://local.hasura.dev:5756" -GLOBALS_GLOBAL_FUNCTIONS_WRITE_URL="http://local.hasura.dev:5756" JWT_SECRET="hptj8supNeslwet7nhGGr5Uu5MombVVjDmcGMOyrWa8" OPERATIONS_ACTIONS_AUTHORIZATION_HEADER="Bearer Qdn4TfpQaeaOKhv_0BlGZQ==" OPERATIONS_ACTIONS_HASURA_CONNECTOR_PORT=7228 @@ -26,8 +14,6 @@ OPERATIONS_AUTH_OTEL_EXPORTER_OTLP_ENDPOINT="http://local.hasura.dev:4317" OPERATIONS_AUTH_OTEL_SERVICE_NAME="operations_auth" OPERATIONS_AUTH_READ_URL="http://local.hasura.dev:5098" OPERATIONS_AUTH_WRITE_URL="http://local.hasura.dev:5098" -RESTIFIED_ENDPOINTS_URL="http://local.hasura.dev:8788" -RESTIFIED_PLUGIN_SECRET="zZkhKqFjqXR4g5MZCsJUZCnhCcoPyZ" REVOPS_CLARI_AUTHORIZATION_HEADER="Bearer 7_gYtGjB_I8BF6Bms_PJXA==" REVOPS_CLARI_CONNECTION_URI="postgres://postgres:hbGciOiJIUzI1NiIsInR5cCI6IkpX@local.hasura.dev:5433/clari" REVOPS_CLARI_HASURA_CONNECTOR_PORT=7480 diff --git a/hasura/.env.healthcare.template b/hasura/.env.healthcare.template index 7032aa6d..8c3de409 100644 --- a/hasura/.env.healthcare.template +++ b/hasura/.env.healthcare.template @@ -1,15 +1,4 @@ -CACHING_PLUGIN_PRE_PARSE_URL="http://local.hasura.dev:8787/pre-parse" -CACHING_PLUGIN_PRE_RESPONSE_URL="http://local.hasura.dev:8787/pre-response" -CACHING_PLUGIN_REDIS_URL="redis://local.hasura.dev:6379" -CACHING_PLUGIN_SECRET="zZkhKqFjqXR4g5MZCsJUZCnhCcoPyZ" -GLOBALS_GLOBAL_FUNCTIONS_AUTHORIZATION_HEADER="Bearer YQ==" -GLOBALS_GLOBAL_FUNCTIONS_HASURA_CONNECTOR_PORT=5756 -GLOBALS_GLOBAL_FUNCTIONS_HASURA_SERVICE_TOKEN_SECRET="YQ==" -GLOBALS_GLOBAL_FUNCTIONS_OTEL_EXPORTER_OTLP_ENDPOINT="http://local.hasura.dev:4317" -GLOBALS_GLOBAL_FUNCTIONS_OTEL_SERVICE_NAME="globals_global_functions" -GLOBALS_GLOBAL_FUNCTIONS_READ_URL="http://local.hasura.dev:5756" -GLOBALS_GLOBAL_FUNCTIONS_WRITE_URL="http://local.hasura.dev:5756" -JWT_SECRET="KGOUts9A6hU2dWQQiQHdNN5VZBixs+BAh74RwDElxps" +JWT_SECRET="hptj8supNeslwet7nhGGr5Uu5MombVVjDmcGMOyrWa8" PATIENT_OPS_OPERATIONS_AUTHORIZATION_HEADER="Bearer LmI9HLQ_4_1uBum5OwND0A==" PATIENT_OPS_OPERATIONS_CONNECTION_URI="postgres://postgres:hbGciOiJIUzI1NiIsInR5cCI6IkpX@local.hasura.dev/ops" PATIENT_OPS_OPERATIONS_HASURA_SERVICE_TOKEN_SECRET="LmI9HLQ_4_1uBum5OwND0A==" @@ -38,5 +27,3 @@ REFERENCE_REFERENCE_OTEL_EXPORTER_OTLP_ENDPOINT="http://local.hasura.dev:4317" REFERENCE_REFERENCE_OTEL_SERVICE_NAME="reference_reference" REFERENCE_REFERENCE_READ_URL="http://local.hasura.dev:5655" REFERENCE_REFERENCE_WRITE_URL="http://local.hasura.dev:5655" -RESTIFIED_ENDPOINTS_URL="http://local.hasura.dev:8788" -RESTIFIED_PLUGIN_SECRET="zZkhKqFjqXR4g5MZCsJUZCnhCcoPyZ" diff --git a/hasura/.env.telco.template b/hasura/.env.telco.template index aeda5bb1..f97c645e 100644 --- a/hasura/.env.telco.template +++ b/hasura/.env.telco.template @@ -15,10 +15,6 @@ AUTH_SEARCH_OTEL_SERVICE_NAME="auth_search" AUTH_SEARCH_PERPLEXITY_API_KEY="FILLME" AUTH_SEARCH_READ_URL="http://local.hasura.dev:8956" AUTH_SEARCH_WRITE_URL="http://local.hasura.dev:8956" -CACHING_PLUGIN_PRE_PARSE_URL="http://local.hasura.dev:8787/pre-parse" -CACHING_PLUGIN_PRE_RESPONSE_URL="http://local.hasura.dev:8787/pre-response" -CACHING_PLUGIN_REDIS_URL="redis://local.hasura.dev:6379" -CACHING_PLUGIN_SECRET="zZkhKqFjqXR4g5MZCsJUZCnhCcoPyZ" CUSTOMER_AURORA_AUTHORIZATION_HEADER="Bearer lW9ob0kcz3Zy6s5LXJCxbQ==" CUSTOMER_AURORA_CONNECTION_URI="postgres://postgres:hbGciOiJIUzI1NiIsInR5cCI6IkpX@local.hasura.dev:5432/customer" CUSTOMER_AURORA_HASURA_CONNECTOR_PORT=8043 @@ -67,8 +63,6 @@ NETWORK_KAFKA_SINK_OTEL_EXPORTER_OTLP_ENDPOINT="http://local.hasura.dev:4317" NETWORK_KAFKA_SINK_OTEL_SERVICE_NAME="network_kafka_sink" NETWORK_KAFKA_SINK_READ_URL="http://local.hasura.dev:4040" NETWORK_KAFKA_SINK_WRITE_URL="http://local.hasura.dev:4040" -RESTIFIED_ENDPOINTS_URL="http://local.hasura.dev:8788" -RESTIFIED_PLUGIN_SECRET="zZkhKqFjqXR4g5MZCsJUZCnhCcoPyZ" SUPPORT_ATLAS_AUTHORIZATION_HEADER="Bearer NW85vcBvTEZHpqFwYV95sQ==" SUPPORT_ATLAS_HASURA_CONNECTOR_PORT=4240 SUPPORT_ATLAS_HASURA_SERVICE_TOKEN_SECRET="NW85vcBvTEZHpqFwYV95sQ==" diff --git a/hasura/README.md b/hasura/README.md index b8298a9a..d486fffb 100644 --- a/hasura/README.md +++ b/hasura/README.md @@ -1,233 +1,266 @@ -# Axiom Hasura Installation Guide +# Axiom Hasura Demo Development Guide -Axiom provides a centralised platform for deploying and testing a variety of Hasura industry demos. It serves as: -- A library of demo profiles for quick deployment. -- A testing ground for showcasing new Hasura features with real-world examples. +Axiom provides a centralized platform for deploying and testing a variety of Hasura industry demos. This guide will help you understand how to use existing demos and create new ones. ---- +## 🌟 Existing Demo Profiles -## Existing Demo Profiles -* starter -* telco -* aml -* healthcare +* starter - Basic example for new demo development +* telco - Telecommunications industry demo +* aml - Anti-Money Laundering compliance demo +* healthcare - Patient operations and medical reference demo +* cpg - Consumer Packaged Goods retail operations demo +* gtm - Go-to-Market sales and marketing operations demo -### How to Use -To utilize an existing demo profile, run the following `ddn run` commands. These commands automatically use the scripts in the background: +## 🚀 Using Existing Demos -- **`build`**: Builds metadata for a specific demo context. +To utilize an existing demo profile, run the following `ddn run` commands: + +- **`init`**: Initialize the environment for a specific demo (only needed once per profile). + ```bash + ddn run init -- + # Example: ddn run init -- telco + ``` + +- **`build`**: Build metadata for a specific demo context. ```bash - ddn run build -- + ddn run build -- # Example: ddn run build -- telco ``` -- **`docker-start`**: Sets up the demo's Docker environment. +- **`docker-start`**: Set up the demo's Docker environment. ```bash - ddn run docker-start -- + ddn run docker-start -- # Example: ddn run docker-start -- telco ``` -- **`demo`**: Executes both build and docker-start, then launches Hasura locally. +- **`demo`**: Execute both build and docker-start, then launch Hasura locally. ```bash - ddn run demo -- + ddn run demo -- # Example: ddn run demo -- telco ``` -- **`docker-stop`**: Stops all running Docker containers. +- **`docker-stop`**: Stop all running Docker containers. ```bash ddn run docker-stop ``` -### Deploying to the Cloud -For deployment instructions, see [scripts/deploy/README.md](../scripts/deploy/README.md). +## 🏗️ Creating a New Demo Profile ---- +This section provides a comprehensive guide for creating a new industry demo profile. Each demo requires specific files and configurations in multiple directories. -## Adding a New Demo Profile +### Required Components Overview -New profiles can be added with minimal effort, enabling streamlined testing and cloud deployment. +A complete demo profile requires: -The simplest way to initialise a new industry demo profile within `axiom` is to create and configure supergraph, subgraph(s), and metadata elsewhere before merging it with the following instructions. +1. **In the `.data` directory**: Docker configuration and seed data +2. **In the `hasura` directory**: + - Environment files + - Compose configuration + - Supergraph configuration + - Industry-specific subgraphs and metadata -Creating a new supergraph from scratch is beyond the scope of this documentation and the [DDN quickstart](https://hasura.io/docs/3.0/getting-started/quickstart/) should be followed - -### Step 1: Name Your Profile -Decide on a name for your profile. This name (e.g., `telco`, `starter`) will be referenced throughout the repo. +### Step 1: Set Up Your Profile Name ```bash -# Set the $PROFILE variable for reuse +# Set the profile variable for reuse PROFILE= echo $PROFILE -# Change directory into hasura supergraph directory +# Change directory into hasura cd hasura ``` -### Step 2: Create the Demo Project - -1. Create a new project in DDN cloud: +### Step 2: Create Required Directory Structure ```bash -ddn project create $PROFILE -``` +# Create industry directory +mkdir -p industry/$PROFILE -2. Add a new context using `ddn context set` commands: +# Create supergraph config directory +mkdir -p supergraph-config/$PROFILE -```bash -# Create a new context with the profile name -ddn context set project $PROFILE -ddn context set supergraph ../supergraph-config/$PROFILE/1-supergraph.yaml -ddn context set localEnvFile ../.env.$PROFILE -ddn context set cloudEnvFile ../.env.cloud.$PROFILE +# Create data directory +mkdir -p ../.data/$PROFILE ``` -### Step 2: Copy Subgraphs -1. Copy subgraphs - -Copy any subgraph directories from the source repository into `industry/$PROFILE`. +### Step 3: Set Up Data Directory (`.data/$PROFILE`) -2. Create subgraphs on DDN: +The `.data` directory contains Docker configurations and seed data for local development. -Add subgraphs to the DDN project. - - ```bash - ddn project subgraph create globals - ddn project subgraph create - ``` - -### Step 3: Copy Supergraph -1. Set up a supergraph directory: ```bash -mkdir -p supergraph-config/$PROFILE -``` - -2. Copy `supergraph.yaml` - -Copy the `supergraph.yaml` from the source supergraph into `supergraph-config/$PROFILE/1-supergraph.yaml`. +# Create the data directory structure +mkdir -p ../.data/$PROFILE/postgres -Adjust the paths within `1-supergraph.yaml` to reference the right location for subgraphs within `industry/$PROFILE`. +# Copy the starter compose.yaml as a template +cp ../.data/starter/compose.yaml ../.data/$PROFILE/compose.yaml -> [!NOTE] -> Add any additional `supergraph.yaml` files you have may be added to the same directory and the [deploy script](../scripts/deploy/) will automatically build them in order. +# Copy environment template and customize it +cp ../.data/.env.template ../.data/$PROFILE/.env +sed "s/CONTAINER_PREFIX=axiomdata/CONTAINER_PREFIX=axiom${PROFILE}/g" ../.data/$PROFILE/.env > ../.data/$PROFILE/.env.tmp && mv ../.data/$PROFILE/.env.tmp ../.data/$PROFILE/.env +``` -### Step 4: Environment Files +**Required files in `.data/$PROFILE`:** -1. Create an .env template for example configuration +<<<<<<< Updated upstream +Remember to include a JWT_SECRET configuration in your `.env` files to allow for builds to proceed: ```bash -touch .env.$PROFILE.template -git add -f .env.$PROFILE.template +echo 'JWT_SECRET="hptj8supNeslwet7nhGGr5Uu5MombVVjDmcGMOyrWa8"' > .env.$PROFILE.template ``` +======= +1. **`compose.yaml`**: Docker Compose configuration defining: + - Database containers (PostgreSQL, MongoDB, etc.) + - Redis for caching + - Caching plugin configuration + - Any other services needed for your demo + +2. **`postgres/`**: Directory containing SQL initialization scripts that will run when the container starts + - SQL files should be named with numerical prefixes (e.g., `1-schema.sql`, `2-data.sql`) + - These scripts create tables and populate them with seed data -2. Copy environment files from your own supergraph to populate environments in this repository +3. **`.env`**: Environment variables for Docker Compose + - Contains passwords and configuration for containers + - Should include `CONTAINER_PREFIX` to identify your demo's containers -Remember to include a JWT_SECRET and caching plugin configuration in your `.env` files to allow for builds to proceed: +### Step 4: Set Up Hasura Directory Components + +#### 4.1: Create Environment Files ```bash -echo 'JWT_SECRET="hptj8supNeslwet7nhGGr5Uu5MombVVjDmcGMOyrWa8" +# Create environment files +touch .env.$PROFILE.template .env.$PROFILE .env.cloud.$PROFILE + +# Add basic configuration to template +cat > .env.$PROFILE.template << EOF +JWT_SECRET="hptj8supNeslwet7nhGGr5Uu5MombVVjDmcGMOyrWa8" CACHING_PLUGIN_PRE_PARSE_URL="http://local.hasura.dev:8787/pre-parse" CACHING_PLUGIN_PRE_RESPONSE_URL="http://local.hasura.dev:8787/pre-response" CACHING_PLUGIN_REDIS_URL="redis://local.hasura.dev:6379" -CACHING_PLUGIN_SECRET="zZkhKqFjqXR4g5MZCsJUZCnhCcoPyZ"' > .env.$PROFILE.template -``` +CACHING_PLUGIN_SECRET="zZkhKqFjqXR4g5MZCsJUZCnhCcoPyZ" +>>>>>>> Stashed changes -_Optional_ Use the following one-liner to generate a JWT_SECRET - -```bash -openssl rand -base64 32 -``` +# Add your connector environment variables here +${PROFILE^^}_MYPOSTGRES_READ_URL="postgres://postgres:hbGciOiJIUzI1NiIsInR5cCI6IkpX@local.hasura.dev:5432/postgres" +${PROFILE^^}_MYPOSTGRES_WRITE_URL="postgres://postgres:hbGciOiJIUzI1NiIsInR5cCI6IkpX@local.hasura.dev:5432/postgres" +${PROFILE^^}_MYPOSTGRES_AUTHORIZATION_HEADER="Bearer example-token" +EOF -3. Seed environment files: -```bash +# Copy template to actual env file cp .env.$PROFILE.template .env.$PROFILE -touch .env.$PROFILE.template .env.cloud.$PROFILE + +# Add git tracking for template only +git add -f .env.$PROFILE.template ``` -> [!WARNING] -> Do not commit any database credentials to the pull request and ensure that the template file that gets force committed uses dummy data +#### 4.2: Create Docker Compose Configuration ---- +```bash +# Create profile-specific Docker Compose file +cp compose.yaml compose-$PROFILE.yaml +``` -## [_Optional_] Set up local data +#### 4.3: Set Up Industry Directory Structure -Local docker-based configuration may be used to run demo profiles without cloud dependencies. This is demonstrated within the `telco` profile with a docker compose and database seeds in `.data/telco`. +```bash +# Create a basic subgraph directory structure +mkdir -p industry/$PROFILE/example/{connector/mypostgres,metadata} + +# Create a basic subgraph.yaml +cat > industry/$PROFILE/example/subgraph.yaml << EOF +kind: Subgraph +version: v2 +definition: + name: example + generator: + rootPath: . + namingConvention: graphql + includePaths: + - metadata + envMapping: + ${PROFILE^^}_MYPOSTGRES_AUTHORIZATION_HEADER: + fromEnv: ${PROFILE^^}_MYPOSTGRES_AUTHORIZATION_HEADER + ${PROFILE^^}_MYPOSTGRES_READ_URL: + fromEnv: ${PROFILE^^}_MYPOSTGRES_READ_URL + ${PROFILE^^}_MYPOSTGRES_WRITE_URL: + fromEnv: ${PROFILE^^}_MYPOSTGRES_WRITE_URL + connectors: + - path: connector/mypostgres/connector.yaml + connectorLinkName: mypostgres +EOF + +# Create a placeholder for metadata +touch industry/$PROFILE/example/metadata/.keep +``` -> [!TIP] -> All below commands should be executed from the root directory of this repository. +#### 4.4: Create Supergraph Configuration -### Step 1: Initial Setup -Use the starter profile to get bootstrapped sooner with existing/common data sets. +```bash +# Create supergraph configuration +cat > supergraph-config/$PROFILE/1-supergraph.yaml << EOF +kind: Supergraph +version: v2 +definition: + subgraphs: + - ../../globals/subgraph-jwt.yaml + - ../../industry/$PROFILE/example/subgraph.yaml +EOF +``` -Custom `compose.yaml` and `.env` may be used. Their location must be in `.data/$PROFILE`. +### Step 5: Develop Your Demo Content -1. Set up the data structure of the profile +1. **Create connector configuration** in `industry/$PROFILE/example/connector/mypostgres/connector.yaml` +2. **Add metadata files** in `industry/$PROFILE/example/metadata/` (HML files defining models, relationships, etc.) +3. **Create SQL seed data** in `.data/$PROFILE/postgres/` to populate your database +4. **Update environment variables** in `.env.$PROFILE` with actual connection details -Run the following commands to set up your profile. +### Step 6: Test Your Demo ```bash -# Create the directory structure -mkdir -p .data/$PROFILE - -# [Optional] Add the starter compose.yaml -cp .data/starter/compose.yaml .data/$PROFILE/compose.yaml - -# [Optional] Add starter postgres dataset -cp -r .data/starter/postgres .data/$PROFILE/ +# Test the build +ddn run build -- $PROFILE -# Copy and customise the environment file to show the name of your profile in docker -cp .data/.env.template .data/$PROFILE/.env -sed "s/CONTAINER_PREFIX=axiomdata/CONTAINER_PREFIX=axiom${PROFILE}/g" .data/$PROFILE/.env > .data/$PROFILE/.env.tmp && mv .data/$PROFILE/.env.tmp .data/$PROFILE/.env +# Start the demo +ddn run demo -- $PROFILE ``` -2. Customise `.data/$PROFILE/compose.yaml` +### Step 7: Prepare for Deployment -Make any further adjustments to the profile's `compose.yaml` as appropriate to use different containers, data sources and seed data. +For cloud deployment: -### Step 2: Local Docker Setup - -No changes to `hasura/.hasura/context.yaml` are needed as ddn run uses a context parameter. The Docker environment will be started using: +1. Update `.env.cloud.$PROFILE` with internet-accessible data source URLs +2. Deploy using the deploy script: ```bash -ddn run docker-start -- $PROFILE +../scripts/deploy/deploy.mjs --context $PROFILE --profile $PROFILE --log-level DEBUG --full-metadata-build --override ``` -This command will: -1. Verify the context exists -2. Check that the data directory exists at `.data/$PROFILE` -3. Set the DATASET environment variable -4. Start the Docker containers using the compose file at `.data/$PROFILE/compose.yaml` - -### Step 3: Docker Compose -1. Create a profile-specific Docker Compose file -```bash -cp hasura/compose.yaml hasura/compose-$PROFILE.yaml -``` +## 📋 Demo Profile Checklist -> [!IMPORTANT] -> Do not commit changes to the base `hasura/compose.yaml`. +Ensure your demo profile includes: ---- +### In `.data/$PROFILE/`: +- [ ] `compose.yaml` - Docker Compose configuration +- [ ] `.env` - Environment variables for Docker +- [ ] `postgres/` (or other database) - SQL initialization scripts -## Testing and Deployment +### In `hasura/`: +- [ ] `.env.$PROFILE.template` - Template environment file (safe to commit) +- [ ] `.env.$PROFILE` - Local environment file (do not commit) +- [ ] `.env.cloud.$PROFILE` - Cloud environment file +- [ ] `compose-$PROFILE.yaml` - Profile-specific Docker Compose -1. **Test the Build:** -```bash -ddn run build -- $PROFILE -``` +### In `hasura/industry/$PROFILE/`: +- [ ] Subgraph directories with: + - [ ] `subgraph.yaml` - Subgraph configuration + - [ ] `connector/` - Connector configurations + - [ ] `metadata/` - HML metadata files -2. **Start the Demo:** -```bash -ddn run demo -- $PROFILE -``` +### In `hasura/supergraph-config/$PROFILE/`: +- [ ] `1-supergraph.yaml` - Primary supergraph configuration +- [ ] Additional supergraph files if needed -3. **Cloud Deployment:** -- Ensure data sources are internet-accessible. -- Update `.env.cloud.$PROFILE` with the relevant URLs. -- Run the deploy script: -```bash -./scripts/deploy/deploy.mjs --context $PROFILE --profile $PROFILE --log-level DEBUG --full-metadata-build --override -``` ---- +## 📚 Additional Resources -## Notes -- **Auto Deployments:** Ensure changes to Ansible playbooks and `.data` are committed to the `main` branch to allow them to be automatically deployed. \ No newline at end of file +- [DDN Documentation](https://hasura.io/docs/3.0/) +- [Deployment Guide](../scripts/deploy/README.md) +- [Connector Development Guide](https://hasura.io/docs/3.0/data-connectors/build/overview/) \ No newline at end of file diff --git a/hasura/globals/plugin-config.hml b/hasura/globals/plugin-config.hml deleted file mode 100644 index 5ada2617..00000000 --- a/hasura/globals/plugin-config.hml +++ /dev/null @@ -1,66 +0,0 @@ ---- -kind: LifecyclePluginHook -version: v1 -definition: - pre: parse - name: cache_get_test - url: - valueFromEnv: CACHING_PLUGIN_PRE_PARSE_URL - config: - request: - headers: - additional: - hasura-m-auth: - valueFromEnv: CACHING_PLUGIN_SECRET - rawRequest: - query: {} - variables: {} ---- -kind: LifecyclePluginHook -version: v1 -definition: - pre: response - name: cache_set_test - url: - valueFromEnv: CACHING_PLUGIN_PRE_RESPONSE_URL - config: - request: - headers: - additional: - hasura-m-auth: - valueFromEnv: CACHING_PLUGIN_SECRET - rawRequest: - query: {} - variables: {} - ---- -kind: LifecyclePluginHook -version: v1 -definition: - pre: route - name: restified_endpoints - url: - valueFromEnv: RESTIFIED_ENDPOINTS_URL - config: - matchPath: "/v1/api/rest/*" - matchMethods: ["GET", "POST", "PUT", "DELETE"] - request: - method: GET - headers: - forward: - - Authorization - - x-hasura-role - - x-hasura-ddn-token - additional: - hasura-m-auth: - valueFromEnv: RESTIFIED_PLUGIN_SECRET - rawRequest: - path: {} - query: {} - method: {} - body: {} - response: - headers: - additional: - content-type: - value: application/json \ No newline at end of file diff --git a/hasura/globals/subgraph-jwt.yaml b/hasura/globals/subgraph-jwt.yaml index 4ab3960a..c88943f9 100644 --- a/hasura/globals/subgraph-jwt.yaml +++ b/hasura/globals/subgraph-jwt.yaml @@ -8,17 +8,6 @@ definition: - auth-config-jwt.hml - compatibility-config.hml - graphql-config.hml - - plugin-config.hml envMapping: JWT_SECRET: fromEnv: JWT_SECRET - CACHING_PLUGIN_SECRET: - fromEnv: CACHING_PLUGIN_SECRET - CACHING_PLUGIN_PRE_PARSE_URL: - fromEnv: CACHING_PLUGIN_PRE_PARSE_URL - CACHING_PLUGIN_PRE_RESPONSE_URL: - fromEnv: CACHING_PLUGIN_PRE_RESPONSE_URL - RESTIFIED_ENDPOINTS_URL: - fromEnv: RESTIFIED_ENDPOINTS_URL - RESTIFIED_PLUGIN_SECRET: - fromEnv: RESTIFIED_PLUGIN_SECRET diff --git a/hasura/globals/subgraph-noauth.yaml b/hasura/globals/subgraph-noauth.yaml index e01faf94..baf37282 100644 --- a/hasura/globals/subgraph-noauth.yaml +++ b/hasura/globals/subgraph-noauth.yaml @@ -8,17 +8,6 @@ definition: - auth-config-noauth.hml - compatibility-config.hml - graphql-config.hml - - plugin-config.hml envMapping: JWT_SECRET: fromEnv: JWT_SECRET - CACHING_PLUGIN_SECRET: - fromEnv: CACHING_PLUGIN_SECRET - CACHING_PLUGIN_PRE_PARSE_URL: - fromEnv: CACHING_PLUGIN_PRE_PARSE_URL - CACHING_PLUGIN_PRE_RESPONSE_URL: - fromEnv: CACHING_PLUGIN_PRE_RESPONSE_URL - RESTIFIED_ENDPOINTS_URL: - fromEnv: RESTIFIED_ENDPOINTS_URL - RESTIFIED_PLUGIN_SECRET: - fromEnv: RESTIFIED_PLUGIN_SECRET diff --git a/infra/ansible/playbooks/axiom.yml b/infra/ansible/playbooks/axiom.yml index 2f0f1bfc..79da39f7 100644 --- a/infra/ansible/playbooks/axiom.yml +++ b/infra/ansible/playbooks/axiom.yml @@ -72,10 +72,6 @@ file: "{{ playbook_dir }}/../.env" name: env_vars - - name: Override RESTIFIED_GRAPHQL_SERVER_URL based on server - ansible.builtin.set_fact: - restified_graphql_server_url: "{{ hostvars[inventory_hostname]['graphql_url'] | default('http://local.hasura.dev:3280/graphql') }}" - - name: Setup environment variables from Ansible -> Docker ansible.builtin.template: src: "{{ playbook_dir }}/templates/env_vars.j2" diff --git a/infra/ansible/playbooks/templates/env_vars.j2 b/infra/ansible/playbooks/templates/env_vars.j2 index a029d231..a9ce2eef 100644 --- a/infra/ansible/playbooks/templates/env_vars.j2 +++ b/infra/ansible/playbooks/templates/env_vars.j2 @@ -2,7 +2,3 @@ CONTAINER_PREFIX={{ env_vars.CONTAINER_PREFIX }} MONGO_PASSWORD={{ env_vars.MONGO_PASSWORD }} POSTGRES_PASSWORD={{ env_vars.POSTGRES_PASSWORD }} CLICKHOUSE_PASSWORD={{ env_vars.CLICKHOUSE_PASSWORD }} -CACHING_PLUGIN_SECRET={{ env_vars.CACHING_PLUGIN_SECRET }} -CACHING_PLUGIN_REDIS_URL={{ env_vars.CACHING_PLUGIN_REDIS_URL }} -RESTIFIED_PLUGIN_SECRET={{ env_vars.RESTIFIED_PLUGIN_SECRET }} -RESTIFIED_GRAPHQL_SERVER_URL={{ restified_graphql_server_url }} \ No newline at end of file diff --git a/infra/ansible/template.env b/infra/ansible/template.env index c8b71220..4f7e00a3 100644 --- a/infra/ansible/template.env +++ b/infra/ansible/template.env @@ -2,8 +2,3 @@ CONTAINER_PREFIX: axiomdata MONGO_PASSWORD: password123 POSTGRES_PASSWORD: password123 CLICKHOUSE_PASSWORD: password123 -CACHING_PLUGIN_SECRET: password123 -CACHING_PLUGIN_REDIS_URL: redis://local.hasura.dev:6379 -RESTIFIED_PLUGIN_SECRET: password123 -RESTIFIED_GRAPHQL_SERVER_URL: http://local.hasura.dev:3280/graphql -RESTIFIED_EXPORTER_OTLP_ENDPOINT: http://local.hasura.dev:4318/v1/traces diff --git a/infra/aws/README.md b/infra/aws/README.md index 2cd2d60e..f5a6939b 100644 --- a/infra/aws/README.md +++ b/infra/aws/README.md @@ -32,8 +32,6 @@ To set up a new presales demo instance, run this script to provision one automat * 443 (HTTPS) * 5432 (Postgres 1) * 5433 (Postgres 2) - * 8787 (Cache) - * 8788 (RESTified endpoints) * 8123 (Clickhouse) * 9000 (Clickhouse) * 27017 (MongoDB) diff --git a/infra/aws/create-axiom-server.sh b/infra/aws/create-axiom-server.sh index e0f97386..c26a2ad4 100755 --- a/infra/aws/create-axiom-server.sh +++ b/infra/aws/create-axiom-server.sh @@ -35,7 +35,7 @@ INSTANCE_TYPE="t2.medium" VOLUME_SIZE=25 SG_NAME="presales-sg" SG_DESCRIPTION="presales sg with required ports" -PORTS=(22 80 443 5432 5433 8123 8787 8788 9000 27017) +PORTS=(22 80 443 5432 5433 8123 9000 27017) # Generate the key name based on region and date DATETIME=$(date +%Y%m%d-%H%M%S) diff --git a/queries/README.md b/queries/README.md deleted file mode 100644 index b2a01cc1..00000000 --- a/queries/README.md +++ /dev/null @@ -1,52 +0,0 @@ -# Queries Directory - -This directory contains example queries for the Hasura GraphQL API and REST endpoints. - -## Structure - -- `graphql/` - GraphQL query examples -- `rest/` - REST API request examples - -## GraphQL Queries - -The GraphQL queries are intended for use within the `telco` demo and showcase different examples of how DDN can retrieve, join, filter, sort, and limit information across multiple different backend data sources. - -Use the inbuilt GraphiQL editor within Hasura DDN to test these queries. - -## REST API Requests - -RESTified endpoints are added in as a plugin in the globals subgraph. Configuration of RESTified endpoints is first in Hasura at `hasura/globals/plugin-config.hml` and secondly in the plugin itself. - -The plugins define the REST endpoints and the graphql query they correspond to. These are both defined in the `.data/plugins/restified` directory: - -- `telco.http` - Uses endpoints defined in `.data/plugins/restified/telco-config.ts` -- `aml.http` - Uses endpoints defined in `.data/plugins/restified/aml-config.ts` -- `healthcare.http` - Uses endpoints defined in `.data/plugins/restified/healthcare-config.ts` - -Each config file maps REST endpoints to GraphQL operations. For example, in telco-config.ts: - -```typescript -{ - path: "/v1/api/rest/users/:id", - methods: ["DELETE"], - query: ` - mutation DeleteUser($id: Auth_Int4!) { - DeleteUsersById( - keyId: $id - preCheck: {} - ) { - affectedRows - } - } - `, -} -``` - -This defines a DELETE endpoint at `/v1/api/rest/users/:id` that executes the DeleteUser mutation. - -The HTTP files in the `rest/` directory provide examples of calling these endpoints: - -``` -DELETE http://localhost:3280/v1/api/rest/users/101 -Content-Type: application/json -hasura-m-auth: your-auth-token \ No newline at end of file diff --git a/queries/graphql/customer-behaviour-analysis.gql b/queries/graphql/customer-behaviour-analysis.gql deleted file mode 100644 index fc69885f..00000000 --- a/queries/graphql/customer-behaviour-analysis.gql +++ /dev/null @@ -1,97 +0,0 @@ -query CustomerBehaviorAnalysis($customerId: Customer_Int4) { - # First get the customer guid - customerLink(where: { customerId: { _eq: $customerId } }) { - customerGuid - # Then use it in a nested query for all the data - customer { - firstName - lastName - segment - email - - customerPlans { - cellNumber - startDate - plan { - planName - monthlyFee - } - customerPlanDevices { - device { - brand - model - } - } - } - - customerNetworks { - network { - nodeName - status - latitude - longitude - capacity - } - } - } - - # Network metrics directly from the link - NetworkPerformance { - downloadSpeed - uploadSpeed - latency - timestamp - } - - DataUsage { - dataUsage - timestamp - } - - CDR { - callDuration - callType - timestamp - } - - # User profile through the guid - supportDB { - accountDetails { - accountNumber - registrationDate - } - supportHistory { - ticketId - issue - status - resolutionNotes - date - } - usageStats { - appUsage { - name - usage - } - callStats { - totalMinutes - internationalMinutes - } - dataUsage { - currentMonth - total - } - } - } - } - - # Billing history - billing( - where: { customerId: { _eq: $customerId } } - order_by: { billingDate: Desc } - limit: 6 - ) { - billingDate - totalAmount - paymentStatus - } -} diff --git a/queries/graphql/customer-dashboard.gql b/queries/graphql/customer-dashboard.gql deleted file mode 100644 index 8638f9ff..00000000 --- a/queries/graphql/customer-dashboard.gql +++ /dev/null @@ -1,43 +0,0 @@ -query CustomerDashboard($customerId: Customer_Int4) { - billing(where: { customerId: { _eq: $customerId } }) { - customerId - paymentStatus - totalAmount - customer { - firstName - lastName - email - phoneNumber - address - city - state - country - customerPlans { - startDate - endDate - plan { - description - monthlyFee - } - customerPlanDevices { - device { - brand - model - image - } - } - } - customerLinks { - DataUsage { - dataUsage - timestamp - } - NetworkPerformance { - downloadSpeed - uploadSpeed - latency - } - } - } - } -} diff --git a/queries/graphql/error-query.gql b/queries/graphql/error-query.gql deleted file mode 100644 index abdbda90..00000000 --- a/queries/graphql/error-query.gql +++ /dev/null @@ -1,51 +0,0 @@ -query ErrorQuery { - billing { - customer { - billings { - billingDate - customerId - paymentStatus - totalAmount - } - creditCards { - customerId - } - customerPlans { - plan { - type - } - } - customerNetworks { - customerId - } - customerLinks { - customerGuid - NetworkPerformance { - downloadSpeed - } - DataUsage { - dataUsage - } - CDR { - callType - formatTimestamp - timestamp - } - supportDB { - memberId - notes - preferences { - communication { - emailUpdates - smsNotifications - appNotifications { - enabled - } - } - } - } - } - } - billingDate - } -} diff --git a/queries/graphql/join-query.gql b/queries/graphql/join-query.gql deleted file mode 100644 index 431afdfc..00000000 --- a/queries/graphql/join-query.gql +++ /dev/null @@ -1,16 +0,0 @@ -query JoinQuery($limit: Int = 10) { - # Get customer information with credit cards - customers(limit: $limit) { - firstName - lastName - address - city - state - postcode - segment - creditCards { - maskCreditCard - expiry - } - } -} diff --git a/queries/graphql/simple-query.gql b/queries/graphql/simple-query.gql deleted file mode 100644 index e6942aba..00000000 --- a/queries/graphql/simple-query.gql +++ /dev/null @@ -1,12 +0,0 @@ -query SimpleQuery($limit: Int = 10) { - # Get basic customer information - customers(limit: $limit) { - firstName - lastName - address - city - state - postcode - segment - } -} diff --git a/queries/rest/aml.http b/queries/rest/aml.http deleted file mode 100644 index 4e643b33..00000000 --- a/queries/rest/aml.http +++ /dev/null @@ -1,3 +0,0 @@ -GET http://localhost:3280/v1/api/rest/customers?limit=3&offset=2 -Content-Type: application/json -hasura-m-auth: zZkhKqFjqXR4g5MZCsJUZCcoPyZ \ No newline at end of file diff --git a/queries/rest/healthcare.http b/queries/rest/healthcare.http deleted file mode 100644 index 49bad940..00000000 --- a/queries/rest/healthcare.http +++ /dev/null @@ -1,3 +0,0 @@ -DELETE http://localhost:3280/v1/api/rest/users/101 -Content-Type: application/json -hasura-m-auth: zZkhKqFjqXR4g5MZCsJUZCcoPyZ \ No newline at end of file diff --git a/queries/rest/telco.http b/queries/rest/telco.http deleted file mode 100644 index d54cf8b6..00000000 --- a/queries/rest/telco.http +++ /dev/null @@ -1,34 +0,0 @@ -GET http://localhost:3280/v1/api/rest/users?limit=5&offset=3 -Content-Type: application/json -hasura-m-auth: zZkhKqFjqXR4g5MZCsJUZCcoPyZ - -### -GET http://localhost:3280/v1/api/rest/user/7 -Content-Type: application/json -hasura-m-auth: zZkhKqFjqXR4g5MZCsJUZCcoPyZ - -### -POST http://localhost:3280/v1/api/rest/users -Content-Type: application/json -hasura-m-auth: zZkhKqFjqXR4g5MZCsJUZCcoPyZ - -{ - "email": "johndoe@example.com", - "id": 101, - "password": "$2a$10$DSRHAPZP0fuEFioGOPOdW.kgFWZvQgmMihaBYsUs8rO4cdHFFK7Sc", - "roles": "customer" -} - -### -PUT http://localhost:3280/v1/api/rest/users/101/password -Content-Type: application/json -hasura-m-auth: zZkhKqFjqXR4g5MZCsJUZCcoPyZ - -{ - "password": "newpassword" -} - -### -DELETE http://localhost:3280/v1/api/rest/users/101 -Content-Type: application/json -hasura-m-auth: zZkhKqFjqXR4g5MZCsJUZCcoPyZ