22# shellcheck disable=SC2087
33set -Eeuo pipefail
44
5+
6+ #
7+ # Problems discovered while running this script
8+ #
9+ # - on first run "virsh" not found. This seems to be installed only later
10+ # - change cleanup user logic:
11+ #
12+ #
13+ #
14+
515msg () {
616 echo >&2 -e " ${1-} "
717}
@@ -28,7 +38,7 @@ Running the script without any arguments requires one interaction - confirming t
2838For CI usage, it's recommended to invoke "--force-redeploy".
2939
3040It is likely desirable to invoke the script with "--artifact-hash" and / or "--target-domain" as well. These are the hardcoded fallback values:
31- * artifact-hash = 5c06158547bc57846eadaa2be5c813ec43be9b59
41+ * artifact-hash = dd7b682ba14c65116fa9a87b1dc80787bbad16bb
3242 * target-domain = wiab-autodeploy.wire.link
3343
3444Available options:
@@ -78,7 +88,7 @@ parse_params() {
7888
7989parse_params " $@ "
8090
81- ARTIFACT_HASH=" ${ARTIFACT_HASH:- 5c06158547bc57846eadaa2be5c813ec43be9b59 } "
91+ ARTIFACT_HASH=" ${ARTIFACT_HASH:- dd7b682ba14c65116fa9a87b1dc80787bbad16bb } "
8292TARGET_SYSTEM=" ${TARGET_SYSTEM:- wiab-autodeploy.wire.link} "
8393FORCE_REDEPLOY=" ${FORCE_REDEPLOY:- 0} "
8494SUBDOMAINS=" account assets coturn federator inbucket nginz-https nginz-ssl sft teams webapp"
@@ -104,14 +114,14 @@ if ssh -q -o ConnectTimeout=5 -p "$SSH_PORT" "$SSH_USER"@webapp."$TARGET_SYSTEM"
104114 msg " "
105115 msg " INFO: Successfully logged into $TARGET_SYSTEM as $SSH_USER "
106116else
107- die " ERROR: Can't log into $TARGET_SYSTEM via SSH, please check SSH connectivity."
117+ die " ERROR: Can't log into webapp. $TARGET_SYSTEM via SSH, please check SSH connectivity."
108118fi
109119
110- if curl --head --silent --fail https://s3-eu-west-1.amazonaws.com/public.wire.com/artifacts/wire-server-deploy-static-" $ARTIFACT_HASH " .tgz > /dev/null 2>&1 ; then
111- msg " INFO: Artifact exists https://s3-eu-west-1.amazonaws.com/public.wire.com/artifacts/wire-server-deploy-static-$ARTIFACT_HASH .tgz"
112- else
113- die " ERROR: No artifact found via https://s3-eu-west-1.amazonaws.com/public.wire.com/artifacts/wire-server-deploy-static-$ARTIFACT_HASH .tgz"
114- fi
120+ # if curl --head --silent --fail https://s3-eu-west-1.amazonaws.com/public.wire.com/artifacts/wire-server-deploy-static-"$ARTIFACT_HASH".tgz >/dev/null 2>&1 ; then
121+ # msg "INFO: Artifact exists https://s3-eu-west-1.amazonaws.com/public.wire.com/artifacts/wire-server-deploy-static-$ARTIFACT_HASH.tgz"
122+ # else
123+ # die "ERROR: No artifact found via https://s3-eu-west-1.amazonaws.com/public.wire.com/artifacts/wire-server-deploy-static-$ARTIFACT_HASH.tgz"
124+ # fi
115125
116126system_cleanup_meta () {
117127 msg " "
@@ -126,12 +136,14 @@ system_cleanup
126136EOT
127137}
128138
139+ # TODO:: Check if virsh is available. If not (fresh install) then you don't need to check
140+ # for
129141system_cleanup () {
130142 for VM in $( virsh list --all --name) ; do virsh destroy " $VM " ; virsh undefine " $VM " --remove-all-storage; done
131- docker system prune -a -f
132- rm -f /home/$DEMO_USER /.ssh/known_hosts
133- rm -rf /home/$DEMO_USER /wire-server-deploy
134- rm -f /home/$DEMO_USER /wire-server-deploy-static-* .tgz
143+ # docker system prune -a -f
144+ # rm -f /home/$DEMO_USER/.ssh/known_hosts
145+ # rm -rf /home/$DEMO_USER/wire-server-deploy
146+ # rm -f /home/$DEMO_USER/wire-server-deploy-static-*.tgz
135147}
136148
137149preprovision_hetzner () {
@@ -170,8 +182,7 @@ remote_deployment() {
170182 ZAUTH_CONTAINER=$( sudo docker load -i " $SCRIPT_DIR " /containers-adminhost/quay.io_wire_zauth_* .tar | awk ' {print $3}' )
171183 export ZAUTH_CONTAINER
172184 WSD_CONTAINER=$( sudo docker load -i " $SCRIPT_DIR " /containers-adminhost/container-wire-server-deploy.tgz | awk ' {print $3}' )
173- d () {
174- sudo docker run --network=host -v " ${SSH_AUTH_SOCK:- nonexistent} " :/ssh-agent -e SSH_AUTH_SOCK=/ssh-agent -v " $HOME " /.ssh:/root/.ssh -v " $PWD " :/wire-server-deploy " $WSD_CONTAINER " " $@ "
185+ d () { sudo docker run --network=host -v " ${SSH_AUTH_SOCK:- nonexistent} " :/ssh-agent -e SSH_AUTH_SOCK=/ssh-agent -v " $HOME " /.ssh:/root/.ssh -v " $PWD " :/wire-server-deploy " $WSD_CONTAINER " " $@ "
175186 }
176187 export -f d
177188
@@ -405,7 +416,7 @@ if [ "$DO_SYSTEM_CLEANUP" = true ] && [ "$FORCE_REDEPLOY" = 1 ]; then
405416fi
406417
407418msg " INFO: Commencing Wire-in-a-box deployment on $TARGET_SYSTEM ."
408- preprovision_hetzner
419+ # preprovision_hetzner
409420ssh -p " $SSH_PORT " " $DEMO_USER " @webapp." $TARGET_SYSTEM " " bash -s" << EOT
410421# Making relevant vars and functions available to remote shell via SSH
411422$( declare -p DEMO_USER TARGET_SYSTEM SCRIPT_DIR)
0 commit comments