🎬 ARR Suite Template Bootstrap - Complete Media Automation Stack Features: - 16 production services (Prowlarr, Sonarr, Radarr, Plex, etc.) - One-command Ansible deployment - VPN-protected downloads via Gluetun - Tailscale secure access - Production-ready security (UFW, Fail2Ban) - Automated backups and monitoring - Comprehensive documentation Ready for customization and deployment to any VPS. Co-authored-by: openhands <openhands@all-hands.dev>
232 lines
6.4 KiB
Bash
Executable File
232 lines
6.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Synology Arrs Stack Setup Script
|
|
# This script helps set up the directory structure and environment for the Arrs stack
|
|
|
|
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
|
|
|
|
# Default values
|
|
DEFAULT_DATA_ROOT="/volume1/data"
|
|
DEFAULT_CONFIG_ROOT="/volume1/docker"
|
|
DEFAULT_PROJECT_PATH="/volume1/docker/projects/arrs-compose"
|
|
|
|
echo -e "${BLUE}=== Synology Arrs Stack Setup ===${NC}"
|
|
echo ""
|
|
|
|
# Function to print colored output
|
|
print_status() {
|
|
echo -e "${GREEN}[INFO]${NC} $1"
|
|
}
|
|
|
|
print_warning() {
|
|
echo -e "${YELLOW}[WARNING]${NC} $1"
|
|
}
|
|
|
|
print_error() {
|
|
echo -e "${RED}[ERROR]${NC} $1"
|
|
}
|
|
|
|
# Check if running on Synology
|
|
check_synology() {
|
|
if [ ! -f /etc/synoinfo.conf ]; then
|
|
print_warning "This doesn't appear to be a Synology system."
|
|
read -p "Continue anyway? (y/N): " -n 1 -r
|
|
echo
|
|
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
|
exit 1
|
|
fi
|
|
fi
|
|
}
|
|
|
|
# Get user input for configuration
|
|
get_user_config() {
|
|
echo -e "${BLUE}Configuration Setup${NC}"
|
|
echo "Please provide the following information:"
|
|
echo ""
|
|
|
|
# Get PUID and PGID
|
|
if command -v id >/dev/null 2>&1; then
|
|
if id dockerlimited >/dev/null 2>&1; then
|
|
DEFAULT_PUID=$(id -u dockerlimited)
|
|
DEFAULT_PGID=$(id -g dockerlimited)
|
|
print_status "Found dockerlimited user: PUID=$DEFAULT_PUID, PGID=$DEFAULT_PGID"
|
|
else
|
|
print_warning "dockerlimited user not found. Please create it first."
|
|
DEFAULT_PUID="1234"
|
|
DEFAULT_PGID="65432"
|
|
fi
|
|
else
|
|
DEFAULT_PUID="1234"
|
|
DEFAULT_PGID="65432"
|
|
fi
|
|
|
|
read -p "PUID (User ID) [$DEFAULT_PUID]: " PUID
|
|
PUID=${PUID:-$DEFAULT_PUID}
|
|
|
|
read -p "PGID (Group ID) [$DEFAULT_PGID]: " PGID
|
|
PGID=${PGID:-$DEFAULT_PGID}
|
|
|
|
# Get timezone
|
|
read -p "Timezone [Europe/London]: " TZ
|
|
TZ=${TZ:-"Europe/London"}
|
|
|
|
# Get paths
|
|
read -p "Data root directory [$DEFAULT_DATA_ROOT]: " DATA_ROOT
|
|
DATA_ROOT=${DATA_ROOT:-$DEFAULT_DATA_ROOT}
|
|
|
|
read -p "Config root directory [$DEFAULT_CONFIG_ROOT]: " CONFIG_ROOT
|
|
CONFIG_ROOT=${CONFIG_ROOT:-$DEFAULT_CONFIG_ROOT}
|
|
|
|
read -p "Project path [$DEFAULT_PROJECT_PATH]: " PROJECT_PATH
|
|
PROJECT_PATH=${PROJECT_PATH:-$DEFAULT_PROJECT_PATH}
|
|
}
|
|
|
|
# Create directory structure
|
|
create_directories() {
|
|
print_status "Creating directory structure..."
|
|
|
|
# Create data directories
|
|
mkdir -p "$DATA_ROOT/media/movies"
|
|
mkdir -p "$DATA_ROOT/media/tv"
|
|
mkdir -p "$DATA_ROOT/media/music"
|
|
mkdir -p "$DATA_ROOT/media/books"
|
|
mkdir -p "$DATA_ROOT/torrents/movies"
|
|
mkdir -p "$DATA_ROOT/torrents/tv"
|
|
mkdir -p "$DATA_ROOT/torrents/music"
|
|
mkdir -p "$DATA_ROOT/torrents/books"
|
|
|
|
# Create config directories
|
|
mkdir -p "$CONFIG_ROOT/sonarr"
|
|
mkdir -p "$CONFIG_ROOT/radarr"
|
|
mkdir -p "$CONFIG_ROOT/lidarr"
|
|
mkdir -p "$CONFIG_ROOT/bazarr"
|
|
mkdir -p "$CONFIG_ROOT/prowlarr"
|
|
mkdir -p "$PROJECT_PATH"
|
|
|
|
print_status "Directory structure created successfully!"
|
|
}
|
|
|
|
# Set permissions
|
|
set_permissions() {
|
|
print_status "Setting directory permissions..."
|
|
|
|
# Set ownership if dockerlimited user exists
|
|
if id dockerlimited >/dev/null 2>&1; then
|
|
chown -R dockerlimited:dockerlimited "$DATA_ROOT" 2>/dev/null || print_warning "Could not set ownership on $DATA_ROOT (may require sudo)"
|
|
chown -R dockerlimited:dockerlimited "$CONFIG_ROOT" 2>/dev/null || print_warning "Could not set ownership on $CONFIG_ROOT (may require sudo)"
|
|
else
|
|
print_warning "dockerlimited user not found. Skipping ownership changes."
|
|
fi
|
|
|
|
# Set permissions
|
|
chmod -R 755 "$DATA_ROOT" 2>/dev/null || print_warning "Could not set permissions on $DATA_ROOT (may require sudo)"
|
|
chmod -R 755 "$CONFIG_ROOT" 2>/dev/null || print_warning "Could not set permissions on $CONFIG_ROOT (may require sudo)"
|
|
|
|
print_status "Permissions set successfully!"
|
|
}
|
|
|
|
# Create .env file
|
|
create_env_file() {
|
|
print_status "Creating .env file..."
|
|
|
|
cat > .env << EOF
|
|
# Synology Arrs Stack Environment Configuration
|
|
# Generated by setup script on $(date)
|
|
|
|
# User and Group Configuration
|
|
PUID=$PUID
|
|
PGID=$PGID
|
|
|
|
# Timezone Configuration
|
|
TZ=$TZ
|
|
|
|
# Directory Paths
|
|
DATA_ROOT=$DATA_ROOT
|
|
CONFIG_ROOT=$CONFIG_ROOT
|
|
|
|
# Network Configuration
|
|
NETWORK_MODE=synobridge
|
|
|
|
# Port Configuration
|
|
SONARR_PORT=8989
|
|
RADARR_PORT=7878
|
|
LIDARR_PORT=8686
|
|
BAZARR_PORT=6767
|
|
PROWLARR_PORT=9696
|
|
|
|
# VPN Configuration (for docker-compose-vpn.yml)
|
|
VPN_PROVIDER=nordvpn
|
|
VPN_TYPE=openvpn
|
|
VPN_USER=your_vpn_username
|
|
VPN_PASSWORD=your_vpn_password
|
|
VPN_COUNTRIES=Netherlands,Germany
|
|
EOF
|
|
|
|
print_status ".env file created successfully!"
|
|
}
|
|
|
|
# Copy docker-compose file to project directory
|
|
copy_compose_file() {
|
|
print_status "Copying docker-compose.yml to project directory..."
|
|
|
|
if [ -f "compose/docker-compose.yml" ]; then
|
|
cp "compose/docker-compose.yml" "$PROJECT_PATH/"
|
|
print_status "docker-compose.yml copied to $PROJECT_PATH/"
|
|
else
|
|
print_error "docker-compose.yml not found in compose/ directory"
|
|
return 1
|
|
fi
|
|
}
|
|
|
|
# Check prerequisites
|
|
check_prerequisites() {
|
|
print_status "Checking prerequisites..."
|
|
|
|
# Check if Container Manager is available
|
|
if [ -d "/var/packages/ContainerManager" ]; then
|
|
print_status "Container Manager package found"
|
|
else
|
|
print_warning "Container Manager package not found. Please install it from Package Center."
|
|
fi
|
|
|
|
# Check if synobridge network exists (this would require docker command)
|
|
print_status "Please ensure synobridge network is configured in Container Manager"
|
|
}
|
|
|
|
# Main execution
|
|
main() {
|
|
echo -e "${GREEN}Starting Synology Arrs Stack setup...${NC}"
|
|
echo ""
|
|
|
|
check_synology
|
|
get_user_config
|
|
create_directories
|
|
set_permissions
|
|
create_env_file
|
|
copy_compose_file
|
|
check_prerequisites
|
|
|
|
echo ""
|
|
echo -e "${GREEN}=== Setup Complete! ===${NC}"
|
|
echo ""
|
|
echo "Next steps:"
|
|
echo "1. Review and edit the .env file if needed"
|
|
echo "2. Ensure synobridge network is configured in Container Manager"
|
|
echo "3. Run './scripts/deploy.sh' to deploy the stack"
|
|
echo "4. Or manually create a project in Container Manager using:"
|
|
echo " - Project Name: media-stack"
|
|
echo " - Path: $PROJECT_PATH"
|
|
echo " - Use the docker-compose.yml file in that directory"
|
|
echo ""
|
|
echo -e "${BLUE}For more information, see the README.md file${NC}"
|
|
}
|
|
|
|
# Run main function
|
|
main "$@" |