Compare commits
No commits in common. "f52e4fc6e6ffd77055b2447d648cc50c433e5086" and "87e166c28144e187f83d1d59d4fba00c5938e74d" have entirely different histories.
f52e4fc6e6
...
87e166c281
9 changed files with 10 additions and 383 deletions
4
renovate.json → .github/renovate.json
vendored
4
renovate.json → .github/renovate.json
vendored
|
@ -7,12 +7,12 @@
|
|||
"dependencyDashboardTitle": "Renovate Dashboard",
|
||||
"labels": ["renovatebot"],
|
||||
"docker-compose": {
|
||||
"ignorePaths": ["scripts"]
|
||||
"ignorePaths": ["apps_old"]
|
||||
},
|
||||
"hostRules": [
|
||||
{
|
||||
"matchHost": "docker.io",
|
||||
"concurrentRequestLimit": 3
|
||||
"concurrentRequestLimit": 2
|
||||
}
|
||||
]
|
||||
}
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +0,0 @@
|
|||
.env
|
|
@ -1,78 +0,0 @@
|
|||
---
|
||||
services:
|
||||
gotify:
|
||||
image: gotify/server-arm7@sha256:b1fff7e7940fbf0526c2cff20df7a0f41d4618ea373fa9f812fb335c3ddb0b98
|
||||
container_name: gotify
|
||||
ports:
|
||||
- 9008:80
|
||||
volumes:
|
||||
- /docker/appdata/gotify:/app/data
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- TZ=America/New_York
|
||||
- GOTIFY_DEFAULTUSER_NAME=$GOTIFY_DEFAULTUSER_NAME
|
||||
- GOTIFY_DEFAULTUSER_PASS=$GOTIFY_DEFAULTUSER_PASS
|
||||
networks:
|
||||
- gitea_main
|
||||
|
||||
nginx-proxy-manager:
|
||||
image: jc21/nginx-proxy-manager@sha256:360f871f37bd0e945a358bd5ff8dd3a8d2309623e8bae4c09761d5ab7090404c
|
||||
container_name: nginx-proxy-manager
|
||||
ports:
|
||||
- 80:80
|
||||
- 81:81
|
||||
- 443:443
|
||||
volumes:
|
||||
- /docker/appdata/nginx/data:/data
|
||||
- /docker/appdata/nginx/letsencrypt:/etc/letsencrypt
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- gitea_main
|
||||
|
||||
uptime-kuma:
|
||||
image: louislam/uptime-kuma@sha256:48c17e48b96c17ee09f613c8c115dc05bc0bdc52cdf1ede6f634ba3798a7171e
|
||||
container_name: uptime-kuma
|
||||
ports:
|
||||
- 3001:3001
|
||||
volumes:
|
||||
- /docker/appdata/kuma:/app/data
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- gitea_main
|
||||
|
||||
jellyseerr:
|
||||
image: fallenbagel/jellyseerr@sha256:ac4e42e1be629419dbbe423ed41a179cb33140c7ced7f4679eb4b058e84b5aca
|
||||
container_name: jellyseerr
|
||||
ports:
|
||||
- 5055:5055
|
||||
volumes:
|
||||
- /docker/appdata/jellyseerr:/app/config
|
||||
environment:
|
||||
- TZ=America/New_York
|
||||
- LOG_LEVEL=debug
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- gitea_main
|
||||
|
||||
linkstack:
|
||||
image: linkstackorg/linkstack@sha256:ad2ec7ffa69f4b04367313d1b95566bb00955b9670eb5467fd4fab39dd1f53c1
|
||||
container_name: linkstack
|
||||
ports:
|
||||
- 8005:80
|
||||
- 8006:443
|
||||
volumes:
|
||||
- linkstack:/htdocs
|
||||
environment:
|
||||
- HTTP_SERVER_NAME=$HTTP_SERVER_NAME
|
||||
- HTTPS_SERVER_NAME=$HTTP_SERVER_NAME
|
||||
- SERVER_ADMIN=$SERVER_ADMIN
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- gitea_main
|
||||
|
||||
networks:
|
||||
gitea_main:
|
||||
external: true
|
||||
|
||||
volumes:
|
||||
linkstack:
|
|
@ -1,7 +1,8 @@
|
|||
---
|
||||
version: "3.7"
|
||||
services:
|
||||
bazarr:
|
||||
image: lscr.io/linuxserver/bazarr@sha256:563a496ca85130962001b1a40bca1d8f8b37fc646d8d4da771c31d8dd20320d2
|
||||
image: lscr.io/linuxserver/bazarr@sha256:3a66e9805d74b9b2cd67c9bac37c7b5345ce85639922a550194bba4572d403cb
|
||||
ports:
|
||||
- "6767:6767"
|
||||
volumes:
|
||||
|
@ -14,7 +15,7 @@ services:
|
|||
- PGID=1000
|
||||
|
||||
lidarr:
|
||||
image: lscr.io/linuxserver/lidarr@sha256:e1abb0af888c67ceb2607ed0e72244a2db5e8c69a81ba79c115dc1b3e78f257b
|
||||
image: lscr.io/linuxserver/lidarr@sha256:800cf2d9d10113e371af975f3dfeed97f196e8747a463c6e4639d2bd300cdf10
|
||||
ports:
|
||||
- "8686:8686"
|
||||
volumes:
|
||||
|
@ -27,7 +28,7 @@ services:
|
|||
- PGID=1000
|
||||
|
||||
prowlarr:
|
||||
image: lscr.io/linuxserver/prowlarr@sha256:2286e6381b62fa4fec296bd101e51355e48193c99cdc813ae7dc50ee4696ef9a
|
||||
image: lscr.io/linuxserver/prowlarr@sha256:575327a71a9f00284246623a237d5079f3dc53db05805373938dd7534987bf26
|
||||
ports:
|
||||
- "9696:9696"
|
||||
volumes:
|
||||
|
@ -38,7 +39,7 @@ services:
|
|||
- PGID=1000
|
||||
|
||||
radarr:
|
||||
image: lscr.io/linuxserver/radarr@sha256:1afb332d12843163750a40a4e03b0a91b03db8831f9455cbb6fc06ebddbfa16e
|
||||
image: lscr.io/linuxserver/radarr@sha256:122cb0e9104f5b29b48a2578e0ad02ad82c8b8568b8bc5154eb6e360f4e72799
|
||||
ports:
|
||||
- "7878:7878"
|
||||
volumes:
|
||||
|
@ -51,7 +52,7 @@ services:
|
|||
- PGID=1000
|
||||
|
||||
sonarr:
|
||||
image: lscr.io/linuxserver/sonarr@sha256:b320e411a6781a39042eee68a22a535f578033ce44e937caed10489a16336f5f
|
||||
image: lscr.io/linuxserver/sonarr@sha256:f4c3088f5c07a33da5bd3d39df7499c425c60f3e40093a2efd057d145a73b34f
|
||||
ports:
|
||||
- "8989:8989"
|
||||
volumes:
|
||||
|
@ -63,52 +64,6 @@ services:
|
|||
- PUID=1000
|
||||
- PGID=1000
|
||||
|
||||
homarr:
|
||||
container_name: homarr
|
||||
image: ghcr.io/ajnart/homarr@sha256:caf77d79272d16e8081a90e0f2b2928d385ca0b3c0dd36e50cb46ff3aa940ab9
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- /docker/appdata/homarr/configs:/app/data/configs
|
||||
- /docker/appdata/homarr/icons:/app/public/icons
|
||||
- /docker/appdata/homarr/data:/data
|
||||
ports:
|
||||
- '7575:7575'
|
||||
environment:
|
||||
- AUTH_PROVIDER=oidc
|
||||
- AUTH_OIDC_URI=${AUTH_OIDC_URI}
|
||||
- AUTH_OIDC_CLIENT_SECRET=${AUTH_OIDC_CLIENT_SECRET}
|
||||
- AUTH_OIDC_CLIENT_ID=${AUTH_OIDC_CLIENT_ID}
|
||||
- AUTH_OIDC_CLIENT_NAME=authentik
|
||||
- BASE_URL=${BASE_URL}
|
||||
- NEXTAUTH_URL=${NEXTAUTH_URL}
|
||||
- AUTH_OIDC_ADMIN_GROUP=${AUTH_OIDC_ADMIN_GROUP}
|
||||
|
||||
doplarr:
|
||||
image: lscr.io/linuxserver/doplarr@sha256:839999416f9f660cc638e72de41b1d854dda43b22d499efdf298d0ece863bc35
|
||||
container_name: doplarr
|
||||
environment:
|
||||
- PUID=1000
|
||||
- PGID=1000
|
||||
- TZ=${TZ}
|
||||
- DISCORD__TOKEN=${DISCORD__TOKEN}
|
||||
- RADARR__API=${RADARR__API}
|
||||
- RADARR__URL=${RADARR__URL}
|
||||
- SONARR__API=${SONARR__API}
|
||||
- SONARR__URL=${SONARR__URL}
|
||||
- DISCORD__MAX_RESULTS=${DISCORD__MAX_RESULTS}
|
||||
- DISCORD__REQUESTED_MSG_STYLE=${DISCORD__REQUESTED_MSG_STYLE}
|
||||
- SONARR__QUALITY_PROFILE=${SONARR__QUALITY_PROFILE}
|
||||
- RADARR__QUALITY_PROFILE=${RADARR__QUALITY_PROFILE}
|
||||
- SONARR__ROOTFOLDER=${SONARR__ROOTFOLDER}
|
||||
- RADARR__ROOTFOLDER=${RADARR__ROOTFOLDER}
|
||||
- PARTIAL_SEASONS=${PARTIAL_SEASONS}
|
||||
- LOG_LEVEL=${LOG_LEVEL}
|
||||
- JAVA_OPTS=${JAVA_OPTS}
|
||||
volumes:
|
||||
- /docker/appdata/doplarr/config:/config
|
||||
restart: unless-stopped
|
||||
|
||||
networks:
|
||||
default:
|
||||
name: arrs_default
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
version: '3.9'
|
||||
services:
|
||||
sabnzbd:
|
||||
image: lscr.io/linuxserver/sabnzbd@sha256:e81ff09d2ec6b8b07217f1d704b0ae0ed1b54551857589ffd8aca0e7a110b81b
|
||||
image: lscr.io/linuxserver/sabnzbd@sha256:878505a5101d7b67bbf8ff5c2c6091b25fe8c728c553b56cb6f2198a478f3fd8
|
||||
container_name: sabnzbd
|
||||
environment:
|
||||
- PUID=1000
|
||||
|
@ -46,12 +46,3 @@ services:
|
|||
privileged: true
|
||||
network_mode: bridge
|
||||
restart: unless-stopped
|
||||
|
||||
flaresolverr:
|
||||
image: ghcr.io/flaresolverr/flaresolverr@sha256:5f5661db1e69a6f80ac24d47d9fa5580f6f741ee5ec967818396ae0dacecd7ea
|
||||
container_name: flaresolverr
|
||||
ports:
|
||||
- '8191:8191'
|
||||
environment:
|
||||
- LOG_LEVEL=info
|
||||
restart: unless-stopped
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
services:
|
||||
jellyfin:
|
||||
image: lscr.io/linuxserver/jellyfin@sha256:1f29806ecfb4f42d32f795cb442e0eeff13dcc0a8584af90592ea030332de313
|
||||
image: lscr.io/linuxserver/jellyfin@sha256:e752915da1435366cf13fdcefdbc65a20ac762031a7a10212546dbda5ff18f07
|
||||
container_name: jellyfin
|
||||
devices:
|
||||
- /dev/dri/renderD129:/dev/dri/renderD129
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
---
|
||||
services:
|
||||
kasm:
|
||||
image: lscr.io/linuxserver/kasm@sha256:145e60f4b35768580cb56b976cb3e125f95367c4a30481cb574837f39a84ddf5
|
||||
container_name: kasm
|
||||
privileged: true
|
||||
environment:
|
||||
- KASM_PORT=443
|
||||
volumes:
|
||||
- /docker/appdata/kasm:/opt
|
||||
ports:
|
||||
- 3000:3000
|
||||
- 443:443
|
||||
restart: unless-stopped
|
|
@ -1,21 +0,0 @@
|
|||
Make executable:
|
||||
```
|
||||
sudo chmod +x dccd.sh
|
||||
```
|
||||
Example:
|
||||
```
|
||||
./dccd.sh -b main -d /home/mafyuh/Auto-Homelab -p -f 'arrs'
|
||||
```
|
||||
Crontab:
|
||||
```
|
||||
*/30 * * * * /home/mafyuh/Auto-Homelab/scripts/dccd.sh -b main -d /home/mafyuh/Auto-Homelab -l /tmp/dccd.txt -p -f 'arrs'
|
||||
```
|
||||
View Logs:
|
||||
```
|
||||
cat /tmp/dccd.txt
|
||||
```
|
||||
Export Variables:
|
||||
```
|
||||
export GOTIFY_BASE_URL="https:go.example.com"
|
||||
export GOTIFY_TOKEN="token"
|
||||
```
|
205
scripts/dccd.sh
205
scripts/dccd.sh
|
@ -1,205 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
########################################
|
||||
# Default configuration values
|
||||
########################################
|
||||
BASE_DIR="" # Initialize empty variable
|
||||
LOG_FILE="/tmp/dccd.log" # Default log file name
|
||||
PRUNE=0 # Default prune setting
|
||||
REMOTE_BRANCH="main" # Default remote branch name
|
||||
NOTIFY_URL="$GOTIFY_BASE_URL/message" # Gotify server URL
|
||||
NOTIFY_TOKEN="$GOTIFY_TOKEN" # Gotify app token
|
||||
|
||||
########################################
|
||||
# Functions
|
||||
########################################
|
||||
log_message() {
|
||||
local message="$1"
|
||||
echo "$(date +'%Y-%m-%d %H:%M:%S') - $message" | tee -a "$LOG_FILE"
|
||||
}
|
||||
|
||||
send_notification() {
|
||||
local title="$1"
|
||||
local message="$2"
|
||||
|
||||
curl -X POST "$NOTIFY_URL?token=$NOTIFY_TOKEN" -F "title=$title" -F "message=$message"
|
||||
}
|
||||
|
||||
update_compose_files() {
|
||||
local dir="$1"
|
||||
local folder_pattern="$2" # Added parameter for folder pattern
|
||||
|
||||
cd "$dir" || { log_message "ERROR: Directory doesn't exist, exiting..."; send_notification "Script Error" "Failed to update compose files: Directory doesn't exist"; exit 127; }
|
||||
|
||||
# Make sure we're in a git repo
|
||||
if [ ! -d .git ]; then
|
||||
log_message "ERROR: Directory is not a git repository, exiting..."
|
||||
send_notification "Script Error" "Failed to update compose files: Directory is not a git repository"
|
||||
exit 1
|
||||
else
|
||||
log_message "INFO: Git repository found!"
|
||||
fi
|
||||
|
||||
# Check if there are any changes in the Git repository
|
||||
if ! git fetch origin; then
|
||||
log_message "ERROR: Unable to fetch changes from the remote repository (the server may be offline or unreachable)"
|
||||
send_notification "Script Error" "Failed to update compose files: Unable to fetch changes from the remote repository (the server may be offline or unreachable)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local_hash=$(git rev-parse HEAD)
|
||||
remote_hash=$(git rev-parse "origin/$REMOTE_BRANCH")
|
||||
log_message "INFO: Local hash is $local_hash"
|
||||
log_message "INFO: Remote hash is $remote_hash"
|
||||
|
||||
# Check for uncommitted local changes
|
||||
uncommitted_changes=$(git status --porcelain)
|
||||
if [ -n "$uncommitted_changes" ]; then
|
||||
log_message "ERROR: Uncommitted changes detected in $dir, exiting..."
|
||||
send_notification "Script Error" "Failed to update compose files: Uncommitted changes detected in $dir"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if the local hash matches the remote hash
|
||||
if [ "$local_hash" != "$remote_hash" ]; then
|
||||
log_message "STATE: Hashes don't match, updating..."
|
||||
|
||||
# Pull any changes in the Git repository
|
||||
if ! git pull --quiet origin "$REMOTE_BRANCH"; then
|
||||
log_message "ERROR: Unable to pull changes from the remote repository (the server may be offline or unreachable)"
|
||||
send_notification "Script Error" "Failed to update compose files: Unable to pull changes from the remote repository (the server may be offline or unreachable)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Loop through directories matching the specified pattern
|
||||
find "$dir" -type d -name "$folder_pattern" | while IFS= read -r folder; do
|
||||
log_message "INFO: Found folder matching pattern: $folder"
|
||||
|
||||
# If EXCLUDE is set and the directory matches the exclude pattern, skip
|
||||
if [ -n "$EXCLUDE" ] && [[ "$folder" == *"$EXCLUDE"* ]]; then
|
||||
log_message "INFO: Excluding directory $folder"
|
||||
continue
|
||||
fi
|
||||
|
||||
# Go into the directory
|
||||
cd "$folder" || { log_message "ERROR: Failed to enter directory $folder"; send_notification "Script Error" "Failed to update compose files: Failed to enter directory $folder"; continue; }
|
||||
|
||||
# Redeploy compose file in this directory
|
||||
log_message "STATE: Redeploying compose file in directory: $folder"
|
||||
docker compose up -d --quiet-pull
|
||||
|
||||
# Go back to the original directory
|
||||
cd "$dir" || { log_message "ERROR: Failed to return to directory $dir"; send_notification "Script Error" "Failed to update compose files: Failed to return to directory $dir"; exit 1; }
|
||||
done
|
||||
else
|
||||
log_message "STATE: Hashes match, so nothing to do"
|
||||
fi
|
||||
|
||||
# Check if PRUNE is provided
|
||||
if [ $PRUNE -eq 1 ]; then
|
||||
log_message "STATE: Pruning images"
|
||||
docker image prune --all --force
|
||||
fi
|
||||
|
||||
log_message "STATE: Done!"
|
||||
}
|
||||
|
||||
usage() {
|
||||
printf "
|
||||
Usage: $0 [OPTIONS]
|
||||
|
||||
Options:
|
||||
-b <name> Specify the remote branch to track (default: main)
|
||||
-d <path> Specify the base directory of the git repository (required)
|
||||
-h Show this help message
|
||||
-l <path> Specify the path to the log file (default: /tmp/dccd.log)
|
||||
-p Specify if you want to prune docker images (default: don't prune)
|
||||
-x <path> Exclude directories matching the specified pattern (relative to the base directory)
|
||||
-f <pattern> Specify the pattern for folder names to match
|
||||
|
||||
Example: $0 -b master -d /path/to/git_repo -l /tmp/dccd.txt -p -f 'arrs'
|
||||
|
||||
"
|
||||
exit 1
|
||||
}
|
||||
|
||||
########################################
|
||||
# Options
|
||||
########################################
|
||||
|
||||
while getopts ":b:d:hl:px:f:" opt; do
|
||||
case "$opt" in
|
||||
b)
|
||||
REMOTE_BRANCH="$OPTARG"
|
||||
;;
|
||||
d)
|
||||
BASE_DIR="$OPTARG"
|
||||
;;
|
||||
h)
|
||||
usage
|
||||
;;
|
||||
l)
|
||||
LOG_FILE="$OPTARG"
|
||||
;;
|
||||
p)
|
||||
PRUNE=1
|
||||
;;
|
||||
x)
|
||||
EXCLUDE="$OPTARG"
|
||||
;;
|
||||
f)
|
||||
FOLDER_PATTERN="$OPTARG"
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
usage
|
||||
;;
|
||||
:)
|
||||
echo "Option -$OPTARG requires an argument." >&2
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
########################################
|
||||
# Script starts here
|
||||
########################################
|
||||
|
||||
touch "$LOG_FILE"
|
||||
{
|
||||
echo "########################################"
|
||||
echo "# Starting!"
|
||||
echo "########################################"
|
||||
} >> "$LOG_FILE"
|
||||
|
||||
# Check if BASE_DIR is provided
|
||||
if [ -z "$BASE_DIR" ]; then
|
||||
log_message "ERROR: The base directory (-d) is required, exiting..."
|
||||
send_notification "Script Error" "Failed to update compose files: Base directory (-d) is required"
|
||||
usage
|
||||
else
|
||||
log_message "INFO: Base directory is set to $BASE_DIR"
|
||||
fi
|
||||
|
||||
# Check if REMOTE_BRANCH is provided
|
||||
if [ -z "$REMOTE_BRANCH" ]; then
|
||||
log_message "INFO: The remote branch isn't specified, so using $REMOTE_BRANCH"
|
||||
else
|
||||
log_message "INFO: The remote branch is set to $REMOTE_BRANCH"
|
||||
fi
|
||||
|
||||
# Check if EXCLUDE is provided
|
||||
if [ -n "$EXCLUDE" ]; then
|
||||
log_message "INFO: Will be excluding pattern $EXCLUDE"
|
||||
fi
|
||||
|
||||
# Check if FOLDER_PATTERN is provided
|
||||
if [ -z "$FOLDER_PATTERN" ]; then
|
||||
log_message "ERROR: The folder pattern (-f) is required, exiting..."
|
||||
send_notification "Script Error" "Failed to update compose files: Folder pattern (-f) is required"
|
||||
usage
|
||||
else
|
||||
log_message "INFO: Folder pattern is set to $FOLDER_PATTERN"
|
||||
fi
|
||||
|
||||
update_compose_files "$BASE_DIR" "$FOLDER_PATTERN"
|
Reference in a new issue