Last active
April 5, 2023 18:44
-
-
Save upkarlidder/f7b682e691caa5b2fce260065e7cd817 to your computer and use it in GitHub Desktop.
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
Vagrant.configure("2") do |config| | |
config.vm.define "microk8s" do |microk8s| | |
microk8s.vm.box = "ubuntu/bionic64" | |
microk8s.vm.hostname = "microk8s" | |
microk8s.vm.network "forwarded_port", guest: 3000, host: 3000 | |
microk8s.vm.network "forwarded_port", guest: 9090, host: 9090 | |
microk8s.vm.network "forwarded_port", guest: 9070, host: 9070 | |
microk8s.vm.network 'forwarded_port', guest: 80, host: 8000, id: 'ingress', host_ip: '127.0.0.1', auto_correct: true | |
microk8s.vm.network 'forwarded_port', guest: 8080, host: 8080, id: 'apiserver', host_ip: '127.0.0.1', auto_correct: true | |
microk8s.vm.network 'forwarded_port', guest: 32000, host: 32000, id: 'registry', host_ip: '127.0.0.1', auto_correct: true | |
microk8s.vm.network 'forwarded_port', guest: 10443, host: 10443, id: 'registry', host_ip: '127.0.0.1', auto_correct: true | |
microk8s.vm.network "forwarded_port", guest: 6443, host: 6443 # API Access | |
for p in 30000..30100 # expose NodePort IP's | |
microk8s.vm.network "forwarded_port", guest: p, host: p, protocol: "tcp" | |
end | |
microk8s.vm.provider "virtualbox" do |vb| | |
vb.name = "microk8s" | |
vb.memory = 12288 | |
vb.cpus = 2 | |
end | |
microk8s.vm.provision "shell", inline: <<-EOF | |
echo "******** Begin installing microk8s ********" | |
snap install microk8s --classic | |
echo "******** Begin installing docker ********" | |
snap install docker | |
microk8s.status --wait-ready | |
echo "******** enabling ingress, dns, dashboard and registry ********" | |
microk8s.enable ingress dns dashboard registry helm3 prometheus knative jaeger istio fluentd | |
usermod -a -G microk8s vagrant | |
echo "alias kubectl='microk8s.kubectl'" > /home/vagrant/.bash_aliases | |
echo "alias k=kubectl" >> /home/vagrant/.bash_aliases | |
chown vagrant:vagrant /home/vagrant/.bash_aliases | |
echo "alias kubectl='microk8s.kubectl'" > /root/.bash_aliases | |
chown root:root /root/.bash_aliases | |
echo "******** Begin kubectl port-forward for the dashboard ********" | |
# echo "running kubectl port forward" | |
# microk8s kubectl port-forward -n kube-system service/kubernetes-dashboard --address 0.0.0.0 10443:443 & | |
alias k=kubectl | |
echo "******** Generating kubectl token ********" | |
token=$(microk8s kubectl -n kube-system get secret | grep default-token | cut -d " " -f1) | |
microk8s kubectl -n kube-system describe secret $token | |
echo "******** install oc, tkn, helm, stern, odo, kn ********" | |
echo "******** Begin installing odo ********" | |
wget -q https://developers.redhat.com/content-gateway/rest/mirror/pub/openshift-v4/clients/odo/latest/odo-linux-amd64.tar.gz | |
mkdir -p odo && tar xf ./odo-linux-amd64.tar.gz -C $_ | |
sudo mv odo/odo /usr/local/bin/ | |
rm -rf odo* | |
odo version | |
echo "******** Begin installing oc ********" | |
wget -q https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/stable/openshift-client-linux.tar.gz | |
mkdir -p oc && tar xf ./openshift-client-linux.tar.gz -C $_ | |
sudo mv oc/oc /usr/local/bin/ | |
rm -rf openshift* && rm -rf oc | |
oc version --client | |
echo "******** Begin installing kn ********" | |
wget -q https://mirror.openshift.com/pub/openshift-v4/clients/serverless/latest/kn-linux-amd64.tar.gz | |
mkdir -p kn && tar xf ./kn-linux-amd64.tar.gz -C $_ | |
sudo mv kn/kn /usr/local/bin/ | |
rm -rf kn* | |
kn version | |
echo "******** Begin installing helm ********" | |
wget -q https://mirror.openshift.com/pub/openshift-v4/clients/helm/latest/helm-linux-amd64 | |
chmod a+x helm-linux-amd64 | |
sudo mv helm-linux-amd64 /usr/local/bin/helm | |
helm version | |
echo "******** Begin installing stern ********" | |
wget -q https://github.com/wercker/stern/releases/download/1.11.0/stern_linux_amd64 | |
chmod a+x stern_linux_amd64 | |
sudo mv ./stern_linux_amd64 /usr/local/bin/stern | |
stern --version | |
echo "******** Begin installing mysql-client ********" | |
sudo apt install mysql-client | |
# echo "******** Begin kubectl port forward ********" | |
# nohup microk8s kubectl port-forward -n monitoring service/grafana --address 0.0.0.0 3000:3000 & | |
# nohup microk8s kubectl port-forward -n monitoring service/prometheus-k8s --address 0.0.0.0 9090:9090 & | |
# nohup microk8s kubectl port-forward -n kube-system service/kubernetes-dashboard --address 0.0.0.0 10443:443 & | |
# nohup microk8s kubectl port-forward -n default service/argocd-server --address 0.0.0.0 9070:80 & | |
# jobs | |
EOF | |
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
Vagrant.configure("2") do |config| | |
config.vm.define "rocky" do |rocky| | |
rocky.vm.box = "generic/rocky8" | |
rocky.vm.hostname = "rocky" | |
# rocky.vagrant.plugins = "vagrant-docker-compose" | |
# rocky.vm.provision :docker | |
# rocky.vm.provision :docker_compose | |
rocky.vm.synced_folder "/host", "/home/vagrant/upkar-code" | |
rocky.vm.provider "virtualbox" do |vb| | |
vb.name = "rocky" | |
vb.memory = 4096 | |
vb.cpus = 2 | |
vb.customize ["modifyvm", :id, "--audio", "none"] | |
vb.customize ["modifyvm", :id, "--usb", "off"] | |
vb.customize ["modifyvm", :id, "--usbehci", "off"] | |
end | |
rocky.vm.provision "shell", privileged: false, inline: <<-EOF | |
echo "******** Begin update system ********" | |
sudo dnf update -y | |
echo "******** Begin install utilities ********" | |
sudo dnf install -y util-linux | |
sudo dnf install -y util-linux-user | |
echo "******** Begin installing docker ********" | |
sudo yum remove docker \ | |
docker-client \ | |
docker-client-latest \ | |
docker-common \ | |
docker-latest \ | |
docker-latest-logrotate \ | |
docker-logrotate \ | |
docker-engine | |
sudo yum install -y yum-utils | |
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo | |
sudo yum install docker-ce docker-ce-cli containerd.io -y | |
sudo systemctl start docker | |
sudo systemctl enable docker | |
sudo groupadd docker | |
sudo gpasswd -a $USER docker | |
# exec sudo su -l vagrant | |
docker --version | |
echo "******** Begin installing docker-compose ********" | |
# install docker-compose | |
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
sudo chmod +x /usr/local/bin/docker-compose | |
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose | |
docker-compose --version | |
echo "******** Begin install common tools ********" | |
echo "******** Begin installing mysql ********" | |
sudo dnf module enable mysql:8.0 | |
sudo dnf install @mysql | |
mysql --version | |
echo "******** Begin installing odo ********" | |
wget -q https://developers.redhat.com/content-gateway/rest/mirror/pub/openshift-v4/clients/odo/latest/odo-linux-amd64.tar.gz | |
mkdir -p odo && tar xf ./odo-linux-amd64.tar.gz -C $_ | |
sudo mv odo/odo /usr/local/sbin/ | |
rm -rf odo* | |
odo version | |
echo "******** Begin installing oc ********" | |
wget -q https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/stable/openshift-client-linux.tar.gz | |
mkdir -p oc && tar xf ./openshift-client-linux.tar.gz -C $_ | |
sudo mv oc/oc /usr/local/sbin/ | |
rm -rf openshift* && rm -rf oc | |
oc version --client | |
echo "******** Begin installing kn ********" | |
wget -q https://mirror.openshift.com/pub/openshift-v4/clients/serverless/latest/kn-linux-amd64.tar.gz | |
mkdir -p kn && tar xf ./kn-linux-amd64.tar.gz -C $_ | |
sudo mv kn/kn /usr/local/sbin/ | |
rm -rf kn* | |
kn version | |
echo "******** Begin installing helm ********" | |
wget -q https://mirror.openshift.com/pub/openshift-v4/clients/helm/latest/helm-linux-amd64 | |
chmod a+x helm-linux-amd64 | |
sudo mv helm-linux-amd64 /usr/local/sbin/helm | |
helm version | |
echo "******** Begin installing stern ********" | |
wget -q https://github.com/wercker/stern/releases/download/1.11.0/stern_linux_amd64 | |
chmod a+x stern_linux_amd64 | |
sudo mv ./stern_linux_amd64 /usr/local/sbin/stern | |
stern --version | |
echo "******** Begin installing kuebctl ********" | |
curl -sLO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" | |
sudo install -o root -g root -m 0755 kubectl /usr/local/sbin/kubectl | |
rm -rf kubectl | |
kubectl version --client | |
echo "******** Begin installing git ********" | |
sudo dnf install git -y | |
echo "******** Begin installing zsh ********" | |
sudo dnf install zsh -y | |
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" | |
sudo chsh -s /bin/zsh vagrant | |
# Change the oh my zsh default theme. | |
sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="dpoggi"/g' /home/vagrant/.zshrc | |
echo "******** Begin installing tree ********" | |
sudo dnf install tree -y | |
tree --version | |
echo "******** Begin installing bat ********" | |
wget -q https://github.com/sharkdp/bat/releases/download/v0.20.0/bat-v0.20.0-x86_64-unknown-linux-musl.tar.gz | |
mkdir -p bat && tar xf ./bat-v0.20.0-x86_64-unknown-linux-musl.tar.gz -C $_ | |
sudo mv bat/bat-v0.20.0-x86_64-unknown-linux-musl/bat /usr/local/sbin/ | |
rm -rf bat* | |
bat --version | |
echo "******** Begin installing tldr ********" | |
sudo dnf install tldr -y | |
tldr --version | |
echo "******** Begin installing httpie ********" | |
sudo dnf install httpie -y | |
https --version | |
echo "******** Begin installing nvm ********" | |
curl -sL https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash | |
export NVM_DIR="$HOME/.nvm" | |
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm | |
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion | |
nvm --version | |
echo "******** Begin installing latest node LTS ********" | |
nvm install --lts --default | |
echo "node version: $(node --version)" | |
echo "npm version: $(npm --version)" | |
echo "******** Begin installing colordiff ********" | |
sudo dnf install colordiff -y | |
colordiff --version | |
echo "******** Begin installing htop ********" | |
sudo dnf install htop -y | |
htop --version | |
echo "******** Begin installing ctop ********" | |
sudo wget -q https://github.com/bcicen/ctop/releases/download/v0.7.7/ctop-0.7.7-linux-amd64 -O /usr/local/sbin/ctop | |
sudo chmod +x /usr/local/sbin/ctop | |
ctop -v | |
echo "******** Begin installing lazydocker ********" | |
curl -sL https://raw.githubusercontent.com/jesseduffield/lazydocker/master/scripts/install_update_linux.sh | bash | |
sudo mv ./lazydocker /usr/local/sbin | |
echo "lazydocker installed $(lazydocker --version | grep -i version)" | |
echo "******** Begin installing python3.9 ********" | |
sudo dnf install curl gcc openssl-devel bzip2-devel libffi-devel zlib-devel wget make -y | |
sudo dnf install python39 -y | |
python3.9 --version | |
EOF | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Install docker on Fedora