From 40917890b005a322b5b4a438f66b526ff58c38b5 Mon Sep 17 00:00:00 2001 From: Victor Martin Date: Tue, 27 Aug 2024 17:36:57 +0200 Subject: [PATCH] add multiprofile environment, fix issue with app version (instead of web), clean up --- .../overlays/prod/kustomization.yaml.mustache | 2 +- deploy/terraform/.terraform.lock.hcl | 26 +++---- deploy/terraform/data.tf | 7 +- deploy/terraform/genai.tf | 7 -- deploy/terraform/outputs.tf | 30 -------- deploy/terraform/provider.tf | 17 +++-- deploy/terraform/terraform.tfvars.mustache | 9 +-- deploy/terraform/variables.tf | 36 +-------- scripts/clean.mjs | 1 + scripts/kustom.mjs | 26 +++++++ scripts/lib/oci.mjs | 25 +++++-- scripts/package-lock.json | 73 ++++++++++++++++++- scripts/package.json | 7 +- scripts/setenv.mjs | 55 +++++++++++--- scripts/tfvars.mjs | 18 +---- web/Dockerfile | 2 +- 16 files changed, 202 insertions(+), 139 deletions(-) delete mode 100644 deploy/terraform/genai.tf diff --git a/deploy/k8s/overlays/prod/kustomization.yaml.mustache b/deploy/k8s/overlays/prod/kustomization.yaml.mustache index 13999b2f..864f5d81 100644 --- a/deploy/k8s/overlays/prod/kustomization.yaml.mustache +++ b/deploy/k8s/overlays/prod/kustomization.yaml.mustache @@ -6,7 +6,7 @@ resources: images: - name: app newName: {{region_key}}.ocir.io/{{{tenancy_namespace}}}/{{{project_name}}}/app - newTag: {{{web_version}}} + newTag: {{{app_version}}} - name: backend newName: {{region_key}}.ocir.io/{{{tenancy_namespace}}}/{{{project_name}}}/backend newTag: {{{backend_version}}} \ No newline at end of file diff --git a/deploy/terraform/.terraform.lock.hcl b/deploy/terraform/.terraform.lock.hcl index 396723e4..0a106da3 100644 --- a/deploy/terraform/.terraform.lock.hcl +++ b/deploy/terraform/.terraform.lock.hcl @@ -22,22 +22,22 @@ provider "registry.terraform.io/hashicorp/cloudinit" { } provider "registry.terraform.io/hashicorp/helm" { - version = "2.14.1" + version = "2.15.0" constraints = ">= 2.9.0" hashes = [ - "h1:JpDnPg+/pqynL54+Og9/bORTRYP1NxFjbrm65827Cns=", - "zh:0b8190016b101edbec158f869e14e5bcb9708dc88040e3d0119f6bf0a0384fa6", - "zh:0bd483d0193716ee7f30ce2e25eebb463aa51700c716842e25026bf2167e8feb", - "zh:5c8c16640f84f952e7ed1bab43b91c65f97168dd3bc189ea368e07fd40d44037", - "zh:67729452ff9c4f7a32d2e0008ce5deb86293929704ed3219971595db757924fa", - "zh:72dd1bc749de240e3700623ab1ff9b490ad5bbf17338e02d30b13a04a3b3c4ef", - "zh:7dcaec73d82c61f4bf315a5074217c6a8c1f774955a7b6f80c943a8907067a6f", - "zh:a48e27fbd17112e4f29d67d0467a8ea1ca554f98bf1f0748f1ebbc61355c465e", - "zh:b6283654f06d6ac5e0d67b0807c348fe5a700febf18f4990bf965705b379e29e", - "zh:dee35c1a536364431b9a6e022a9f89e2942425ca7111edd1ea89d596d68ee4e7", + "h1:VymvscRkDy0+zN2uKpKYY6njXPY8JROARuaL3VPsEos=", + "zh:18b94c7c83c30ad166722a61a412e3de6a67935772960e79aaa24c15f8ea0d0f", + "zh:4f07c929a71e8169f7471b7600bfcca36dfb295787e975e82ac0455a3ab68b47", + "zh:776b804a14c3c4ae6075b12176f81c1f1987214ee1cae4a542599389591cde11", + "zh:7c11e3adbe9bd26e88484dcdbd28c473ce3a5c58950a3e3c4f0a2caee225b845", + "zh:821e1a53415df0ae4ed523f098360d367a95d6ce3872ba841f22adfdd2f97664", + "zh:94c06e483f75a11c3f139c41b3f64b51a96d1d1485e7d1fd3c0f795e2e750945", + "zh:aa2040de0b8150ef40222a965445ec40e3df2997ffde1fb062ab4c226689115e", + "zh:ad73eebeffe20228656567963477d034b9ed3d1bd2075c1c81150def4927d810", + "zh:b77450a36807f3ad1d3ae736d1d165a94fa26f476504a280e9fb2ccb89f648d0", + "zh:d2ebd3c34c50c92106ce2df25d5598f47127dc7c60172b9e2fe56ac73dc863a8", + "zh:e565995e2614df5ddde75a743a674129288fb91669596a7b0b2580fa7ed49979", "zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c", - "zh:f5dd0141145104c681620d470093bd16bf3e4833021907581317c0b4ed650f8d", - "zh:f7fe46792e37d918e14740fb562b92a6d1594d60a43cc6b944a23a32930a2b16", ] } diff --git a/deploy/terraform/data.tf b/deploy/terraform/data.tf index c65c970b..2e7a78c7 100644 --- a/deploy/terraform/data.tf +++ b/deploy/terraform/data.tf @@ -4,11 +4,8 @@ data "oci_identity_tenancy" "tenant_details" { provider = oci } -data "oci_identity_regions" "home" { - filter { - name = "key" - values = [data.oci_identity_tenancy.tenant_details.home_region_key] - } +data "oci_identity_region_subscriptions" "region_subscriptions" { + tenancy_id = var.tenancy_ocid provider = oci } diff --git a/deploy/terraform/genai.tf b/deploy/terraform/genai.tf deleted file mode 100644 index 660e44f6..00000000 --- a/deploy/terraform/genai.tf +++ /dev/null @@ -1,7 +0,0 @@ -data "oci_generative_ai_models" "genai_models" { - compartment_id = var.compartment_ocid - - capability = ["TEXT_GENERATION"] - state = "ACTIVE" - vendor = "cohere" -} \ No newline at end of file diff --git a/deploy/terraform/outputs.tf b/deploy/terraform/outputs.tf index 94bbe054..a1d894e4 100644 --- a/deploy/terraform/outputs.tf +++ b/deploy/terraform/outputs.tf @@ -1,38 +1,8 @@ -locals { - model_collection = data.oci_generative_ai_models.genai_models.model_collection[0] - cohere_models = tolist([for each in local.model_collection.items : each - if contains(each.capabilities, "TEXT_GENERATION") - && each.vendor == "cohere"]) -} output "project" { value = "${var.project_name}${random_string.deploy_id.result}" } -# output "load_balancer" { -# value = oci_core_public_ip.reserved_ip.ip_address -# } - -# output "web_instances" { -# value = oci_core_instance.web[*].private_ip -# } - -# output "backend_instances" { -# value = oci_core_instance.backend[*].private_ip -# } - -output "cohere_model_id" { - value = local.cohere_models[0].id -} - -# output "ssh_bastion_session_backend" { -# value = oci_bastion_session.backend_session.ssh_metadata.command -# } - -# output "ssh_bastion_session_web" { -# value = oci_bastion_session.web_session.ssh_metadata.command -# } - output "db_service" { value = "${local.project_name}${local.deploy_id}" } diff --git a/deploy/terraform/provider.tf b/deploy/terraform/provider.tf index 768e35f8..4da8e6a0 100644 --- a/deploy/terraform/provider.tf +++ b/deploy/terraform/provider.tf @@ -1,10 +1,17 @@ +locals { + home_region_key = [for key, value in data.oci_identity_region_subscriptions.region_subscriptions.region_subscriptions: key if value.is_home_region == true][0] + home_region = data.oci_identity_region_subscriptions.region_subscriptions.region_subscriptions[local.home_region_key] +} + provider "oci" { - tenancy_ocid = var.tenancy_ocid - region = var.region + tenancy_ocid = var.tenancy_ocid + region = var.region + config_file_profile = var.config_file_profile } provider "oci" { - alias = "home" - tenancy_ocid = var.tenancy_ocid - region = lookup(data.oci_identity_regions.home.regions[0], "name") + alias = "home" + tenancy_ocid = var.tenancy_ocid + region = local.home_region.region_name + config_file_profile = var.config_file_profile } diff --git a/deploy/terraform/terraform.tfvars.mustache b/deploy/terraform/terraform.tfvars.mustache index a4b8f311..9ff68db3 100644 --- a/deploy/terraform/terraform.tfvars.mustache +++ b/deploy/terraform/terraform.tfvars.mustache @@ -1,13 +1,8 @@ region = "{{ regionName }}" tenancy_ocid = "{{ tenancyId }}" +config_file_profile = "{{ profile }}" compartment_ocid = "{{ compartmentId }}" ssh_public_key = "{{{ ssh_public_key }}}" ssh_private_key_path = "{{{ ssh_private_key_path }}}" cert_fullchain = "{{{ cert_fullchain }}}" -cert_private_key = "{{{ cert_private_key }}}" -genai_endpoint = "{{{ genai_endpoint }}}" - -# web_artifact_url = "" -# backend_artifact_url = "" -# ansible_web_artifact_url = "" -# ansible_backend_artifact_url = "" \ No newline at end of file +cert_private_key = "{{{ cert_private_key }}}" \ No newline at end of file diff --git a/deploy/terraform/variables.tf b/deploy/terraform/variables.tf index 7ce9bdc6..ba81c7af 100644 --- a/deploy/terraform/variables.tf +++ b/deploy/terraform/variables.tf @@ -7,6 +7,10 @@ variable "region" { default = "us-chicago-1" } +variable "config_file_profile" { + type = string +} + variable "compartment_ocid" { type = string } @@ -32,39 +36,7 @@ variable "project_name" { default = "genai" } -# variable "web_artifact_url" { -# type = string -# } - -# variable "backend_artifact_url" { -# type = string -# } - -# variable "ansible_web_artifact_url" { -# type = string -# } - -# variable "ansible_backend_artifact_url" { -# type = string -# } - -# variable "instance_shape" { -# default = "VM.Standard.E4.Flex" -# } - -# variable "web_node_count" { -# default = "1" -# } - -# variable "backend_node_count" { -# default = "1" -# } - variable "artifacts_par_expiration_in_days" { type = number default = 7 -} - -variable "genai_endpoint" { - type = string } \ No newline at end of file diff --git a/scripts/clean.mjs b/scripts/clean.mjs index ca647117..f70bf214 100644 --- a/scripts/clean.mjs +++ b/scripts/clean.mjs @@ -36,6 +36,7 @@ console.log(`Files in ${chalk.green(walletK8sPath)} deleted`); // ${regionKey}.ocir.io/${namespace}/${projectName}/backend:${backendBersion} await $`rm -rf ./.artifacts`; +await $`rm -rf ./.certs`; await $`rm -rf ./deploy/terraform/generated/wallet`; config.clear(); diff --git a/scripts/kustom.mjs b/scripts/kustom.mjs index 463239a4..0ee898ee 100644 --- a/scripts/kustom.mjs +++ b/scripts/kustom.mjs @@ -2,6 +2,8 @@ import Configstore from "configstore"; import clear from "clear"; import Mustache from "mustache"; +import { parse, stringify } from "yaml"; +import { readFile, writeFile } from "node:fs/promises"; import { getOutputValues } from "./lib/terraform.mjs"; import { exitWithError } from "./lib/utils.mjs"; @@ -16,6 +18,7 @@ const config = new Configstore(projectName, { projectName }); const compartmentId = config.get("compartmentId"); const namespace = config.get("namespace"); +const profile = config.get("profile"); const regionName = config.get("regionName"); const regionKey = config.get("regionKey"); const webVersion = config.get("webVersion"); @@ -28,6 +31,7 @@ const genAiModelSummarization = config.get("genAiModelSummarization"); const { db_service, db_password } = await getOutputValues("./deploy/terraform"); +await addProfileToKubeconfig(profile); await createBackendProperties(); await createProdKustomization(); await copyCerts(); @@ -150,3 +154,25 @@ async function createRegistrySecret() { exitWithError(error.stderr); } } + +async function addProfileToKubeconfig(profile = "DEFAULT") { + if (profile === "DEFAULT") return; + + const kubeconfigPath = "./deploy/terraform/generated/kubeconfig"; + + let yamlContent = await readFile(kubeconfigPath, { + encoding: "utf-8", + }); + + const profileFlag = "--profile"; + const profileValue = profile; + + const kubeconfig = parse(yamlContent); + const execArgs = kubeconfig.users[0].user.exec.args; + kubeconfig.users[0].user.exec.args = [...execArgs, profileFlag, profileValue]; + const newKubeconfigContent = stringify(kubeconfig); + + await writeFile(kubeconfigPath, newKubeconfigContent, { + encoding: "utf-8", + }); +} diff --git a/scripts/lib/oci.mjs b/scripts/lib/oci.mjs index e9b080a3..dcec9a97 100644 --- a/scripts/lib/oci.mjs +++ b/scripts/lib/oci.mjs @@ -2,11 +2,12 @@ import { exitWithError } from "./utils.mjs"; import { where, max } from "underscore"; -export async function getRegions() { +export async function getRegions(profile = "DEFAULT", tenancyId) { try { - const tenancyId = await getTenancyId(); const output = ( - await $`oci iam region-subscription list --tenancy-id ${tenancyId}` + await $`oci iam region-subscription list \ + --tenancy-id ${tenancyId} \ + --profile ${profile}` ).stdout.trim(); const { data } = JSON.parse(output); return data @@ -21,8 +22,8 @@ export async function getRegions() { } } -export async function getNamespace() { - const output = (await $`oci os ns get`).stdout.trim(); +export async function getNamespace(profile) { + const output = (await $`oci os ns get --profile ${profile}`).stdout.trim(); const { data } = JSON.parse(output); return data; } @@ -96,7 +97,10 @@ export async function getTenancyId() { return tenancyId; } -export async function searchCompartmentIdByName(compartmentName) { +export async function searchCompartmentIdByName( + profile = "DEFAULT", + compartmentName +) { if (!compartmentName) { exitWithError("Compartment name required"); } @@ -104,8 +108,11 @@ export async function searchCompartmentIdByName(compartmentName) { return getTenancyId(); } try { - const { stdout, exitCode, stderr } = - await $`oci iam compartment list --compartment-id-in-subtree true --name ${compartmentName} --query "data[].id"`; + const { stdout, exitCode, stderr } = await $`oci iam compartment list \ + --compartment-id-in-subtree true \ + --name ${compartmentName} \ + --profile=${profile} \ + --query "data[].id"`; if (exitCode !== 0) { exitWithError(stderr); } @@ -339,6 +346,7 @@ export async function getBucket(compartmentId, name) { } export async function getLatestGenAIModels( + profile, compartmentId, regionName, vendor = "cohere", @@ -354,6 +362,7 @@ export async function getLatestGenAIModels( try { const { stdout, stderr, exitCode } = await $`oci generative-ai model-collection list-models \ + --profile ${profile} \ --compartment-id ${compartmentId} \ --region ${regionName}`; diff --git a/scripts/package-lock.json b/scripts/package-lock.json index a39ee580..7ebe3226 100644 --- a/scripts/package-lock.json +++ b/scripts/package-lock.json @@ -11,10 +11,13 @@ "dependencies": { "clear": "^0.1.0", "configstore": "^6.0.0", + "ini": "^4.1.3", "inquirer": "^9.2.19", "moment": "^2.30.1", "mustache": "^4.2.0", - "underscore": "^1.13.6" + "underscore": "^1.13.6", + "yaml": "^2.5.0", + "zx": "^8.1.4" } }, "node_modules/@inquirer/figures": { @@ -36,6 +39,34 @@ "node": ">= 0.4" } }, + "node_modules/@types/fs-extra": { + "version": "11.0.4", + "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-11.0.4.tgz", + "integrity": "sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==", + "optional": true, + "dependencies": { + "@types/jsonfile": "*", + "@types/node": "*" + } + }, + "node_modules/@types/jsonfile": { + "version": "6.1.4", + "resolved": "https://registry.npmjs.org/@types/jsonfile/-/jsonfile-6.1.4.tgz", + "integrity": "sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ==", + "optional": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/node": { + "version": "22.5.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.0.tgz", + "integrity": "sha512-DkFrJOe+rfdHTqqMg0bSNlGlQ85hSoh2TPzZyhHsXnMtligRWpxUySiyw8FY14ITt24HVCiQPWxS3KO/QlGmWg==", + "optional": true, + "dependencies": { + "undici-types": "~6.19.2" + } + }, "node_modules/ansi-escapes": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", @@ -478,6 +509,14 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, + "node_modules/ini": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/ini/-/ini-4.1.3.tgz", + "integrity": "sha512-X7rqawQBvfdjS10YU1y1YVreA3SsLrW9dX2CewP2EbBJM4ypVNLDkO5y04gejPwKIY9lR+7r9gn3rFPt/kmWFg==", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, "node_modules/inquirer": { "version": "9.2.19", "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-9.2.19.tgz", @@ -838,6 +877,12 @@ "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.6.tgz", "integrity": "sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A==" }, + "node_modules/undici-types": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "optional": true + }, "node_modules/unique-string": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-3.0.0.tgz", @@ -899,6 +944,32 @@ "funding": { "url": "https://github.com/sponsors/sindresorhus" } + }, + "node_modules/yaml": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.5.0.tgz", + "integrity": "sha512-2wWLbGbYDiSqqIKoPjar3MPgB94ErzCtrNE1FdqGuaO0pi2JGjmE8aW8TDZwzU7vuxcGRdL/4gPQwQ7hD5AMSw==", + "bin": { + "yaml": "bin.mjs" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/zx": { + "version": "8.1.4", + "resolved": "https://registry.npmjs.org/zx/-/zx-8.1.4.tgz", + "integrity": "sha512-QFDYYpnzdpRiJ3dL2102Cw26FpXpWshW4QLTGxiYfIcwdAqg084jRCkK/kuP/NOSkxOjydRwNFG81qzA5r1a6w==", + "bin": { + "zx": "build/cli.js" + }, + "engines": { + "node": ">= 12.17.0" + }, + "optionalDependencies": { + "@types/fs-extra": ">=11", + "@types/node": ">=20" + } } } } diff --git a/scripts/package.json b/scripts/package.json index c3b7db54..4d0ed7bf 100644 --- a/scripts/package.json +++ b/scripts/package.json @@ -14,9 +14,12 @@ "dependencies": { "clear": "^0.1.0", "configstore": "^6.0.0", + "ini": "^4.1.3", "inquirer": "^9.2.19", "moment": "^2.30.1", "mustache": "^4.2.0", - "underscore": "^1.13.6" + "underscore": "^1.13.6", + "yaml": "^2.5.0", + "zx": "^8.1.4" } -} \ No newline at end of file +} diff --git a/scripts/setenv.mjs b/scripts/setenv.mjs index ea185678..5bdf9507 100644 --- a/scripts/setenv.mjs +++ b/scripts/setenv.mjs @@ -1,5 +1,7 @@ #!/usr/bin/env zx import moment from "moment"; +import { readFile } from "node:fs/promises"; +import { parse as iniParse } from "ini"; import Configstore from "configstore"; import inquirer from "inquirer"; import clear from "clear"; @@ -7,7 +9,6 @@ import { getLatestGenAIModels, getNamespace, getRegions, - getTenancyId, searchCompartmentIdByName, } from "./lib/oci.mjs"; import { createSSHKeyPair, createSelfSignedCert } from "./lib/crypto.mjs"; @@ -21,10 +22,16 @@ const projectName = "genai"; const config = new Configstore(projectName, { projectName }); -await setTenancyEnv(); +await selectProfile(); +const profile = config.get("profile"); +const tenancyId = config.get("tenancyId"); + await setNamespaceEnv(); await setRegionEnv(); +const regionName = config.get("regionName"); await setCompartmentEnv(); +const compartmentId = config.get("compartmentId"); + await createSSHKeys(projectName); await createCerts(); await setLatestGenAIModelChat(); @@ -32,18 +39,41 @@ await setLatestGenAIModelSummarization(); console.log(`\nConfiguration file saved in: ${chalk.green(config.path)}`); -async function setTenancyEnv() { - const tenancyId = await getTenancyId(); - config.set("tenancyId", tenancyId); +async function selectProfile() { + let ociConfigFile = await readFile(`${os.homedir()}/.oci/config`, { + encoding: "utf-8", + }); + + const ociConfig = iniParse(ociConfigFile); + const profileList = Object.keys(ociConfig); + + if (profileList.length === 1) { + config.set("profile", profileList[0]); + config.set("tenancyId", ociConfig[profileList[0]].tenancy); + } else { + await inquirer + .prompt([ + { + type: "list", + name: "profile", + message: "Select the OCI Config Profile", + choices: profileList, + }, + ]) + .then((answers) => { + config.set("profile", answers.profile); + config.set("tenancyId", ociConfig[answers.profile].tenancy); + }); + } } async function setNamespaceEnv() { - const namespace = await getNamespace(); + const namespace = await getNamespace(profile); config.set("namespace", namespace); } async function setRegionEnv() { - const listSubscribedRegions = (await getRegions()).sort( + const listSubscribedRegions = (await getRegions(profile, tenancyId)).sort( (r1, r2) => r1.isHomeRegion > r2.isHomeRegion ); @@ -89,6 +119,7 @@ async function setCompartmentEnv() { .then(async (answers) => { const compartmentName = answers.compartmentName; const compartmentId = await searchCompartmentIdByName( + profile, compartmentName || "root" ); config.set("compartmentName", compartmentName); @@ -115,8 +146,9 @@ async function createCerts() { async function setLatestGenAIModelChat() { const latestVersionModel = await getLatestGenAIModels( - config.get("compartmentId"), - config.get("regionName"), + profile, + compartmentId, + regionName, "cohere", "TEXT_GENERATION" ); @@ -137,8 +169,9 @@ async function setLatestGenAIModelChat() { async function setLatestGenAIModelSummarization() { const latestVersionModel = await getLatestGenAIModels( - config.get("compartmentId"), - config.get("regionName"), + profile, + compartmentId, + regionName, "cohere", "TEXT_SUMMARIZATION" ); diff --git a/scripts/tfvars.mjs b/scripts/tfvars.mjs index bb1425c6..71388319 100644 --- a/scripts/tfvars.mjs +++ b/scripts/tfvars.mjs @@ -17,23 +17,13 @@ await generateTFVars(); async function generateTFVars() { const compartmentId = config.get("compartmentId"); const compartmentName = config.get("compartmentName"); + const profile = config.get("profile"); const regionName = config.get("regionName"); const tenancyId = config.get("tenancyId"); const publicKeyContent = config.get("publicKeyContent"); const sshPrivateKeyPath = config.get("privateKeyPath"); const certFullchain = config.get("certFullchain"); const certPrivateKey = config.get("certPrivateKey"); - // const backend = config.get("backend"); - // const backendAnsible = config.get("backendAnsible"); - // const web = config.get("web"); - // const webAnsible = config.get("webAnsible"); - - // const webArtifactUrl = web.fullPath; - // const backendArtifactUrl = backend.fullPath; - // const ansibleWebArtifactUrl = webAnsible.fullPath; - // const ansibleBackendArtifactUrl = backendAnsible.fullPath; - - const genaiEndpoint = `https://inference.generativeai.${regionName}.oci.oraclecloud.com`; const tfVarsPath = "deploy/terraform/terraform.tfvars"; @@ -43,15 +33,11 @@ async function generateTFVars() { tenancyId, regionName, compartmentId, + profile, ssh_public_key: publicKeyContent, ssh_private_key_path: sshPrivateKeyPath, cert_fullchain: certFullchain, cert_private_key: certPrivateKey, - // web_artifact_url: webArtifactUrl, - // backend_artifact_url: backendArtifactUrl, - // ansible_web_artifact_url: ansibleWebArtifactUrl, - // ansible_backend_artifact_url: ansibleBackendArtifactUrl, - genai_endpoint: genaiEndpoint, }); console.log( diff --git a/web/Dockerfile b/web/Dockerfile index 3da6f1c4..d2768958 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -1,4 +1,4 @@ -FROM --platform=linux/amd64 node:21-slim AS builder +FROM --platform=linux/amd64 node:22-slim AS builder ENV NODE_ENV=production ENV NODE_MAX_MEM=2048