1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2026-03-14 17:27:23 +01:00

Remove vagrant references - everything has moved to lxd

This commit is contained in:
downtownallday
2024-10-04 14:51:25 -04:00
parent 3e0a621450
commit 3b6e6177d0
15 changed files with 3 additions and 732 deletions

View File

@@ -0,0 +1 @@
TODO - convert to lxd

61
tests/lxd/majorupgrade/Vagrantfile vendored Normal file
View File

@@ -0,0 +1,61 @@
#####
##### This file is part of Mail-in-a-Box-LDAP which is released under the
##### terms of the GNU Affero General Public License as published by the
##### Free Software Foundation, either version 3 of the License, or (at
##### your option) any later version. See file LICENSE or go to
##### https://github.com/downtownallday/mailinabox-ldap for full license
##### details.
#####
load '../funcs.rb'
# major upgrade Ubuntu 18.04 (bionic) -> Ubuntu 22.04 (jammy)
Vagrant.configure("2") do |config|
config.vm.synced_folder "../../..", "/mailinabox", id: "mailinabox", automount: false
config.vm.network "public_network", bridge: "#$default_network_interface"
config.vm.define "major-upgrade-oldvm" do |m1|
use_preloaded_box m1, "ubuntu/bionic64", ".."
m1.vm.provision :shell, :inline => <<-SH
# setup vanilla system, populated with some data
cd /mailinabox
export PRIMARY_HOSTNAME=majorupgrade.local
export FEATURE_MUNIN=false
source tests/system-setup/setup-defaults.sh
tests/system-setup/vanilla.sh \
--checkout-repo="$MIABLDAP_GIT" \
--checkout-treeish="$MIABLDAP_FINAL_RELEASE_TAG_BIONIC64" \
--checkout-targetdir="$HOME/miabldap-bionic" \
--populate=basic \
--populate=totpuser \
--capture-state=/tmp/state/oldvm \
|| exit 1
SH
end
# config.vm.provider "virtualbox" do |v|
# v.memory = 512
# end
config.vm.define "major-upgrade-newvm" do |m2|
use_preloaded_box m2, "ubuntu/jammy64", ".."
m2.vm.provision :shell, :inline => <<-SH
cd /mailinabox
export PRIMARY_HOSTNAME=majorupgrade.local
export FEATURE_MUNIN=true
tests/system-setup/from-backup.sh \
"#{ENV['storage_user']}" \
"#{ENV['duplicity_files']}" \
"#{ENV['secret_key']}" \
"#{ENV['restore_to']}" \
--capture-state=/tmp/state/newvm \
|| exit 1
SH
end
end

View File

@@ -0,0 +1,82 @@
#!/bin/bash
#####
##### This file is part of Mail-in-a-Box-LDAP which is released under the
##### terms of the GNU Affero General Public License as published by the
##### Free Software Foundation, either version 3 of the License, or (at
##### your option) any later version. See file LICENSE or go to
##### https://github.com/downtownallday/mailinabox-ldap for full license
##### details.
#####
# run from this script's directory
cd $(dirname "$0")
source ../../lib/color-output.sh
artifact_dir_local="$(dirname "$0")/../../out/majorupgrade_artifacts"
artifact_dir_vm="/mailinabox/tests/out/majorupgrade_artifacts"
oldvm="major-upgrade-oldvm"
newvm="major-upgrade-newvm"
warn "Artifacts directory: $(realpath "$artifact_dir_local")"
warn "Destroy existing VMs"
vagrant destroy -f
if [ "$1" != "--no-oldvm" ]; then
#
# bring up oldvm
# ... then install, populate, and backup
# ... installed source is in $HOME/miabldap-bionic ($HOME is /root)
#
warn "Bring up $oldvm"
vagrant up $oldvm || exit 1
warn "Run managment/backup.py"
vagrant ssh $oldvm -- "sudo -H bash -c 'cd \$HOME/miabldap-bionic; management/backup.py' && echo 'backup successful'" || exit 2
# copy artifacts from oldvm to host
warn "Copy artifacts"
rm -rf "$artifact_dir_local"
mkdir -p "$artifact_dir_local"
vagrant ssh $oldvm -- "cd \"$artifact_dir_vm\" || exit 1; sudo -H cp -R /tmp/state/oldvm state || exit 2; sudo -H cp -R /home/user-data/backup backup || exit 3" || exit $?
# destroy oldvm - bring up newvm
warn "Destroy $oldvm - no longer needed"
vagrant destroy $oldvm -f
else
# remove --no-oldvm from argument list
shift
fi
#
# bring up newvm
#
warn "Bring up $newvm"
# inputs to Vagrantfile passed through environment
export storage_user="user-data"
export duplicity_files="$artifact_dir_vm/backup/encrypted"
export secret_key="$artifact_dir_vm/backup/secret_key.txt"
export restore_to="/home/user-data"
vagrant up $newvm || exit 1
# compare states
vagrant ssh $newvm -- "cd /mailinabox; sudo -H bash -c 'source tests/lib/all.sh; installed_state_compare $artifact_dir_vm/state /tmp/state/newvm'" || exit 2
# run tests
if [ "$1" != "--no-tests" ]; then
vagrant ssh $newvm -- "cd /mailinabox; sudo -H tests/runner.sh upgrade-basic upgrade-totpuser default" || exit 3
else
# remove --no-tests from argument list
shift
fi
success 'Success'