updates and reset-perm scripts
This commit is contained in:
1 parent
be6b08ceab
commit
3f4030fd96
22 files changed
+19
-1091
No files matched your search
@@ -1,6 +0,0 @@
|
||||
robocopy C:\Docker_data\minecraft \\NAS\public\Minecraft\docker-backup /z /s /r:2 /copy:dt /w:2 /purge
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
# Docker Configuration
|
||||
|
||||
Docker and Docker Compose setup files.
|
||||
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
This directory contains Docker installation scripts and compose file examples.
|
||||
|
||||
## Installation Scripts
|
||||
|
||||
| Script | Platform |
|
||||
|--------|----------|
|
||||
| `install_docker_debian.sh` | Debian/Ubuntu |
|
||||
| `install_docker_ubuntu.sh` | Ubuntu only |
|
||||
|
||||
## Docker Compose Examples
|
||||
|
||||
| File | Service |
|
||||
|------|---------|
|
||||
| `jellyfin-docker-compose.yml` | Media server |
|
||||
| `portainer/portainer-installscript.sh` | Container management |
|
||||
| `portainer/update-portainer.sh` | Update Portainer |
|
||||
|
||||
## Portainer
|
||||
|
||||
### Install
|
||||
|
||||
```bash
|
||||
# Run the install script
|
||||
sudo ./docker/portainer/portainer-installscript.sh
|
||||
```
|
||||
|
||||
Manually:
|
||||
```bash
|
||||
docker volume create portainer_data
|
||||
docker run -d -p 8099:8000 -p 9443:9443 \
|
||||
--name portainer \
|
||||
--restart=always \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-v portainer_data:/data \
|
||||
portainer/portainer-ce:latest
|
||||
```
|
||||
|
||||
### Update
|
||||
|
||||
```bash
|
||||
docker stop portainer
|
||||
docker rm portainer
|
||||
docker pull portainer/portainer-ce:latest
|
||||
./docker/portainer/update-portainer.sh
|
||||
```
|
||||
|
||||
## Jellyfin
|
||||
|
||||
See `docker/jellyfin-docker-compose.yml` for the full compose file.
|
||||
|
||||
**Ports:**
|
||||
- `8096` — HTTP
|
||||
- `8920` — HTTPS (optional)
|
||||
- `7359/1900` — UPnP (optional)
|
||||
|
||||
**Edit before running:**
|
||||
- Volume paths for config, cache, media
|
||||
- `JELLYFIN_PublishedServerUrl` for your domain
|
||||
|
||||
## Notes
|
||||
|
||||
- Run Docker installation as root
|
||||
- Add user to docker group after install: `sudo usermod -aG docker $USER`
|
||||
- Log out and back in for group changes
|
||||
@@ -1,6 +0,0 @@
|
||||
# Gluetun
|
||||
# Never commit real environment files with secrets
|
||||
.env
|
||||
*.env
|
||||
!.gitkeep
|
||||
!gluetun.env.example
|
||||
@@ -1,62 +0,0 @@
|
||||
# === Gluetun Environment Configuration ===
|
||||
# Copy this file to .env and fill in your actual values.
|
||||
# DO NOT commit the .env file — it contains sensitive credentials.
|
||||
|
||||
PUID=1000
|
||||
PGID=1000
|
||||
VPN_PROVIDER=mullvad
|
||||
|
||||
# Mullvad account number (NOT committed here)
|
||||
MULLVAD_KEY=YOUR_MULLVAD_KEY_HERE
|
||||
|
||||
TZ=America/Chicago
|
||||
|
||||
# WireGuard private key (NOT committed here — generated by Gluetun or your VPN provider)
|
||||
WIREGUARD_KEY=YOUR_WIREGUARD_KEY_HERE
|
||||
WIREGUARD_ADD=10.8.0.2/32
|
||||
VPN_SERVER_CITIES=Atlanta
|
||||
WIREGUARD_MTU=1200
|
||||
|
||||
LOCAL_LAN=10.0.0.0/16
|
||||
PUBLICIP_API=https://api.ipify.org
|
||||
PUBLICIP_TOKEN=
|
||||
|
||||
# === Media Service API Keys ===
|
||||
# Get these from each service's settings page.
|
||||
SONARR_KEY=YOUR_SONARR_KEY_HERE
|
||||
RADARR_KEY=YOUR_RADARR_KEY_HERE
|
||||
LIDARR_KEY=YOUR_LIDARR_KEY_HERE
|
||||
READARR_KEY=YOUR_READARR_KEY_HERE
|
||||
|
||||
# === Application Credentials ===
|
||||
QBIT_USER=admin
|
||||
QBIT_PASS=USE_PASSWORD_MANAGER_HERE
|
||||
JELLYSTATDB_USER=postgres
|
||||
JELLYSTATDB_PASS=USE_PASSWORD_MANAGER_HERE
|
||||
JWT_SECRET=GENERATE_RANDOM_SECRET_HERE
|
||||
|
||||
# === Network ===
|
||||
RADARR_IPV4=172.20.0.10
|
||||
SONARR_IPV4=172.20.0.11
|
||||
BASE_PATH=/home/traver/docker/
|
||||
MEDIA_SHARE=/mnt/nasmedia
|
||||
TRANSCODE_PATH=/mnt/nasmedia/transcode
|
||||
|
||||
# === Transmission ===
|
||||
TRANSMISSION_USERNAME=admin
|
||||
TRANSMISSION_PASSWORD=USE_PASSWORD_MANAGER_HERE
|
||||
|
||||
# === qBittorrent ===
|
||||
QBITTORRENT_USERNAME=admin
|
||||
QBITTORRENT_PASSWORD=USE_PASSWORD_MANAGER_HERE
|
||||
|
||||
# === Jellystat ===
|
||||
JELLYSTAT_DB_USER=jellystat
|
||||
JELLYSTAT_DB_PASSWORD=USE_PASSWORD_MANAGER_HERE
|
||||
JELLYSTAT_DB_NAME=jellystat
|
||||
|
||||
# === Jellyfin ===
|
||||
JELLYFIN_URL=http://10.0.85.47:8096
|
||||
|
||||
# === Whisparr ===
|
||||
WHISPARR_API_KEY=YOUR_WHISPARR_API_KEY_HERE
|
||||
@@ -1,179 +0,0 @@
|
||||
services:
|
||||
vulnerability-tests:
|
||||
image: greenbone/vulnerability-tests
|
||||
environment:
|
||||
STORAGE_PATH: /var/lib/openvas/22.04/vt-data/nasl
|
||||
volumes:
|
||||
- vt_data_vol:/mnt
|
||||
|
||||
notus-data:
|
||||
image: greenbone/notus-data
|
||||
volumes:
|
||||
- notus_data_vol:/mnt
|
||||
|
||||
scap-data:
|
||||
image: greenbone/scap-data
|
||||
volumes:
|
||||
- scap_data_vol:/mnt
|
||||
|
||||
cert-bund-data:
|
||||
image: greenbone/cert-bund-data
|
||||
volumes:
|
||||
- cert_data_vol:/mnt
|
||||
|
||||
dfn-cert-data:
|
||||
image: greenbone/dfn-cert-data
|
||||
volumes:
|
||||
- cert_data_vol:/mnt
|
||||
depends_on:
|
||||
- cert-bund-data
|
||||
|
||||
data-objects:
|
||||
image: greenbone/data-objects
|
||||
volumes:
|
||||
- data_objects_vol:/mnt
|
||||
|
||||
report-formats:
|
||||
image: greenbone/report-formats
|
||||
volumes:
|
||||
- data_objects_vol:/mnt
|
||||
depends_on:
|
||||
- data-objects
|
||||
|
||||
gpg-data:
|
||||
image: greenbone/gpg-data
|
||||
volumes:
|
||||
- gpg_data_vol:/mnt
|
||||
|
||||
redis-server:
|
||||
image: greenbone/redis-server
|
||||
restart: on-failure
|
||||
volumes:
|
||||
- redis_socket_vol:/run/redis/
|
||||
|
||||
pg-gvm:
|
||||
image: greenbone/pg-gvm:stable
|
||||
restart: on-failure
|
||||
volumes:
|
||||
- psql_data_vol:/var/lib/postgresql
|
||||
- psql_socket_vol:/var/run/postgresql
|
||||
|
||||
gvmd:
|
||||
image: greenbone/gvmd:stable
|
||||
restart: on-failure
|
||||
volumes:
|
||||
- gvmd_data_vol:/var/lib/gvm
|
||||
- scap_data_vol:/var/lib/gvm/scap-data/
|
||||
- cert_data_vol:/var/lib/gvm/cert-data
|
||||
- data_objects_vol:/var/lib/gvm/data-objects/gvmd
|
||||
- vt_data_vol:/var/lib/openvas/plugins
|
||||
- psql_data_vol:/var/lib/postgresql
|
||||
- gvmd_socket_vol:/run/gvmd
|
||||
- ospd_openvas_socket_vol:/run/ospd
|
||||
- psql_socket_vol:/var/run/postgresql
|
||||
depends_on:
|
||||
pg-gvm:
|
||||
condition: service_started
|
||||
scap-data:
|
||||
condition: service_completed_successfully
|
||||
cert-bund-data:
|
||||
condition: service_completed_successfully
|
||||
dfn-cert-data:
|
||||
condition: service_completed_successfully
|
||||
data-objects:
|
||||
condition: service_completed_successfully
|
||||
report-formats:
|
||||
condition: service_completed_successfully
|
||||
|
||||
gsa:
|
||||
image: greenbone/gsa:stable
|
||||
restart: on-failure
|
||||
ports:
|
||||
- 127.0.0.1:9392:80
|
||||
volumes:
|
||||
- gvmd_socket_vol:/run/gvmd
|
||||
depends_on:
|
||||
- gvmd
|
||||
|
||||
ospd-openvas:
|
||||
image: greenbone/ospd-openvas:stable
|
||||
restart: on-failure
|
||||
hostname: ospd-openvas.local
|
||||
cap_add:
|
||||
- NET_ADMIN # for capturing packages in promiscuous mode
|
||||
- NET_RAW # for raw sockets e.g. used for the boreas alive detection
|
||||
security_opt:
|
||||
- seccomp=unconfined
|
||||
- apparmor=unconfined
|
||||
command:
|
||||
[
|
||||
"ospd-openvas",
|
||||
"-f",
|
||||
"--config",
|
||||
"/etc/gvm/ospd-openvas.conf",
|
||||
"--mqtt-broker-address",
|
||||
"mqtt-broker",
|
||||
"--notus-feed-dir",
|
||||
"/var/lib/notus/advisories",
|
||||
"-m",
|
||||
"666"
|
||||
]
|
||||
volumes:
|
||||
- gpg_data_vol:/etc/openvas/gnupg
|
||||
- vt_data_vol:/var/lib/openvas/plugins
|
||||
- notus_data_vol:/var/lib/notus
|
||||
- ospd_openvas_socket_vol:/run/ospd
|
||||
- redis_socket_vol:/run/redis/
|
||||
depends_on:
|
||||
redis-server:
|
||||
condition: service_started
|
||||
gpg-data:
|
||||
condition: service_completed_successfully
|
||||
vulnerability-tests:
|
||||
condition: service_completed_successfully
|
||||
|
||||
mqtt-broker:
|
||||
restart: on-failure
|
||||
image: greenbone/mqtt-broker
|
||||
networks:
|
||||
default:
|
||||
aliases:
|
||||
- mqtt-broker
|
||||
- broker
|
||||
|
||||
notus-scanner:
|
||||
restart: on-failure
|
||||
image: greenbone/notus-scanner:stable
|
||||
volumes:
|
||||
- notus_data_vol:/var/lib/notus
|
||||
- gpg_data_vol:/etc/openvas/gnupg
|
||||
environment:
|
||||
NOTUS_SCANNER_MQTT_BROKER_ADDRESS: mqtt-broker
|
||||
NOTUS_SCANNER_PRODUCTS_DIRECTORY: /var/lib/notus/products
|
||||
depends_on:
|
||||
- mqtt-broker
|
||||
- gpg-data
|
||||
- vulnerability-tests
|
||||
|
||||
gvm-tools:
|
||||
image: greenbone/gvm-tools
|
||||
volumes:
|
||||
- gvmd_socket_vol:/run/gvmd
|
||||
- ospd_openvas_socket_vol:/run/ospd
|
||||
depends_on:
|
||||
- gvmd
|
||||
- ospd-openvas
|
||||
|
||||
volumes:
|
||||
gpg_data_vol:
|
||||
scap_data_vol:
|
||||
cert_data_vol:
|
||||
data_objects_vol:
|
||||
gvmd_data_vol:
|
||||
psql_data_vol:
|
||||
vt_data_vol:
|
||||
notus_data_vol:
|
||||
psql_socket_vol:
|
||||
gvmd_socket_vol:
|
||||
ospd_openvas_socket_vol:
|
||||
redis_socket_vol:
|
||||
@@ -1,28 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Remove previous conflicting packages
|
||||
for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do
|
||||
sudo apt remove "$pkg" -y
|
||||
done
|
||||
|
||||
#updates, setup souces and install.
|
||||
sudo install -m 0755 -d /etc/apt/keyrings
|
||||
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
||||
sudo chmod a+r /etc/apt/keyrings/docker.gpg
|
||||
echo \
|
||||
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
|
||||
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
|
||||
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
sudo apt update
|
||||
|
||||
#install docker
|
||||
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin -y
|
||||
|
||||
# Add user to docker group
|
||||
sudo usermod -aG docker "$USER"
|
||||
echo "[*] Added $USER to docker group."
|
||||
echo "[!] Log out and log back in for Docker group changes to take effect."
|
||||
|
||||
# create download dir:
|
||||
export DOWNLOAD_DIR=$HOME/greenbone-community-container && mkdir -p $DOWNLOAD_DIR
|
||||
@@ -1,2 +0,0 @@
|
||||
#!/bin/bash
|
||||
curl -f -O https://greenbone.github.io/docs/latest/_static/setup-and-start-greenbone-community-edition.sh && chmod u+x setup-and-start-greenbone-community-edition.sh
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Update the package index
|
||||
sudo apt update
|
||||
|
||||
# Install prerequisites
|
||||
sudo apt install -y ca-certificates curl gnupg lsb-release
|
||||
|
||||
# Add Docker's official GPG key
|
||||
sudo install -m 0755 -d /etc/apt/keyrings
|
||||
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
||||
sudo chmod a+r /etc/apt/keyrings/docker.gpg
|
||||
|
||||
# Set up the Docker repository
|
||||
CODENAME=$(lsb_release -cs)
|
||||
echo \
|
||||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
|
||||
$CODENAME stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
|
||||
# Update the package index again
|
||||
sudo apt update
|
||||
|
||||
# Install Docker Engine, CLI, and containerd
|
||||
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
||||
|
||||
# Optional: Add the current user to the Docker group
|
||||
if [ "$USER" != "root" ]; then
|
||||
echo "Adding user $USER to the Docker group. Log out and log back in to apply the changes."
|
||||
sudo usermod -aG docker $USER
|
||||
fi
|
||||
|
||||
# Done
|
||||
echo "Docker has been installed successfully!"
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Update package lists and install dependencies
|
||||
sudo apt update
|
||||
sudo apt-get install libffi-dev libssl-dev python3-dev python3-pip -y
|
||||
|
||||
# Script install docker
|
||||
curl -fsSL https://get.docker.com -o get-docker.sh
|
||||
sh get-docker.sh
|
||||
|
||||
# Script: install_docker_compose.sh
|
||||
# Description: Script to install Docker Compose and its dependencies on Linux
|
||||
|
||||
# Install Docker Compose (v2) binary (standalone method)
|
||||
DOCKER_COMPOSE_VERSION=2.27.0
|
||||
sudo curl -L --fail "https://github.com/docker/compose/releases/download/v${DOCKER_COMPOSE_VERSION}/docker-compose-linux-x86_64" \
|
||||
-o /usr/local/bin/docker-compose
|
||||
sudo chmod +x /usr/local/bin/docker-compose
|
||||
|
||||
# Check if Docker Compose installation was successful
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Docker Compose is installed and ready to use."
|
||||
else
|
||||
echo "Failed to install Docker Compose."
|
||||
fi
|
||||
@@ -1,25 +0,0 @@
|
||||
GNU nano 6.2 docker-compose.yml
|
||||
version: "3.5"
|
||||
services:
|
||||
jellyfin:
|
||||
image: ghcr.io/linuxserver/jellyfin:latest
|
||||
# image: ghcr.io/linuxserver/jellyfin:arm64v8-10.8.12
|
||||
container_name: jellyfin
|
||||
network_mode: "bridge"
|
||||
volumes:
|
||||
- /home/traver/docker/jellyfin/config:/config
|
||||
- /home/traver/docker/jellyfin/cache:/cache
|
||||
- /media/nasmedia:/media
|
||||
restart: "unless-stopped"
|
||||
# Optional - alternative address used for autodiscovery
|
||||
environment:
|
||||
- JELLYFIN_PublishedServerUrl=http://docker2
|
||||
ports:
|
||||
- 8096:8096
|
||||
- 8920:8920 #optional
|
||||
- 7359:7359/udp #optional
|
||||
- 1900:1900/udp #optional
|
||||
#group_add:
|
||||
# - "109" # Change this to match your "render" host group id and remove this comment
|
||||
devices:
|
||||
- /dev/dri/renderD128:/dev/dri/renderD128
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Script: setup_portainer.sh
|
||||
# Description: Script to set up Portainer using Docker on Linux
|
||||
|
||||
# Variables
|
||||
PORTAINER_PORT=8099
|
||||
DOCKER_SOCK=/var/run/docker.sock
|
||||
|
||||
# Create the portainer volume
|
||||
docker volume create portainer_data
|
||||
|
||||
# Download and create portainer container
|
||||
docker run -d -p $PORTAINER_PORT:8000 -p 9443:9443 --name portainer --restart=always -v $DOCKER_SOCK:$DOCKER_SOCK -v portainer_data:/data portainer/portainer-ce:latest
|
||||
|
||||
# Check if the container started successfully
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Portainer container is up and running."
|
||||
else
|
||||
echo "Failed to start Portainer container."
|
||||
fi
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/bin/bash
|
||||
docker stop portainer
|
||||
docker rm portainer
|
||||
docker pull portainer/portainer-ce:latest
|
||||
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo "=================================================="
|
||||
echo " WickedYoda System Update & Docker Cleanup"
|
||||
echo " Started: $(date)"
|
||||
echo "=================================================="
|
||||
|
||||
#
|
||||
# Step 1 - Update local setup scripts from GitHub
|
||||
#
|
||||
echo
|
||||
echo "==> Updating setup scripts from GitHub..."
|
||||
curl -fsSL https://raw.githubusercontent.com/wickedyoda/public-setupfiles/refs/heads/main/update-from_repo.sh | sudo bash
|
||||
|
||||
#
|
||||
# Step 2 - Run the update script
|
||||
#
|
||||
echo
|
||||
echo "==> Running system update..."
|
||||
sudo ./public-setupfiles/updates_scripts/updates.sh
|
||||
|
||||
#
|
||||
# Step 3 - Remove unused Docker images
|
||||
#
|
||||
echo
|
||||
echo "==> Pruning unused Docker images..."
|
||||
docker image prune -af
|
||||
|
||||
#
|
||||
# Step 4 - Remove unused Docker networks
|
||||
#
|
||||
echo
|
||||
echo "==> Pruning unused Docker networks..."
|
||||
docker network prune -f
|
||||
|
||||
#
|
||||
# Step 5 - Remove stopped containers
|
||||
#
|
||||
echo
|
||||
echo "==> Pruning stopped Docker containers..."
|
||||
docker container prune -f
|
||||
|
||||
#
|
||||
# Step 6 - Remove unused build cache
|
||||
#
|
||||
echo
|
||||
echo "==> Pruning Docker build cache..."
|
||||
docker builder prune -af
|
||||
|
||||
echo
|
||||
echo "=================================================="
|
||||
echo " Update and cleanup completed successfully!"
|
||||
echo " Finished: $(date)"
|
||||
echo "=================================================="
|
||||
@@ -1,213 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Docker installer for Debian 12 (bookworm) and Debian 13 (trixie).
|
||||
# Installs Docker Engine, CLI, containerd, Buildx, and Docker Compose plugin.
|
||||
# Optionally configures unattended upgrades for Docker packages.
|
||||
|
||||
SCRIPT_NAME="$(basename "$0")"
|
||||
AUTO_UPDATES=true
|
||||
|
||||
log() {
|
||||
printf "[%s] %s\n" "$(date +"%Y-%m-%d %H:%M:%S")" "$*"
|
||||
}
|
||||
|
||||
die() {
|
||||
printf "Error: %s\n" "$*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
Usage: sudo ./${SCRIPT_NAME} [options]
|
||||
|
||||
Options:
|
||||
--no-auto-updates Do not configure unattended-upgrades for Docker packages
|
||||
--auto-updates Configure unattended-upgrades for Docker packages (default)
|
||||
-h, --help Show this help text
|
||||
|
||||
Examples:
|
||||
sudo ./${SCRIPT_NAME}
|
||||
sudo ./${SCRIPT_NAME} --no-auto-updates
|
||||
EOF
|
||||
}
|
||||
|
||||
parse_args() {
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--no-auto-updates)
|
||||
AUTO_UPDATES=false
|
||||
;;
|
||||
--auto-updates)
|
||||
AUTO_UPDATES=true
|
||||
;;
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
die "Unknown option: $1"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
require_root() {
|
||||
if [[ "${EUID}" -ne 0 ]]; then
|
||||
die "Please run as root: sudo ./${SCRIPT_NAME}"
|
||||
fi
|
||||
}
|
||||
|
||||
check_os() {
|
||||
[[ -r /etc/os-release ]] || die "Cannot read /etc/os-release"
|
||||
# shellcheck disable=SC1091
|
||||
source /etc/os-release
|
||||
|
||||
[[ "${ID:-}" == "debian" ]] || die "This script supports Debian only. Detected: ${ID:-unknown}"
|
||||
|
||||
case "${VERSION_CODENAME:-}" in
|
||||
bookworm|trixie)
|
||||
;;
|
||||
*)
|
||||
die "Unsupported Debian codename: ${VERSION_CODENAME:-unknown}. Supported: bookworm (12), trixie (13)."
|
||||
;;
|
||||
esac
|
||||
|
||||
log "Detected Debian ${VERSION_ID:-unknown} (${VERSION_CODENAME})"
|
||||
}
|
||||
|
||||
install_prereqs() {
|
||||
log "Installing prerequisite packages..."
|
||||
apt-get update
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
ca-certificates \
|
||||
curl \
|
||||
gnupg \
|
||||
lsb-release \
|
||||
apt-transport-https
|
||||
}
|
||||
|
||||
setup_docker_repo() {
|
||||
local keyring_dir="/etc/apt/keyrings"
|
||||
local keyring_file="${keyring_dir}/docker.asc"
|
||||
local repo_file="/etc/apt/sources.list.d/docker.list"
|
||||
local main_sources_file="/etc/apt/sources.list"
|
||||
local repo_line
|
||||
local arch
|
||||
arch="$(dpkg --print-architecture)"
|
||||
repo_line="deb [arch=${arch} signed-by=${keyring_file}] https://download.docker.com/linux/debian ${VERSION_CODENAME} stable"
|
||||
|
||||
log "Configuring Docker APT repository..."
|
||||
install -m 0755 -d "${keyring_dir}"
|
||||
|
||||
curl -fsSL https://download.docker.com/linux/debian/gpg -o "${keyring_file}"
|
||||
chmod a+r "${keyring_file}"
|
||||
|
||||
cat > "${repo_file}" <<EOF
|
||||
${repo_line}
|
||||
EOF
|
||||
|
||||
# Ensure the Docker repo line is present in the main sources.list as requested.
|
||||
touch "${main_sources_file}"
|
||||
if grep -Fq "https://download.docker.com/linux/debian ${VERSION_CODENAME} stable" "${main_sources_file}"; then
|
||||
log "Docker repository already present in ${main_sources_file}."
|
||||
else
|
||||
log "Adding Docker repository to ${main_sources_file}..."
|
||||
printf "\n# Docker repository\n%s\n" "${repo_line}" >> "${main_sources_file}"
|
||||
fi
|
||||
}
|
||||
|
||||
install_docker() {
|
||||
log "Installing Docker Engine and plugins..."
|
||||
apt-get update
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
docker-ce \
|
||||
docker-ce-cli \
|
||||
containerd.io \
|
||||
docker-buildx-plugin \
|
||||
docker-compose-plugin
|
||||
}
|
||||
|
||||
enable_services() {
|
||||
log "Enabling and starting Docker services..."
|
||||
systemctl enable --now docker
|
||||
systemctl enable --now containerd
|
||||
}
|
||||
|
||||
configure_user_group() {
|
||||
local target_user="${SUDO_USER:-}"
|
||||
|
||||
if ! getent group docker >/dev/null; then
|
||||
groupadd docker
|
||||
fi
|
||||
|
||||
if [[ -n "${target_user}" && "${target_user}" != "root" ]]; then
|
||||
if id -nG "${target_user}" | tr ' ' '\n' | grep -qx docker; then
|
||||
log "User '${target_user}' is already in docker group."
|
||||
else
|
||||
log "Adding user '${target_user}' to docker group..."
|
||||
usermod -aG docker "${target_user}"
|
||||
log "User '${target_user}' must log out and back in for group changes to apply."
|
||||
fi
|
||||
else
|
||||
log "No non-root sudo user detected. Skipping docker group assignment."
|
||||
fi
|
||||
}
|
||||
|
||||
configure_unattended_upgrades() {
|
||||
log "Configuring unattended-upgrades for Docker packages..."
|
||||
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y unattended-upgrades
|
||||
|
||||
local auto_file="/etc/apt/apt.conf.d/20auto-upgrades"
|
||||
local docker_upgrade_file="/etc/apt/apt.conf.d/52docker-unattended-upgrades"
|
||||
|
||||
cat > "${auto_file}" <<'EOF'
|
||||
APT::Periodic::Update-Package-Lists "1";
|
||||
APT::Periodic::Unattended-Upgrade "1";
|
||||
EOF
|
||||
|
||||
cat > "${docker_upgrade_file}" <<'EOF'
|
||||
Unattended-Upgrade::Origins-Pattern {
|
||||
"origin=Docker";
|
||||
};
|
||||
|
||||
Unattended-Upgrade::Package-Blacklist {
|
||||
};
|
||||
EOF
|
||||
|
||||
systemctl enable --now unattended-upgrades
|
||||
}
|
||||
|
||||
print_versions() {
|
||||
log "Installed versions:"
|
||||
docker --version || true
|
||||
docker compose version || true
|
||||
containerd --version || true
|
||||
}
|
||||
|
||||
main() {
|
||||
parse_args "$@"
|
||||
require_root
|
||||
check_os
|
||||
install_prereqs
|
||||
setup_docker_repo
|
||||
install_docker
|
||||
enable_services
|
||||
configure_user_group
|
||||
|
||||
if [[ "${AUTO_UPDATES}" == "true" ]]; then
|
||||
configure_unattended_upgrades
|
||||
else
|
||||
log "Skipping unattended-upgrades configuration."
|
||||
fi
|
||||
|
||||
print_versions
|
||||
|
||||
log "Docker installation complete."
|
||||
log "Test with: docker run --rm hello-world"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,199 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# setup-docker-remote-api.sh
|
||||
# Enables Docker remote API on tcp://0.0.0.0:2375 using a systemd override.
|
||||
# Optional: lock port 2375 down to a single source IP.
|
||||
#
|
||||
# Usage:
|
||||
# sudo bash setup-docker-remote-api.sh
|
||||
# sudo bash setup-docker-remote-api.sh --allow-ip 10.0.84.50
|
||||
#
|
||||
# Notes:
|
||||
# - This exposes the Docker API over unencrypted TCP.
|
||||
# - Anyone who can reach port 2375 can effectively control Docker on the host.
|
||||
# - Strongly recommended: use --allow-ip with your Uptime Kuma server IP.
|
||||
|
||||
ALLOW_IP=""
|
||||
OVERRIDE_DIR="/etc/systemd/system/docker.service.d"
|
||||
OVERRIDE_FILE="${OVERRIDE_DIR}/override.conf"
|
||||
BACKUP_SUFFIX="$(date +%Y%m%d-%H%M%S)"
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
Usage:
|
||||
sudo bash $0 [--allow-ip IP]
|
||||
|
||||
Options:
|
||||
--allow-ip IP Allow only this source IP to access TCP 2375 using iptables.
|
||||
-h, --help Show this help.
|
||||
|
||||
Examples:
|
||||
sudo bash $0
|
||||
sudo bash $0 --allow-ip 10.0.84.50
|
||||
EOF
|
||||
}
|
||||
|
||||
log() {
|
||||
echo "[INFO] $*"
|
||||
}
|
||||
|
||||
warn() {
|
||||
echo "[WARN] $*" >&2
|
||||
}
|
||||
|
||||
err() {
|
||||
echo "[ERROR] $*" >&2
|
||||
}
|
||||
|
||||
require_root() {
|
||||
if [[ "${EUID}" -ne 0 ]]; then
|
||||
err "Run this script as root or with sudo."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
parse_args() {
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--allow-ip)
|
||||
shift
|
||||
[[ $# -gt 0 ]] || { err "Missing value for --allow-ip"; exit 1; }
|
||||
ALLOW_IP="$1"
|
||||
;;
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
err "Unknown argument: $1"
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
check_prereqs() {
|
||||
command -v systemctl >/dev/null 2>&1 || { err "systemctl not found."; exit 1; }
|
||||
command -v docker >/dev/null 2>&1 || { err "docker not found."; exit 1; }
|
||||
command -v ss >/dev/null 2>&1 || { err "ss not found."; exit 1; }
|
||||
command -v curl >/dev/null 2>&1 || { err "curl not found."; exit 1; }
|
||||
|
||||
if ! systemctl list-unit-files | grep -q '^docker.service'; then
|
||||
err "docker.service not found."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
backup_existing_override() {
|
||||
mkdir -p "${OVERRIDE_DIR}"
|
||||
|
||||
if [[ -f "${OVERRIDE_FILE}" ]]; then
|
||||
cp -a "${OVERRIDE_FILE}" "${OVERRIDE_FILE}.bak.${BACKUP_SUFFIX}"
|
||||
log "Backed up existing override to ${OVERRIDE_FILE}.bak.${BACKUP_SUFFIX}"
|
||||
fi
|
||||
}
|
||||
|
||||
write_override() {
|
||||
cat > "${OVERRIDE_FILE}" <<'EOF'
|
||||
[Service]
|
||||
ExecStart=
|
||||
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2375 --containerd=/run/containerd/containerd.sock
|
||||
EOF
|
||||
|
||||
log "Wrote Docker systemd override: ${OVERRIDE_FILE}"
|
||||
}
|
||||
|
||||
reload_and_restart() {
|
||||
log "Reloading systemd..."
|
||||
systemctl daemon-reload
|
||||
|
||||
log "Restarting Docker..."
|
||||
systemctl restart docker
|
||||
|
||||
log "Checking Docker service status..."
|
||||
systemctl --no-pager --full status docker.service || true
|
||||
}
|
||||
|
||||
verify_listener() {
|
||||
log "Verifying Docker is listening on TCP 2375..."
|
||||
if ss -lntp | grep -q ':2375'; then
|
||||
ss -lntp | grep ':2375' || true
|
||||
log "Docker is listening on port 2375."
|
||||
else
|
||||
err "Docker is not listening on port 2375."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
verify_local_api() {
|
||||
log "Verifying local Docker API response..."
|
||||
if curl -fsS http://127.0.0.1:2375/version >/dev/null; then
|
||||
curl -fsS http://127.0.0.1:2375/version
|
||||
echo
|
||||
log "Local Docker API test succeeded."
|
||||
else
|
||||
err "Local Docker API test failed."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
configure_firewall() {
|
||||
if [[ -z "${ALLOW_IP}" ]]; then
|
||||
warn "No --allow-ip provided. Port 2375 will remain reachable by anything that can route to this host."
|
||||
return
|
||||
fi
|
||||
|
||||
command -v iptables >/dev/null 2>&1 || {
|
||||
warn "iptables not found. Skipping firewall rules."
|
||||
return
|
||||
}
|
||||
|
||||
log "Applying iptables rules to allow only ${ALLOW_IP} to TCP 2375..."
|
||||
|
||||
# Avoid duplicate rules
|
||||
iptables -C INPUT -p tcp -s "${ALLOW_IP}" --dport 2375 -j ACCEPT 2>/dev/null || \
|
||||
iptables -A INPUT -p tcp -s "${ALLOW_IP}" --dport 2375 -j ACCEPT
|
||||
|
||||
iptables -C INPUT -p tcp --dport 2375 -j DROP 2>/dev/null || \
|
||||
iptables -A INPUT -p tcp --dport 2375 -j DROP
|
||||
|
||||
log "iptables rules applied."
|
||||
warn "Make sure your firewall rules are saved persistently on this host."
|
||||
}
|
||||
|
||||
show_summary() {
|
||||
echo
|
||||
echo "Done."
|
||||
echo
|
||||
echo "Docker remote API should now be available at:"
|
||||
echo " tcp://$(hostname -I | awk '{print $1}'):2375"
|
||||
echo
|
||||
echo "Use this in Uptime Kuma:"
|
||||
echo " tcp://HOST_IP:2375"
|
||||
echo
|
||||
if [[ -n "${ALLOW_IP}" ]]; then
|
||||
echo "Access restricted to source IP:"
|
||||
echo " ${ALLOW_IP}"
|
||||
else
|
||||
echo "No IP restriction was applied."
|
||||
fi
|
||||
echo
|
||||
}
|
||||
|
||||
main() {
|
||||
require_root
|
||||
parse_args "$@"
|
||||
check_prereqs
|
||||
backup_existing_override
|
||||
write_override
|
||||
reload_and_restart
|
||||
verify_listener
|
||||
verify_local_api
|
||||
configure_firewall
|
||||
show_summary
|
||||
}
|
||||
|
||||
main "$@"
|
||||
+19
-30
@@ -1,38 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Define mount points and devices
|
||||
declare -A mounts=(
|
||||
["/mnt/public"]="/dev/sdc1"
|
||||
["/mnt/public-bk"]="/dev/sde1"
|
||||
["/mnt/public2"]="/dev/sdd1"
|
||||
["/mnt/public2-bk"]="/dev/sdb1"
|
||||
mounts=(
|
||||
"/mnt/backup-10t"
|
||||
"/mnt/backup-8t"
|
||||
"/mnt/hermes"
|
||||
"/mnt/primary-10t"
|
||||
"/mnt/primary-8t"
|
||||
)
|
||||
|
||||
# Ensure mount folders exist
|
||||
for dir in "${!mounts[@]}"; do
|
||||
echo "Creating $dir if needed..."
|
||||
mkdir -p "$dir"
|
||||
for dir in "${mounts[@]}"; do
|
||||
if ! mountpoint -q "$dir"; then
|
||||
echo "Error: $dir is not mounted. Mount it before running this script." >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Mount each device to its folder
|
||||
for dir in "${!mounts[@]}"; do
|
||||
device="${mounts[$dir]}"
|
||||
echo "Mounting $device to $dir..."
|
||||
mount "$device" "$dir"
|
||||
echo "Setting chmod 777 on all mount contents..."
|
||||
for dir in "${mounts[@]}"; do
|
||||
echo "Processing $dir..."
|
||||
if ! chmod -R 777 "$dir"; then
|
||||
echo "Error: failed to set permissions on $dir." >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Bind mount for timeshift folders
|
||||
echo "Creating timeshift bind mounts..."
|
||||
mkdir -p /mnt/timeshift /mnt/timeshift1
|
||||
mount --bind /mnt/public2 /mnt/timeshift
|
||||
mount --bind /mnt/public2-bk /mnt/timeshift1
|
||||
|
||||
# Apply root ownership and full permissions
|
||||
echo "Setting root:root ownership and chmod 777..."
|
||||
for path in /mnt/public /mnt/public-bk /mnt/public2 /mnt/public2-bk /mnt/timeshift /mnt/timeshift1; do
|
||||
echo "Processing $path..."
|
||||
chown -R root:root "$path"
|
||||
chmod -R 777 "$path"
|
||||
done
|
||||
|
||||
echo "All mounts and permissions applied successfully."
|
||||
echo "All permissions applied successfully."
|
||||
@@ -1,30 +0,0 @@
|
||||
#!/bin/bash
|
||||
for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done
|
||||
# Remove docker.io, docker-doc, docker-compose, podman-docker, containerd, runc
|
||||
sudo apt-get purge docker.io docker-doc docker-compose podman-docker containerd runc
|
||||
|
||||
# update repos
|
||||
sudo apt-get update
|
||||
|
||||
# install dependencies
|
||||
sudo apt-get install ca-certificates curl -y
|
||||
sudo install -m 0755 -d /etc/apt/trusted.gpg.d
|
||||
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/docker.gpg
|
||||
|
||||
# Add docker repo to apt/sources.list.d
|
||||
echo \
|
||||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/trusted.gpg.d/docker.gpg] https://download.docker.com/linux/ubuntu \
|
||||
$(lsb_release -cs) stable" | \
|
||||
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
|
||||
# run apt update
|
||||
sudo apt-get update
|
||||
|
||||
# Install docker and docker-compose
|
||||
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
|
||||
|
||||
# adduser traver to docker
|
||||
sudo adduser $USER docker
|
||||
|
||||
# echo done
|
||||
echo "Install complete, please reboot"
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/bin/bash
|
||||
docker run -d \
|
||||
--name netdata \
|
||||
--hostname docker3 \
|
||||
--pid host \
|
||||
--network host \
|
||||
--restart unless-stopped \
|
||||
--cap-add SYS_PTRACE \
|
||||
--cap-add SYS_ADMIN \
|
||||
--security-opt apparmor=unconfined \
|
||||
-v /root/docker/netdata/config:/etc/netdata \
|
||||
-v /root/docker/netdata/lib:/var/lib/netdata \
|
||||
-v /root/docker/netdata/cache:/var/cache/netdata \
|
||||
-v /:/host/root:ro,rslave \
|
||||
-v /etc/passwd:/host/etc/passwd:ro \
|
||||
-v /etc/group:/host/etc/group:ro \
|
||||
-v /etc/localtime:/etc/localtime:ro \
|
||||
-v /proc:/host/proc:ro \
|
||||
-v /sys:/host/sys:ro \
|
||||
-v /etc/os-release:/host/etc/os-release:ro \
|
||||
-v /var/log:/host/var/log:ro \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock:ro \
|
||||
-v /run/dbus:/run/dbus:ro \
|
||||
netdata/netdata
|
||||
@@ -1,15 +0,0 @@
|
||||
FROM python:3.12-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY requirements.txt /app/requirements.txt
|
||||
RUN pip install --no-cache-dir -r /app/requirements.txt
|
||||
|
||||
COPY uptime-bot.py /app/uptime-bot.py
|
||||
COPY config.yml /app/config.yml
|
||||
COPY container-monitor-map.yaml /app/container-monitor-map.yaml
|
||||
|
||||
ENV UPTIME_BOT_CONFIG=/app/config.yml
|
||||
ENV UPTIME_BOT_MAP=/app/container-monitor-map.yaml
|
||||
|
||||
CMD ["python", "/app/uptime-bot.py"]
|
||||
@@ -1,14 +0,0 @@
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
watchtower-with-uptime-bot:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: watchtower-embedded/Dockerfile.watchtower-with-uptime-bot
|
||||
container_name: watchtower-with-uptime-bot
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- ./config.yml:/opt/uptime-bot/config.yml:ro
|
||||
- ./container-monitor-map.yaml:/opt/uptime-bot/container-monitor-map.yaml:ro
|
||||
command: --interval 300 --cleanup
|
||||
@@ -1,23 +0,0 @@
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
watchtower:
|
||||
image: containrrr/watchtower:latest
|
||||
container_name: watchtower
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
command: --interval 300 --cleanup
|
||||
|
||||
uptime-sync-bot:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: uptime-sync-bot
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./config.yml:/app/config.yml:ro
|
||||
- ./container-monitor-map.yaml:/app/container-monitor-map.yaml:ro
|
||||
environment:
|
||||
- UPTIME_BOT_CONFIG=/app/config.yml
|
||||
- UPTIME_BOT_MAP=/app/container-monitor-map.yaml
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
FROM containrrr/watchtower:latest
|
||||
|
||||
USER root
|
||||
|
||||
RUN apk add --no-cache python3 py3-pip
|
||||
|
||||
WORKDIR /opt/uptime-bot
|
||||
|
||||
COPY requirements.txt /opt/uptime-bot/requirements.txt
|
||||
RUN pip3 install --no-cache-dir -r /opt/uptime-bot/requirements.txt
|
||||
|
||||
COPY uptime-bot.py /opt/uptime-bot/uptime-bot.py
|
||||
COPY config.yml /opt/uptime-bot/config.yml
|
||||
COPY container-monitor-map.yaml /opt/uptime-bot/container-monitor-map.yaml
|
||||
COPY watchtower-embedded/start-watchtower-with-uptime-bot.sh /usr/local/bin/start-watchtower-with-uptime-bot.sh
|
||||
|
||||
RUN chmod +x /usr/local/bin/start-watchtower-with-uptime-bot.sh
|
||||
|
||||
ENV UPTIME_BOT_CONFIG=/opt/uptime-bot/config.yml
|
||||
ENV UPTIME_BOT_MAP=/opt/uptime-bot/container-monitor-map.yaml
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/start-watchtower-with-uptime-bot.sh"]
|
||||
CMD ["--interval", "300", "--cleanup"]
|
||||
Reference in new issue
Block a user