Update caddy/config/caddyfile/check_caddyfile.sh
All checks were successful
Test and Publish Templates / test-and-publish (push) Successful in 9s
All checks were successful
Test and Publish Templates / test-and-publish (push) Successful in 9s
This commit is contained in:
@@ -11,3 +11,6 @@ docker run --rm -v "${SCRIPT_DIR}/Caddyfile:/etc/caddy/Caddyfile" caddy caddy va
|
|||||||
|
|
||||||
echo "Caddyfile is valid and formatted"
|
echo "Caddyfile is valid and formatted"
|
||||||
|
|
||||||
|
echo "To activate:"
|
||||||
|
echo "ds reload-config SERVER SERVICE"
|
||||||
|
|
||||||
|
|||||||
7
scrutiny/_volumes.sh
Executable file
7
scrutiny/_volumes.sh
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Define volume items for scrutiny container
|
||||||
|
# These are used across backup, restore, create, and destroy operations
|
||||||
|
|
||||||
|
get_scrutiny_volumes() {
|
||||||
|
echo "volume:config:${CONTAINER_NAME}_config" "volume:influxdb:${CONTAINER_NAME}_influxdb"
|
||||||
|
}
|
||||||
21
scrutiny/backup.sh
Executable file
21
scrutiny/backup.sh
Executable file
@@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# shellcheck disable=SC1091
|
||||||
|
source "${AGENT_PATH}/common.sh"
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
source "${SCRIPT_DIR}/_volumes.sh"
|
||||||
|
|
||||||
|
_check_required_env_vars "CONTAINER_NAME" "BACKUP_FILE" "TEMP_DIR"
|
||||||
|
|
||||||
|
echo "Backing up ${CONTAINER_NAME}..."
|
||||||
|
|
||||||
|
# Stop container for consistent backup
|
||||||
|
_stop_container "$CONTAINER_NAME"
|
||||||
|
|
||||||
|
# Backup volumes
|
||||||
|
# shellcheck disable=SC2046
|
||||||
|
backup_items $(get_scrutiny_volumes) || _die "Failed to create backup"
|
||||||
|
|
||||||
|
# Restart container
|
||||||
|
_start_container "$CONTAINER_NAME"
|
||||||
|
|
||||||
|
echo "Backup created successfully: $BACKUP_FILE"
|
||||||
27
scrutiny/config/service.env
Normal file
27
scrutiny/config/service.env
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# Scrutiny - Hard Drive S.M.A.R.T Monitoring
|
||||||
|
# https://github.com/analogj/scrutiny
|
||||||
|
|
||||||
|
# Server Settings
|
||||||
|
SSH_USER="dropshell"
|
||||||
|
|
||||||
|
# Container name (change if running multiple instances)
|
||||||
|
CONTAINER_NAME=scrutiny
|
||||||
|
|
||||||
|
# Web UI port
|
||||||
|
WEB_PORT=8080
|
||||||
|
|
||||||
|
# InfluxDB port (for metrics storage)
|
||||||
|
INFLUXDB_PORT=8086
|
||||||
|
|
||||||
|
# Devices to monitor - space-separated list of block devices
|
||||||
|
# Example: "/dev/sda /dev/sdb /dev/nvme0n1"
|
||||||
|
# Leave empty to auto-detect (requires --privileged mode)
|
||||||
|
DEVICES="/dev/sda"
|
||||||
|
|
||||||
|
# Set to "true" to run in privileged mode (auto-detects all devices)
|
||||||
|
# Set to "false" to use explicit DEVICES list above
|
||||||
|
PRIVILEGED_MODE=false
|
||||||
|
|
||||||
|
# Collector schedule (cron format) - how often to collect SMART data
|
||||||
|
# Default: every day at midnight
|
||||||
|
COLLECTOR_CRON_SCHEDULE="0 0 * * *"
|
||||||
18
scrutiny/destroy.sh
Executable file
18
scrutiny/destroy.sh
Executable file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# shellcheck disable=SC1091
|
||||||
|
source "${AGENT_PATH}/common.sh"
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
source "${SCRIPT_DIR}/_volumes.sh"
|
||||||
|
|
||||||
|
_check_required_env_vars "CONTAINER_NAME"
|
||||||
|
|
||||||
|
echo "WARNING: This will PERMANENTLY DELETE all data for ${CONTAINER_NAME}"
|
||||||
|
|
||||||
|
# Uninstall container
|
||||||
|
bash ./uninstall.sh 2>/dev/null || true
|
||||||
|
|
||||||
|
# Destroy volumes
|
||||||
|
# shellcheck disable=SC2046
|
||||||
|
destroy_items $(get_scrutiny_volumes) || _die "Failed to destroy volumes"
|
||||||
|
|
||||||
|
echo "Destroyed ${CONTAINER_NAME} and all associated data."
|
||||||
25
scrutiny/install.sh
Executable file
25
scrutiny/install.sh
Executable file
@@ -0,0 +1,25 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# shellcheck disable=SC1091
|
||||||
|
source "${AGENT_PATH}/common.sh"
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
source "${SCRIPT_DIR}/_volumes.sh"
|
||||||
|
|
||||||
|
_check_required_env_vars "CONTAINER_NAME" "IMAGE_REGISTRY" "IMAGE_REPO" "IMAGE_TAG"
|
||||||
|
|
||||||
|
# Create volumes
|
||||||
|
# shellcheck disable=SC2046
|
||||||
|
create_items $(get_scrutiny_volumes) || _die "Failed to create volumes"
|
||||||
|
|
||||||
|
# Pull image
|
||||||
|
echo "Pulling ${IMAGE_REGISTRY}/${IMAGE_REPO}:${IMAGE_TAG}..."
|
||||||
|
docker pull "${IMAGE_REGISTRY}/${IMAGE_REPO}:${IMAGE_TAG}" || _die "Failed to pull image"
|
||||||
|
|
||||||
|
# Stop and remove existing container
|
||||||
|
bash ./stop.sh 2>/dev/null || true
|
||||||
|
_remove_container "$CONTAINER_NAME" 2>/dev/null || true
|
||||||
|
|
||||||
|
# Start service
|
||||||
|
bash ./start.sh || _die "Failed to start container"
|
||||||
|
|
||||||
|
echo "Installation complete for service ${CONTAINER_NAME}."
|
||||||
|
echo "Web UI available at http://localhost:${WEB_PORT:-8080}"
|
||||||
11
scrutiny/logs.sh
Executable file
11
scrutiny/logs.sh
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# shellcheck disable=SC1091
|
||||||
|
source "${AGENT_PATH}/common.sh"
|
||||||
|
|
||||||
|
_check_required_env_vars "CONTAINER_NAME"
|
||||||
|
|
||||||
|
if ! _is_container_exists "$CONTAINER_NAME"; then
|
||||||
|
_die "Container ${CONTAINER_NAME} does not exist"
|
||||||
|
fi
|
||||||
|
|
||||||
|
docker logs -f "$CONTAINER_NAME"
|
||||||
21
scrutiny/restore.sh
Executable file
21
scrutiny/restore.sh
Executable file
@@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# shellcheck disable=SC1091
|
||||||
|
source "${AGENT_PATH}/common.sh"
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
source "${SCRIPT_DIR}/_volumes.sh"
|
||||||
|
|
||||||
|
_check_required_env_vars "CONTAINER_NAME" "BACKUP_FILE" "TEMP_DIR"
|
||||||
|
|
||||||
|
echo "Restoring ${CONTAINER_NAME} from backup..."
|
||||||
|
|
||||||
|
# Uninstall before restore
|
||||||
|
bash ./uninstall.sh || _die "Failed to uninstall service before restore"
|
||||||
|
|
||||||
|
# Restore volumes from backup
|
||||||
|
# shellcheck disable=SC2046
|
||||||
|
restore_items $(get_scrutiny_volumes) || _die "Failed to restore from backup"
|
||||||
|
|
||||||
|
# Reinstall service
|
||||||
|
bash ./install.sh || _die "Failed to reinstall service after restore"
|
||||||
|
|
||||||
|
echo "Restore complete! Service ${CONTAINER_NAME} is running."
|
||||||
59
scrutiny/start.sh
Executable file
59
scrutiny/start.sh
Executable file
@@ -0,0 +1,59 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# shellcheck disable=SC1091
|
||||||
|
source "${AGENT_PATH}/common.sh"
|
||||||
|
|
||||||
|
_check_required_env_vars "CONTAINER_NAME" "IMAGE_REGISTRY" "IMAGE_REPO" "IMAGE_TAG"
|
||||||
|
|
||||||
|
# Set defaults
|
||||||
|
WEB_PORT="${WEB_PORT:-8080}"
|
||||||
|
INFLUXDB_PORT="${INFLUXDB_PORT:-8086}"
|
||||||
|
DEVICES="${DEVICES:-/dev/sda}"
|
||||||
|
PRIVILEGED_MODE="${PRIVILEGED_MODE:-false}"
|
||||||
|
COLLECTOR_CRON_SCHEDULE="${COLLECTOR_CRON_SCHEDULE:-0 0 * * *}"
|
||||||
|
|
||||||
|
# Build device arguments
|
||||||
|
DEVICE_ARGS=""
|
||||||
|
if [ "$PRIVILEGED_MODE" = "true" ]; then
|
||||||
|
DEVICE_ARGS="--privileged"
|
||||||
|
else
|
||||||
|
for dev in $DEVICES; do
|
||||||
|
if [ -e "$dev" ]; then
|
||||||
|
DEVICE_ARGS="$DEVICE_ARGS --device=$dev"
|
||||||
|
else
|
||||||
|
echo "Warning: Device $dev does not exist, skipping"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ -z "$DEVICE_ARGS" ]; then
|
||||||
|
_die "No valid devices found. Check DEVICES setting or enable PRIVILEGED_MODE."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Build docker run command
|
||||||
|
DOCKER_RUN_CMD="docker run -d \
|
||||||
|
--restart unless-stopped \
|
||||||
|
--name ${CONTAINER_NAME} \
|
||||||
|
-p ${WEB_PORT}:8080 \
|
||||||
|
-p ${INFLUXDB_PORT}:8086 \
|
||||||
|
-v ${CONTAINER_NAME}_config:/opt/scrutiny/config \
|
||||||
|
-v ${CONTAINER_NAME}_influxdb:/opt/scrutiny/influxdb \
|
||||||
|
-v /run/udev:/run/udev:ro \
|
||||||
|
--cap-add SYS_RAWIO \
|
||||||
|
--cap-add SYS_ADMIN \
|
||||||
|
-e COLLECTOR_CRON_SCHEDULE=\"${COLLECTOR_CRON_SCHEDULE}\" \
|
||||||
|
${DEVICE_ARGS} \
|
||||||
|
${IMAGE_REGISTRY}/${IMAGE_REPO}:${IMAGE_TAG}"
|
||||||
|
|
||||||
|
# Start container
|
||||||
|
if ! _create_and_start_container "$DOCKER_RUN_CMD" "$CONTAINER_NAME"; then
|
||||||
|
_die "Failed to start container ${CONTAINER_NAME}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Verify running
|
||||||
|
sleep 2
|
||||||
|
if ! _is_container_running "$CONTAINER_NAME"; then
|
||||||
|
echo "Container logs:"
|
||||||
|
docker logs "$CONTAINER_NAME" 2>&1 | tail -20
|
||||||
|
_die "Container ${CONTAINER_NAME} is not running"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Container ${CONTAINER_NAME} started successfully."
|
||||||
11
scrutiny/status.sh
Executable file
11
scrutiny/status.sh
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# shellcheck disable=SC1091
|
||||||
|
source "${AGENT_PATH}/common.sh"
|
||||||
|
|
||||||
|
_check_required_env_vars "CONTAINER_NAME"
|
||||||
|
|
||||||
|
# Check if container is running
|
||||||
|
_is_container_running "$CONTAINER_NAME" || _die "Service is not running - did not find container $CONTAINER_NAME."
|
||||||
|
|
||||||
|
echo "Service is healthy"
|
||||||
|
exit 0
|
||||||
9
scrutiny/stop.sh
Executable file
9
scrutiny/stop.sh
Executable file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# shellcheck disable=SC1091
|
||||||
|
source "${AGENT_PATH}/common.sh"
|
||||||
|
|
||||||
|
_check_required_env_vars "CONTAINER_NAME"
|
||||||
|
|
||||||
|
echo "Stopping service ${CONTAINER_NAME}..."
|
||||||
|
_stop_container "$CONTAINER_NAME" || _die "Failed to stop container ${CONTAINER_NAME}"
|
||||||
|
echo "Service ${CONTAINER_NAME} stopped."
|
||||||
13
scrutiny/template_info.env
Normal file
13
scrutiny/template_info.env
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# Template info - AUTO GENERATED, DO NOT EDIT
|
||||||
|
TEMPLATE=scrutiny
|
||||||
|
REQUIRES_HOST_ROOT=false
|
||||||
|
REQUIRES_DOCKER=true
|
||||||
|
REQUIRES_DOCKER_ROOT=true
|
||||||
|
|
||||||
|
# Default service name
|
||||||
|
CONTAINER_NAME=scrutiny
|
||||||
|
|
||||||
|
# Image - Omnibus (all-in-one) version
|
||||||
|
IMAGE_REGISTRY="ghcr.io"
|
||||||
|
IMAGE_REPO="analogj/scrutiny"
|
||||||
|
IMAGE_TAG="master-omnibus"
|
||||||
16
scrutiny/uninstall.sh
Executable file
16
scrutiny/uninstall.sh
Executable file
@@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# shellcheck disable=SC1091
|
||||||
|
source "${AGENT_PATH}/common.sh"
|
||||||
|
|
||||||
|
_check_required_env_vars "CONTAINER_NAME"
|
||||||
|
|
||||||
|
echo "Uninstalling ${CONTAINER_NAME}..."
|
||||||
|
|
||||||
|
# Stop and remove container (preserves data volumes)
|
||||||
|
_remove_container "$CONTAINER_NAME" || _die "Failed to remove container ${CONTAINER_NAME}"
|
||||||
|
|
||||||
|
# Optionally remove image
|
||||||
|
docker rmi "${IMAGE_REGISTRY}/${IMAGE_REPO}:${IMAGE_TAG}" 2>/dev/null || true
|
||||||
|
|
||||||
|
echo "Uninstallation of ${CONTAINER_NAME} complete."
|
||||||
|
echo "Data volumes preserved. Use destroy.sh to remove all data."
|
||||||
Reference in New Issue
Block a user