Update nginx-example
This commit is contained in:
parent
192cc48d42
commit
c35fabe6e7
@ -12,11 +12,12 @@ The optional backups script gets a second argument, which is the backup file to
|
|||||||
Mandatory scripts are:
|
Mandatory scripts are:
|
||||||
- install.sh
|
- install.sh
|
||||||
- uninstall.sh
|
- uninstall.sh
|
||||||
- start.sh
|
|
||||||
- stop.sh
|
|
||||||
|
|
||||||
Optional standard scripts are:
|
Optional standard scripts are:
|
||||||
|
- start.sh
|
||||||
|
- stop.sh
|
||||||
- backup.sh
|
- backup.sh
|
||||||
|
- restore.sh
|
||||||
- status.sh
|
- status.sh
|
||||||
- ports.sh
|
- ports.sh
|
||||||
- logs.sh
|
- logs.sh
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
# Service settings specific to this server
|
# Service settings specific to this server
|
||||||
|
|
||||||
# Application settings
|
|
||||||
CONTAINER_PORT=8181
|
|
||||||
|
|
||||||
# Image settings
|
# Image settings
|
||||||
IMAGE_REGISTRY="docker.io"
|
IMAGE_REGISTRY="docker.io"
|
||||||
IMAGE_REPO="nginx"
|
IMAGE_REPO="nginx"
|
||||||
|
@ -9,9 +9,6 @@
|
|||||||
# If the backup file already exists, the script should exit with a message.
|
# If the backup file already exists, the script should exit with a message.
|
||||||
|
|
||||||
source "$(dirname "$0")/_common.sh"
|
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"
|
check_required_env_vars "CONTAINER_NAME" "LOCAL_DATA_FOLDER"
|
||||||
|
|
||||||
# Get backup file path from second argument
|
# Get backup file path from second argument
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
# It is called with the path to the server specific env file as an argument.
|
# It is called with the path to the server specific env file as an argument.
|
||||||
|
|
||||||
source "$(dirname "$0")/_common.sh"
|
source "$(dirname "$0")/_common.sh"
|
||||||
load_env "$1" || die "Failed to load environment variables"
|
|
||||||
|
|
||||||
# Required environment variables
|
# Required environment variables
|
||||||
check_required_env_vars "CONTAINER_NAME"
|
check_required_env_vars "CONTAINER_NAME"
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
# It is called with the path to the server specific env file as an argument.
|
# It is called with the path to the server specific env file as an argument.
|
||||||
|
|
||||||
source "$(dirname "$0")/_common.sh"
|
source "$(dirname "$0")/_common.sh"
|
||||||
load_env "$1" || die "Failed to load environment variables"
|
|
||||||
|
|
||||||
# Required environment variables
|
# Required environment variables
|
||||||
# check_required_env_vars "HOST_PORT"
|
# check_required_env_vars "HOST_PORT"
|
||||||
|
@ -6,23 +6,15 @@
|
|||||||
# It is called with the path to the server specific env file as an argument.
|
# It is called with the path to the server specific env file as an argument.
|
||||||
|
|
||||||
source "$(dirname "$0")/_common.sh"
|
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"
|
check_required_env_vars "CONTAINER_NAME" "HOST_PORT" "CONTAINER_PORT" "LOCAL_DATA_FOLDER"
|
||||||
|
|
||||||
if [ -d "${LOCAL_DATA_FOLDER}" ]; then
|
[ -d "${LOCAL_DATA_FOLDER}" ] || die "Local data folder ${LOCAL_DATA_FOLDER} does not exist."
|
||||||
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
|
|
||||||
|
|
||||||
DOCKER_RUN_CMD="docker run -d \
|
DOCKER_RUN_CMD="docker run -d \
|
||||||
--restart unless-stopped \
|
--restart unless-stopped \
|
||||||
--name ${CONTAINER_NAME} \
|
--name ${CONTAINER_NAME} \
|
||||||
-p ${HOST_PORT}:${CONTAINER_PORT} \
|
-p ${HOST_PORT}:80 \
|
||||||
-v ${LOCAL_DATA_FOLDER}:/skdata \
|
-v ${LOCAL_DATA_FOLDER}:/usr/share/nginx/html:ro \
|
||||||
${IMAGE_REGISTRY}/${IMAGE_REPO}:${IMAGE_TAG}"
|
${IMAGE_REGISTRY}/${IMAGE_REPO}:${IMAGE_TAG}"
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,9 +8,6 @@
|
|||||||
|
|
||||||
# This is an example of a status script that checks if the service is running.
|
# This is an example of a status script that checks if the service is running.
|
||||||
source "$(dirname "$0")/_common.sh"
|
source "$(dirname "$0")/_common.sh"
|
||||||
load_env "$1" || die "Failed to load environment variables"
|
|
||||||
|
|
||||||
# Required environment variables
|
|
||||||
check_required_env_vars "CONTAINER_NAME"
|
check_required_env_vars "CONTAINER_NAME"
|
||||||
|
|
||||||
# check if the service is running
|
# check if the service is running
|
||||||
|
@ -6,9 +6,6 @@
|
|||||||
# It is called with the path to the server specific env file as an argument.
|
# It is called with the path to the server specific env file as an argument.
|
||||||
|
|
||||||
source "$(dirname "$0")/_common.sh"
|
source "$(dirname "$0")/_common.sh"
|
||||||
load_env "$1" || die "Failed to load environment variables"
|
|
||||||
|
|
||||||
# Required environment variables
|
|
||||||
check_required_env_vars "CONTAINER_NAME"
|
check_required_env_vars "CONTAINER_NAME"
|
||||||
|
|
||||||
_stop_container $CONTAINER_NAME || die "Failed to stop container ${CONTAINER_NAME}"
|
_stop_container $CONTAINER_NAME || die "Failed to stop container ${CONTAINER_NAME}"
|
||||||
|
@ -6,9 +6,6 @@
|
|||||||
# It is called with the path to the server specific env file as an argument.
|
# It is called with the path to the server specific env file as an argument.
|
||||||
|
|
||||||
source "$(dirname "$0")/_common.sh"
|
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"
|
check_required_env_vars "CONTAINER_NAME" "IMAGE_REGISTRY" "IMAGE_REPO" "IMAGE_TAG"
|
||||||
|
|
||||||
_remove_container $CONTAINER_NAME || die "Failed to remove container ${CONTAINER_NAME}"
|
_remove_container $CONTAINER_NAME || die "Failed to remove container ${CONTAINER_NAME}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user