#!/usr/bin/env bash
# Deploy tools
# this script generates a docker-compose.yml.
#
# example: ./deploy
# example: ./deploy --skip-update
#
# Mostly of scripts fork from https://github.com/getsentry/self-hosted
# Original License: https://github.com/getsentry/self-hosted/blob/master/LICENSE.md

set -eE

if [ -e "./env.sh" ]; then
  source "./env.sh"
fi
source "$(dirname $0)/scripts/function.sh"

source "scripts/load-cli-parser.sh"
source "scripts/detect-platform.sh"
source "scripts/dc-detect-version.sh"
source "scripts/error-handling.sh"

# We set the trap at the top level so that we get better tracebacks.
trap_with_arg cleanup ERR INT TERM EXIT
source "scripts/check-latest-commit.sh"
source "scripts/check-minimum-requirements.sh"

# Let's go! Start impacting things.
source "scripts/generate-env-file.sh"
source "scripts/turn-things-off.sh"
source "scripts/generate-secret-key.sh"
source "scripts/generate-domain.sh"
source "scripts/configure-cert.sh"
source "scripts/generate-compose-file.sh"
source "scripts/configure-zealot-version.sh"
source "scripts/configure-volumes.sh"
source "scripts/fetch-docker-images.sh"
source "scripts/wrap-up.sh"
