NixOS + home-manager configs, mirrored from GitLab SaaS. gitlab.com/andreijiroh-dev/nixops-config
nix-flake nixos home-manager nixpkgs nix-flakes
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore(coolify-compose): do command handling for up/down/stop

Signed-off-by: Andrei Jiroh Halili <ajhalili2006@andreijiroh.dev>

+35 -12
+35 -12
scripts/coolify-compose
··· 7 7 COOLIFY_SOURCE_DIR="${COOLIFY_DIR}/source" 8 8 SUDO=${SUDO:-"sudo"} 9 9 10 - # Since the /data/coolify folder is chowned to 9999:root, we need to esclate 11 - # perms via $SUDO. 12 - if [[ $EUID != "0" ]]; then 13 - echo "Attempting to exec as root via $(command -v ${SUDO})..." 14 - exec "${SUDO}" docker compose --env-file "${COOLIFY_SOURCE_DIR}/.env" \ 15 - -f "${COOLIFY_SOURCE_DIR}/docker-compose.yml" \ 16 - -f "${COOLIFY_SOURCE_DIR}/docker-compose.prod.yml" \ 17 - "$@" 10 + # The main entrypoint to docker-compose pointing to Coolify's compose + dotenv files, 11 + # after handling those compose commands. 12 + main() { 13 + # Since the /data/coolify folder is chowned to 9999:root, we need to esclate 14 + # perms via $SUDO. 15 + if [[ $EUID != "0" ]]; then 16 + echo "Attempting to exec as root via $(command -v ${SUDO})..." 17 + exec "${SUDO}" docker compose --env-file "${COOLIFY_SOURCE_DIR}/.env" \ 18 + -f "${COOLIFY_SOURCE_DIR}/docker-compose.yml" \ 19 + -f "${COOLIFY_SOURCE_DIR}/docker-compose.prod.yml" \ 20 + "$@" 21 + else 22 + exec docker compose --env-file "${COOLIFY_SOURCE_DIR}/.env" \ 23 + -f "${COOLIFY_SOURCE_DIR}/docker-compose.yml" \ 24 + -f "${COOLIFY_SOURCE_DIR}/docker-compose.prod.yml" \ 25 + "$@" 26 + fi 27 + } 28 + 29 + if [[ $1 == "up" ]]; then 30 + # From the Coolify docs for manual installation steps, we always want to use these 31 + # flags when bringing up. 32 + # Docs: https://coolify.io/docs/get-started/installation#_7-start-coolify 33 + main up -d --remove-orphans --pull=always --force-recreate "$@" 34 + elif [[ $1 == "down" ]]; then 35 + # From the Coolify docs for uninstallation steps (the Compose way of tearing down 36 + # containers), we always want to use these flags when bringing down. 37 + # Docs: https://coolify.io/docs/get-started/uninstallation#_1-stop-and-remove-containers 38 + main down --timeout=0 "$@" 39 + elif [[ $1 == "stop" ]]; then 40 + # From the Coolify docs for uninstallation steps (the `docker stop` one), we 41 + # always want to use these flags when stopping 42 + # Docs: https://coolify.io/docs/get-started/uninstallation#_1-stop-and-remove-containers 43 + main stop --timeout=0 "$@" 18 44 else 19 - exec docker compose --env-file "${COOLIFY_SOURCE_DIR}/.env" \ 20 - -f "${COOLIFY_SOURCE_DIR}/docker-compose.yml" \ 21 - -f "${COOLIFY_SOURCE_DIR}/docker-compose.prod.yml" \ 22 - "$@" 45 + main "$@" 23 46 fi