From 7c8e1d646a4958059072058ad0832e13f87b60c4 Mon Sep 17 00:00:00 2001 From: n3-rd Date: Tue, 17 Feb 2026 12:49:40 +0100 Subject: [PATCH 1/3] feat: Improve install script for proxy detection and configuration options - Added automatic detection of services using ports 80/443 and enhanced user prompts for configuring external proxies (Nginx, Traefik). - Implemented options for auto-configuration based on detected proxies, allowing for easier setup in non-interactive mode. - Updated messaging to guide users through the selection process for handling HTTPS with their domain. --- install.sh | 350 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 295 insertions(+), 55 deletions(-) diff --git a/install.sh b/install.sh index d25210e..49c477d 100755 --- a/install.sh +++ b/install.sh @@ -113,6 +113,7 @@ fi # When a domain is set, check if ports 80/443 are available PROXY_MODE="direct" # direct = Caddy handles TLS on 80/443, external = user's proxy handles TLS +PROXY_AUTO_CONFIG="none" # none, nginx, or traefik if [ -n "$DOMAIN_NAME" ]; then PORT_80_FREE=true PORT_443_FREE=true @@ -126,35 +127,128 @@ if [ -n "$DOMAIN_NAME" ]; then if [ "$PORT_80_FREE" = "false" ] || [ "$PORT_443_FREE" = "false" ]; then echo "" echo -e "${YELLOW}Port 80 and/or 443 are already in use.${NC}" - echo -e "Another service (nginx, Traefik, Apache, etc.) is using these ports." + PROXY_MODE="external" + + # Detect what's on port 80 + DETECTED_PROXY="" + PORT80_PID=$(ss -tlnp 2>/dev/null | grep ':80 ' | grep -oP 'pid=\K[0-9]+' | head -1) + if [ -n "$PORT80_PID" ]; then + PORT80_PROC=$(ps -p "$PORT80_PID" -o comm= 2>/dev/null || echo "") + case "$PORT80_PROC" in + nginx*) + DETECTED_PROXY="nginx" + ;; + docker-proxy*|docker*) + PORT80_CONTAINER=$(docker ps --format '{{.Names}}' --filter "publish=80" 2>/dev/null | head -1) + if [ -n "$PORT80_CONTAINER" ]; then + PORT80_IMAGE=$(docker inspect "$PORT80_CONTAINER" --format '{{.Config.Image}}' 2>/dev/null || echo "") + case "$PORT80_IMAGE" in + *traefik*) DETECTED_PROXY="traefik"; TRAEFIK_CONTAINER="$PORT80_CONTAINER" ;; + *caddy*) DETECTED_PROXY="caddy-external" ;; + *nginx*) DETECTED_PROXY="nginx-docker" ;; + *) DETECTED_PROXY="docker-unknown" ;; + esac + fi + ;; + apache2*|httpd*) + DETECTED_PROXY="apache" + ;; + caddy*) + DETECTED_PROXY="caddy-external" + ;; + esac + fi + + if [ -n "$DETECTED_PROXY" ]; then + echo -e "Detected: ${GREEN}${DETECTED_PROXY}${NC}" + else + echo -e "Could not detect which service is using port 80." + fi echo "" + # Offer auto-config based on detected proxy + PROXY_AUTO_CONFIG="none" if [ "$NON_INTERACTIVE" = "true" ]; then - PROXY_MODE="external" + # Non-interactive: auto-configure if we can, otherwise manual + case "$DETECTED_PROXY" in + nginx) + if command -v nginx &>/dev/null; then + PROXY_AUTO_CONFIG="nginx" + fi + ;; + traefik) + PROXY_AUTO_CONFIG="traefik" + ;; + esac else - echo -e "Choose how to handle HTTPS for ${GREEN}${DOMAIN_NAME}${NC}:" - echo "" - echo -e " ${GREEN}1)${NC} External proxy mode (recommended)" - echo -e " Multi-PB stays on port ${MULTIPB_PORT} (HTTP only)." - echo -e " Configure your existing proxy to forward ${DOMAIN_NAME} → localhost:${MULTIPB_PORT}" - echo "" - echo -e " ${GREEN}2)${NC} Free ports 80/443 and let Multi-PB handle TLS" - echo -e " You'll need to stop the service using these ports first." - echo "" - read -p "Choice [1]: " PROXY_CHOICE - PROXY_CHOICE="${PROXY_CHOICE:-1}" - if [ "$PROXY_CHOICE" = "2" ]; then - echo "" - echo -e "${YELLOW}Please free ports 80 and 443, then re-run the installer.${NC}" - exit 0 - fi - PROXY_MODE="external" + case "$DETECTED_PROXY" in + nginx) + echo -e "Choose how to set up ${GREEN}${DOMAIN_NAME}${NC}:" + echo "" + echo -e " ${GREEN}1)${NC} Auto-configure nginx" + echo -e " Writes a site config, reloads nginx, optionally sets up HTTPS with certbot." + echo "" + echo -e " ${GREEN}2)${NC} Manual setup (print instructions only)" + echo "" + echo -e " ${GREEN}3)${NC} Free ports 80/443 and let Multi-PB handle TLS instead" + echo "" + read -p "Choice [1]: " PROXY_CHOICE + PROXY_CHOICE="${PROXY_CHOICE:-1}" + case "$PROXY_CHOICE" in + 1) PROXY_AUTO_CONFIG="nginx" ;; + 3) + echo "" + echo -e "${YELLOW}Please free ports 80 and 443, then re-run the installer.${NC}" + exit 0 + ;; + *) PROXY_AUTO_CONFIG="none" ;; + esac + ;; + traefik) + echo -e "Choose how to set up ${GREEN}${DOMAIN_NAME}${NC}:" + echo "" + echo -e " ${GREEN}1)${NC} Auto-configure Traefik" + echo -e " Adds labels and connects to Traefik's docker network." + echo "" + echo -e " ${GREEN}2)${NC} Manual setup (print instructions only)" + echo "" + echo -e " ${GREEN}3)${NC} Free ports 80/443 and let Multi-PB handle TLS instead" + echo "" + read -p "Choice [1]: " PROXY_CHOICE + PROXY_CHOICE="${PROXY_CHOICE:-1}" + case "$PROXY_CHOICE" in + 1) PROXY_AUTO_CONFIG="traefik" ;; + 3) + echo "" + echo -e "${YELLOW}Please free ports 80 and 443, then re-run the installer.${NC}" + exit 0 + ;; + *) PROXY_AUTO_CONFIG="none" ;; + esac + ;; + *) + echo -e "Choose how to handle HTTPS for ${GREEN}${DOMAIN_NAME}${NC}:" + echo "" + echo -e " ${GREEN}1)${NC} External proxy mode (print setup instructions)" + echo -e " Multi-PB stays on port ${MULTIPB_PORT} (HTTP only)." + echo -e " You configure your existing proxy to forward ${DOMAIN_NAME} → localhost:${MULTIPB_PORT}" + echo "" + echo -e " ${GREEN}2)${NC} Free ports 80/443 and let Multi-PB handle TLS" + echo -e " You'll need to stop the service using these ports first." + echo "" + read -p "Choice [1]: " PROXY_CHOICE + PROXY_CHOICE="${PROXY_CHOICE:-1}" + if [ "$PROXY_CHOICE" = "2" ]; then + echo "" + echo -e "${YELLOW}Please free ports 80 and 443, then re-run the installer.${NC}" + exit 0 + fi + ;; + esac fi - if [ "$PROXY_MODE" = "external" ]; then - echo -e "${GREEN}Using external proxy mode.${NC}" - echo -e "Multi-PB will run on port ${MULTIPB_PORT} (HTTP). Your existing proxy handles TLS." - fi + echo -e "${GREEN}Using external proxy mode.${NC}" + echo -e "Multi-PB will run on port ${MULTIPB_PORT} (HTTP). Your existing proxy handles TLS." fi fi @@ -218,6 +312,39 @@ cat >> "$INSTALL_DIR/docker-compose.yml" << EOF EOF fi +# Traefik auto-config: add labels and discover network +if [ "$PROXY_AUTO_CONFIG" = "traefik" ]; then + TRAEFIK_NETWORK="" + if [ -n "$TRAEFIK_CONTAINER" ]; then + TRAEFIK_NETWORK=$(docker inspect "$TRAEFIK_CONTAINER" --format '{{range $k,$v := .NetworkSettings.Networks}}{{$k}} {{end}}' 2>/dev/null | awk '{print $1}') + fi + # Fallback: check common network names + if [ -z "$TRAEFIK_NETWORK" ] || [ "$TRAEFIK_NETWORK" = "bridge" ]; then + for net in traefik web proxy traefik-public; do + if docker network inspect "$net" &>/dev/null; then + TRAEFIK_NETWORK="$net" + break + fi + done + fi + if [ -n "$TRAEFIK_NETWORK" ] && [ "$TRAEFIK_NETWORK" != "bridge" ]; then + echo -e "${GREEN}Detected Traefik network: ${TRAEFIK_NETWORK}${NC}" + else + TRAEFIK_NETWORK="web" + echo -e "${YELLOW}Could not detect Traefik network, using '${TRAEFIK_NETWORK}'. Edit docker-compose.yml if different.${NC}" + fi +cat >> "$INSTALL_DIR/docker-compose.yml" << EOF + labels: + - traefik.enable=true + - traefik.http.routers.multipb.rule=Host(\`${DOMAIN_NAME}\`) + - traefik.http.routers.multipb.entrypoints=websecure + - traefik.http.routers.multipb.tls.certresolver=letsencrypt + - traefik.http.services.multipb.loadbalancer.server.port=25983 + networks: + - ${TRAEFIK_NETWORK} +EOF +fi + cat >> "$INSTALL_DIR/docker-compose.yml" << EOF healthcheck: test: ["CMD", "curl", "-f", "http://localhost:25983/_health"] @@ -227,6 +354,16 @@ cat >> "$INSTALL_DIR/docker-compose.yml" << EOF start_period: 15s EOF +# Close Traefik external network definition +if [ "$PROXY_AUTO_CONFIG" = "traefik" ] && [ -n "$TRAEFIK_NETWORK" ]; then +cat >> "$INSTALL_DIR/docker-compose.yml" << EOF + +networks: + ${TRAEFIK_NETWORK}: + external: true +EOF +fi + echo -e "${GREEN}✓ Configuration created${NC}" echo "" @@ -239,7 +376,13 @@ echo -e " Data Dir: ${GREEN}${DATA_DIR}${NC}" if [ -n "$DOMAIN_NAME" ]; then echo -e " Domain: ${GREEN}${DOMAIN_NAME}${NC}" if [ "$PROXY_MODE" = "external" ]; then - echo -e " TLS: ${YELLOW}External proxy (configure your proxy → localhost:${MULTIPB_PORT})${NC}" + if [ "$PROXY_AUTO_CONFIG" = "nginx" ]; then + echo -e " TLS: ${GREEN}Nginx (auto-configured + certbot)${NC}" + elif [ "$PROXY_AUTO_CONFIG" = "traefik" ]; then + echo -e " TLS: ${GREEN}Traefik (auto-configured via labels)${NC}" + else + echo -e " TLS: ${YELLOW}External proxy (configure your proxy → localhost:${MULTIPB_PORT})${NC}" + fi else echo -e " TLS: ${GREEN}Caddy (automatic HTTPS on ports 80/443)${NC}" fi @@ -302,39 +445,136 @@ if [[ ! "$START_NOW" =~ ^[Nn]$ ]]; then echo -e " ${BLUE}docker exec ${CONTAINER_NAME} remove-instance.sh myapp${NC}" echo "" - # Show external proxy instructions if applicable + # External proxy: auto-configure or print instructions if [ -n "$DOMAIN_NAME" ] && [ "$PROXY_MODE" = "external" ]; then echo "" - echo -e "${YELLOW}━━━ External Proxy Setup ━━━${NC}" - echo -e "Configure your reverse proxy to forward ${GREEN}${DOMAIN_NAME}${NC} to ${GREEN}localhost:${MULTIPB_PORT}${NC}" - echo "" - echo -e "${BLUE}Nginx example:${NC}" - echo " server {" - echo " listen 80;" - echo " server_name ${DOMAIN_NAME};" - echo " location / {" - echo " proxy_pass http://127.0.0.1:${MULTIPB_PORT};" - echo " proxy_set_header Host \$host;" - echo " proxy_set_header X-Real-IP \$remote_addr;" - echo " proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;" - echo " proxy_set_header X-Forwarded-Proto \$scheme;" - echo " }" - echo " }" - echo "" - echo -e "${BLUE}Caddy example:${NC}" - echo " ${DOMAIN_NAME} {" - echo " reverse_proxy localhost:${MULTIPB_PORT}" - echo " }" - echo "" - echo -e "${BLUE}Traefik (docker labels):${NC}" - echo " Add to your docker-compose.yml under ${CONTAINER_NAME}:" - echo " labels:" - echo " - traefik.enable=true" - echo " - traefik.http.routers.multipb.rule=Host(\`${DOMAIN_NAME}\`)" - echo " - traefik.http.services.multipb.loadbalancer.server.port=25983" - echo "" - echo -e "After configuring your proxy, ${GREEN}${DOMAIN_NAME}${NC} will serve Multi-PB." - echo -e "Your proxy handles TLS — add HTTPS there (e.g. certbot for nginx, automatic for Caddy/Traefik)." + + if [ "$PROXY_AUTO_CONFIG" = "nginx" ]; then + # ── Nginx auto-config ── + echo -e "${YELLOW}━━━ Configuring Nginx ━━━${NC}" + + # Find nginx config directory + NGINX_CONF_DIR="" + if [ -d "/etc/nginx/sites-available" ]; then + NGINX_CONF_DIR="/etc/nginx/sites-available" + NGINX_LINK_DIR="/etc/nginx/sites-enabled" + elif [ -d "/etc/nginx/conf.d" ]; then + NGINX_CONF_DIR="/etc/nginx/conf.d" + NGINX_LINK_DIR="" + fi + + if [ -z "$NGINX_CONF_DIR" ]; then + echo -e "${RED}Could not find nginx config directory. Printing manual instructions instead.${NC}" + PROXY_AUTO_CONFIG="none" + else + NGINX_CONF_FILE="${NGINX_CONF_DIR}/multipb-${DOMAIN_NAME}.conf" + echo -e "Writing config to ${GREEN}${NGINX_CONF_FILE}${NC}" + + cat > "$NGINX_CONF_FILE" << NGINXEOF +server { + listen 80; + listen [::]:80; + server_name ${DOMAIN_NAME}; + + location / { + proxy_pass http://127.0.0.1:${MULTIPB_PORT}; + proxy_http_version 1.1; + proxy_set_header Host \$host; + proxy_set_header X-Real-IP \$remote_addr; + proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto \$scheme; + proxy_set_header Upgrade \$http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_read_timeout 86400; + } +} +NGINXEOF + + # Symlink if using sites-available/sites-enabled pattern + if [ -n "$NGINX_LINK_DIR" ] && [ -d "$NGINX_LINK_DIR" ]; then + ln -sf "$NGINX_CONF_FILE" "${NGINX_LINK_DIR}/multipb-${DOMAIN_NAME}.conf" + echo -e "Symlinked to ${GREEN}${NGINX_LINK_DIR}/multipb-${DOMAIN_NAME}.conf${NC}" + fi + + # Test and reload + if nginx -t 2>/dev/null; then + nginx -s reload 2>/dev/null || systemctl reload nginx 2>/dev/null || true + echo -e "${GREEN}✓ Nginx configured and reloaded${NC}" + echo -e " ${GREEN}${DOMAIN_NAME}${NC} → localhost:${MULTIPB_PORT} (HTTP)" + + # Offer certbot for HTTPS + CERTBOT_DONE=false + if command -v certbot &>/dev/null; then + echo "" + if [ "$NON_INTERACTIVE" = "true" ]; then + echo -e "${YELLOW}Certbot detected. Run this to enable HTTPS:${NC}" + echo -e " ${BLUE}certbot --nginx -d ${DOMAIN_NAME}${NC}" + else + read -p "Certbot detected. Set up HTTPS now? (Y/n): " CERTBOT_CHOICE + CERTBOT_CHOICE="${CERTBOT_CHOICE:-y}" + if [[ ! "$CERTBOT_CHOICE" =~ ^[Nn]$ ]]; then + echo -e "${YELLOW}Running certbot...${NC}" + if certbot --nginx -d "${DOMAIN_NAME}" --non-interactive --agree-tos --redirect --register-unsafely-without-email 2>&1; then + echo -e "${GREEN}✓ HTTPS enabled for ${DOMAIN_NAME}${NC}" + CERTBOT_DONE=true + else + echo -e "${YELLOW}Certbot failed. You can retry manually:${NC}" + echo -e " ${BLUE}certbot --nginx -d ${DOMAIN_NAME}${NC}" + fi + fi + fi + else + echo "" + echo -e "${YELLOW}To enable HTTPS, install certbot and run:${NC}" + echo -e " ${BLUE}apt install -y certbot python3-certbot-nginx${NC}" + echo -e " ${BLUE}certbot --nginx -d ${DOMAIN_NAME}${NC}" + fi + else + echo -e "${RED}Nginx config test failed. Check ${NGINX_CONF_FILE} manually.${NC}" + nginx -t 2>&1 || true + fi + fi + + elif [ "$PROXY_AUTO_CONFIG" = "traefik" ]; then + # ── Traefik auto-config ── + echo -e "${GREEN}✓ Traefik labels added to docker-compose.yml${NC}" + echo -e " ${GREEN}${DOMAIN_NAME}${NC} → multipb container (port 25983)" + echo -e " Traefik will handle TLS automatically." + echo "" + fi + + # Fallback: manual instructions for anything we couldn't auto-configure + if [ "$PROXY_AUTO_CONFIG" = "none" ]; then + echo -e "${YELLOW}━━━ External Proxy Setup ━━━${NC}" + echo -e "Configure your reverse proxy to forward ${GREEN}${DOMAIN_NAME}${NC} to ${GREEN}localhost:${MULTIPB_PORT}${NC}" + echo "" + echo -e "${BLUE}Nginx:${NC}" + echo " server {" + echo " listen 80;" + echo " server_name ${DOMAIN_NAME};" + echo " location / {" + echo " proxy_pass http://127.0.0.1:${MULTIPB_PORT};" + echo " proxy_set_header Host \$host;" + echo " proxy_set_header X-Real-IP \$remote_addr;" + echo " proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;" + echo " proxy_set_header X-Forwarded-Proto \$scheme;" + echo " }" + echo " }" + echo "" + echo -e "${BLUE}Caddy:${NC}" + echo " ${DOMAIN_NAME} {" + echo " reverse_proxy localhost:${MULTIPB_PORT}" + echo " }" + echo "" + echo -e "${BLUE}Traefik (docker labels):${NC}" + echo " Add to your docker-compose.yml under ${CONTAINER_NAME}:" + echo " labels:" + echo " - traefik.enable=true" + echo " - traefik.http.routers.multipb.rule=Host(\`${DOMAIN_NAME}\`)" + echo " - traefik.http.services.multipb.loadbalancer.server.port=25983" + echo "" + echo -e "Your proxy handles TLS — add HTTPS there (e.g. certbot for nginx, automatic for Caddy/Traefik)." + fi echo "" fi From f19720ad1282c062d9362ec790d56de56413dab2 Mon Sep 17 00:00:00 2001 From: n3-rd Date: Tue, 17 Feb 2026 12:56:44 +0100 Subject: [PATCH 2/3] feat: Enhance Traefik network detection and configuration in install script - Added logic to automatically detect the Traefik container and its associated networks. - Implemented user prompts for selecting a network when multiple non-bridge networks are found. - Improved fallback mechanisms for network detection and user interaction in non-interactive mode. - Updated Docker Compose configuration to dynamically set entrypoints and certresolver based on detected Traefik settings. --- install.sh | 75 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 65 insertions(+), 10 deletions(-) diff --git a/install.sh b/install.sh index 49c477d..0688170 100755 --- a/install.sh +++ b/install.sh @@ -315,11 +315,40 @@ fi # Traefik auto-config: add labels and discover network if [ "$PROXY_AUTO_CONFIG" = "traefik" ]; then TRAEFIK_NETWORK="" + + # Try to find the Traefik container if not already set + if [ -z "$TRAEFIK_CONTAINER" ]; then + TRAEFIK_CONTAINER=$(docker ps --format '{{.Names}}' --filter "publish=80" 2>/dev/null | head -1) + fi + + # Get all non-bridge networks from the Traefik container if [ -n "$TRAEFIK_CONTAINER" ]; then - TRAEFIK_NETWORK=$(docker inspect "$TRAEFIK_CONTAINER" --format '{{range $k,$v := .NetworkSettings.Networks}}{{$k}} {{end}}' 2>/dev/null | awk '{print $1}') + TRAEFIK_NETWORKS=$(docker inspect "$TRAEFIK_CONTAINER" --format '{{range $k,$v := .NetworkSettings.Networks}}{{$k}} {{end}}' 2>/dev/null | tr ' ' '\n' | grep -v '^bridge$' | grep -v '^$') + # If exactly one non-bridge network, use it + NET_COUNT=$(echo "$TRAEFIK_NETWORKS" | wc -l | tr -d ' ') + if [ "$NET_COUNT" = "1" ] && [ -n "$TRAEFIK_NETWORKS" ]; then + TRAEFIK_NETWORK="$TRAEFIK_NETWORKS" + elif [ "$NET_COUNT" -gt 1 ] 2>/dev/null; then + # Multiple networks — let user pick + if [ "$NON_INTERACTIVE" != "true" ]; then + echo -e "${YELLOW}Traefik container is on multiple networks:${NC}" + i=1 + for net in $TRAEFIK_NETWORKS; do + echo -e " ${GREEN}${i})${NC} ${net}" + i=$((i + 1)) + done + read -p "Which network should Multi-PB join? [1]: " NET_PICK + NET_PICK="${NET_PICK:-1}" + TRAEFIK_NETWORK=$(echo "$TRAEFIK_NETWORKS" | sed -n "${NET_PICK}p") + else + # Non-interactive: pick first non-bridge + TRAEFIK_NETWORK=$(echo "$TRAEFIK_NETWORKS" | head -1) + fi + fi fi - # Fallback: check common network names - if [ -z "$TRAEFIK_NETWORK" ] || [ "$TRAEFIK_NETWORK" = "bridge" ]; then + + # Fallback: scan for common network names + if [ -z "$TRAEFIK_NETWORK" ]; then for net in traefik web proxy traefik-public; do if docker network inspect "$net" &>/dev/null; then TRAEFIK_NETWORK="$net" @@ -327,22 +356,48 @@ if [ "$PROXY_AUTO_CONFIG" = "traefik" ]; then fi done fi - if [ -n "$TRAEFIK_NETWORK" ] && [ "$TRAEFIK_NETWORK" != "bridge" ]; then - echo -e "${GREEN}Detected Traefik network: ${TRAEFIK_NETWORK}${NC}" - else - TRAEFIK_NETWORK="web" - echo -e "${YELLOW}Could not detect Traefik network, using '${TRAEFIK_NETWORK}'. Edit docker-compose.yml if different.${NC}" + + # Still nothing — ask the user + if [ -z "$TRAEFIK_NETWORK" ]; then + if [ "$NON_INTERACTIVE" != "true" ]; then + echo -e "${YELLOW}Could not auto-detect Traefik's docker network.${NC}" + echo -e "List your networks with: ${BLUE}docker network ls${NC}" + read -p "Traefik network name: " TRAEFIK_NETWORK + fi + if [ -z "$TRAEFIK_NETWORK" ]; then + echo -e "${RED}No Traefik network specified. Falling back to manual instructions.${NC}" + PROXY_AUTO_CONFIG="none" + fi fi + + if [ "$PROXY_AUTO_CONFIG" = "traefik" ]; then + echo -e "${GREEN}Using Traefik network: ${TRAEFIK_NETWORK}${NC}" + + # Detect entrypoints and certresolver from Traefik container command/labels + TRAEFIK_ENTRYPOINT="websecure" + TRAEFIK_CERTRESOLVER="letsencrypt" + if [ -n "$TRAEFIK_CONTAINER" ]; then + # Try to detect entrypoint name from container command args + TRAEFIK_CMD=$(docker inspect "$TRAEFIK_CONTAINER" --format '{{join .Config.Cmd " "}}' 2>/dev/null || echo "") + if echo "$TRAEFIK_CMD" | grep -qoP 'entrypoints\.\K[a-zA-Z0-9_-]+(?=\.address=:443)' 2>/dev/null; then + TRAEFIK_ENTRYPOINT=$(echo "$TRAEFIK_CMD" | grep -oP 'entrypoints\.\K[a-zA-Z0-9_-]+(?=\.address=:443)' | head -1) + fi + if echo "$TRAEFIK_CMD" | grep -qoP 'certificatesresolvers\.\K[a-zA-Z0-9_-]+' 2>/dev/null; then + TRAEFIK_CERTRESOLVER=$(echo "$TRAEFIK_CMD" | grep -oP 'certificatesresolvers\.\K[a-zA-Z0-9_-]+' | head -1) + fi + fi + cat >> "$INSTALL_DIR/docker-compose.yml" << EOF labels: - traefik.enable=true - traefik.http.routers.multipb.rule=Host(\`${DOMAIN_NAME}\`) - - traefik.http.routers.multipb.entrypoints=websecure - - traefik.http.routers.multipb.tls.certresolver=letsencrypt + - traefik.http.routers.multipb.entrypoints=${TRAEFIK_ENTRYPOINT} + - traefik.http.routers.multipb.tls.certresolver=${TRAEFIK_CERTRESOLVER} - traefik.http.services.multipb.loadbalancer.server.port=25983 networks: - ${TRAEFIK_NETWORK} EOF + fi fi cat >> "$INSTALL_DIR/docker-compose.yml" << EOF From 7533ca9b7259c12d617c8b169c9c19414165366a Mon Sep 17 00:00:00 2001 From: n3-rd Date: Tue, 17 Feb 2026 14:45:44 +0100 Subject: [PATCH 3/3] docs: Update README with installation instructions for interactive and non-interactive modes - Added a section for interactive installation using curl, prompting users for configuration options. - Clarified the non-interactive installation process and provided example commands. - Removed outdated instructions for interactive mode that were previously included. --- README.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 2032271..875da08 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,13 @@ Install curl if needed: ## Quick Start -**One-liner (curl):** When piped, the script runs non-interactively and uses defaults. +**Interactive install (curl):** +```bash +bash <(curl -fsSL https://raw.githubusercontent.com/n3-rd/multi-pb/main/install.sh) +``` +Prompts for port, data dir, domain, etc. + +**Non-interactive (piped, uses defaults):** ```bash curl -fsSL https://raw.githubusercontent.com/n3-rd/multi-pb/main/install.sh | bash ``` @@ -57,11 +63,6 @@ With options (port, data dir, domain): curl -fsSL https://raw.githubusercontent.com/n3-rd/multi-pb/main/install.sh | bash -s -- --non-interactive --port 25983 --data-dir ./multipb-data ``` -Or interactive (will prompt for config): -```bash -curl -fsSL https://raw.githubusercontent.com/n3-rd/multi-pb/main/install.sh | bash -s -- -``` - **From clone:** ```bash git clone https://github.com/n3-rd/multi-pb.git