config: Update 7 files
All checks were successful
Test and Publish Templates / test-and-publish (push) Successful in 22s

This commit is contained in:
Your Name
2025-09-01 14:16:35 +12:00
parent 11ddc264eb
commit 4c2eff0011
7 changed files with 31 additions and 76 deletions

View File

@@ -9,7 +9,7 @@ services:
network_mode: host network_mode: host
volumes: volumes:
- ./mediamtx.yml:/mediamtx.yml - ./mediamtx.yml:/mediamtx.yml
- ${RECORDINGS_PATH}:/recordings - ${RECORDINGS_FOLDER}:/recordings
environment: environment:
- MTX_PROTOCOLS=tcp - MTX_PROTOCOLS=tcp
- CAMERA_USER=${CAMERA_USER} - CAMERA_USER=${CAMERA_USER}
@@ -34,7 +34,7 @@ services:
depends_on: depends_on:
- mediamtx - mediamtx
volumes: volumes:
- ${RECORDINGS_PATH}:/recordings - ${RECORDINGS_FOLDER}:/recordings
environment: environment:
- SQUASHKIWI_API=${SQUASHKIWI_API} - SQUASHKIWI_API=${SQUASHKIWI_API}
- COURT_ID=${COURT_ID} - COURT_ID=${COURT_ID}
@@ -58,7 +58,7 @@ services:
volumes: volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro - ./nginx.conf:/etc/nginx/nginx.conf:ro
- ./web:/usr/share/nginx/html:ro - ./web:/usr/share/nginx/html:ro
- ${RECORDINGS_PATH}:/recordings:ro - ${RECORDINGS_FOLDER}:/recordings:ro
- nginx-cache:/var/cache/nginx - nginx-cache:/var/cache/nginx
depends_on: depends_on:
- mediamtx - mediamtx

View File

@@ -1,7 +1,8 @@
# SquashKiwi Streaming Configuration # SquashKiwi Streaming Configuration
# Edit this file to configure your streaming service # Edit this file to configure your streaming service
LOCAL_DATA_FOLDER="/home/dropshell/example-squashkiwi-streaming" LOCAL_DATA_FOLDER="/home/dropshell/example-squashkiwi-streaming-data"
RECORDINGS_FOLDER="/home/dropshell/example-squashkiwi-streaming-recordings"
# Camera Configuration # Camera Configuration
@@ -18,7 +19,6 @@ COURT_NAME=Court 1
SQUASHKIWI_API=https://squash.kiwi/api SQUASHKIWI_API=https://squash.kiwi/api
# Recording Settings # Recording Settings
RECORDINGS_PATH="/home/dropshell/example-squashkiwi-streaming/recordings"
RECORDING_RETENTION_DAYS=30 RECORDING_RETENTION_DAYS=30
RECORDING_QUALITY=high RECORDING_QUALITY=high
IDLE_TIMEOUT=300 IDLE_TIMEOUT=300

View File

@@ -1,11 +1,15 @@
#!/bin/bash #!/bin/bash
# shellcheck disable=SC1091 # shellcheck disable=SC1091
source "${AGENT_PATH}/common.sh" source "${AGENT_PATH}/common.sh"
_check_required_env_vars "PROJECT_NAME" "LOCAL_DATA_FOLDER" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SCRIPT_DIR}/_paths.sh"
_check_required_env_vars "LOCAL_DATA_FOLDER"
cd "${LOCAL_DATA_FOLDER}/config" || _die "Failed to change to config directory" "${SCRIPT_DIR}/uninstall.sh"
echo "Destroying ${PROJECT_NAME} containers and networks..." # shellcheck disable=SC2046
docker compose down -v || _die "Failed to destroy Docker Compose services" destroy_items $(get_squashkiwi_streaming_paths) || _die "Failed to destroy ${LOCAL_DATA_FOLDER}"
rm -rf "${RECORDINGS_FOLDER}"
echo "Destroyed ${CONTAINER_NAME}"
echo "${PROJECT_NAME} destroyed (configuration and recordings preserved)"

View File

@@ -8,13 +8,11 @@ _check_required_env_vars "PROJECT_NAME" "LOCAL_DATA_FOLDER" "CAMERA_IP" "COURT_I
# Create directories # Create directories
# shellcheck disable=SC2046 # shellcheck disable=SC2046
create_items $(get_squashkiwi_streaming_paths) || _die "Failed to create directories" create_items $(get_squashkiwi_streaming_paths) || _die "Failed to create directories"
mkdir -p "${RECORDINGS_FOLDER}"
# Copy configuration files # Copy configuration files
cp -r "${SCRIPT_DIR}/config/"* "${LOCAL_DATA_FOLDER}/config/" || _die "Failed to copy config files" cp -r "${SCRIPT_DIR}/config/"* "${LOCAL_DATA_FOLDER}/config/" || _die "Failed to copy config files"
# Update recordings path in service.env
sed -i "s|RECORDINGS_PATH=.*|RECORDINGS_PATH=${LOCAL_DATA_FOLDER}/recordings|" "${LOCAL_DATA_FOLDER}/config/service.env"
# Test Docker # Test Docker
_check_docker_installed || _die "Docker test failed, aborting installation..." _check_docker_installed || _die "Docker test failed, aborting installation..."

View File

@@ -1,55 +1,22 @@
#!/bin/bash #!/bin/bash
# shellcheck disable=SC1091 # shellcheck disable=SC1091
source "${AGENT_PATH}/common.sh" source "${AGENT_PATH}/common.sh"
_check_required_env_vars "PROJECT_NAME" "LOCAL_DATA_FOLDER" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SCRIPT_DIR}/_paths.sh"
_check_required_env_vars "CONTAINER_NAME" "LOCAL_DATA_FOLDER" "BACKUP_FILE" "TEMP_DIR"
BACKUP_DIR="${HOME}/backups/${PROJECT_NAME}" # RESTORE SCRIPT
# The restore script is OPTIONAL.
# It is used to restore the service on the server from a backup file.
# It is called with one argument: the path to the backup file.
# List available backups # # Stop container before backup
echo "Available backups:" "${SCRIPT_DIR}/uninstall.sh" || _die "Failed to uninstall service before restore"
ls -1t "${BACKUP_DIR}"/*.tar.gz 2>/dev/null | head -10 | nl
if [[ $? -ne 0 ]]; then # shellcheck disable=SC2046
echo "No backups found in ${BACKUP_DIR}" restore_items $(get_squashkiwi_streaming_paths) || _die "Failed to restore data folder from backup"
exit 1
fi
# Select backup # reinstall service
read -p "Enter backup number to restore (or path to backup file): " selection "${SCRIPT_DIR}/install.sh" || _die "Failed to reinstall service after restore"
if [[ -f "$selection" ]]; then echo "Restore complete! Service is running again on port $HOST_PORT with restored website."
BACKUP_FILE="$selection"
else
BACKUP_FILE=$(ls -1t "${BACKUP_DIR}"/*.tar.gz 2>/dev/null | sed -n "${selection}p")
fi
if [[ ! -f "$BACKUP_FILE" ]]; then
echo "Backup file not found: ${BACKUP_FILE}"
exit 1
fi
echo "Restoring from: ${BACKUP_FILE}"
read -p "This will overwrite current configuration. Continue? (yes/no): " confirmation
if [[ "$confirmation" != "yes" ]]; then
echo "Restore cancelled"
exit 0
fi
# Stop services
bash "${SCRIPT_DIR}/stop.sh" || true
# Backup current config
if [[ -d "${LOCAL_DATA_FOLDER}/config" ]]; then
mv "${LOCAL_DATA_FOLDER}/config" "${LOCAL_DATA_FOLDER}/config.bak.$(date +%Y%m%d_%H%M%S)"
fi
# Extract backup
tar -xzf "${BACKUP_FILE}" -C "${LOCAL_DATA_FOLDER}" || _die "Failed to extract backup"
echo "✓ Backup restored"
# Restart services
bash "${SCRIPT_DIR}/start.sh"
echo "Restore complete!"

View File

@@ -1,7 +1,6 @@
#!/bin/bash #!/bin/bash
# shellcheck disable=SC1091 # shellcheck disable=SC1091
source "${AGENT_PATH}/common.sh" source "${AGENT_PATH}/common.sh"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
_check_required_env_vars "PROJECT_NAME" "LOCAL_DATA_FOLDER" _check_required_env_vars "PROJECT_NAME" "LOCAL_DATA_FOLDER"
cd "${LOCAL_DATA_FOLDER}/config" || _die "Failed to change to config directory" cd "${LOCAL_DATA_FOLDER}/config" || _die "Failed to change to config directory"

View File

@@ -3,22 +3,9 @@
source "${AGENT_PATH}/common.sh" source "${AGENT_PATH}/common.sh"
_check_required_env_vars "PROJECT_NAME" "LOCAL_DATA_FOLDER" _check_required_env_vars "PROJECT_NAME" "LOCAL_DATA_FOLDER"
echo "WARNING: This will remove all ${PROJECT_NAME} containers, images, and data!"
echo "Recordings will be permanently deleted."
read -p "Are you sure? (yes/no): " confirmation
if [[ "$confirmation" != "yes" ]]; then
echo "Uninstall cancelled"
exit 0
fi
cd "${LOCAL_DATA_FOLDER}/config" || _die "Failed to change to config directory" cd "${LOCAL_DATA_FOLDER}/config" || _die "Failed to change to config directory"
# Stop and remove containers # Stop and remove containers
docker compose down -v --rmi all || true docker compose down || true
# Remove local data echo "${PROJECT_NAME} has been uninstalled"
echo "Removing local data folder: ${LOCAL_DATA_FOLDER}"
rm -rf "${LOCAL_DATA_FOLDER}"
echo "${PROJECT_NAME} has been completely uninstalled"