2
2
# shellcheck disable=SC2087
3
3
set -Eeuo pipefail
4
4
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
+
5
15
msg () {
6
16
echo >&2 -e " ${1-} "
7
17
}
@@ -28,7 +38,7 @@ Running the script without any arguments requires one interaction - confirming t
28
38
For CI usage, it's recommended to invoke "--force-redeploy".
29
39
30
40
It 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
32
42
* target-domain = wiab-autodeploy.wire.link
33
43
34
44
Available options:
@@ -78,7 +88,7 @@ parse_params() {
78
88
79
89
parse_params " $@ "
80
90
81
- ARTIFACT_HASH=" ${ARTIFACT_HASH:- 5c06158547bc57846eadaa2be5c813ec43be9b59 } "
91
+ ARTIFACT_HASH=" ${ARTIFACT_HASH:- dd7b682ba14c65116fa9a87b1dc80787bbad16bb } "
82
92
TARGET_SYSTEM=" ${TARGET_SYSTEM:- wiab-autodeploy.wire.link} "
83
93
FORCE_REDEPLOY=" ${FORCE_REDEPLOY:- 0} "
84
94
SUBDOMAINS=" 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"
104
114
msg " "
105
115
msg " INFO: Successfully logged into $TARGET_SYSTEM as $SSH_USER "
106
116
else
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."
108
118
fi
109
119
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
115
125
116
126
system_cleanup_meta () {
117
127
msg " "
@@ -126,12 +136,14 @@ system_cleanup
126
136
EOT
127
137
}
128
138
139
+ # TODO:: Check if virsh is available. If not (fresh install) then you don't need to check
140
+ # for
129
141
system_cleanup () {
130
142
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
135
147
}
136
148
137
149
preprovision_hetzner () {
@@ -170,8 +182,7 @@ remote_deployment() {
170
182
ZAUTH_CONTAINER=$( sudo docker load -i " $SCRIPT_DIR " /containers-adminhost/quay.io_wire_zauth_* .tar | awk ' {print $3}' )
171
183
export ZAUTH_CONTAINER
172
184
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 " " $@ "
175
186
}
176
187
export -f d
177
188
@@ -405,7 +416,7 @@ if [ "$DO_SYSTEM_CLEANUP" = true ] && [ "$FORCE_REDEPLOY" = 1 ]; then
405
416
fi
406
417
407
418
msg " INFO: Commencing Wire-in-a-box deployment on $TARGET_SYSTEM ."
408
- preprovision_hetzner
419
+ # preprovision_hetzner
409
420
ssh -p " $SSH_PORT " " $DEMO_USER " @webapp." $TARGET_SYSTEM " " bash -s" << EOT
410
421
# Making relevant vars and functions available to remote shell via SSH
411
422
$( declare -p DEMO_USER TARGET_SYSTEM SCRIPT_DIR)
0 commit comments