Skip to content

Commit

Permalink
EPOC-540 Updated oh-orchestrator to selectively delete containers
Browse files Browse the repository at this point in the history
  • Loading branch information
kevintoormimik committed Mar 17, 2022
1 parent c916e70 commit 6daf3a1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mimik_ohorchestrator",
"version": "1.1.1",
"version": "1.1.2",
"swaggerFile": {
"version": "1.1.0",
"account": "mimik",
Expand Down Expand Up @@ -44,18 +44,18 @@
"private": true,
"dependencies": {
"@mimik/cluster": "2.4.0",
"@mimik/configuration": "4.4.4",
"@mimik/configuration": "4.4.8",
"@mimik/init": "3.6.0",
"@mimik/response-helper": "2.6.0",
"@mimik/request-helper": "1.7.3",
"@mimik/request-retry": "2.0.6",
"@mimik/sumologic-winston-logger": "1.6.6",
"@mimik/swagger-helper": "2.5.0",
"@mimik/swagger-helper": "2.5.1",
"@mimik/systeminfo": "2.3.8",
"bluebird": "3.7.2",
"connect": "3.7.0",
"form-data": "4.0.0",
"fs-extra": "10.0.0",
"fs-extra": "10.0.1",
"get-port": "5.1.1",
"uuid": "8.3.2"
},
Expand Down
4 changes: 3 additions & 1 deletion src/scripts/anax.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# export HOST_SHARE_PATH="${HOME}/.oh/${HZN_NODE_ID}"
# export ESS_AUTH_DIR="${HOST_SHARE_PATH}/essAuth"
# export ESS_SOCKET_DIR="${HOST_SHARE_PATH}/essSocket"
# export CONTAINER_LABEL=containerType=anaxNode
#
### Required envs in config file
#
Expand All @@ -34,6 +35,7 @@ ARCH=${ARCH:-$(dpkg --print-architecture)}
DOCKER_NAME=anax_${HZN_NODE_ID}
ANAX_IMAGE=${ANAX_IMAGE:-openhorizon/${ARCH}_anax}
ANAX_TAG=${ANAX_TAG:-2.30.0-708}
CONTAINER_LABEL=${CONTAINER_LABEL:-containerType=anaxNode}

validateStart() {
[[ -z "${HZN_NODE_ID}" ]] && echo "HZN_NODE_ID is required env" 1>&2 && exit 1
Expand All @@ -54,7 +56,7 @@ start() {

docker run -d -t --restart always --name $DOCKER_NAME --privileged \
-p 127.0.0.1:${HORIZON_AGENT_PORT}:8510 -e DOCKER_NAME=${DOCKER_NAME} \
-e HZN_VAR_RUN_BASE=/var/tmp/horizon/${DOCKER_NAME} \
-e HZN_VAR_RUN_BASE=/var/tmp/horizon/${DOCKER_NAME} -l ${CONTAINER_LABEL} \
-v ${DOCKER_SOCKET}:/var/run/docker.sock -v ${CONFIG_PATH}:/etc/default/horizon \
-v ${ESS_AUTH_DIR}:/var/horizon/ess-auth -v ${ESS_SOCKET_DIR}:/var/tmp/horizon/${DOCKER_NAME} \
${ANAX_IMAGE}:${ANAX_TAG}
Expand Down
4 changes: 3 additions & 1 deletion src/util/anaxUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ const {
nodesDir,
} = require('../configuration/config');

const anaxNodeContainerLabel = 'containerType=anaxNode';

const scriptCommandValues = {
REGISTER_ANAX: 'hzn register',
UNREGISTER_ANAX: 'echo "y" | hzn unregister',
NUKE_DOCKER: 'docker rm -f $(docker ps -a -q)',
NUKE_DOCKER: `docker rm -f $(docker ps -a -q --filter label=${anaxNodeContainerLabel})`,
};

const getArch = () => {
Expand Down

0 comments on commit 6daf3a1

Please sign in to comment.