dev: make cni, consul, dev, docker, and vault scripts Lima compat. (#16689)

This commit is contained in:
James Rasell 2023-03-28 16:21:14 +01:00 committed by GitHub
parent 87f4b71df0
commit 17fd1a2e35
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 69 additions and 33 deletions

10
Vagrantfile vendored
View file

@ -138,23 +138,23 @@ def configureLinuxProvisioners(vmCfg)
vmCfg.vm.provision "shell",
privileged: true,
path: './scripts/vagrant-linux-priv-dev.sh'
path: './scripts/linux-priv-dev.sh'
vmCfg.vm.provision "shell",
privileged: true,
path: './scripts/vagrant-linux-priv-docker.sh'
path: './scripts/linux-priv-docker.sh'
vmCfg.vm.provision "shell",
privileged: true,
path: './scripts/vagrant-linux-priv-consul.sh'
path: './scripts/linux-priv-consul.sh'
vmCfg.vm.provision "shell",
privileged: true,
path: './scripts/vagrant-linux-priv-cni.sh'
path: './scripts/linux-priv-cni.sh'
vmCfg.vm.provision "shell",
privileged: true,
path: './scripts/vagrant-linux-priv-vault.sh'
path: './scripts/linux-priv-vault.sh'
vmCfg.vm.provision "shell",
privileged: false,

View file

@ -2,8 +2,15 @@
set -o errexit
# Minimal effort to support amd64 and arm64 installs.
ARCH=""
case $(arch) in
x86_64) ARCH="amd64" ;;
aarch64) ARCH="arm64" ;;
esac
VERSION="v1.0.0"
DOWNLOAD=https://github.com/containernetworking/plugins/releases/download/${VERSION}/cni-plugins-linux-amd64-${VERSION}.tgz
DOWNLOAD=https://github.com/containernetworking/plugins/releases/download/${VERSION}/cni-plugins-linux-${ARCH}-${VERSION}.tgz
TARGET_DIR=/opt/cni/bin
CONFIG_DIR=/opt/cni/config

View file

@ -2,8 +2,15 @@
set -o errexit
VERSION="1.10.3"
DOWNLOAD=https://releases.hashicorp.com/consul/${VERSION}/consul_${VERSION}_linux_amd64.zip
# Minimal effort to support amd64 and arm64 installs.
ARCH=""
case $(arch) in
x86_64) ARCH="amd64" ;;
aarch64) ARCH="arm64" ;;
esac
VERSION="1.15.1"
DOWNLOAD=https://releases.hashicorp.com/consul/${VERSION}/consul_${VERSION}_linux_${ARCH}.zip
function install_consul() {
if [[ -e /usr/bin/consul ]] ; then

View file

@ -20,6 +20,8 @@ hostname=$(hostname)
sed -i -e "s/.*nomad.*/${ip} ${hostname}/" /etc/hosts
# Ensure we cd into the working directory on login
if ! grep "cd /opt/gopath/src/github.com/hashicorp/nomad" /home/vagrant/.profile ; then
echo 'cd /opt/gopath/src/github.com/hashicorp/nomad' >> /home/vagrant/.profile
if [ -d /home/vagrant/ ] ; then
if ! grep "cd /opt/gopath/src/github.com/hashicorp/nomad" /home/vagrant/.profile ; then
echo 'cd /opt/gopath/src/github.com/hashicorp/nomad' >> /home/vagrant/.profile
fi
fi

34
scripts/linux-priv-docker.sh Executable file
View file

@ -0,0 +1,34 @@
#!/usr/bin/env bash
# Source: https://docs.docker.com/engine/install/ubuntu/
# Minimal effort to support amd64 and arm64 installs.
ARCH=""
case $(arch) in
x86_64) ARCH="amd64" ;;
aarch64) ARCH="arm64" ;;
esac
USER=""
case $(whoami) in
root) USER="vagrant" ;;
*) USER=$(whoami) ;;
esac
# Add the Docker repository
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository -y \
"deb [arch=${ARCH}] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
# Update with i386, Go and Docker
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
# Restart Docker in case it got upgraded
sudo systemctl restart docker.service
# Ensure Docker can be used by the correct user
sudo usermod -aG docker ${USER}

View file

@ -2,8 +2,15 @@
set -o errexit
VERSION=1.8.4
DOWNLOAD=https://releases.hashicorp.com/vault/${VERSION}/vault_${VERSION}_linux_amd64.zip
# Minimal effort to support amd64 and arm64 installs.
ARCH=""
case $(arch) in
x86_64) ARCH="amd64" ;;
aarch64) ARCH="arm64" ;;
esac
VERSION=1.13.0
DOWNLOAD=https://releases.hashicorp.com/vault/${VERSION}/vault_${VERSION}_linux_${ARCH}.zip
function install_vault() {
if [[ -e /usr/bin/vault ]] ; then

View file

@ -1,21 +0,0 @@
#!/usr/bin/env bash
# Source: https://docs.docker.com/engine/install/ubuntu/
# Add the Docker repository
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
# Update with i386, Go and Docker
apt-get update
apt-get install -y docker-ce docker-ce-cli containerd.io
# Restart Docker in case it got upgraded
systemctl restart docker.service
# Ensure Docker can be used by vagrant user
usermod -aG docker vagrant