Compare commits
34 commits
87e166c281
...
f52e4fc6e6
Author | SHA1 | Date | |
---|---|---|---|
|
f52e4fc6e6 | ||
1da9d4293a | |||
|
42f73f2bcd | ||
|
38c8403315 | ||
|
76849663b5 | ||
42351d38ae | |||
|
92c7e02a9b | ||
33b7ef33d0 | |||
3bf19a5967 | |||
|
ac3ae66caf | ||
|
8a6249c930 | ||
9f42087f94 | |||
|
d3dbb465d3 | ||
0492769be1 | |||
|
cb9768d823 | ||
acc46314bf | |||
1f03aea7a1 | |||
018c5d96b7 | |||
efaeddae58 | |||
|
0d84b86f36 | ||
5eaa2bc484 | |||
8c501e06b3 | |||
b1e104783f | |||
b87340f342 | |||
4223e359de | |||
|
708eccb234 | ||
28015bf558 | |||
7fe23573f6 | |||
8989e2f2d4 | |||
|
67993a7c99 | ||
|
eec34d7046 | ||
|
65fc472d0f | ||
|
16e760462e | ||
c281ae9d67 |
9 changed files with 383 additions and 10 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
.env
|
78
arm/docker-compose.yml
Normal file
78
arm/docker-compose.yml
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
---
|
||||||
|
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,8 +1,7 @@
|
||||||
---
|
---
|
||||||
version: "3.7"
|
|
||||||
services:
|
services:
|
||||||
bazarr:
|
bazarr:
|
||||||
image: lscr.io/linuxserver/bazarr@sha256:3a66e9805d74b9b2cd67c9bac37c7b5345ce85639922a550194bba4572d403cb
|
image: lscr.io/linuxserver/bazarr@sha256:563a496ca85130962001b1a40bca1d8f8b37fc646d8d4da771c31d8dd20320d2
|
||||||
ports:
|
ports:
|
||||||
- "6767:6767"
|
- "6767:6767"
|
||||||
volumes:
|
volumes:
|
||||||
|
@ -15,7 +14,7 @@ services:
|
||||||
- PGID=1000
|
- PGID=1000
|
||||||
|
|
||||||
lidarr:
|
lidarr:
|
||||||
image: lscr.io/linuxserver/lidarr@sha256:800cf2d9d10113e371af975f3dfeed97f196e8747a463c6e4639d2bd300cdf10
|
image: lscr.io/linuxserver/lidarr@sha256:e1abb0af888c67ceb2607ed0e72244a2db5e8c69a81ba79c115dc1b3e78f257b
|
||||||
ports:
|
ports:
|
||||||
- "8686:8686"
|
- "8686:8686"
|
||||||
volumes:
|
volumes:
|
||||||
|
@ -28,7 +27,7 @@ services:
|
||||||
- PGID=1000
|
- PGID=1000
|
||||||
|
|
||||||
prowlarr:
|
prowlarr:
|
||||||
image: lscr.io/linuxserver/prowlarr@sha256:575327a71a9f00284246623a237d5079f3dc53db05805373938dd7534987bf26
|
image: lscr.io/linuxserver/prowlarr@sha256:2286e6381b62fa4fec296bd101e51355e48193c99cdc813ae7dc50ee4696ef9a
|
||||||
ports:
|
ports:
|
||||||
- "9696:9696"
|
- "9696:9696"
|
||||||
volumes:
|
volumes:
|
||||||
|
@ -39,7 +38,7 @@ services:
|
||||||
- PGID=1000
|
- PGID=1000
|
||||||
|
|
||||||
radarr:
|
radarr:
|
||||||
image: lscr.io/linuxserver/radarr@sha256:122cb0e9104f5b29b48a2578e0ad02ad82c8b8568b8bc5154eb6e360f4e72799
|
image: lscr.io/linuxserver/radarr@sha256:1afb332d12843163750a40a4e03b0a91b03db8831f9455cbb6fc06ebddbfa16e
|
||||||
ports:
|
ports:
|
||||||
- "7878:7878"
|
- "7878:7878"
|
||||||
volumes:
|
volumes:
|
||||||
|
@ -52,7 +51,7 @@ services:
|
||||||
- PGID=1000
|
- PGID=1000
|
||||||
|
|
||||||
sonarr:
|
sonarr:
|
||||||
image: lscr.io/linuxserver/sonarr@sha256:f4c3088f5c07a33da5bd3d39df7499c425c60f3e40093a2efd057d145a73b34f
|
image: lscr.io/linuxserver/sonarr@sha256:b320e411a6781a39042eee68a22a535f578033ce44e937caed10489a16336f5f
|
||||||
ports:
|
ports:
|
||||||
- "8989:8989"
|
- "8989:8989"
|
||||||
volumes:
|
volumes:
|
||||||
|
@ -64,6 +63,52 @@ services:
|
||||||
- PUID=1000
|
- PUID=1000
|
||||||
- PGID=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:
|
networks:
|
||||||
default:
|
default:
|
||||||
name: arrs_default
|
name: arrs_default
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
version: '3.9'
|
version: '3.9'
|
||||||
services:
|
services:
|
||||||
sabnzbd:
|
sabnzbd:
|
||||||
image: lscr.io/linuxserver/sabnzbd@sha256:878505a5101d7b67bbf8ff5c2c6091b25fe8c728c553b56cb6f2198a478f3fd8
|
image: lscr.io/linuxserver/sabnzbd@sha256:e81ff09d2ec6b8b07217f1d704b0ae0ed1b54551857589ffd8aca0e7a110b81b
|
||||||
container_name: sabnzbd
|
container_name: sabnzbd
|
||||||
environment:
|
environment:
|
||||||
- PUID=1000
|
- PUID=1000
|
||||||
|
@ -46,3 +46,12 @@ services:
|
||||||
privileged: true
|
privileged: true
|
||||||
network_mode: bridge
|
network_mode: bridge
|
||||||
restart: unless-stopped
|
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:
|
services:
|
||||||
jellyfin:
|
jellyfin:
|
||||||
image: lscr.io/linuxserver/jellyfin@sha256:e752915da1435366cf13fdcefdbc65a20ac762031a7a10212546dbda5ff18f07
|
image: lscr.io/linuxserver/jellyfin@sha256:1f29806ecfb4f42d32f795cb442e0eeff13dcc0a8584af90592ea030332de313
|
||||||
container_name: jellyfin
|
container_name: jellyfin
|
||||||
devices:
|
devices:
|
||||||
- /dev/dri/renderD129:/dev/dri/renderD129
|
- /dev/dri/renderD129:/dev/dri/renderD129
|
||||||
|
|
14
kasm/docker-compose.yml
Normal file
14
kasm/docker-compose.yml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
---
|
||||||
|
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
|
|
@ -7,12 +7,12 @@
|
||||||
"dependencyDashboardTitle": "Renovate Dashboard",
|
"dependencyDashboardTitle": "Renovate Dashboard",
|
||||||
"labels": ["renovatebot"],
|
"labels": ["renovatebot"],
|
||||||
"docker-compose": {
|
"docker-compose": {
|
||||||
"ignorePaths": ["apps_old"]
|
"ignorePaths": ["scripts"]
|
||||||
},
|
},
|
||||||
"hostRules": [
|
"hostRules": [
|
||||||
{
|
{
|
||||||
"matchHost": "docker.io",
|
"matchHost": "docker.io",
|
||||||
"concurrentRequestLimit": 2
|
"concurrentRequestLimit": 3
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
21
scripts/README.md
Normal file
21
scripts/README.md
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
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
Executable file
205
scripts/dccd.sh
Executable file
|
@ -0,0 +1,205 @@
|
||||||
|
#!/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