Introduce starting port number env variable (#6)

This commit is contained in:
Chalith Desaman
2022-09-06 09:16:28 +05:30
committed by GitHub
parent 99a7754ee3
commit bd84875d04
6 changed files with 138 additions and 20 deletions

View File

@@ -6,6 +6,8 @@ $ClusterSize = if ($env:HP_CLUSTER_SIZE) { $env:HP_CLUSTER_SIZE } else { 3 };
$DefaultNode = if ($env:HP_DEFAULT_NODE) { $env:HP_DEFAULT_NODE } else { 1 };
$DevKitImage = if ($env:HP_DEVKIT_IMAGE) { $env:HP_DEVKIT_IMAGE } else { "evernodedev/hpdevkit" };
$InstanceImage = if ($env:HP_INSTANCE_IMAGE) { $env:HP_INSTANCE_IMAGE } else { "evernodedev/hotpocket:latest-ubt.20.04-njs.16" };
$HpUserPortBegin = if ($env:HP_USER_PORT_BEGIN) { $env:HP_USER_PORT_BEGIN } else { 8081 };
$HpPeerPortBegin = if ($env:HP_PEER_PORT_BEGIN) { $env:HP_PEER_PORT_BEGIN } else { 22861 };
$VolumeMount = "/$($GlobalPrefix)_vol"
$Volume = "$($GlobalPrefix)_$($Cluster)_vol"
@@ -16,7 +18,7 @@ $DeploymentContainerName = "$($GlobalPrefix)_$($Cluster)_deploymgr"
$CodegenContainerName = "$($GlobalPrefix)_codegen"
$ConfigOverridesFile = "hp.cfg.override"
$CodegenOutputDir = "/codegen-output"
$CloudStorage = "https://stevernode.blob.core.windows.net/evernode-beta"
$CloudStorage = "https://stevernode.blob.core.windows.net/evernode-dev-bb7ec110-f72e-430e-b297-9210468a4cbb"
$HPDevKitExeUrl = "$($CloudStorage)/hpdevkit-windows/hpdevkit.exe";
$HPDevKitBackup = "\hpdevkit.exe.bak";
$ExePath = (Get-Process -Id $pid).Path
@@ -53,6 +55,7 @@ function DevKitContainer([string]$Mode, [string]$Name, [switch]$Detached, [switc
$Command += " -e CLUSTER=$($Cluster) -e CLUSTER_SIZE=$($ClusterSize) -e DEFAULT_NODE=$($DefaultNode) -e VOLUME=$($Volume) -e NETWORK=$($Network)"
$Command += " -e CONTAINER_PREFIX=$($ContainerPrefix) -e VOLUME_MOUNT=$($VolumeMount) -e BUNDLE_MOUNT=$($BundleMount) -e HOTPOCKET_IMAGE=$($InstanceImage)"
$Command += " -e CONFIG_OVERRIDES_FILE=$($ConfigOverridesFile) -e CODEGEN_OUTPUT=$($CodegenOutputDir)"
$Command += " -e HP_USER_PORT_BEGIN=$($HpUserPortBegin) -e HP_PEER_PORT_BEGIN=$($HpPeerPortBegin)"
$Command += " $($DevKitImage)"
if ($Cmd) {
@@ -180,6 +183,16 @@ Function UpdateHPDevKit() {
## Pull the updated Docker instance image from Docker Hub.
Write-Host "Pulling the latest $InstanceImage Image."
docker pull $InstanceImage
## Clear if there's already deployed cluster since they are outdated now.
$Null = docker inspect $DeploymentContainerName *>&1
if ($?) {
Write-Host "Cleaning the deployed contracts."
TeardownDeploymentCluster
}
Write-Host "Update Completed !!"
Write-Host "NOTE: You need to re-deploy your contracts to make the new changes effective."
}
if ($ExePath.Contains('hpdevkit.exe')) {