diff --git a/bin/selfcheck.sh b/bin/selfcheck.sh index 166480b0..1d46e673 100755 --- a/bin/selfcheck.sh +++ b/bin/selfcheck.sh @@ -1,14 +1,16 @@ #!/bin/bash set -e set -x APP_DOMAIN=$(grep APP_DOMAIN .env | tail -n1 | sed "s/APP_DOMAIN=//") ADMIN_PASSWORD="simple123" docker compose exec postfix testsaslauthd -u "admin@$APP_DOMAIN" -p "$ADMIN_PASSWORD" docker compose exec imap testsaslauthd -u "admin@$APP_DOMAIN" -p "$ADMIN_PASSWORD" utils/mailtransporttest.py --sender-username "admin@$APP_DOMAIN" --sender-password "$ADMIN_PASSWORD" --sender-host "$APP_DOMAIN" --recipient-username "admin@$APP_DOMAIN" --recipient-password "$ADMIN_PASSWORD" --recipient-host "$APP_DOMAIN" utils/kolabendpointtester.py --verbose --host "$APP_DOMAIN" --dav "https://$APP_DOMAIN/dav/" --imap "$APP_DOMAIN" --activesync "$APP_DOMAIN" --user "admin@$APP_DOMAIN" --password "$ADMIN_PASSWORD" + +echo "All tests have passed!" diff --git a/kolabctl b/kolabctl new file mode 100755 index 00000000..cb06c99d --- /dev/null +++ b/kolabctl @@ -0,0 +1,79 @@ +#!/bin/bash + +CONFIG="config.prod" +HOST="kolab.local" +BRANCH="master" + +kolab__deploy() { + echo "Please enter your new admin password for the admin@$HOST user:" + read -r ADMIN_PASSWORD + echo "Deploying $CONFIG from branch $BRANCH on $HOST" + command env KOLAB_GIT_REF=$BRANCH HOST=$HOST ADMIN_PASSWORD="$ADMIN_PASSWORD" bin/configure.sh "$CONFIG" + command env ADMIN_PASSWORD="$ADMIN_PASSWORD" bin/deploy.sh +} + +kolab__start() { + command bin/start.sh +} + +kolab__stop() { + command bin/stop.sh +} + +kolab__update() { + command bin/update.sh +} + +kolab__backup() { + command bin/backup.sh +} + +kolab__restore() { + command bin/restore.sh +} + +kolab__selfcheck() { + command bin/selfcheck.sh +} + +kolab__help() { + cat </dev/null 2>&1; then + "kolab__$cmdname" "$@" + else + command "$cmdname" "$@" # call the **real** yum command + fi +} + +# if the functions above are sourced into an interactive interpreter, the user can +# just call "kolab deploy" or "kolab start" with no further code needed. + +# if invoked as a script rather than sourced, call function named on argv via the below; +# note that this must be the first operation other than a function definition +# for $_ to successfully distinguish between sourcing and invocation: +# [[ $_ != $0 ]] && return + +# make sure we actually *did* get passed a valid function name +if declare -f "kolab__$1" >/dev/null 2>&1; then + "kolab__$1" "${@:1}" +else + echo "Function $1 not recognized" >&2 + command kolab__help + exit 1 +fi +