Update README.md with new service details, add healthcheck improvements for Immich, and remove deprecated Watchtower service configuration.
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
**/.env
|
||||
65
README.md
65
README.md
@@ -4,17 +4,18 @@ A collection of Docker services for a home lab environment.
|
||||
|
||||
## Port Matrix
|
||||
|
||||
| Service | 80 | 81 | 222 | 2283 | 3000 | 5000 | 5540 | 5678 | 6379 | 8001 | 8554 | 8555 | 8971 | 9000 | 9443 | 27017 |
|
||||
|---------|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|
|
||||
| 🔥 Firefly III | ✅ | ✅ | | | | | | | | | | | | | | |
|
||||
| 📹 Frigate | | | | | | ✅ | | | | | ✅ | ✅ | ✅ | | | |
|
||||
| 🐙 Gitea | | | ✅ | | ✅ | | | | | | | | | | | |
|
||||
| 📱 Immich | | | | ✅ | | | | | | | | | | | | |
|
||||
| 🍃 MongoDB | | | | | | | | | | | | | | | | ✅ |
|
||||
| 🔄 n8n | | | | | | | | ✅ | | | | | | | | |
|
||||
| 🐳 Portainer | | | | | | | | | | | | | | | ✅ | ✅ |
|
||||
| 🔴 Redis | | | | | | | ✅ | | ✅ | | | | | | | |
|
||||
| 🗺️ WebMap | | | | | | | | | | ✅ | | | | | | |
|
||||
| Service | 80 | 81 | 222 | 2283 | 3000 | 5000 | 5540 | 5678 | 6379 | 8001 | 8554 | 8555 | 8971 | 9000 | 9443 | 9999 | 27017 |
|
||||
|---------|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|
|
||||
| 🔥 Firefly III | ✅ | ✅ | | | | | | | | | | | | | | | |
|
||||
| 📹 Frigate | | | | | | ✅ | | | | | ✅ | ✅ | ✅ | | | | |
|
||||
| 🐙 Gitea | | | ✅ | | ✅ | | | | | | | | | | | | |
|
||||
| 📱 Immich | | | | ✅ | | | | | | | | | | | | | |
|
||||
| 🍃 MongoDB | | | | | | | | | | | | | | | | | ✅ |
|
||||
| 🔄 n8n | | | | | | | | ✅ | | | | | | | | | |
|
||||
| 🐳 Portainer | | | | | | | | | | | | | | ✅ | ✅ | | |
|
||||
| 🔴 Redis | | | | | | | ✅ | | ✅ | | | | | | | | |
|
||||
| 📊 What's Up Docker | | | | | | | | | | | | | | | | ✅ | |
|
||||
| 🗺️ WebMap | | | | | | | | | | ✅ | | | | | | | |
|
||||
|
||||
## Services
|
||||
|
||||
@@ -23,8 +24,9 @@ A collection of Docker services for a home lab environment.
|
||||
**Description:** Personal finance manager with budgeting, expense tracking, and financial insights. Includes data import capabilities and automated cron jobs for recurring transactions.
|
||||
|
||||
### 📹 Frigate
|
||||
**Ports:** 8971, 5000, 8554, 8555
|
||||
**Description:** NVR (Network Video Recorder) with real-time object detection using AI. Supports RTSP cameras, USB Coral TPU for hardware acceleration, and provides web interface for monitoring.
|
||||
**Ports:** 8971 (Web UI), 5000 (Internal API), 8554 (RTSP), 8555 (WebRTC)
|
||||
**Description:** AI-powered NVR with real-time object detection using USB Coral TPU. Features face recognition, license plate recognition, and motion detection with custom zones.
|
||||
**Configuration:** 3 cameras (achtertuin, tuinhuis, carport) via NVR at 192.168.2.26. MQTT integration with Home Assistant for automation. Recording strategy: motion/detection clips retained for 3 days, no continuous recording.
|
||||
|
||||
### 🐙 Gitea
|
||||
**Ports:** 3000 (Web), 222 (SSH)
|
||||
@@ -32,7 +34,8 @@ A collection of Docker services for a home lab environment.
|
||||
|
||||
### 📱 Immich
|
||||
**Ports:** 2283
|
||||
**Description:** Self-hosted photo and video backup solution with machine learning capabilities. Features automatic organization, face recognition, and mobile app support.
|
||||
**Description:** Self-hosted photo and video backup solution with machine learning capabilities. Features automatic organization, face recognition, and mobile app support.
|
||||
**Notes:** Healthcheck uses bash TCP probe on `localhost:2283`. Database is optimized for HDD with `DB_STORAGE_TYPE: 'HDD'`.
|
||||
|
||||
### 🍃 MongoDB
|
||||
**Ports:** 27017
|
||||
@@ -50,8 +53,10 @@ A collection of Docker services for a home lab environment.
|
||||
**Ports:** 6379 (Redis), 5540 (RedisInsight)
|
||||
**Description:** In-memory data structure store with RedisInsight for database management and monitoring. Used as cache, message broker, and session store.
|
||||
|
||||
### 👀 Watchtower
|
||||
**Description:** Automated Docker container updater that monitors running containers and automatically updates them to the latest available image versions.
|
||||
### 📊 What's Up Docker
|
||||
**Ports:** 9999
|
||||
**Description:** Web-based container update monitoring tool that tracks available updates for Docker containers. Provides a dashboard to view outdated containers and sends notifications via webhooks.
|
||||
**Notes:** Webhook configured to send update notifications to external endpoint.
|
||||
|
||||
### 🗺️ WebMap
|
||||
**Ports:** 8001
|
||||
@@ -59,13 +64,39 @@ A collection of Docker services for a home lab environment.
|
||||
|
||||
## Getting Started
|
||||
|
||||
Each service is contained in its own directory with a `compose.yaml` file. To start a service:
|
||||
### Option 1: Single Command (Recommended)
|
||||
Start all services with one command:
|
||||
|
||||
```bash
|
||||
# Start all services
|
||||
docker-compose up -d
|
||||
|
||||
# Or use the management script
|
||||
./manage.sh start
|
||||
```
|
||||
|
||||
### Option 2: Individual Services
|
||||
Each service is contained in its own directory with a `compose.yaml` file:
|
||||
|
||||
```bash
|
||||
cd <service-directory>
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
### Management Script
|
||||
Use the included `manage.sh` script for easy management:
|
||||
|
||||
```bash
|
||||
./manage.sh start # Start all services
|
||||
./manage.sh stop # Stop all services
|
||||
./manage.sh restart # Restart all services
|
||||
./manage.sh status # Show service status
|
||||
./manage.sh logs [service] # View logs
|
||||
./manage.sh update # Update and restart
|
||||
./manage.sh backup # Backup data volumes
|
||||
./manage.sh clean # Clean up unused resources
|
||||
```
|
||||
|
||||
## Requirements
|
||||
|
||||
- Docker and Docker Compose
|
||||
|
||||
10
WUD/compose.yaml
Normal file
10
WUD/compose.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
services:
|
||||
whatsupdocker:
|
||||
image: getwud/wud
|
||||
container_name: wud
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
ports:
|
||||
- 9999:3000
|
||||
environment:
|
||||
- WUD_TRIGGER_HTTP_MYREMOTEHOST_URL=https://satisfhome.duckdns.org/webhook/4865569a-ceb7-4d46-8c69-a50e39b8fa6d
|
||||
359
docker-compose.yml
Normal file
359
docker-compose.yml
Normal file
@@ -0,0 +1,359 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
# Firefly III
|
||||
firefly-app:
|
||||
image: fireflyiii/core:latest
|
||||
hostname: app
|
||||
container_name: firefly_iii_core
|
||||
networks:
|
||||
- firefly_iii
|
||||
restart: always
|
||||
volumes:
|
||||
- firefly_iii_upload:/var/www/html/storage/upload
|
||||
env_file: ./firefly/.env
|
||||
ports:
|
||||
- '80:8080'
|
||||
depends_on:
|
||||
- firefly-db
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/api/v1/about"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 60s
|
||||
|
||||
firefly-db:
|
||||
image: mariadb:lts
|
||||
hostname: db
|
||||
container_name: firefly_iii_db
|
||||
networks:
|
||||
- firefly_iii
|
||||
restart: always
|
||||
env_file: ./firefly/.db.env
|
||||
volumes:
|
||||
- firefly_iii_db:/var/lib/mysql
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
|
||||
firefly-importer:
|
||||
image: fireflyiii/data-importer:latest
|
||||
hostname: importer
|
||||
restart: always
|
||||
container_name: firefly_iii_importer
|
||||
networks:
|
||||
- firefly_iii
|
||||
ports:
|
||||
- '81:8080'
|
||||
depends_on:
|
||||
- firefly-app
|
||||
env_file: ./firefly/.importer.env
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
|
||||
firefly-cron:
|
||||
image: alpine
|
||||
container_name: firefly_iii_cron
|
||||
restart: always
|
||||
command: sh -c "
|
||||
apk add tzdata
|
||||
&& ln -s /usr/share/zoneinfo/${TZ} /etc/localtime
|
||||
| echo \"0 3 * * * wget -qO- http://app:8080/api/v1/cron/HcguQHJQpjR38uLfred;echo\"
|
||||
| crontab -
|
||||
&& crond -f -L /dev/stdout"
|
||||
networks:
|
||||
- firefly_iii
|
||||
|
||||
# Frigate
|
||||
frigate:
|
||||
container_name: frigate
|
||||
restart: unless-stopped
|
||||
stop_grace_period: 30s
|
||||
image: ghcr.io/blakeblackshear/frigate:stable
|
||||
shm_size: "512mb"
|
||||
devices:
|
||||
- /dev/bus/usb:/dev/bus/usb
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- ./frigate/config:/config
|
||||
- ./frigate/storage:/media/frigate
|
||||
- type: tmpfs
|
||||
target: /tmp/cache
|
||||
tmpfs:
|
||||
size: 3000000000
|
||||
ports:
|
||||
- "8971:8971"
|
||||
- "5000:5000"
|
||||
- "8554:8554"
|
||||
- "8555:8555/tcp"
|
||||
- "8555:8555/udp"
|
||||
environment:
|
||||
FRIGATE_RTSP_PASSWORD: "password"
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:5000/api/version"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 60s
|
||||
|
||||
# Gitea
|
||||
gitea-server:
|
||||
image: docker.gitea.com/gitea:latest
|
||||
container_name: gitea
|
||||
environment:
|
||||
- USER_UID=1000
|
||||
- USER_GID=1000
|
||||
- GITEA__database__DB_TYPE=postgres
|
||||
- GITEA__database__HOST=gitea-db:5432
|
||||
- GITEA__database__NAME=gitea
|
||||
- GITEA__database__USER=gitea
|
||||
- GITEA__database__PASSWD=gitea
|
||||
restart: always
|
||||
networks:
|
||||
- gitea
|
||||
volumes:
|
||||
- ./gitea/gitea:/data
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
ports:
|
||||
- "3000:3000"
|
||||
- "222:22"
|
||||
depends_on:
|
||||
- gitea-db
|
||||
|
||||
gitea-db:
|
||||
image: docker.io/library/postgres:14
|
||||
restart: always
|
||||
environment:
|
||||
- POSTGRES_USER=gitea
|
||||
- POSTGRES_PASSWORD=gitea
|
||||
- POSTGRES_DB=gitea
|
||||
networks:
|
||||
- gitea
|
||||
volumes:
|
||||
- ./gitea/postgres:/var/lib/postgresql/data
|
||||
|
||||
# Immich
|
||||
immich-server:
|
||||
container_name: immich_server
|
||||
image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
|
||||
volumes:
|
||||
- ${UPLOAD_LOCATION}:/data
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
env_file:
|
||||
- ./immich/.env
|
||||
ports:
|
||||
- '2283:2283'
|
||||
depends_on:
|
||||
- immich-redis
|
||||
- immich-database
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "timeout 1 bash -c '</dev/tcp/localhost/2283' || exit 1"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 60s
|
||||
labels:
|
||||
- "com.centurylinklabs.watchtower.monitor-only=true"
|
||||
|
||||
immich-machine-learning:
|
||||
container_name: immich_machine_learning
|
||||
image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
|
||||
volumes:
|
||||
- immich-model-cache:/cache
|
||||
env_file:
|
||||
- ./immich/.env
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "ps", "aux", "|", "grep", "python", "|", "grep", "-v", "grep"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 60s
|
||||
|
||||
immich-redis:
|
||||
container_name: immich_redis
|
||||
image: docker.io/valkey/valkey:8-bookworm@sha256:facc1d2c3462975c34e10fccb167bfa92b0e0dbd992fc282c29a61c3243afb11
|
||||
healthcheck:
|
||||
test: redis-cli ping || exit 1
|
||||
restart: unless-stopped
|
||||
|
||||
immich-database:
|
||||
container_name: immich_postgres
|
||||
image: ghcr.io/immich-app/postgres:14-vectorchord0.4.3-pgvectors0.2.0@sha256:32324a2f41df5de9efe1af166b7008c3f55646f8d0e00d9550c16c9822366b4a
|
||||
environment:
|
||||
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
||||
POSTGRES_USER: ${DB_USERNAME}
|
||||
POSTGRES_DB: ${DB_DATABASE_NAME}
|
||||
POSTGRES_INITDB_ARGS: '--data-checksums'
|
||||
DB_STORAGE_TYPE: 'HDD'
|
||||
volumes:
|
||||
- ${DB_DATA_LOCATION}:/var/lib/postgresql/data
|
||||
shm_size: 128mb
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${DB_USERNAME} -d ${DB_DATABASE_NAME}"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
|
||||
# MongoDB
|
||||
mongodb:
|
||||
image: mongo:6-jammy
|
||||
ports:
|
||||
- '27017:27017'
|
||||
volumes:
|
||||
- mongodb-data:/data/db
|
||||
restart: "unless-stopped"
|
||||
healthcheck:
|
||||
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
|
||||
# n8n
|
||||
n8n:
|
||||
image: docker.n8n.io/n8nio/n8n:latest
|
||||
container_name: n8n
|
||||
ports:
|
||||
- "5678:5678"
|
||||
volumes:
|
||||
- n8n-data:/home/node/.n8n
|
||||
- ./n8n/data:/data
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
- ./n8n/.env
|
||||
network_mode: "host"
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:5678/healthz"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
|
||||
# Portainer
|
||||
portainer:
|
||||
image: portainer/portainer-ce:latest
|
||||
ports:
|
||||
- 9443:9443
|
||||
- 9000:9000
|
||||
volumes:
|
||||
- portainer-data:/data
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- ./portainer/curl:/usr/local/bin/curl
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD","/usr/local/bin/curl", "http://localhost:9000/api/system/status"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
|
||||
# Redis
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: redis
|
||||
restart: unless-stopped
|
||||
command: >
|
||||
redis-server
|
||||
--requirepass Olenoob2209
|
||||
--appendonly yes
|
||||
ports:
|
||||
- "6379:6379"
|
||||
volumes:
|
||||
- redis-data:/data
|
||||
environment:
|
||||
- REDIS_PASSWORD=Olenoob2209
|
||||
networks:
|
||||
- redis-net
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "-a", "Olenoob2209", "ping"]
|
||||
interval: 10s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
start_period: 5s
|
||||
|
||||
redisinsight:
|
||||
image: redislabs/redisinsight:2.70
|
||||
container_name: redisinsight
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "5540:5540"
|
||||
networks:
|
||||
- redis-net
|
||||
volumes:
|
||||
- redisinsight-data:/db
|
||||
|
||||
# What's Up Docker
|
||||
whatsupdocker:
|
||||
image: getwud/wud
|
||||
container_name: wud
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
ports:
|
||||
- 9999:3000
|
||||
environment:
|
||||
- WUD_TRIGGER_HTTP_MYREMOTEHOST_URL=https://satisfhome.duckdns.org/webhook/4865569a-ceb7-4d46-8c69-a50e39b8fa6d
|
||||
|
||||
# WebMap
|
||||
nmap:
|
||||
image: instrumentisto/nmap
|
||||
container_name: nmap
|
||||
command: -sT -A -T3 -oX tmp/myscan.xml 192.168.2.0/24
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
volumes:
|
||||
- ./webmap/webmap:/tmp
|
||||
network_mode: host
|
||||
environment:
|
||||
- PUID=1000
|
||||
- PGID=100
|
||||
|
||||
webmap:
|
||||
container_name: webmap
|
||||
hostname: webmap
|
||||
ports:
|
||||
- '8001:8000'
|
||||
volumes:
|
||||
- ./webmap/webmap:/opt/xml
|
||||
image: reborntc/webmap
|
||||
environment:
|
||||
- PUID=1000
|
||||
- PGID=100
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8000"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
|
||||
volumes:
|
||||
firefly_iii_upload:
|
||||
firefly_iii_db:
|
||||
immich-model-cache:
|
||||
mongodb-data:
|
||||
n8n-data:
|
||||
portainer-data:
|
||||
redis-data:
|
||||
redisinsight-data:
|
||||
|
||||
networks:
|
||||
firefly_iii:
|
||||
driver: bridge
|
||||
gitea:
|
||||
driver: bridge
|
||||
redis-net:
|
||||
driver: bridge
|
||||
@@ -29,11 +29,13 @@ services:
|
||||
- database
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:2283/health"]
|
||||
test: ["CMD-SHELL", "timeout 1 bash -c '</dev/tcp/localhost/2283' || exit 1"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 60s
|
||||
labels:
|
||||
- "com.centurylinklabs.watchtower.monitor-only=true"
|
||||
|
||||
immich-machine-learning:
|
||||
container_name: immich_machine_learning
|
||||
@@ -54,6 +56,8 @@ services:
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 60s
|
||||
labels:
|
||||
- "com.centurylinklabs.watchtower.monitor-only=true"
|
||||
|
||||
redis:
|
||||
container_name: immich_redis
|
||||
@@ -71,7 +75,7 @@ services:
|
||||
POSTGRES_DB: ${DB_DATABASE_NAME}
|
||||
POSTGRES_INITDB_ARGS: '--data-checksums'
|
||||
# Uncomment the DB_STORAGE_TYPE: 'HDD' var if your database isn't stored on SSDs
|
||||
# DB_STORAGE_TYPE: 'HDD'
|
||||
DB_STORAGE_TYPE: 'HDD'
|
||||
volumes:
|
||||
# Do not edit the next line. If you want to change the database storage location on your system, edit the value of DB_DATA_LOCATION in the .env file
|
||||
- ${DB_DATA_LOCATION}:/var/lib/postgresql/data
|
||||
@@ -85,4 +89,4 @@ services:
|
||||
start_period: 40s
|
||||
|
||||
volumes:
|
||||
model-cache:
|
||||
model-cache:
|
||||
195
manage.sh
Normal file
195
manage.sh
Normal file
@@ -0,0 +1,195 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Homelab Docker Management Script
|
||||
|
||||
set -e
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Function to print colored output
|
||||
print_status() {
|
||||
echo -e "${BLUE}[INFO]${NC} $1"
|
||||
}
|
||||
|
||||
print_success() {
|
||||
echo -e "${GREEN}[SUCCESS]${NC} $1"
|
||||
}
|
||||
|
||||
print_warning() {
|
||||
echo -e "${YELLOW}[WARNING]${NC} $1"
|
||||
}
|
||||
|
||||
print_error() {
|
||||
echo -e "${RED}[ERROR]${NC} $1"
|
||||
}
|
||||
|
||||
# Function to show help
|
||||
show_help() {
|
||||
echo "Homelab Docker Management Script"
|
||||
echo ""
|
||||
echo "Usage: $0 [COMMAND] [SERVICE]"
|
||||
echo ""
|
||||
echo "Commands:"
|
||||
echo " start [service] Start all services or specific service"
|
||||
echo " stop [service] Stop all services or specific service"
|
||||
echo " restart [service] Restart all services or specific service"
|
||||
echo " status Show status of all services"
|
||||
echo " logs [service] Show logs for all services or specific service"
|
||||
echo " update Pull latest images and restart services"
|
||||
echo " clean Remove unused containers, networks, and images"
|
||||
echo " backup Backup important data volumes"
|
||||
echo " help Show this help message"
|
||||
echo ""
|
||||
echo "Services:"
|
||||
echo " firefly, frigate, gitea, immich, mongodb, n8n, portainer, redis, wud, webmap"
|
||||
echo ""
|
||||
echo "Examples:"
|
||||
echo " $0 start # Start all services"
|
||||
echo " $0 start frigate # Start only Frigate"
|
||||
echo " $0 logs immich # Show Immich logs"
|
||||
echo " $0 restart firefly # Restart Firefly III"
|
||||
}
|
||||
|
||||
# Function to start services
|
||||
start_services() {
|
||||
local service=$1
|
||||
if [ -z "$service" ]; then
|
||||
print_status "Starting all homelab services..."
|
||||
docker-compose up -d
|
||||
print_success "All services started!"
|
||||
else
|
||||
print_status "Starting $service..."
|
||||
docker-compose up -d $service
|
||||
print_success "$service started!"
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to stop services
|
||||
stop_services() {
|
||||
local service=$1
|
||||
if [ -z "$service" ]; then
|
||||
print_status "Stopping all homelab services..."
|
||||
docker-compose down
|
||||
print_success "All services stopped!"
|
||||
else
|
||||
print_status "Stopping $service..."
|
||||
docker-compose stop $service
|
||||
print_success "$service stopped!"
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to restart services
|
||||
restart_services() {
|
||||
local service=$1
|
||||
if [ -z "$service" ]; then
|
||||
print_status "Restarting all homelab services..."
|
||||
docker-compose restart
|
||||
print_success "All services restarted!"
|
||||
else
|
||||
print_status "Restarting $service..."
|
||||
docker-compose restart $service
|
||||
print_success "$service restarted!"
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to show status
|
||||
show_status() {
|
||||
print_status "Homelab services status:"
|
||||
echo ""
|
||||
docker-compose ps
|
||||
echo ""
|
||||
print_status "Resource usage:"
|
||||
docker stats --no-stream --format "table {{.Container}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.NetIO}}\t{{.BlockIO}}"
|
||||
}
|
||||
|
||||
# Function to show logs
|
||||
show_logs() {
|
||||
local service=$1
|
||||
if [ -z "$service" ]; then
|
||||
print_status "Showing logs for all services (last 50 lines each)..."
|
||||
docker-compose logs --tail=50
|
||||
else
|
||||
print_status "Showing logs for $service..."
|
||||
docker-compose logs -f $service
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to update services
|
||||
update_services() {
|
||||
print_status "Updating homelab services..."
|
||||
docker-compose pull
|
||||
docker-compose up -d
|
||||
print_success "Services updated and restarted!"
|
||||
}
|
||||
|
||||
# Function to clean up
|
||||
clean_up() {
|
||||
print_warning "This will remove unused containers, networks, and images."
|
||||
read -p "Are you sure? (y/N): " -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
print_status "Cleaning up Docker resources..."
|
||||
docker system prune -f
|
||||
docker volume prune -f
|
||||
print_success "Cleanup completed!"
|
||||
else
|
||||
print_status "Cleanup cancelled."
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to backup data
|
||||
backup_data() {
|
||||
local backup_dir="./backups/$(date +%Y%m%d_%H%M%S)"
|
||||
print_status "Creating backup in $backup_dir..."
|
||||
|
||||
mkdir -p "$backup_dir"
|
||||
|
||||
# Backup important volumes
|
||||
docker run --rm -v firefly_iii_db:/data -v "$(pwd)/$backup_dir":/backup alpine tar czf /backup/firefly_db.tar.gz -C /data .
|
||||
docker run --rm -v mongodb-data:/data -v "$(pwd)/$backup_dir":/backup alpine tar czf /backup/mongodb.tar.gz -C /data .
|
||||
docker run --rm -v redis-data:/data -v "$(pwd)/$backup_dir":/backup alpine tar czf /backup/redis.tar.gz -C /data .
|
||||
|
||||
print_success "Backup completed in $backup_dir"
|
||||
}
|
||||
|
||||
# Main script logic
|
||||
case "$1" in
|
||||
start)
|
||||
start_services "$2"
|
||||
;;
|
||||
stop)
|
||||
stop_services "$2"
|
||||
;;
|
||||
restart)
|
||||
restart_services "$2"
|
||||
;;
|
||||
status)
|
||||
show_status
|
||||
;;
|
||||
logs)
|
||||
show_logs "$2"
|
||||
;;
|
||||
update)
|
||||
update_services
|
||||
;;
|
||||
clean)
|
||||
clean_up
|
||||
;;
|
||||
backup)
|
||||
backup_data
|
||||
;;
|
||||
help|--help|-h)
|
||||
show_help
|
||||
;;
|
||||
*)
|
||||
print_error "Unknown command: $1"
|
||||
echo ""
|
||||
show_help
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -1,35 +0,0 @@
|
||||
services:
|
||||
watchtower:
|
||||
image: containrrr/watchtower
|
||||
container_name: watchtower
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
environment:
|
||||
WATCHTOWER_CLEANUP: "true"
|
||||
WATCHTOWER_POLL_INTERVAL: 86400
|
||||
WATCHTOWER_NOTIFICATION_REPORT: "true"
|
||||
WATCHTOWER_NOTIFICATION_URL: >
|
||||
generic+http://192.168.2.158:8123/api/webhook/-skoZVzhPaZcecNZaigi9Np1B?template=json
|
||||
WATCHTOWER_NOTIFICATION_TEMPLATE: |
|
||||
{"title":"Watchtower","message":"
|
||||
{{- if .Report -}}
|
||||
{{- with .Report -}}
|
||||
{{len .Scanned}} Scanned, {{len .Updated}} Updated, {{len .Failed}} Failed
|
||||
{{- range .Updated}}
|
||||
- {{.Name}} ({{.ImageName}}): {{.CurrentImageID.ShortID}} updated to {{.LatestImageID.ShortID}}
|
||||
{{- end -}}
|
||||
{{- range .Fresh}}
|
||||
- {{.Name}} ({{.ImageName}}): {{.State}}
|
||||
{{- end -}}
|
||||
{{- range .Skipped}}
|
||||
- {{.Name}} ({{.ImageName}}): {{.State}}: {{.Error}}
|
||||
{{- end -}}
|
||||
{{- range .Failed}}
|
||||
- {{.Name}} ({{.ImageName}}): {{.State}}: {{.Error}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{range .Entries -}}{{.Message}}\n{{- end -}}
|
||||
{{- end -}}"
|
||||
}
|
||||
Reference in New Issue
Block a user