.
This commit is contained in:
@ -1,12 +1,10 @@
|
||||
#!/bin/bash
|
||||
source "${AGENT_PATH}/_common.sh"
|
||||
check_required_env_vars "LOCAL_DATA_FOLDER"
|
||||
|
||||
# Nginx Example Backup Script
|
||||
|
||||
_check_required_env_vars "CONTAINER_NAME" "LOCAL_DATA_FOLDER"
|
||||
|
||||
# hot backup is fine for nginx website content.
|
||||
|
||||
autobackup "path=${LOCAL_DATA_FOLDER}" $1 $2 || _die "Failed to create backup"
|
||||
|
||||
echo "Backup complete: ${BACKUP_FILE}"
|
||||
echo "Backup complete"
|
||||
|
@ -1,12 +1,12 @@
|
||||
#!/bin/bash
|
||||
source "${AGENT_PATH}/_common.sh"
|
||||
check_required_env_vars "LOCAL_DATA_FOLDER" "IMAGE_REGISTRY" "IMAGE_REPO" "IMAGE_TAG" "CONTAINER_NAME"
|
||||
|
||||
# Nginx Example Install Script
|
||||
|
||||
|
||||
# Load service environment variables
|
||||
source ./service.env
|
||||
_check_required_env_vars "CONTAINER_NAME" "IMAGE_REGISTRY" "IMAGE_REPO" "IMAGE_TAG" "LOCAL_DATA_FOLDER"
|
||||
|
||||
# Ensure local data folder exists
|
||||
if [ ! -d "${LOCAL_DATA_FOLDER}" ]; then
|
||||
|
@ -1,13 +1,9 @@
|
||||
#!/bin/bash
|
||||
source "${AGENT_PATH}/_common.sh"
|
||||
check_required_env_vars "CONTAINER_NAME"
|
||||
|
||||
# Nginx Example Logs Script
|
||||
|
||||
|
||||
# Load service environment variables
|
||||
source ./service.env
|
||||
_check_required_env_vars "CONTAINER_NAME"
|
||||
|
||||
echo "Showing logs for ${CONTAINER_NAME}... (Press Ctrl+C to stop)"
|
||||
_grey_start
|
||||
_get_container_logs $CONTAINER_NAME
|
||||
|
@ -1,14 +1,10 @@
|
||||
#!/bin/bash
|
||||
source "${AGENT_PATH}/_common.sh"
|
||||
check_required_env_vars "LOCAL_DATA_FOLDER" "CONTAINER_NAME"
|
||||
|
||||
# Nginx Example Nuke Script
|
||||
# Removes container and local data folder.
|
||||
|
||||
|
||||
# Load service environment variables
|
||||
source ./service.env
|
||||
_check_required_env_vars "LOCAL_DATA_FOLDER" "CONTAINER_NAME"
|
||||
|
||||
# Call uninstall script first
|
||||
./uninstall.sh
|
||||
|
||||
|
@ -1,18 +1,7 @@
|
||||
#!/bin/bash
|
||||
source "${AGENT_PATH}/_common.sh"
|
||||
check_required_env_vars "HOST_PORT"
|
||||
|
||||
# Nginx Example Ports Script
|
||||
|
||||
|
||||
# Load service environment variables
|
||||
source ./service.env
|
||||
|
||||
# This template uses HOST_PORT directly if set
|
||||
# check_required_env_vars "HOST_PORT"
|
||||
|
||||
if [ -n "$HOST_PORT" ]; then
|
||||
echo $HOST_PORT
|
||||
else
|
||||
# Default or logic to determine port if not in env
|
||||
echo 80 # Default Nginx port
|
||||
fi
|
||||
echo $HOST_PORT
|
||||
|
@ -1,40 +1,15 @@
|
||||
#!/bin/bash
|
||||
source "${AGENT_PATH}/_common.sh"
|
||||
check_required_env_vars "LOCAL_DATA_FOLDER"
|
||||
|
||||
# Nginx Example Restore Script
|
||||
|
||||
|
||||
# Load service environment variables
|
||||
source ./service.env
|
||||
_check_required_env_vars "CONTAINER_NAME" "LOCAL_DATA_FOLDER"
|
||||
|
||||
BACKUP_FILE="$1"
|
||||
|
||||
if [ -z "$BACKUP_FILE" ]; then
|
||||
_die "Backup file path not provided"
|
||||
fi
|
||||
|
||||
if [ ! -f "$BACKUP_FILE" ]; then
|
||||
_die "Backup file $BACKUP_FILE does not exist"
|
||||
fi
|
||||
|
||||
echo "Uninstalling service before restore..."
|
||||
bash ./uninstall.sh || _die "Failed to uninstall service before restore"
|
||||
|
||||
echo "Removing existing data folder ${LOCAL_DATA_FOLDER}..."
|
||||
# Use root remove in case of permission issues
|
||||
_root_remove_tree "$LOCAL_DATA_FOLDER"
|
||||
[ ! -d "$LOCAL_DATA_FOLDER" ] || _die "Failed to delete $LOCAL_DATA_FOLDER"
|
||||
mkdir -p "$LOCAL_DATA_FOLDER"
|
||||
[ -d "$LOCAL_DATA_FOLDER" ] || _die "Failed to create $LOCAL_DATA_FOLDER"
|
||||
chmod 777 "$LOCAL_DATA_FOLDER" # Ensure permissions
|
||||
|
||||
echo "Restoring data from ${BACKUP_FILE} to ${LOCAL_DATA_FOLDER}..."
|
||||
# Assuming backup is a simple tarball of the folder contents
|
||||
tar -xzf "$BACKUP_FILE" -C "$LOCAL_DATA_FOLDER" --strip-components=1
|
||||
if [ $? -ne 0 ]; then
|
||||
_die "Failed to restore data folder from backup"
|
||||
fi
|
||||
autorestore "path=${LOCAL_DATA_FOLDER}" $1 $2 || _die "Failed to restore data folder from backup"
|
||||
|
||||
echo "Restore complete. Reinstalling service..."
|
||||
bash ./install.sh || _die "Failed to reinstall service after restore"
|
||||
|
@ -1,12 +1,12 @@
|
||||
#!/bin/bash
|
||||
source "${AGENT_PATH}/_common.sh"
|
||||
check_required_env_vars "CONTAINER_NAME" "LOCAL_DATA_FOLDER" "HOST_PORT" "IMAGE_REGISTRY" "IMAGE_REPO" "IMAGE_TAG"
|
||||
|
||||
# START SCRIPT
|
||||
# The start script is required for all templates.
|
||||
# It is used to start the service on the server.
|
||||
# It is called with the path to the server specific env file as an argument.
|
||||
|
||||
check_required_env_vars "CONTAINER_NAME" "HOST_PORT" "LOCAL_DATA_FOLDER"
|
||||
|
||||
[ -d "${LOCAL_DATA_FOLDER}" ] || die "Local data folder ${LOCAL_DATA_FOLDER} does not exist."
|
||||
|
||||
|
@ -1,21 +1,13 @@
|
||||
#!/bin/bash
|
||||
source "${AGENT_PATH}/_common.sh"
|
||||
check_required_env_vars "CONTAINER_NAME"
|
||||
|
||||
# STATUS SCRIPT
|
||||
# The status script is OPTIONAL.
|
||||
# It is used to return the status of the service (0 is healthy, 1 is unhealthy).
|
||||
# It is called with the path to the server specific env file as an argument.
|
||||
|
||||
|
||||
# This is an example of a status script that checks if the service is running.
|
||||
check_required_env_vars "CONTAINER_NAME"
|
||||
|
||||
# check if the service is running
|
||||
_is_container_running $CONTAINER_NAME || die "Service is not running - did not find container $CONTAINER_NAME."
|
||||
|
||||
# check if the service is healthy
|
||||
# curl -s -X GET http://localhost:${HOST_PORT}/health | grep -q "OK" \
|
||||
# || die "Service is not healthy - did not get OK response from /health endpoint."
|
||||
|
||||
echo "Service is healthy"
|
||||
exit 0
|
||||
|
@ -1,11 +1,5 @@
|
||||
#!/bin/bash
|
||||
source "${AGENT_PATH}/_common.sh"
|
||||
|
||||
# STOP SCRIPT
|
||||
# The stop script is required for all templates.
|
||||
# It is used to stop the service on the server.
|
||||
# It is called with the path to the server specific env file as an argument.
|
||||
|
||||
check_required_env_vars "CONTAINER_NAME"
|
||||
|
||||
_stop_container $CONTAINER_NAME || die "Failed to stop container ${CONTAINER_NAME}"
|
||||
|
@ -1,21 +1,13 @@
|
||||
#!/bin/bash
|
||||
source "${AGENT_PATH}/_common.sh"
|
||||
check_required_env_vars "CONTAINER_NAME"
|
||||
|
||||
# Nginx Example Uninstall Script
|
||||
|
||||
|
||||
# Load service environment variables
|
||||
source ./service.env
|
||||
_check_required_env_vars "CONTAINER_NAME" "IMAGE_REGISTRY" "IMAGE_REPO" "IMAGE_TAG" "LOCAL_DATA_FOLDER"
|
||||
|
||||
echo "Uninstalling service ${CONTAINER_NAME}..."
|
||||
_remove_container $CONTAINER_NAME || _die "Failed to remove container ${CONTAINER_NAME}"
|
||||
if _is_container_running $CONTAINER_NAME; then _die "Couldn't stop existing container"; fi
|
||||
if _is_container_exists $CONTAINER_NAME; then _die "Couldn't remove existing container"; fi
|
||||
|
||||
# Optional: Remove image?
|
||||
# echo "Removing image ${IMAGE_REGISTRY}/${IMAGE_REPO}:${IMAGE_TAG}..."
|
||||
# docker rmi "$IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG" || echo "Warning: Failed to remove image (might be in use)"
|
||||
|
||||
echo "Service ${CONTAINER_NAME} uninstalled."
|
||||
# Note: This does NOT remove the local data folder. Use nuke.sh for that.
|
||||
echo "Note: This does NOT remove the local data folder. Use nuke.sh for that."
|
||||
|
Reference in New Issue
Block a user