Merge branch 'master' into metal-provider-update-plan
This commit is contained in:
commit
7315975878
3
deploy/vagrant/Vagrantfile
vendored
3
deploy/vagrant/Vagrantfile
vendored
@ -15,7 +15,8 @@ end
|
||||
Vagrant.configure('2') do |config|
|
||||
|
||||
config.vm.define :provisioner do |provisioner|
|
||||
provisioner.vm.box = 'generic/ubuntu1804'
|
||||
provisioner.vm.box = "tinkerbelloss/sandbox-ubuntu1804"
|
||||
provisioner.vm.box_version = "0.1.0"
|
||||
provisioner.vm.hostname = 'provisioner'
|
||||
provisioner.vm.synced_folder './../../', '/vagrant'
|
||||
provisioner.vm.provision :shell, path: './scripts/tinkerbell.sh'
|
||||
|
1
deploy/vagrant/basebox/.gitignore
vendored
Normal file
1
deploy/vagrant/basebox/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
output*
|
30
deploy/vagrant/basebox/README.md
Normal file
30
deploy/vagrant/basebox/README.md
Normal file
@ -0,0 +1,30 @@
|
||||
This directory contains a provisioning mechanism for the Vagrant boxes we ship
|
||||
as part of Sandbox.
|
||||
|
||||
In order to self contain and distribute the required dependencies for Tinkerbell
|
||||
and Sandbox without having to download all of them at runtime we decided to use
|
||||
[Packer.io](https://packer.io) to build boxes that you can use when provisioning
|
||||
Tinkerbell on Vagrant.
|
||||
|
||||
Currently the generated boxes are available via [Vagrant
|
||||
Cloud](https://app.vagrantup.com/tinkerbelloss).
|
||||
|
||||
---
|
||||
|
||||
## Build
|
||||
|
||||
To build the boxes checkout the right directory and run
|
||||
|
||||
```terminal
|
||||
$ packer build --parallel-builds=1 ./template.json
|
||||
```
|
||||
|
||||
`-parallel-builds=1` is required because the template builds images for multiple
|
||||
providers using the [Vagrant
|
||||
builder](https://www.packer.io/docs/builders/vagrant) and I didn't manage to get
|
||||
it to work in parallel yet.
|
||||
|
||||
## Deploy to Vagrant Cloud
|
||||
|
||||
I didn't find a way to make the Vagrant Cloud post processor to work. But I use
|
||||
the vagrant cli `vagrant cloud publish` command.
|
47
deploy/vagrant/basebox/ubuntu1804/provision.sh
Normal file
47
deploy/vagrant/basebox/ubuntu1804/provision.sh
Normal file
@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
# abort this script on errors
|
||||
set -euxo pipefail
|
||||
|
||||
setup_docker() (
|
||||
# steps from https://docs.docker.com/engine/install/ubuntu/
|
||||
sudo apt-get install -y \
|
||||
apt-transport-https \
|
||||
ca-certificates \
|
||||
curl \
|
||||
gnupg-agent \
|
||||
software-properties-common
|
||||
|
||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg |
|
||||
sudo apt-key add -
|
||||
|
||||
local repo
|
||||
repo=$(
|
||||
printf "deb [arch=amd64] https://download.docker.com/linux/ubuntu %s stable" \
|
||||
"$(lsb_release -cs)"
|
||||
)
|
||||
sudo add-apt-repository "$repo"
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
|
||||
)
|
||||
|
||||
setup_docker_compose() (
|
||||
# from https://docs.docker.com/compose/install/
|
||||
sudo curl -L \
|
||||
"https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s)-$(uname -m)" \
|
||||
-o /usr/local/bin/docker-compose
|
||||
|
||||
sudo chmod +x /usr/local/bin/docker-compose
|
||||
)
|
||||
|
||||
main() (
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
sudo apt-get update
|
||||
setup_docker
|
||||
setup_docker_compose
|
||||
sudo apt-get install -y jq
|
||||
sudo usermod -aG docker vagrant
|
||||
)
|
||||
|
||||
main
|
27
deploy/vagrant/basebox/ubuntu1804/template.json
Normal file
27
deploy/vagrant/basebox/ubuntu1804/template.json
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"builders": [
|
||||
{
|
||||
"communicator": "ssh",
|
||||
"name": "vagrant-virtualbox",
|
||||
"provider": "virtualbox",
|
||||
"source_path": "generic/ubuntu1804",
|
||||
"type": "vagrant"
|
||||
},
|
||||
{
|
||||
"communicator": "ssh",
|
||||
"name": "vagrant-libvirt",
|
||||
"provider": "libvirt",
|
||||
"source_path": "generic/ubuntu1804",
|
||||
"type": "vagrant"
|
||||
}
|
||||
],
|
||||
"provisioners": [
|
||||
{
|
||||
"script": "provision.sh",
|
||||
"type": "shell"
|
||||
}
|
||||
],
|
||||
"variables": {
|
||||
"cloud_token": "{{ env `VAGRANT_CLOUD_TOKEN` }}"
|
||||
}
|
||||
}
|
@ -7,38 +7,6 @@ whoami
|
||||
|
||||
cd /vagrant
|
||||
|
||||
setup_docker() (
|
||||
# steps from https://docs.docker.com/engine/install/ubuntu/
|
||||
sudo apt-get install -y \
|
||||
apt-transport-https \
|
||||
ca-certificates \
|
||||
curl \
|
||||
gnupg-agent \
|
||||
software-properties-common
|
||||
|
||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg |
|
||||
sudo apt-key add -
|
||||
|
||||
local repo
|
||||
repo=$(
|
||||
printf "deb [arch=amd64] https://download.docker.com/linux/ubuntu %s stable" \
|
||||
"$(lsb_release -cs)"
|
||||
)
|
||||
sudo add-apt-repository "$repo"
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
|
||||
)
|
||||
|
||||
setup_docker_compose() (
|
||||
# from https://docs.docker.com/compose/install/
|
||||
sudo curl -L \
|
||||
"https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s)-$(uname -m)" \
|
||||
-o /usr/local/bin/docker-compose
|
||||
|
||||
sudo chmod +x /usr/local/bin/docker-compose
|
||||
)
|
||||
|
||||
make_certs_writable() (
|
||||
local certdir="/etc/docker/certs.d/$TINKERBELL_HOST_IP"
|
||||
sudo mkdir -p "$certdir"
|
||||
@ -50,13 +18,7 @@ secure_certs() (
|
||||
sudo chown "root" "$certdir"
|
||||
)
|
||||
|
||||
command_exists() (
|
||||
command -v "$@" >/dev/null 2>&1
|
||||
)
|
||||
|
||||
configure_vagrant_user() (
|
||||
sudo usermod -aG docker vagrant
|
||||
|
||||
echo -n "$TINKERBELL_REGISTRY_PASSWORD" |
|
||||
sudo -iu vagrant docker login \
|
||||
--username="$TINKERBELL_REGISTRY_USERNAME" \
|
||||
@ -72,20 +34,6 @@ setup_nat() (
|
||||
main() (
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
apt-get update
|
||||
|
||||
if ! command_exists docker; then
|
||||
setup_docker
|
||||
fi
|
||||
|
||||
if ! command_exists docker-compose; then
|
||||
setup_docker_compose
|
||||
fi
|
||||
|
||||
if ! command_exists jq; then
|
||||
sudo apt-get install -y jq
|
||||
fi
|
||||
|
||||
if [ ! -f ./.env ]; then
|
||||
./generate-envrc.sh eth1 >.env
|
||||
fi
|
||||
@ -98,9 +46,7 @@ main() (
|
||||
./setup.sh
|
||||
|
||||
setup_nat
|
||||
|
||||
secure_certs
|
||||
|
||||
configure_vagrant_user
|
||||
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user