Some basics working (squashkiwi, dropshell-agent).

This commit is contained in:
Your Name
2025-05-03 23:34:05 +12:00
parent 3d9b1fa6d2
commit 77c7315b0b
50 changed files with 192 additions and 225 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash
source "${AGENT_PATH}/_common.sh"
check_required_env_vars
_check_required_env_vars
# Simple Object Storage Backup Script
# Creates a backup tarball of the volume contents.

View File

@ -1,6 +1,6 @@
#!/bin/bash
source "${AGENT_PATH}/_common.sh"
check_required_env_vars
_check_required_env_vars
# Simple Object Storage Install Script
# Pulls image, creates volume/config, starts container.
@ -20,8 +20,8 @@ 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"
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}"

View File

@ -1,6 +1,6 @@
#!/bin/bash
source "${AGENT_PATH}/_common.sh"
check_required_env_vars
_check_required_env_vars
# Simple Object Storage Logs Script
# Shows the logs for the running container.

View File

@ -1,6 +1,6 @@
#!/bin/bash
source "${AGENT_PATH}/_common.sh"
check_required_env_vars
_check_required_env_vars
# Simple Object Storage Nuke Script
# Removes container AND volume.

View File

@ -1,6 +1,6 @@
#!/bin/bash
source "${AGENT_PATH}/_common.sh"
check_required_env_vars
_check_required_env_vars
# PORT SCRIPT
# The port script is OPTIONAL.
@ -11,8 +11,8 @@ check_required_env_vars
# Required environment variables
# 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"
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 $PORT

View File

@ -1,6 +1,6 @@
#!/bin/bash
source "${AGENT_PATH}/_common.sh" || _die "Failed to source _common.sh"
check_required_env_vars
_check_required_env_vars
# Simple Object Storage Restore Script
# Restores data from a backup file.

View File

@ -1,6 +1,6 @@
#!/bin/bash
source "${AGENT_PATH}/_common.sh"
check_required_env_vars
_check_required_env_vars
# Simple Object Storage SSH Script
# Opens a shell in the running container.

View File

@ -1,6 +1,6 @@
#!/bin/bash
source "${AGENT_PATH}/_common.sh"
check_required_env_vars "CONTAINER_NAME" "VOLUME_NAME" "CONFIG_PATH" "IMAGE_REGISTRY" "IMAGE_REPO" "IMAGE_TAG"
_check_required_env_vars "CONTAINER_NAME" "VOLUME_NAME" "CONFIG_PATH" "IMAGE_REGISTRY" "IMAGE_REPO" "IMAGE_TAG"
# Simple Object Storage Start Script
# Creates and starts the container using environment variables.

View File

@ -1,22 +1,22 @@
#!/bin/bash
source "${AGENT_PATH}/_common.sh"
check_required_env_vars
_check_required_env_vars
# STATUS SCRIPT
# This is an example of a status script that checks if the service is running.
# check if the service is running
_is_container_running $CONTAINER_NAME || die "Service is not running - did not find container $CONTAINER_NAME."
_is_container_running $CONTAINER_NAME || _die "Service is not running - did not find container $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"
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")
# check if the service is healthy
curl -s -X GET http://localhost:${PORT}/status | jq -e '.result == "success"' \
|| die "Service is not healthy - did not get OK response from /status endpoint."
|| _die "Service is not healthy - did not get OK response from /status endpoint."
echo "Service is healthy"
exit 0

View File

@ -1,6 +1,6 @@
#!/bin/bash
source "${AGENT_PATH}/_common.sh"
check_required_env_vars
_check_required_env_vars
# Simple Object Storage Stop Script
# Stops the running container.

View File

@ -1,6 +1,6 @@
#!/bin/bash
source "${AGENT_PATH}/_common.sh"
check_required_env_vars
_check_required_env_vars
# UNINSTALL SCRIPT
# The uninstall script is required for all templates.
@ -8,9 +8,9 @@ check_required_env_vars
# It is called with the path to the server specific env file as an argument.
_remove_container $CONTAINER_NAME || die "Failed to remove container ${CONTAINER_NAME}"
_is_container_running && die "Couldn't stop existing container"
_is_container_exists && die "Couldn't remove existing container"
_remove_container $CONTAINER_NAME || _die "Failed to remove container ${CONTAINER_NAME}"
_is_container_running && _die "Couldn't stop existing container"
_is_container_exists && _die "Couldn't remove existing container"
# remove the image
docker rmi "$IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG" || echo "Failed to remove image $IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG"