forked from digital-asset/daml
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
multistep macos setup (digital-asset#5768)
multistep macos setup This updates the macOS node setup instructions to avoid repeating identical work and network traffic across all machines through initialization by building a "daily" image with all the tools and code we need. CHANGELOG_BEGIN CHANGELOG_END * Fix 3-running-box to remount nix partition * updated scripts to use multi-step process * add copyright notices Co-authored-by: nycnewman <edward@digitalasset.com>
- Loading branch information
1 parent
4f2bd15
commit 5b2319e
Showing
16 changed files
with
285 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Host setup | ||
|
||
The host machine for this step needs three things: | ||
|
||
1. The "macinbox" [Vagrant base box](../1-create-box/README.md) for macOS. | ||
2. VirtualBox (with the extension) or VMWare. | ||
3. Vagrant (and the VMWare plugin if using VMWare). | ||
|
||
As all three are already covered by the `macinbox` step, the easiest approach | ||
is probably to just run this on the same box. | ||
|
||
You can refer to the instructions in [this README](../1-create-box/README.md), | ||
or, for a more automated setup, use the following set of commands if using | ||
Virtualbox (which will require a sudoer password at some points): | ||
|
||
``` | ||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" < /dev/null | ||
brew cask install virtualbox | ||
brew cask install vagrant | ||
cd $(mktemp -d) | ||
V=$(VBoxManage --version | sed 's/r.*//') | ||
wget https://download.virtualbox.org/virtualbox/$V/Oracle_VM_VirtualBox_Extension_Pack-$V.vbox-extpack | ||
sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-$V.vbox-extpack | ||
cd - | ||
``` | ||
|
||
This will install homebrew, then use it to install the latest versions of | ||
VirtualBox and Vagrant. The `brew cask` invocations need to be ran from a | ||
sudoer account and will request a password (unless passwordless sudo is | ||
configured, which I would not recommend), so this cannot be completely | ||
scripted. `brew` itself will refuse to run if started as root. | ||
|
||
# Creating the daily Vagrant box | ||
|
||
This step builds upon the `macinbox` step to take a blank macOS image and add: | ||
|
||
- The vsts user that will run the Azure agent. | ||
- The XCode CLI tools. | ||
- A working nix installation. | ||
- All the nix dependencies for the daml project. | ||
- A populated Bazel cache for the daml project. | ||
|
||
This results in a machine that is completely initialized, without having needed | ||
any credentials. The only bit missing is the actual Azure agent. | ||
|
||
This can be run every day, though it is probably good enough to run it once a | ||
week. | ||
|
||
To select a provider, you need to set the `PROVIDER` environment variable. If | ||
you do not set it, `vmware_desktop` will be used. The only other valid option | ||
at the moment is `virtualbox`. | ||
|
||
The steps to create the box are: | ||
|
||
``` | ||
vagrant up | ||
vagrant package --output initialized-$(date +%Y%m%d).box | ||
``` | ||
|
||
The `vagrant up` command can take a while as it is doing all of the internal | ||
setup for the machine. It also ends with shutting down the machine so there | ||
should be no lingering process. | ||
|
||
The output file is all that needs to be moved to the other machines; they do | ||
not need the original `macinbox` files. | ||
|
||
Once the output file is created, you can also remove the "active" (though at | ||
this point shut down) Vagrant box for this folder by running | ||
``` | ||
vagrant destroy | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
provider = ENV["PROVIDER"] || "vmware_desktop" | ||
|
||
providers = { "vmware_desktop" => [57344, 10], | ||
"virtualbox" => [4096, 1] } | ||
|
||
raise "invalid provider: #{provider}" unless providers.member? provider | ||
|
||
Vagrant.configure("2") do |config| | ||
config.vm.box = "macinbox" | ||
config.vm.boot_timeout = 900 # 15 minutes | ||
config.vm.synced_folder ".", "/vagrant", disabled: true | ||
config.vm.provider provider do |prov| | ||
prov.gui = false | ||
prov.memory = providers[provider][0] | ||
prov.cpus = providers[provider][1] | ||
end | ||
config.vm.provision "shell" do |script| | ||
script.path = "init.sh" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
infra/macos/2-vagrant-files/Vagrantfile.virtual-box-sample
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.vagrant |
Oops, something went wrong.