#!/bin/zsh # Load parameters ACTION=$1 ENV_FILE=".env" # Check if .env file exists if [[ ! -f $ENV_FILE ]]; then echo "Error: $ENV_FILE file not found!" echo "Please create $ENV_FILE file with the following variables:" echo "DEV_URL=your.domain.com" echo "EXTERNAL_NETWORK=your_network_name" echo "FORCE_HTTPS_REDIRECT=true # Set to 'false' to disable HTTPS redirect" exit 1 fi # Load environment variables source $ENV_FILE case "$ACTION" in "up") docker network create $EXTERNAL_NETWORK > /dev/null 2>&1 || true # Check HTTPS redirect setting if [[ "${FORCE_HTTPS_REDIRECT}" == "true" ]]; then MSG="Starting with HTTPS redirect enabled..." docker compose -f docker-compose.yml -f docker-compose.https-redirect.yml up -d else MSG="Starting without HTTPS redirect..." docker compose up -d fi echo "\n${MSG}" sleep 2 echo "\nAvailable services:" echo "Traefik: https://traefik.${DEV_URL}" echo "Portainer: https://portainer.${DEV_URL}" ;; "restart") docker compose restart ;; "down") docker compose down ;; *) echo "Usage: $0 [up|restart|down]" exit 1 ;; esac