mirror of
https://github.com/EvernodeXRPL/hp-devkit.git
synced 2026-04-29 15:37:58 +00:00
Restart the deployment cluster when machine restarts (#20)
This commit is contained in:
@@ -86,7 +86,7 @@ function create_instance {
|
||||
# Create container for hotpocket instance.
|
||||
local container_name="${container_prefix}_$node"
|
||||
docker container create --name $container_name --privileged \
|
||||
-p $user_port:$user_port --network $network --network-alias node$node \
|
||||
-p $user_port:$user_port --network $network --network-alias node$node --restart unless-stopped \
|
||||
--mount type=volume,src=$volume,dst=$volume_mount $hotpocket_image run $(contract_dir_mount_path $node)
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ const CONSTANTS = {
|
||||
prerequisiteInstaller: "install.sh"
|
||||
};
|
||||
|
||||
function runOnContainer(name, detached, autoRemove, mountStock, mountVolume, entryCmd, entryPoint, interactive = true) {
|
||||
function runOnContainer(name, detached, autoRemove, mountStock, mountVolume, entryCmd, entryPoint, interactive = true, restart = null) {
|
||||
command = `docker run`;
|
||||
|
||||
if (interactive)
|
||||
@@ -46,6 +46,9 @@ function runOnContainer(name, detached, autoRemove, mountStock, mountVolume, ent
|
||||
else
|
||||
command += " --entrypoint /bin/bash";
|
||||
|
||||
if (restart)
|
||||
command += ` --restart ${restart}`;
|
||||
|
||||
command += ` -e CLUSTER=${appenv.cluster} -e CLUSTER_SIZE=${appenv.clusterSize} -e DEFAULT_NODE=${appenv.defaultNode} -e VOLUME=${CONSTANTS.volume} -e NETWORK=${CONSTANTS.network}`;
|
||||
command += ` -e CONTAINER_PREFIX=${CONSTANTS.containerPrefix} -e VOLUME_MOUNT=${CONSTANTS.volumeMount} -e BUNDLE_MOUNT=${CONSTANTS.bundleMount} -e HOTPOCKET_IMAGE=${appenv.instanceImage}`;
|
||||
command += ` -e CONFIG_OVERRIDES_FILE=${CONSTANTS.confOverrideFile} -e CODEGEN_OUTPUT=${CONSTANTS.codegenOutputDir}`;
|
||||
@@ -89,7 +92,7 @@ function initializeDeploymentCluster() {
|
||||
runOnContainer(CONSTANTS.deploymentContainerName, null, true, true, null, 'cluster stop ; cluster create', null);
|
||||
|
||||
// Spin up management container.
|
||||
runOnContainer(CONSTANTS.deploymentContainerName, true, false, true, true, null, null);
|
||||
runOnContainer(CONSTANTS.deploymentContainerName, true, false, true, true, null, null, true, 'unless-stopped');
|
||||
|
||||
// Bind the instance mesh network config together.
|
||||
executeOnContainer(CONSTANTS.deploymentContainerName, 'cluster bindmesh');
|
||||
|
||||
4
npm/package-lock.json
generated
4
npm/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "hpdevkit",
|
||||
"version": "0.5.5",
|
||||
"version": "0.5.6",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "hpdevkit",
|
||||
"version": "0.5.5",
|
||||
"version": "0.5.6",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hpdevkit",
|
||||
"version": "0.5.5",
|
||||
"version": "0.5.6",
|
||||
"description": "Developer toolkit for HotPocket smart contract development",
|
||||
"scripts": {
|
||||
"install": "node scripts/install.js"
|
||||
|
||||
Reference in New Issue
Block a user