Update nginx-example

This commit is contained in:
John 2025-04-27 13:25:39 +12:00
parent 192cc48d42
commit c35fabe6e7
9 changed files with 6 additions and 30 deletions

View File

@ -12,11 +12,12 @@ The optional backups script gets a second argument, which is the backup file to
Mandatory scripts are:
- install.sh
- uninstall.sh
- start.sh
- stop.sh
Optional standard scripts are:
- start.sh
- stop.sh
- backup.sh
- restore.sh
- status.sh
- ports.sh
- logs.sh

View File

@ -1,8 +1,5 @@
# Service settings specific to this server
# Application settings
CONTAINER_PORT=8181
# Image settings
IMAGE_REGISTRY="docker.io"
IMAGE_REPO="nginx"

View File

@ -9,9 +9,6 @@
# If the backup file already exists, the script should exit with a message.
source "$(dirname "$0")/_common.sh"
load_env "$1" || die "Failed to load environment variables"
# Required environment variables
check_required_env_vars "CONTAINER_NAME" "LOCAL_DATA_FOLDER"
# Get backup file path from second argument

View File

@ -6,7 +6,6 @@
# It is called with the path to the server specific env file as an argument.
source "$(dirname "$0")/_common.sh"
load_env "$1" || die "Failed to load environment variables"
# Required environment variables
check_required_env_vars "CONTAINER_NAME"

View File

@ -6,7 +6,6 @@
# It is called with the path to the server specific env file as an argument.
source "$(dirname "$0")/_common.sh"
load_env "$1" || die "Failed to load environment variables"
# Required environment variables
# check_required_env_vars "HOST_PORT"

View File

@ -6,23 +6,15 @@
# It is called with the path to the server specific env file as an argument.
source "$(dirname "$0")/_common.sh"
load_env "$1" || die "Failed to load environment variables"
# Required environment variables
check_required_env_vars "CONTAINER_NAME" "HOST_PORT" "CONTAINER_PORT" "LOCAL_DATA_FOLDER"
if [ -d "${LOCAL_DATA_FOLDER}" ]; then
echo "Local data folder ${LOCAL_DATA_FOLDER} exists, skipping data folder creation"
else
echo "Local data folder ${LOCAL_DATA_FOLDER} does not exist, creating..."
mkdir -p "${LOCAL_DATA_FOLDER}"
fi
[ -d "${LOCAL_DATA_FOLDER}" ] || die "Local data folder ${LOCAL_DATA_FOLDER} does not exist."
DOCKER_RUN_CMD="docker run -d \
--restart unless-stopped \
--name ${CONTAINER_NAME} \
-p ${HOST_PORT}:${CONTAINER_PORT} \
-v ${LOCAL_DATA_FOLDER}:/skdata \
-p ${HOST_PORT}:80 \
-v ${LOCAL_DATA_FOLDER}:/usr/share/nginx/html:ro \
${IMAGE_REGISTRY}/${IMAGE_REPO}:${IMAGE_TAG}"

View File

@ -8,9 +8,6 @@
# This is an example of a status script that checks if the service is running.
source "$(dirname "$0")/_common.sh"
load_env "$1" || die "Failed to load environment variables"
# Required environment variables
check_required_env_vars "CONTAINER_NAME"
# check if the service is running

View File

@ -6,9 +6,6 @@
# It is called with the path to the server specific env file as an argument.
source "$(dirname "$0")/_common.sh"
load_env "$1" || die "Failed to load environment variables"
# Required environment variables
check_required_env_vars "CONTAINER_NAME"
_stop_container $CONTAINER_NAME || die "Failed to stop container ${CONTAINER_NAME}"

View File

@ -6,9 +6,6 @@
# It is called with the path to the server specific env file as an argument.
source "$(dirname "$0")/_common.sh"
load_env "$1" || die "Failed to load environment variables"
# Required environment variables
check_required_env_vars "CONTAINER_NAME" "IMAGE_REGISTRY" "IMAGE_REPO" "IMAGE_TAG"
_remove_container $CONTAINER_NAME || die "Failed to remove container ${CONTAINER_NAME}"