Simple object store.
This commit is contained in:
33
templates/simple-object-storage/install.sh
Normal file
33
templates/simple-object-storage/install.sh
Normal file
@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
# INSTALL SCRIPT
|
||||
# The install script is required for all templates.
|
||||
# It is used to install the service on the server.
|
||||
# It is called with the path to the server specific env file as an argument.
|
||||
|
||||
source "$(dirname "$0")/_common.sh"
|
||||
|
||||
# Required environment variables
|
||||
check_required_env_vars "CONTAINER_NAME" "IMAGE_REGISTRY" "IMAGE_REPO" "IMAGE_TAG" "VOLUME_NAME"
|
||||
|
||||
# Create volume if it doesn't exist
|
||||
if ! docker volume ls | grep -q "^${VOLUME_NAME} "; then
|
||||
echo "Volume ${VOLUME_NAME} does not exist, creating..."
|
||||
docker volume create "${VOLUME_NAME}"
|
||||
fi
|
||||
|
||||
|
||||
# Test Docker
|
||||
_check_docker_installed || die "Docker test failed, aborting installation..."
|
||||
|
||||
|
||||
# check can pull image on remote host and exit if fails
|
||||
docker pull "$IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG" || die "Failed to pull image $IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG"
|
||||
|
||||
# remove and restart, as the env may have changed.
|
||||
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 of ${CONTAINER_NAME} complete"
|
||||
echo "You can access the service at http://${SERVER}:${HOST_PORT}"
|
Reference in New Issue
Block a user