Last active
October 28, 2021 21:31
-
-
Save alchen99/72c0afaf9d2352fecbdeec7c354b6aa7 to your computer and use it in GitHub Desktop.
Cloud Init / Userdata for setting up Minnaker using Operator
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
#cloud-config | |
repo_update: true | |
repo_upgrade: all | |
packages: | |
- curl | |
- make | |
- screen | |
- tmux | |
- tree | |
- unzip | |
- vim | |
- wget | |
snap: | |
commands: | |
- snap install --classic go | |
- snap install --classic aws-cli | |
- snap install docker helm3 helm-snap http jq starship yq | |
runcmd: | |
- id | |
- echo '# starship prompts' >> /root/.bashrc | |
- echo 'if [[ -f /usr/local/bin/starship || -f /snap/bin/starship ]]; then echo 'eval "$(starship init bash)"'; fi' >> /root/.bashrc | |
- mkdir /root/.config && mkdir /home/ubuntu/.config | |
- curl -s "https://gist.githubusercontent.com/alchen99/19176397fffbc5b43c37fff1ea2869c1/raw/19a38d637d6d725f0ba65c63c85357d7941a1b81/starship.toml" -o /home/ubuntu/.config/starship.toml | |
- cp /home/ubuntu/.config/starship.toml /root/.config/starship.toml | |
- curl -s "https://gist.githubusercontent.com/alchen99/cfe481c230d346ebc94508071fdd36bd/raw/f4122c8240c3a48106df3f43ed77f38276a11664/.bashrc-ext" -o /home/ubuntu/.bashrc-ext | |
- curl -s "https://gist.githubusercontent.com/alchen99/973d2e314cfd648b72bb602d54951644/raw/563f48d306e4b80b4abd1dfe489ba0290239b154/.vimrc" -o /home/ubuntu/.vimrc | |
- curl -s "https://gist.githubusercontent.com/alchen99/4b25de8fc61b69a0f9cd90a840785d81/raw/64ea5b32fbd09bdaa5ce642e626e21ee9c933a21/.tmux.conf" -o /home/ubuntu/.tmux.conf | |
- curl -s "https://gist.githubusercontent.com/alchen99/4a386a801bdfe13007ba489383c4acb6/raw/f421bc31d533cf65e809059161a59c8cc556e193/.screenrc" -o /home/ubuntu/.screenrc | |
- # REPLACE with your own gist for .gitconfig | |
- curl -s "https://gist.githubusercontent.com/$USER/f41338d02afa5b304d699753d00c8bf2/raw/9b2015b36618827b630ce62ef162338c564fe93e/.gitconfig" -o /home/ubuntu/.gitconfig | |
- curl -s "https://gist.githubusercontent.com/alchen99/bf30697e99a4e0faa63dc1b69eb348cb/raw/b7346af68b9f5eabd16700e777dfe9456fc57bba/.bashrc-append" >> /home/ubuntu/.bashrc | |
- chmod 644 /home/ubuntu/.bashrc-ext /home/ubuntu/.vimrc /home/ubuntu/.tmux.conf /home/ubuntu/.screenrc /home/ubuntu/.gitconfig | |
- # REPLACE $SOME_BUCKET with your S3 bucket | |
- # the ssh-min.tar.gz file has the SSH key used fetch the GitHub private repo and an SSH config file that has a config for gitspinoppatch | |
- aws s3 cp s3://$SOME_BUCKET/ssh-min.tar.gz - --region us-east-1 --sse AES256 | tar xvfz - -C / | |
- su - ubuntu -c "git clone https://github.com/tmux-plugins/tpm /home/ubuntu/.tmux/plugins/tpm" | |
- su - ubuntu -c "git clone -b traefik2 git@github.com:armory/minnaker.git /home/ubuntu/minnaker" | |
- curl -s "https://gist.githubusercontent.com/alchen99/b9fbd343e59766346636e5869fc7fee9/raw/d931a1e9c6ef8ca173a196d15d8323480bb10ff3/fix-traefik2-sans.sh" -o /home/ubuntu/minnaker/fix-traefik2-sans.sh && chmod 755 /home/ubuntu/minnaker/fix-traefik2-sans.sh | |
- su - ubuntu -c "git clone https://github.com/carlosedp/cluster-monitoring.git" | |
- chown -R ubuntu:ubuntu /home/ubuntu | |
# REPLACE argument for --git-spinnaker with your repo and replace argument for --branch with your branch | |
- su - ubuntu -c "cd /home/ubuntu/minnaker && scripts/install.sh --nowait --git-spinnaker gitspinoppatch:armory-io/spinnaker-kustomize-patches.git --branch $YOUR_BRANCH --traefik2 -x" | |
- /home/ubuntu/minnaker/fix-traefik2-sans.sh | |
- awk 'NR==1{print; print "EXT_IP := $(shell cat /home/ubuntu/minnaker/spinsvc/secrets/public_ip)"; print "GRAF_PASS := $(shell cat /home/ubuntu/minnaker/spinsvc/secrets/spinnaker_password)"} NR!=1' /home/ubuntu/cluster-monitoring/Makefile > /home/ubuntu/cluster-monitoring/Makefile2 | |
- curl -s https://gist.githubusercontent.com/alchen99/e020408d69c64e7a0163dd55ee78dcec/raw/3dec7dc7d29d59bc01f010203537d5f8c52b816d/Makefile.add -o Makefile.add && cat Makefile.add >> /home/ubuntu/cluster-monitoring/Makefile2 && mv /home/ubuntu/cluster-monitoring/Makefile2 /home/ubuntu/cluster-monitoring/Makefile && rm Makefile.add | |
- chown -R ubuntu:ubuntu /home/ubuntu | |
- kubectl config set-context default --namespace default | |
- su - ubuntu -c "ln -s /home/ubuntu/minnaker/spinsvc install; cd /home/ubuntu/cluster-monitoring && make k3s" | |
- echo "Deleting Traefik pod to reload config" && traefikPod=`kubectl -n kube-system get pods | grep -e '^traefik-.*' | cut -d' ' -f1` && kubectl -n kube-system delete pod $traefikPod |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment