This commit is contained in:
Your Name 2025-04-25 17:58:31 +12:00
parent 72e757ebd6
commit 09035aa2aa
5 changed files with 33 additions and 34 deletions

View File

@ -1,12 +1,13 @@
DropShell Template Example
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.
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:
- install.sh

View File

@ -27,7 +27,7 @@ load_env() {
source "$script_dir/_basic.env"
set +a
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
fi
@ -35,23 +35,18 @@ load_env() {
if [ -z "$1" ]; then
echo "Usage: $0 [path_to_env_file]"
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
if [ -f "$env_file" ]; then
set -a
source "$env_file"
set +a
else
echo "Warning: .env file not found at $env_file"
env_file="$1/service.env"
if [ ! -f "$env_file" ]; then
echo "Warning: service.env file not found in $1"
return 1
fi
set -a
source "$env_file"
set +a
}
grey_start() {

View File

@ -27,7 +27,7 @@ load_env() {
source "$script_dir/_basic.env"
set +a
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
fi
@ -35,23 +35,18 @@ load_env() {
if [ -z "$1" ]; then
echo "Usage: $0 [path_to_env_file]"
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
if [ -f "$env_file" ]; then
set -a
source "$env_file"
set +a
else
echo "Warning: .env file not found at $env_file"
env_file="$1/service.env"
if [ ! -f "$env_file" ]; then
echo "Warning: service.env file not found in $1"
return 1
fi
set -a
source "$env_file"
set +a
}
grey_start() {

View File

@ -0,0 +1,5 @@
{
"auths": {
}
}

View File

@ -1,6 +1,8 @@
#!/bin/bash
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
check_required_env_vars "CONTAINER_NAME" "INTERVAL"
@ -9,6 +11,7 @@ DOCKER_RUN_CMD="docker run -d \
--restart unless-stopped \
--name ${CONTAINER_NAME} \
-v /var/run/docker.sock:/var/run/docker.sock \
-v ${SERVICE_CONFIG_DIR}/config.json:/config.json
${IMAGE_REGISTRY}/${IMAGE_REPO}:${IMAGE_TAG} \
--interval ${INTERVAL}"