Skip to content

Instantly share code, notes, and snippets.

@james-s-tayler
Last active April 12, 2022 03:48
Show Gist options
  • Save james-s-tayler/42190a7e516619fcf08c56507295ab44 to your computer and use it in GitHub Desktop.
Save james-s-tayler/42190a7e516619fcf08c56507295ab44 to your computer and use it in GitHub Desktop.
dev environment Ubuntu 20.04 - .Net Core, Docker, Kubernetets, Node.js, VS Code, Terraform
#! /bin/bash
sudo apt-get install -y gnome-session-flashback
echo "you must restart - on login click the gear and choose gnome flashback (metacity)"
#! /bin/bash
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
sudo apt-get update
sudo apt-get install -y google-chrome-stable
#! /bin/bash
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
sudo docker run hello-world
#! /bin/bash
sudo groupadd docker
sudo usermod -aG docker $USER
sudo shutdown -r 0
#! /bin/bash
sudo systemctl enable docker
! /bin/bash
sudo curl -s https://api.github.com/repos/docker/compose/releases/latest | grep browser_download_url | grep docker-compose-linux-x86_64 | cut -d '"' -f 4 | wget -qi -
chmod +x docker-compose-linux-x86_64
sudo mv docker-compose-linux-x86_64 /usr/local/bin/docker-compose
#! /bin/bash
sudo snap install dotnet-sdk --classic --channel=6.0
sudo snap alias dotnet-sdk.dotnet dotnet
#! /bin/bash
sudo apt-get install -y software-properties-common
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get update
sudo apt-get install -y nodejs
#! /bin/bash
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
sudo apt-get update
sudo apt-get install -y code
#! /bin/bash
echo 'run the following command:'
echo "egrep --color 'vmx|svm' /proc/cpuinfo"
echo "if the output is blank you need to enable VT-x or AMD-v virtualization in your computer’s BIOS/VMWare Player/VirtualBox settings before proceeding."
#! /bin/bash
sudo apt-get install -y conntrack
#kubelet wont start without swap off
sudo swapoff -a
wget https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
chmod +x minikube-linux-amd64
sudo mv minikube-linux-amd64 /usr/local/bin/minikube
minikube version
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubectl
#needed to solve coredns CrashLoopBackOff problem caused by systemd-resolve
sudo rm /etc/resolv.conf
sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
sudo minikube start --vm-driver=none
sudo chown -R $(id -u):$(id -g) $HOME/.minikube
sudo chown -R $(id -u):$(id -g) $HOME/.kube/config
sudo kubectl get pods --all-namespaces
#! /bin/bash
curl -L https://git.io/get_helm.sh | bash
sudo helm init
#! /bin/bash
#not sure I actually want/need this?
#kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
curl -L https://git.io/getLatestIstio | ISTIO_VERSION=1.1.4 sh -
mv istio-1.1.4/ ~/istio-1.1.4
echo 'PATH="$PATH:$HOME/istio-1.1.4/bin"' >> ~/.profile
. ~/.profile
helm repo add istio.io https://storage.googleapis.com/istio-release/releases/1.1.4/charts/
sudo kubectl apply -f ~/istio-1.1.4/install/kubernetes/helm/helm-service-account.yaml
sudo apt-get install -y socat
sudo helm install ~/istio-1.1.4/install/kubernetes/helm/istio-init --name istio-init --namespace istio-system
sudo helm install ~/istio-1.1.4/install/kubernetes/helm/istio --name istio --namespace istio-system \
--values ~/istio-1.1.4/install/kubernetes/helm/istio/values-istio-demo.yaml
#! /bin/bash
curl -L https://github.com/kubernetes/kompose/releases/download/v1.16.0/kompose-linux-amd64 -o kompose
chmod +x kompose
sudo mv ./kompose /usr/local/bin/kompose
#! /bin/bash
mkdir ~/docker-registry
mkdir ~/docker-registry/data
docker-compose -f ../docker-registry/docker-compose.yml up -d
echo "add the following entry to /etc/hosts"
echo "127.0.0.1 docker.local"
#! /bin/bash
export INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].nodePort}')
export SECURE_INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="https")].nodePort}')
export INGRESS_HOST=$(minikube ip)
kubectl apply -f ../kubernetes/dev/istio-gateway.yml
kubectl apply -f ../kubernetes/dev/istio-routes.yml
echo "http://${INGRESS_HOST}:${INGRESS_PORT}/fizzbuzz/15"
#! /bin/bash
wget https://releases.hashicorp.com/terraform/0.12.16/terraform_0.12.16_linux_amd64.zip
sudo unzip ./terraform_0.12.16_linux_amd64.zip -d /usr/local/bin/
terraform -v
#! /bin/bash
sudo apt install -y python
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli.zip"
unzip awscli.zip
sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
aws --version
This set of scripts is designed to configure an ubuntu 18.04 instance with everything needed to build and deploy this repo.
Run them in order and follow any instructions given. It's 95% automated with a little bit of manual attendence required.
I didn't bother to use Vagrant as it always crashes, never works for me and I prefer VMWare over Virtualbox.
nb: To run kubernetes/minikube you need to have CPU virtualization enabled in your BIOS if you are running on physical machine or in your VM settings if running in a VM.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment