Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APPSERV-27 Allow Temp/Unmanaged Docker Node instance to Join a Deployment Group on Creation #4474

Merged
merged 1 commit into from
Feb 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,42 +77,79 @@ function createNewInstance {
checkAndCreateNewNodeIfRequired

echo "Running command create-local-instance:"
if [ -z "${PAYARA_INSTANCE_NAME}" ]; then
if [ -z "${PAYARA_CONFIG_NAME}" ]; then
ASADMIN_COMMAND="./payara5/bin/asadmin -I false -T -a -H ${PAYARA_DAS_HOST} -p ${PAYARA_DAS_PORT} -W ${PAYARA_PASSWORD_FILE} create-local-instance --node ${PAYARA_NODE_NAME} --dockernode true --ip ${DOCKER_CONTAINER_IP}"
echo "${ASADMIN_COMMAND}"
PAYARA_INSTANCE_NAME="$(${ASADMIN_COMMAND})"
else
if [ "${PAYARA_CONFIG_NAME}" == "server-config" ] || [ "${PAYARA_CONFIG_NAME}" == "default-config" ]; then
echo "You cannot use 'server-config' or 'default-config', ignoring provided config name."
ASADMIN_COMMAND="./payara5/bin/asadmin -I false -T -a -H ${PAYARA_DAS_HOST} -p ${PAYARA_DAS_PORT} -W ${PAYARA_PASSWORD_FILE} create-local-instance --node ${PAYARA_NODE_NAME} --dockernode true --ip ${DOCKER_CONTAINER_IP}"
echo "${ASADMIN_COMMAND}"
PAYARA_INSTANCE_NAME="$(${ASADMIN_COMMAND})"
if [ -z "${PAYARA_INSTANCE_NAME}" ]; then
if [ -z "${PAYARA_CONFIG_NAME}" ]; then
if [ -z "${PAYARA_DEPLOYMENT_GROUP}" ]; then
ASADMIN_COMMAND="./payara5/bin/asadmin -I false -T -a -H ${PAYARA_DAS_HOST} -p ${PAYARA_DAS_PORT} -W ${PAYARA_PASSWORD_FILE} create-local-instance --node ${PAYARA_NODE_NAME} --dockernode true --ip ${DOCKER_CONTAINER_IP}"
echo "${ASADMIN_COMMAND}"
PAYARA_INSTANCE_NAME="$(${ASADMIN_COMMAND})"
else
ASADMIN_COMMAND="./payara5/bin/asadmin -I false -T -a -H ${PAYARA_DAS_HOST} -p ${PAYARA_DAS_PORT} -W ${PAYARA_PASSWORD_FILE} create-local-instance --node ${PAYARA_NODE_NAME} --dockernode true --ip ${DOCKER_CONTAINER_IP} --deploymentgroup ${PAYARA_DEPLOYMENT_GROUP}"
echo "${ASADMIN_COMMAND}"
PAYARA_INSTANCE_NAME="$(${ASADMIN_COMMAND})"
fi
else
ASADMIN_COMMAND="./payara5/bin/asadmin -I false -T -a -H ${PAYARA_DAS_HOST} -p ${PAYARA_DAS_PORT} -W ${PAYARA_PASSWORD_FILE} create-local-instance --node ${PAYARA_NODE_NAME} --config ${PAYARA_CONFIG_NAME} --dockernode true --ip ${DOCKER_CONTAINER_IP}"
echo "${ASADMIN_COMMAND}"
PAYARA_INSTANCE_NAME="$(${ASADMIN_COMMAND})"
if [ "${PAYARA_CONFIG_NAME}" == "server-config" ] || [ "${PAYARA_CONFIG_NAME}" == "default-config" ]; then
echo "You cannot use 'server-config' or 'default-config', ignoring provided config name."
if [ -z "${PAYARA_DEPLOYMENT_GROUP}" ]; then
ASADMIN_COMMAND="./payara5/bin/asadmin -I false -T -a -H ${PAYARA_DAS_HOST} -p ${PAYARA_DAS_PORT} -W ${PAYARA_PASSWORD_FILE} create-local-instance --node ${PAYARA_NODE_NAME} --dockernode true --ip ${DOCKER_CONTAINER_IP}"
echo "${ASADMIN_COMMAND}"
PAYARA_INSTANCE_NAME="$(${ASADMIN_COMMAND})"
else
ASADMIN_COMMAND="./payara5/bin/asadmin -I false -T -a -H ${PAYARA_DAS_HOST} -p ${PAYARA_DAS_PORT} -W ${PAYARA_PASSWORD_FILE} create-local-instance --node ${PAYARA_NODE_NAME} --dockernode true --ip ${DOCKER_CONTAINER_IP} --deploymentgroup ${PAYARA_DEPLOYMENT_GROUP}"
echo "${ASADMIN_COMMAND}"
PAYARA_INSTANCE_NAME="$(${ASADMIN_COMMAND})"
fi
else
if [ -z "${PAYARA_DEPLOYMENT_GROUP}" ]; then
ASADMIN_COMMAND="./payara5/bin/asadmin -I false -T -a -H ${PAYARA_DAS_HOST} -p ${PAYARA_DAS_PORT} -W ${PAYARA_PASSWORD_FILE} create-local-instance --node ${PAYARA_NODE_NAME} --config ${PAYARA_CONFIG_NAME} --dockernode true --ip ${DOCKER_CONTAINER_IP}"
echo "${ASADMIN_COMMAND}"
PAYARA_INSTANCE_NAME="$(${ASADMIN_COMMAND})"
else
ASADMIN_COMMAND="./payara5/bin/asadmin -I false -T -a -H ${PAYARA_DAS_HOST} -p ${PAYARA_DAS_PORT} -W ${PAYARA_PASSWORD_FILE} create-local-instance --node ${PAYARA_NODE_NAME} --config ${PAYARA_CONFIG_NAME} --dockernode true --ip ${DOCKER_CONTAINER_IP} --deploymentgroup ${PAYARA_DEPLOYMENT_GROUP}"
echo "${ASADMIN_COMMAND}"
PAYARA_INSTANCE_NAME="$(${ASADMIN_COMMAND})"
fi
fi
fi
fi
else
if [ -z "${PAYARA_CONFIG_NAME}" ]; then
ASADMIN_COMMAND="./payara5/bin/asadmin -I false -T -a -H ${PAYARA_DAS_HOST} -p ${PAYARA_DAS_PORT} -W ${PAYARA_PASSWORD_FILE} create-local-instance --node ${PAYARA_NODE_NAME} --dockernode true --ip ${DOCKER_CONTAINER_IP} ${PAYARA_INSTANCE_NAME}"
echo "${ASADMIN_COMMAND}"
PAYARA_INSTANCE_NAME="$(${ASADMIN_COMMAND})"
else
if [ "${PAYARA_CONFIG_NAME}" == "server-config" ] || [ "${PAYARA_CONFIG_NAME}" == "default-config" ]; then
echo "You cannot use 'server-config' or 'default-config', ignoring provided config name."
ASADMIN_COMMAND="./payara5/bin/asadmin -I false -T -a -H ${PAYARA_DAS_HOST} -p ${PAYARA_DAS_PORT} -W ${PAYARA_PASSWORD_FILE} create-local-instance --node ${PAYARA_NODE_NAME} --dockernode true --ip ${DOCKER_CONTAINER_IP} ${PAYARA_INSTANCE_NAME}"
echo "${ASADMIN_COMMAND}"
PAYARA_INSTANCE_NAME="$(${ASADMIN_COMMAND})"
if [ -z "${PAYARA_CONFIG_NAME}" ]; then
if [ -z "${PAYARA_DEPLOYMENT_GROUP}" ]; then
ASADMIN_COMMAND="./payara5/bin/asadmin -I false -T -a -H ${PAYARA_DAS_HOST} -p ${PAYARA_DAS_PORT} -W ${PAYARA_PASSWORD_FILE} create-local-instance --node ${PAYARA_NODE_NAME} --dockernode true --ip ${DOCKER_CONTAINER_IP} ${PAYARA_INSTANCE_NAME}"
echo "${ASADMIN_COMMAND}"
PAYARA_INSTANCE_NAME="$(${ASADMIN_COMMAND})"
else
ASADMIN_COMMAND="./payara5/bin/asadmin -I false -T -a -H ${PAYARA_DAS_HOST} -p ${PAYARA_DAS_PORT} -W ${PAYARA_PASSWORD_FILE} create-local-instance --node ${PAYARA_NODE_NAME} --dockernode true --ip ${DOCKER_CONTAINER_IP} ${PAYARA_INSTANCE_NAME} --deploymentgroup ${PAYARA_DEPLOYMENT_GROUP}"
echo "${ASADMIN_COMMAND}"
PAYARA_INSTANCE_NAME="$(${ASADMIN_COMMAND})"
fi
else
if [ "${PAYARA_CONFIG_NAME}" == "server-config" ] || [ "${PAYARA_CONFIG_NAME}" == "default-config" ]; then
if [ -z "${PAYARA_DEPLOYMENT_GROUP}" ]; then
echo "You cannot use 'server-config' or 'default-config', ignoring provided config name."
ASADMIN_COMMAND="./payara5/bin/asadmin -I false -T -a -H ${PAYARA_DAS_HOST} -p ${PAYARA_DAS_PORT} -W ${PAYARA_PASSWORD_FILE} create-local-instance --node ${PAYARA_NODE_NAME} --dockernode true --ip ${DOCKER_CONTAINER_IP} ${PAYARA_INSTANCE_NAME}"
echo "${ASADMIN_COMMAND}"
PAYARA_INSTANCE_NAME="$(${ASADMIN_COMMAND})"
else
echo "You cannot use 'server-config' or 'default-config', ignoring provided config name."
ASADMIN_COMMAND="./payara5/bin/asadmin -I false -T -a -H ${PAYARA_DAS_HOST} -p ${PAYARA_DAS_PORT} -W ${PAYARA_PASSWORD_FILE} create-local-instance --node ${PAYARA_NODE_NAME} --dockernode true --ip ${DOCKER_CONTAINER_IP} ${PAYARA_INSTANCE_NAME} --deploymentgroup ${PAYARA_DEPLOYMENT_GROUP}"
echo "${ASADMIN_COMMAND}"
PAYARA_INSTANCE_NAME="$(${ASADMIN_COMMAND})"
fi
else
ASADMIN_COMMAND="./payara5/bin/asadmin -I false -T -a -H ${PAYARA_DAS_HOST} -p ${PAYARA_DAS_PORT} -W ${PAYARA_PASSWORD_FILE} create-local-instance --node ${PAYARA_NODE_NAME} --config ${PAYARA_CONFIG_NAME} --dockernode true --ip ${DOCKER_CONTAINER_IP} ${PAYARA_INSTANCE_NAME}"
echo "${ASADMIN_COMMAND}"
PAYARA_INSTANCE_NAME="$(${ASADMIN_COMMAND})"
if [ -z "${PAYARA_DEPLOYMENT_GROUP}" ]; then
ASADMIN_COMMAND="./payara5/bin/asadmin -I false -T -a -H ${PAYARA_DAS_HOST} -p ${PAYARA_DAS_PORT} -W ${PAYARA_PASSWORD_FILE} create-local-instance --node ${PAYARA_NODE_NAME} --config ${PAYARA_CONFIG_NAME} --dockernode true --ip ${DOCKER_CONTAINER_IP} ${PAYARA_INSTANCE_NAME}"
echo "${ASADMIN_COMMAND}"
PAYARA_INSTANCE_NAME="$(${ASADMIN_COMMAND})"
else
ASADMIN_COMMAND="./payara5/bin/asadmin -I false -T -a -H ${PAYARA_DAS_HOST} -p ${PAYARA_DAS_PORT} -W ${PAYARA_PASSWORD_FILE} create-local-instance --node ${PAYARA_NODE_NAME} --config ${PAYARA_CONFIG_NAME} --dockernode true --ip ${DOCKER_CONTAINER_IP} ${PAYARA_INSTANCE_NAME} --deploymentgroup ${PAYARA_DEPLOYMENT_GROUP}"
echo "${ASADMIN_COMMAND}"
PAYARA_INSTANCE_NAME="$(${ASADMIN_COMMAND})"
fi
fi
fi
fi

# Register Docker container ID to DAS
echo "Setting Docker Container ID for instance ${PAYARA_INSTANCE_NAME}: ${DOCKER_CONTAINER_ID}"
ASADMIN_COMMAND="./payara5/bin/asadmin -I false -H ${PAYARA_DAS_HOST} -p ${PAYARA_DAS_PORT} -W ${PAYARA_PASSWORD_FILE} _set-docker-container-id --instance ${PAYARA_INSTANCE_NAME} --id ${DOCKER_CONTAINER_ID}"
Expand Down Expand Up @@ -168,4 +205,4 @@ fi
### Start ###
echo "Starting instance ${PAYARA_INSTANCE_NAME}"
ASADMIN_COMMAND="./payara5/bin/asadmin --passwordfile ${PAYARA_PASSWORD_FILE} start-local-instance --node ${PAYARA_NODE_NAME} --verbose ${PAYARA_INSTANCE_NAME}"
${ASADMIN_COMMAND}
${ASADMIN_COMMAND}