Vagrant changes

• Get rid of the 'fresh' VM. It just got in the way, taking up more memory when 'vagrant up' was used, and only solved one problem  that was happening three years ago when I was at RustFest and in a programm-y mood.
• Use a more up-to-date Ubuntu image and give the machine more cores.
• Start moving some of the developer tools out of this repo. As I get more and more Rust projects, I don't want the scripts to package them to be repeated in each repository.
This commit is contained in:
Benjamin Sago 2020-10-10 00:21:20 +01:00
parent e44858eb41
commit e95eb5e9fc
5 changed files with 7 additions and 129 deletions

52
Vagrantfile vendored
View File

@ -4,19 +4,18 @@ Vagrant.configure(2) do |config|
# We use Ubuntu instead of Debian because the image comes with two-way # We use Ubuntu instead of Debian because the image comes with two-way
# shared folder support by default. # shared folder support by default.
UBUNTU = 'bento/ubuntu-16.04' UBUNTU = 'hashicorp/bionic64'
# The main VM is the one used for development and testing. config.vm.define(:exa) do |config|
config.vm.define(:exa, primary: true) do |config|
config.vm.provider :virtualbox do |v| config.vm.provider :virtualbox do |v|
v.name = 'exa' v.name = 'exa'
v.memory = 2048 v.memory = 2048
v.cpus = 2 v.cpus = `nproc`.chomp.to_i
end end
config.vm.provider :vmware_desktop do |v| config.vm.provider :vmware_desktop do |v|
v.vmx['memsize'] = '2048' v.vmx['memsize'] = '2048'
v.vmx['numvcpus'] = '2' v.vmx['numvcpus'] = `nproc`.chomp
end end
config.vm.box = UBUNTU config.vm.box = UBUNTU
@ -562,47 +561,4 @@ Vagrant.configure(2) do |config|
EOF EOF
end end
end end
# Remember that problem that exa had where the binary wasnt actually
# self-contained? Or the problem where the Linux binary was actually the
# macOS binary in disguise?
#
# This is a “fresh” VM that intentionally downloads no dependencies and
# installs nothing so that we can check that exa still runs!
config.vm.define(:fresh) do |config|
config.vm.box = UBUNTU
config.vm.hostname = 'fresh'
config.vm.provider :virtualbox do |v|
v.name = 'exa-fresh'
v.memory = 384
v.cpus = 1
end
# Well, we do need *one* dependency...
config.vm.provision :shell, privileged: true, inline: <<-EOF
set -xe
apt-get install -qq -o=Dpkg::Use-Pty=0 -y unzip
EOF
# This thing also has its own welcoming text.
config.vm.provision :shell, privileged: true, inline: <<-EOF
rm -f /etc/update-motd.d/*
# Capture the help text so it gets displayed first
bash /vagrant/devtools/dev-help-testvm.sh > /etc/motd
# Disable last login date in sshd
sed -i '/PrintLastLog yes/c\PrintLastLog no' /etc/ssh/sshd_config
systemctl restart sshd
EOF
# Make the checker script a command.
config.vm.provision :shell, privileged: true, inline: <<-EOF
set -xe
echo -e "#!/bin/sh\nbash /vagrant/devtools/dev-download-and-check-release.sh \"\\$*\"" > /usr/bin/check-release
chmod +x /usr/bin/check-release
EOF
end
end end

View File

@ -1,5 +1,5 @@
## exa development tools ## exa development tools
These scripts deal with things like packaging release-worthy versions of exa and making sure the published versions actually work. These scripts deal with things like packaging release-worthy versions of exa.
They are **not general-purpose scripts** that youre able to run from your main computer! Theyre intended to be run from the Vagrant machines — they have commands such as package-exa or check-release that execute them instead. They are **not general-purpose scripts** that youre able to run from your main computer! Theyre intended to be run from the Vagrant machine.

View File

@ -1,51 +0,0 @@
# This script downloads the published versions of exa from GitHub and my site,
# checks that the checksums match, and makes sure the files at least unzip and
# execute okay.
#
# The argument should be of the form “0.8.0”, no v. That version was the
# first one to offer checksums, so its the minimum version that can be tested.
set +x
trap 'exit' ERR
exa_version=$1
if [[ -z "$exa_version" ]]; then
echo "Please specify a version, such as '$0 0.8.0'"
exit 1
fi
# Delete anything that already exists
rm -rfv "/tmp/${exa_version}-downloads"
# Create a temporary directory and download exa into it
mkdir "/tmp/${exa_version}-downloads"
cd "/tmp/${exa_version}-downloads"
echo -e "\n\033[4mDownloading stuff...\033[0m"
wget --quiet --show-progress "https://github.com/ogham/exa/releases/download/v${exa_version}/exa-macos-x86_64-${exa_version}.zip"
wget --quiet --show-progress "https://github.com/ogham/exa/releases/download/v${exa_version}/exa-linux-x86_64-${exa_version}.zip"
wget --quiet --show-progress "https://github.com/ogham/exa/releases/download/v${exa_version}/MD5SUMS"
wget --quiet --show-progress "https://github.com/ogham/exa/releases/download/v${exa_version}/SHA1SUMS"
# Unzip the zips and check the sums
echo -e "\n\033[4mExtracting that stuff...\033[0m"
unzip "exa-macos-x86_64-${exa_version}.zip"
unzip "exa-linux-x86_64-${exa_version}.zip"
echo -e "\n\033[4mValidating MD5 checksums...\033[0m"
md5sum -c MD5SUMS
echo -e "\n\033[4mValidating SHA1 checksums...\033[0m"
sha1sum -c SHA1SUMS
# Finally, give the Linux version a go
echo -e "\n\033[4mChecking it actually runs...\033[0m"
./"exa-linux-x86_64" --version
./"exa-linux-x86_64" --long
echo -e "\n\033[1;32mAll's lookin' good!\033[0m"

View File

@ -1,15 +0,0 @@
# This script generates the MD5SUMS and SHA1SUMS files.
# Youll need to have run dev-download-and-check-release.sh and
# local-package-for-macos.sh scripts to generate the binaries first.
set +x
trap 'exit' ERR
cd /vagrant
rm -f MD5SUMS SHA1SUMS
echo -e "\n\033[4mValidating MD5 checksums...\033[0m"
md5sum exa-linux-x86_64 exa-macos-x86_64 | tee MD5SUMS
echo -e "\n\033[4mValidating SHA1 checksums...\033[0m"
sha1sum exa-linux-x86_64 exa-macos-x86_64 | tee SHA1SUMS

View File

@ -1,12 +0,0 @@
# This file is like the other one, except for the testing VM.
# It also gets dumped into /etc/motd.
echo -e "
\033[1;33mThe exa testing environment!\033[0m
This machine is dependency-free, and can be used to test that
released versions of exa still work on vanilla Linux installs.
\033[4mCommands\033[0m
\033[32;1mcheck-release\033[0m to download and verify released binaries
"