Skip to content

Commit b51cfe9

Browse files
committed
WIP
1 parent 35323ca commit b51cfe9

File tree

4 files changed

+32
-20
lines changed

4 files changed

+32
-20
lines changed

ansible/hetzner-single-deploy.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
- hosts: all
22
become: true
33
vars:
4-
artifact_hash: d8fe36747614968ea73ebd43d47b99364c52f9c1
5-
ubuntu_version: 22.04.4
6-
ssh_pubkey: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDPTGTo1lTqd3Ym/75MRyQvj8xZINO/GI6FzfIadSe5c [email protected]"
4+
artifact_hash: dd7b682ba14c65116fa9a87b1dc80787bbad16bb
5+
ubuntu_version: 22.04.5
6+
ssh_pubkey: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBantLLGJX/7S6zT+ixyNdQ81XSboOkErYo7Bi9tUIwX"
77
tasks:
88
- name: set ipv4 forward
99
sysctl:
@@ -40,7 +40,7 @@
4040
- docker.io
4141
- telnet
4242
- python3-lxml
43-
- qemu
43+
- qemu-system-x86
4444
- qemu-kvm
4545
- qemu-utils
4646
- libvirt-clients

ansible/inventory.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
webapp.wiab-autodeploy.wire.link

bin/autodeploy.sh

+26-15
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22
# shellcheck disable=SC2087
33
set -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+
515
msg() {
616
echo >&2 -e "${1-}"
717
}
@@ -28,7 +38,7 @@ Running the script without any arguments requires one interaction - confirming t
2838
For CI usage, it's recommended to invoke "--force-redeploy".
2939
3040
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
3242
* target-domain = wiab-autodeploy.wire.link
3343
3444
Available options:
@@ -78,7 +88,7 @@ parse_params() {
7888

7989
parse_params "$@"
8090

81-
ARTIFACT_HASH="${ARTIFACT_HASH:-5c06158547bc57846eadaa2be5c813ec43be9b59}"
91+
ARTIFACT_HASH="${ARTIFACT_HASH:-dd7b682ba14c65116fa9a87b1dc80787bbad16bb}"
8292
TARGET_SYSTEM="${TARGET_SYSTEM:-wiab-autodeploy.wire.link}"
8393
FORCE_REDEPLOY="${FORCE_REDEPLOY:-0}"
8494
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"
104114
msg ""
105115
msg "INFO: Successfully logged into $TARGET_SYSTEM as $SSH_USER"
106116
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."
108118
fi
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

116126
system_cleanup_meta() {
117127
msg ""
@@ -126,12 +136,14 @@ system_cleanup
126136
EOT
127137
}
128138

139+
# TODO:: Check if virsh is available. If not (fresh install) then you don't need to check
140+
# for
129141
system_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

137149
preprovision_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
405416
fi
406417

407418
msg "INFO: Commencing Wire-in-a-box deployment on $TARGET_SYSTEM."
408-
preprovision_hetzner
419+
# preprovision_hetzner
409420
ssh -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)

bin/offline-vm-setup.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ else
108108
VM_IP=(192.168.122.10 192.168.122.21 192.168.122.22 192.168.122.23 192.168.122.31 192.168.122.32 192.168.122.33)
109109
VM_VCPU=(2 6 6 6 4 4 4)
110110
VM_RAM=(4096 8192 8192 8192 8192 8192 8192)
111-
VM_DISK=(100 100 100 100 350 350 350)
111+
VM_DISK=(100 100 100 100 100 100 100)
112112
fi
113113

114114
if [[ -f "$HOME"/.ssh/authorized_keys && -s "$HOME"/.ssh/authorized_keys ]]; then

0 commit comments

Comments
 (0)