Files
dropshell-templates/simple-object-server/install.sh
Your Name 014104df35
All checks were successful
Test and Publish Templates / test-and-publish (push) Successful in 26s
Update 16 files
2025-08-30 18:33:10 +12:00

30 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# shellcheck disable=SC1091
source "${AGENT_PATH}/common.sh"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SCRIPT_DIR}/_volumes.sh"
_check_required_env_vars
# Simple Object Storage Install Script
# Pulls image, creates volume/config, starts container.
# shellcheck disable=SC2046
create_items $(get_simple_object_server_volumes)
# check can pull image on remote host and exit if fails
echo "Pulling image ${IMAGE_REGISTRY}/${IMAGE_REPO}:${IMAGE_TAG}..."
docker pull "$IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG" || _die "Failed to pull image $IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG"
echo "Stopping and removing any existing container..."
bash ./stop.sh || _die "Failed to stop container ${CONTAINER_NAME}"
_remove_container "$CONTAINER_NAME" || _die "Failed to remove container ${CONTAINER_NAME}"
bash ./start.sh || _die "Failed to start container ${CONTAINER_NAME}"
echo "Installation complete for service ${CONTAINER_NAME}."
# determine port.
command -v jq &> /dev/null || _die "jq could not be found, please install it"
[ -f "${CONFIG_PATH}/sos_config.json" ] || _die "sos_config.json does not exist"
PORT=$(jq -r '.port' "${CONFIG_PATH}/sos_config.json")
echo "You can access the service at http://${HOST_NAME}:${PORT}"