Tidy
This commit is contained in:
parent
72e757ebd6
commit
09035aa2aa
@ -1,12 +1,13 @@
|
|||||||
DropShell Template Example
|
DropShell Template Example
|
||||||
|
|
||||||
Shell scripts defined in this folder are run as DropShell commands on the remote server (not locally!).
|
Shell scripts defined in this folder are run as DropShell commands on the remote server (not locally!).
|
||||||
All scripts are passed the server-specific service environment (SSSE) file as an argument.
|
All scripts are passed the directory containing the server-specific service environment (SSSE) as an argument
|
||||||
|
(the environment file, along with any other server and service-specific files, is then in $1/service.env)
|
||||||
|
|
||||||
The default SSSE file used when a new service is created is in example/service.env. This must exist,
|
The default SSSE file included when a new service is created is in example/service.env. This must exist,
|
||||||
and must at minimum contain the TEMPLATE=<template_name> variable.
|
and must at minimum contain the TEMPLATE=<template_name> variable.
|
||||||
|
|
||||||
The backups script gets a second argument, which is the backup file to create (a single tgz file).
|
The optional backups script gets a second argument, which is the backup file to create (a single tgz file).
|
||||||
|
|
||||||
Mandatory scripts are:
|
Mandatory scripts are:
|
||||||
- install.sh
|
- install.sh
|
||||||
|
@ -27,7 +27,7 @@ load_env() {
|
|||||||
source "$script_dir/_basic.env"
|
source "$script_dir/_basic.env"
|
||||||
set +a
|
set +a
|
||||||
else
|
else
|
||||||
echo "Warning: basic.env file not found at $script_dir/_basic.env. Broken template?"
|
echo "Warning: _basic.env file not found at $script_dir/_basic.env. Broken template?"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -35,23 +35,18 @@ load_env() {
|
|||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
echo "Usage: $0 [path_to_env_file]"
|
echo "Usage: $0 [path_to_env_file]"
|
||||||
return 1
|
return 1
|
||||||
else
|
|
||||||
# If path is relative, make it absolute using script directory as base
|
|
||||||
if [[ "$1" != /* ]]; then
|
|
||||||
env_file="$script_dir/$1"
|
|
||||||
else
|
|
||||||
env_file="$1"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$env_file" ]; then
|
env_file="$1/service.env"
|
||||||
set -a
|
|
||||||
source "$env_file"
|
if [ ! -f "$env_file" ]; then
|
||||||
set +a
|
echo "Warning: service.env file not found in $1"
|
||||||
else
|
|
||||||
echo "Warning: .env file not found at $env_file"
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
set -a
|
||||||
|
source "$env_file"
|
||||||
|
set +a
|
||||||
}
|
}
|
||||||
|
|
||||||
grey_start() {
|
grey_start() {
|
||||||
|
@ -27,7 +27,7 @@ load_env() {
|
|||||||
source "$script_dir/_basic.env"
|
source "$script_dir/_basic.env"
|
||||||
set +a
|
set +a
|
||||||
else
|
else
|
||||||
echo "Warning: basic.env file not found at $script_dir/_basic.env. Broken template?"
|
echo "Warning: _basic.env file not found at $script_dir/_basic.env. Broken template?"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -35,23 +35,18 @@ load_env() {
|
|||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
echo "Usage: $0 [path_to_env_file]"
|
echo "Usage: $0 [path_to_env_file]"
|
||||||
return 1
|
return 1
|
||||||
else
|
|
||||||
# If path is relative, make it absolute using script directory as base
|
|
||||||
if [[ "$1" != /* ]]; then
|
|
||||||
env_file="$script_dir/$1"
|
|
||||||
else
|
|
||||||
env_file="$1"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$env_file" ]; then
|
env_file="$1/service.env"
|
||||||
set -a
|
|
||||||
source "$env_file"
|
if [ ! -f "$env_file" ]; then
|
||||||
set +a
|
echo "Warning: service.env file not found in $1"
|
||||||
else
|
|
||||||
echo "Warning: .env file not found at $env_file"
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
set -a
|
||||||
|
source "$env_file"
|
||||||
|
set +a
|
||||||
}
|
}
|
||||||
|
|
||||||
grey_start() {
|
grey_start() {
|
||||||
|
5
templates/watchtower/example/config.json
Normal file
5
templates/watchtower/example/config.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"auths": {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
source "$(dirname "$0")/_common.sh"
|
source "$(dirname "$0")/_common.sh"
|
||||||
load_env "$1" || die "Failed to load environment variables"
|
|
||||||
|
SERVICE_CONFIG_DIR="$1"
|
||||||
|
load_env "$SERVICE_CONFIG_DIR" || die "Failed to load environment variables"
|
||||||
|
|
||||||
# Required environment variables
|
# Required environment variables
|
||||||
check_required_env_vars "CONTAINER_NAME" "INTERVAL"
|
check_required_env_vars "CONTAINER_NAME" "INTERVAL"
|
||||||
@ -9,6 +11,7 @@ DOCKER_RUN_CMD="docker run -d \
|
|||||||
--restart unless-stopped \
|
--restart unless-stopped \
|
||||||
--name ${CONTAINER_NAME} \
|
--name ${CONTAINER_NAME} \
|
||||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||||
|
-v ${SERVICE_CONFIG_DIR}/config.json:/config.json
|
||||||
${IMAGE_REGISTRY}/${IMAGE_REPO}:${IMAGE_TAG} \
|
${IMAGE_REGISTRY}/${IMAGE_REPO}:${IMAGE_TAG} \
|
||||||
--interval ${INTERVAL}"
|
--interval ${INTERVAL}"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user