From 9a77936e58fc72d5a0103588c1bd390011d003a5 Mon Sep 17 00:00:00 2001 From: haywirebanana <113632239+haywirebanana@users.noreply.github.com> Date: Sat, 26 Apr 2025 23:51:44 -0600 Subject: [PATCH 01/20] filled out project skeleton, further adjustments are needed --- scripts/ubuntu_dev_env_setup.sh | 234 ++++++++++++++++++++++++++++++-- 1 file changed, 219 insertions(+), 15 deletions(-) diff --git a/scripts/ubuntu_dev_env_setup.sh b/scripts/ubuntu_dev_env_setup.sh index 3cc268ce..90ddfd31 100755 --- a/scripts/ubuntu_dev_env_setup.sh +++ b/scripts/ubuntu_dev_env_setup.sh @@ -2,11 +2,13 @@ # Update and upgrade the system upgrade_system() { + echo "Updating and upgrading the system..." sudo apt update && sudo apt upgrade -y } # Install essential development tools install_dev_tools() { + echo "Installing core development tools..." sudo apt install -y \ git \ vim \ @@ -14,61 +16,263 @@ install_dev_tools() { curl \ wget \ jq \ - unzip + unzip \ + gnupg } # Install VS Code (via Flatpak) install_vscode() { + echo "Installing VS Code..." flatpak install -y flathub com.visualstudio.code } - # Install Cloud CLIs # ==================================== -# Azure +# Azure CLI +install_azure_cli() { + echo "Installing Azure CLI..." + curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash +} -# AWS +# AWS CLI +install_aws_cli() { + echo "Installing AWS CLI..." + curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" + unzip awscliv2.zip + sudo ./aws/install +} + +# Google Cloud SDK +install_google_cloud_sdk() { + echo "Installing Google Cloud SDK..." + sudo apt install -y apt-transport-https ca-certificates gnupg -# Google + curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg + echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list + + sudo apt update && sudo apt install google-cloud-cli +} -#Install Infrastructure as Code tools +# Install Infrastructure as Code tools # ==================================== # Terraform +install_terraform() { + echo "Installing Terraform..." + sudo apt update && sudo apt install -y software-properties-common + + wget -O- https://apt.releases.hashicorp.com/gpg | \ + gpg --dearmor | \ + sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg > /dev/null + + gpg --no-default-keyring \ + --keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg \ + --fingerprint + + echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] \ + https://apt.releases.hashicorp.com $(lsb_release -cs) main" | \ + sudo tee /etc/apt/sources.list.d/hashicorp.list + + sudo apt update && sudo apt install terraform +} # OpenTofu +install_opentofu() { + echo "Installing OpenTofu..." + snap install --classic opentofu +} # Bicep +install_bicep() { + echo "Installing Bicep..." + curl -Lo bicep https://github.com/Azure/bicep/releases/latest/download/bicep-linux-x64 + chmod +x ./bicep + sudo mv ./bicep /usr/local/bin/bicep +} # Helm +install_helm() { + echo "Installing Helm..." + # curl https://baltocdn.com/helm/signing.asc | gpg --dearmor | sudo tee /usr/share/keyrings/helm.gpg > /dev/null + # sudo apt install apt-transport-https --yes + # echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list + # sudo apt update + # sudo apt install helm + curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 + chmod 700 get_helm.sh + ./get_helm.sh +} -# Instaall Kubernetes tools +# Install Kubernetes tools # ==================================== # kubectl +install_kubectl() { + echo "Installing kubectl..." + curl -LO "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/bin/kubectl +} # K9s +install_k9s() { + echo "Installing K9s..." + +} # minikube +install_minikube() { + echo "Installing minikube..." + curl -LO https://github.com/kubernetes/minikube/releases/latest/download/minikube-linux-amd64 + sudo install minikube-linux-amd64 /usr/local/bin/minikube && rm minikube-linux-amd64 +} # Oh My Posh +install_oh_my_posh() { + echo "Installing Oh My Posh..." + curl -s https://ohmyposh.dev/install.sh | bash -s +} # VScode extensions # ==================================== -# terraform, kubernetes tools, azure tools, bicep, gitlen, spell checker +# terraform, kubernetes tools, azure tools, bicep, gitlen, spell checker, helm +install_vscode_extensions() { + code --install-extension hashicorp.terraform + code --install-extension ms-kubernetes-tools.vscode-kubernetes-tools + code --install-extension msazurermtools.azurerm-vscode-tools + code --install-extension bicep.bicep + code --install-extension eamodio.gitlens + code --install-extension streetsidesoftware.code-spell-checker +} # Config git with ssh authentication +# The following portion would require manual inputs" +configure_git() { + echo "Configuring Git with SSH..." + echo "Enter your primary email for git:" + read git_email + git config --global user.email "$git_email" + + echo "Enter your name for git:" + read git_name + git config --global user.name "$git_name" + + echo "Generating SSH key for GitHub..." + ssh-keygen -t rsa -b 4096 -C "$git_email" + eval "$(ssh-agent -s)" + ssh-add ~/.ssh/id_rsa + + # Refer to Markdown Instructions + echo "Add your SSH key to GitHub by running:" + echo "cat ~/.ssh/id_rsa.pub" +} + +# Validate networking +validate_network() { + echo "Checking network connectivity..." + if ping -c 3 google.com then + echo "Network connectivity: SUCCESSFUL" + else + echo "Network connectivity: FAILED" + exit 1 + fi +} -# Validate networking and permissions +# Validate Permissions and Authentication of Cloud CLI +# ==================================== +# Validate AWS CLI +validate_aws_cli_permissions() { + echo "Checking AWS CLI authentication and permissions..." + if aws sts get-caller-identity &>/dev/null; then + echo "AWS CLI authentication: SUCCESS" + else + echo "AWS CLI authentication: FAILED" + exit 1 + fi +} -# Final messages +# Validate AZURE CLI +validate_azure_cli_permissions() { + echo "Checking Azure CLI authentication and permissions..." + if az account show &>/dev/null; then + echo "Azure CLI authentication: SUCCESS" + else + echo "Azure CLI authentication: FAILED" + exit 1 + fi +} -main() { - # upgrade_system - # install_dev_tools - # install_vscode +# Validate GOOGLE SDK +validate_google_cloud_sdk_permissions() { + echo "Checking Google Cloud SDK authentication and permissions..." + if gcloud auth list &>/dev/null; then + echo "Google Cloud SDK authentication: SUCCESS" + else + echo "Google Cloud SDK authentication: FAILED" + exit 1 + fi +} + +# Validate Kubernetes +check_kubernetes_access() { + echo "Checking Kubernetes cluster access..." + if kubectl cluster-info &>/dev/null; then + echo "Kubernetes access: SUCCESS" + else + echo "Kubernetes access: FAILED" + exit 1 + fi +} +final_messages() { echo "Development environment setup complete!" - echo "Restart your terminal or run 'source ~/.bashrc' to apply changes." } +main() { + # Initial validation + validate_network + + # System update and upgrades + upgrade_system + + # Install Development tools + install_dev_tools + + # Install VS Code + install_vscode + + # Install Cloud CLIs and validate them + install_azure_cli + validate_azure_cli_permissions + + install_aws_cli + validate_aws_cli_permissions + + install_google_cloud_sdk + validate_google_cloud_sdk_permissions + + # Install Infrastructure tools and validate + install_terraform + install_opentofu + install_bicep + install_helm + + # Install Kubernetes tools and validate + install_kubectl + install_k9s + install_minikube + + # Install Oh My Posh + install_oh_my_posh + + # Install VSCode Extensions + install_vscode_extensions + + # Configure Git + configure_git + + # Final validation + validate_networking_and_permissions + + # Final message + final_messages +} main \ No newline at end of file From 56b65ea7e7390f73f83ee0bd23850990e3fa9abf Mon Sep 17 00:00:00 2001 From: haywirebanana <113632239+haywirebanana@users.noreply.github.com> Date: Sun, 27 Apr 2025 13:36:06 -0600 Subject: [PATCH 02/20] Improve error handling in dev-env-setup --- scripts/ubuntu_dev_env_setup.sh | 155 +++++++++++++++++++------------- 1 file changed, 94 insertions(+), 61 deletions(-) diff --git a/scripts/ubuntu_dev_env_setup.sh b/scripts/ubuntu_dev_env_setup.sh index 90ddfd31..deef06e6 100755 --- a/scripts/ubuntu_dev_env_setup.sh +++ b/scripts/ubuntu_dev_env_setup.sh @@ -1,14 +1,23 @@ #!/bin/bash +# Exit immediately on error +set -e + +# Colors for messages +GREEN="\e[32m" +RED="\e[31m" +YELLOW="\e[33m" +RESET="\e[0m" + # Update and upgrade the system upgrade_system() { - echo "Updating and upgrading the system..." + echo -e "${YELLOW}Updating and upgrading the system...${RESET}" sudo apt update && sudo apt upgrade -y } # Install essential development tools install_dev_tools() { - echo "Installing core development tools..." + echo -e "${YELLOW}Installing core development tools...${RESET}" sudo apt install -y \ git \ vim \ @@ -17,123 +26,145 @@ install_dev_tools() { wget \ jq \ unzip \ - gnupg + gnupg \ + apt-transport-https \ + ca-certificates \ + software-properties-common } # Install VS Code (via Flatpak) install_vscode() { - echo "Installing VS Code..." + echo -e "${YELLOW}Installing Azure CLI...${RESET}" flatpak install -y flathub com.visualstudio.code + flatpak info com.visualstudio.code || echo -e "${RED}VS Code installation verification failed!${RESET}" } # Install Cloud CLIs # ==================================== # Azure CLI install_azure_cli() { - echo "Installing Azure CLI..." + echo -e "${YELLOW}Installing Azure CLI...${RESET}" curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash + # Verify Azure CLI has installed + az version || echo -e "${RED}Azure CLI installation verification failed!${RESET}" } # AWS CLI install_aws_cli() { - echo "Installing AWS CLI..." + echo -e "${YELLOW}Installing AWS CLI...${RESET}" curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" unzip awscliv2.zip sudo ./aws/install + # Verify AWS CLI has installed + aws --version || echo -e "${RED}AWS CLI installation verification failed!${RESET}" + # Remove installation "junk" + rm -rf aws awscliv2.zip } # Google Cloud SDK install_google_cloud_sdk() { - echo "Installing Google Cloud SDK..." - sudo apt install -y apt-transport-https ca-certificates gnupg - + echo -e "${YELLOW}Installing Google Cloud SDK...${RESET}" curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list - sudo apt update && sudo apt install google-cloud-cli + # Verify Google Cloud SDK has installed + gcloud version || echo -e "${RED}Google Cloud SDK installation verification failed!${RESET}" } # Install Infrastructure as Code tools # ==================================== # Terraform install_terraform() { - echo "Installing Terraform..." - sudo apt update && sudo apt install -y software-properties-common + echo -e "${YELLOW}Installing Terraform...${RESET}" wget -O- https://apt.releases.hashicorp.com/gpg | \ gpg --dearmor | \ sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg > /dev/null - gpg --no-default-keyring \ - --keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg \ - --fingerprint - echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] \ https://apt.releases.hashicorp.com $(lsb_release -cs) main" | \ sudo tee /etc/apt/sources.list.d/hashicorp.list sudo apt update && sudo apt install terraform + # Verify Terraform has installed + terraform version || echo -e "${RED}Terraform installation verification failed!${RESET}" } # OpenTofu install_opentofu() { - echo "Installing OpenTofu..." + echo -e "${YELLOW}Installing OpenTofu...${RESET}" snap install --classic opentofu + # Verify OpenTofu has installed + tofu version || echo -e "${RED}OpenTofu installation verification failed!${RESET}" } # Bicep install_bicep() { - echo "Installing Bicep..." + echo -e "${YELLOW}Installing Bicep...${RESET}" curl -Lo bicep https://github.com/Azure/bicep/releases/latest/download/bicep-linux-x64 chmod +x ./bicep sudo mv ./bicep /usr/local/bin/bicep + # Verify Bicep has installed + bicep --version || echo -e "${RED}Bicep installation verification failed!${RESET}" } # Helm install_helm() { - echo "Installing Helm..." - # curl https://baltocdn.com/helm/signing.asc | gpg --dearmor | sudo tee /usr/share/keyrings/helm.gpg > /dev/null - # sudo apt install apt-transport-https --yes - # echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list - # sudo apt update - # sudo apt install helm + echo -e "${YELLOW}Installing Helm...${RESET}" curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 chmod 700 get_helm.sh ./get_helm.sh + # Verify Helm has installed + helm version || echo -e "${RED}Helm installation verification failed!${RESET}" + } # Install Kubernetes tools # ==================================== # kubectl install_kubectl() { - echo "Installing kubectl..." + echo -e "${YELLOW}Installing Kubectl...${RESET}" curl -LO "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/bin/kubectl + # Verify kubectl has installed + kubectl version --client || echo -e "${RED}kubectl installation verification failed!${RESET}" + # Remove installation "junk" + rm -f kubectl + } # K9s install_k9s() { - echo "Installing K9s..." + echo -e "${YELLOW}Installing K9s...${RESET}" } # minikube install_minikube() { - echo "Installing minikube..." + echo -e "${YELLOW}Installing Minikube...${RESET}" curl -LO https://github.com/kubernetes/minikube/releases/latest/download/minikube-linux-amd64 - sudo install minikube-linux-amd64 /usr/local/bin/minikube && rm minikube-linux-amd64 + sudo install minikube-linux-amd64 /usr/local/bin/minikube + # Verify minikube has installed + minikube version || echo -e "${RED}minikube installation verification failed!${RESET}" + # Remove installation "junk" + rm -f minikube-linux-amd64 + } # Oh My Posh install_oh_my_posh() { - echo "Installing Oh My Posh..." + echo -e "${YELLOW}Installing Oh My Posh...${RESET}" curl -s https://ohmyposh.dev/install.sh | bash -s + # Verify Oh My Posh has installed + oh-my-posh --version || echo -e "${RED}Oh My Posh installation verification failed!${RESET}" + } # VScode extensions # ==================================== # terraform, kubernetes tools, azure tools, bicep, gitlen, spell checker, helm install_vscode_extensions() { + echo -e "${YELLOW}Installing VS Code extensions...${RESET}" code --install-extension hashicorp.terraform code --install-extension ms-kubernetes-tools.vscode-kubernetes-tools code --install-extension msazurermtools.azurerm-vscode-tools @@ -145,12 +176,12 @@ install_vscode_extensions() { # Config git with ssh authentication # The following portion would require manual inputs" configure_git() { - echo "Configuring Git with SSH..." - echo "Enter your primary email for git:" - read git_email + echo -e "${YELLOW}Configuring Git with SSH...${RESET}" + echo "Enter your primary email for git:" + read git_email git config --global user.email "$git_email" - echo "Enter your name for git:" + echo "Enter your name for git:" read git_name git config --global user.name "$git_name" @@ -159,72 +190,73 @@ configure_git() { eval "$(ssh-agent -s)" ssh-add ~/.ssh/id_rsa - # Refer to Markdown Instructions - echo "Add your SSH key to GitHub by running:" + # Refer to Markdown Instructions + echo "Copy your SSH key and add it to GitHub:" echo "cat ~/.ssh/id_rsa.pub" } # Validate networking validate_network() { - echo "Checking network connectivity..." - if ping -c 3 google.com then - echo "Network connectivity: SUCCESSFUL" - else - echo "Network connectivity: FAILED" - exit 1 - fi + echo -e "${YELLOW}Checking network connectivity...${RESET}" + if ping -c 3 google.com; then + echo -e "${GREEN}Network connectivity: SUCCESSFUL${RESET}" + else + echo -e "${RED}Network connectivity: FAILED${RESET}" + exit 1 + fi } # Validate Permissions and Authentication of Cloud CLI # ==================================== # Validate AWS CLI validate_aws_cli_permissions() { - echo "Checking AWS CLI authentication and permissions..." - if aws sts get-caller-identity &>/dev/null; then - echo "AWS CLI authentication: SUCCESS" - else - echo "AWS CLI authentication: FAILED" - exit 1 - fi + echo -e "${YELLOW}Checking AWS CLI authentication and permissions...${RESET}" + if aws sts get-caller-identity &>/dev/null; then + echo -e "${GREEN}AWS CLI authentication: SUCCESS${RESET}" + else + echo -e "${RED}AWS CLI authentication: FAILED${RESET}" + exit 1 + fi } # Validate AZURE CLI validate_azure_cli_permissions() { - echo "Checking Azure CLI authentication and permissions..." + echo -e "${YELLOW}Checking Azure CLI authentication and permissions...${RESET}" if az account show &>/dev/null; then - echo "Azure CLI authentication: SUCCESS" + echo -e "${GREEN}Azure CLI authentication: SUCCESS${RESET}" else - echo "Azure CLI authentication: FAILED" + echo -e "${RED}Azure CLI authentication: FAILED${RESET}" exit 1 fi } # Validate GOOGLE SDK validate_google_cloud_sdk_permissions() { - echo "Checking Google Cloud SDK authentication and permissions..." + echo -e "${YELLOW}Checking Google Cloud SDK authentication and permissions...${RESET}" if gcloud auth list &>/dev/null; then - echo "Google Cloud SDK authentication: SUCCESS" + echo -e "${GREEN}Google Cloud SDK authentication: SUCCESS${RESET}" else - echo "Google Cloud SDK authentication: FAILED" + echo -e "${RED}Google Cloud SDK authentication: FAILED${RESET}" exit 1 fi } # Validate Kubernetes check_kubernetes_access() { - echo "Checking Kubernetes cluster access..." + echo -e "${YELLOW}Checking Kubernetes cluster access...${RESET}" if kubectl cluster-info &>/dev/null; then - echo "Kubernetes access: SUCCESS" + echo -e "${GREEN}Kubernetes access: SUCCESS${RESET}" else - echo "Kubernetes access: FAILED" + echo -e "${RED}Kubernetes access: FAILED${RESET}" exit 1 fi } final_messages() { - echo "Development environment setup complete!" + echo -e "${GREEN}Development environment setup complete!${RESET}" } + main() { # Initial validation validate_network @@ -268,8 +300,9 @@ main() { # Configure Git configure_git - # Final validation - validate_networking_and_permissions + # Validate Kubernetes + check_kubernetes_access + # Final message final_messages From 31eb325d1ffe8f1fd4f2ff76ab0ab37711ff50c2 Mon Sep 17 00:00:00 2001 From: haywirebanana <113632239+haywirebanana@users.noreply.github.com> Date: Sun, 27 Apr 2025 14:12:07 -0600 Subject: [PATCH 03/20] feat: K9s installation script --- scripts/ubuntu_dev_env_setup.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/ubuntu_dev_env_setup.sh b/scripts/ubuntu_dev_env_setup.sh index deef06e6..8dd2e42f 100755 --- a/scripts/ubuntu_dev_env_setup.sh +++ b/scripts/ubuntu_dev_env_setup.sh @@ -136,6 +136,16 @@ install_kubectl() { # K9s install_k9s() { echo -e "${YELLOW}Installing K9s...${RESET}" + # Find the latest K9s Debian package URL from GitHub releases + latest_k9s=$(curl -s https://api.github.com/repos/derailed/k9s/releases/latest | grep "browser_download_url.*amd64.deb" | cut -d '"' -f 4) + # Download the latest K9s .deb package + wget "$latest_k9s" + # Install K9s using the .deb package + sudo apt install ./"$(basename "$latest_k9s")" + # Verify K9s installation + k9s version || echo -e "${RED}K9s installation verification failed!${RESET}" + # Remove Installation "junk" + rm -f "$(basename "$latest_k9s")" } From 94a42b3bd72b4703355b39e914fce697967d8b3f Mon Sep 17 00:00:00 2001 From: haywirebanana <113632239+haywirebanana@users.noreply.github.com> Date: Mon, 28 Apr 2025 00:00:23 -0600 Subject: [PATCH 04/20] chore: switch from flatpak to snap for VS Code Installation --- scripts/ubuntu_dev_env_setup.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/ubuntu_dev_env_setup.sh b/scripts/ubuntu_dev_env_setup.sh index 8dd2e42f..f0b4c97b 100755 --- a/scripts/ubuntu_dev_env_setup.sh +++ b/scripts/ubuntu_dev_env_setup.sh @@ -32,11 +32,13 @@ install_dev_tools() { software-properties-common } -# Install VS Code (via Flatpak) +# Install VS Code (via Snap) install_vscode() { - echo -e "${YELLOW}Installing Azure CLI...${RESET}" - flatpak install -y flathub com.visualstudio.code - flatpak info com.visualstudio.code || echo -e "${RED}VS Code installation verification failed!${RESET}" + echo -e "${YELLOW}Installing VS Code (via Snap) ${RESET}" + #flatpak install -y flathub com.visualstudio.code + #flatpak info com.visualstudio.code || echo -e "${RED}VS Code installation verification failed!${RESET}" + sudo snap install --classic code + code --version || echo -e "${RED}VS Code installation failed!${RESET}" } # Install Cloud CLIs From 140ac327e6614c649a73f6d07d4aee8b6eb982d5 Mon Sep 17 00:00:00 2001 From: haywirebanana <113632239+haywirebanana@users.noreply.github.com> Date: Mon, 28 Apr 2025 00:02:23 -0600 Subject: [PATCH 05/20] chore: add -y flag for Google Cloud SDK and Terrafrm installations --- scripts/ubuntu_dev_env_setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ubuntu_dev_env_setup.sh b/scripts/ubuntu_dev_env_setup.sh index f0b4c97b..fb5a01ab 100755 --- a/scripts/ubuntu_dev_env_setup.sh +++ b/scripts/ubuntu_dev_env_setup.sh @@ -68,7 +68,7 @@ install_google_cloud_sdk() { echo -e "${YELLOW}Installing Google Cloud SDK...${RESET}" curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list - sudo apt update && sudo apt install google-cloud-cli + sudo apt update && sudo apt -y install google-cloud-cli # Verify Google Cloud SDK has installed gcloud version || echo -e "${RED}Google Cloud SDK installation verification failed!${RESET}" } @@ -87,7 +87,7 @@ install_terraform() { https://apt.releases.hashicorp.com $(lsb_release -cs) main" | \ sudo tee /etc/apt/sources.list.d/hashicorp.list - sudo apt update && sudo apt install terraform + sudo apt update && sudo apt -y install terraform # Verify Terraform has installed terraform version || echo -e "${RED}Terraform installation verification failed!${RESET}" } From 4712ec4d231447d9098c96223b5f43ec29007d8e Mon Sep 17 00:00:00 2001 From: haywirebanana <113632239+haywirebanana@users.noreply.github.com> Date: Mon, 28 Apr 2025 00:07:10 -0600 Subject: [PATCH 06/20] fix: remove unnecessary line continutation in Terraform installation --- scripts/ubuntu_dev_env_setup.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/ubuntu_dev_env_setup.sh b/scripts/ubuntu_dev_env_setup.sh index fb5a01ab..561626de 100755 --- a/scripts/ubuntu_dev_env_setup.sh +++ b/scripts/ubuntu_dev_env_setup.sh @@ -83,8 +83,7 @@ install_terraform() { gpg --dearmor | \ sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg > /dev/null - echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] \ - https://apt.releases.hashicorp.com $(lsb_release -cs) main" | \ + echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | \ sudo tee /etc/apt/sources.list.d/hashicorp.list sudo apt update && sudo apt -y install terraform From c3b821d636b0530ccacb96522c24ef3b128ac661 Mon Sep 17 00:00:00 2001 From: haywirebanana <113632239+haywirebanana@users.noreply.github.com> Date: Mon, 28 Apr 2025 00:09:26 -0600 Subject: [PATCH 07/20] fix: add sudo command within Open Tofu installation --- scripts/ubuntu_dev_env_setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ubuntu_dev_env_setup.sh b/scripts/ubuntu_dev_env_setup.sh index 561626de..9444ef2b 100755 --- a/scripts/ubuntu_dev_env_setup.sh +++ b/scripts/ubuntu_dev_env_setup.sh @@ -94,7 +94,7 @@ install_terraform() { # OpenTofu install_opentofu() { echo -e "${YELLOW}Installing OpenTofu...${RESET}" - snap install --classic opentofu + sudo snap install --classic opentofu # Verify OpenTofu has installed tofu version || echo -e "${RED}OpenTofu installation verification failed!${RESET}" } From 51e885882293196cbf0bb2a275457bab82af67dc Mon Sep 17 00:00:00 2001 From: haywirebanana <113632239+haywirebanana@users.noreply.github.com> Date: Mon, 28 Apr 2025 00:12:35 -0600 Subject: [PATCH 08/20] fix: correct Bicep extension ID in VSCode extention installation --- scripts/ubuntu_dev_env_setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ubuntu_dev_env_setup.sh b/scripts/ubuntu_dev_env_setup.sh index 9444ef2b..fa63f3ad 100755 --- a/scripts/ubuntu_dev_env_setup.sh +++ b/scripts/ubuntu_dev_env_setup.sh @@ -179,7 +179,7 @@ install_vscode_extensions() { code --install-extension hashicorp.terraform code --install-extension ms-kubernetes-tools.vscode-kubernetes-tools code --install-extension msazurermtools.azurerm-vscode-tools - code --install-extension bicep.bicep + code --install-extension ms-azuretools.vscode-bicep code --install-extension eamodio.gitlens code --install-extension streetsidesoftware.code-spell-checker } From 6c683ae7f85db3454c78fe5eca3fcc0aaf73434c Mon Sep 17 00:00:00 2001 From: haywirebanana <113632239+haywirebanana@users.noreply.github.com> Date: Mon, 28 Apr 2025 00:33:01 -0600 Subject: [PATCH 09/20] feat: add check to prevent overwriting existing SSH key for GitHub --- scripts/ubuntu_dev_env_setup.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/scripts/ubuntu_dev_env_setup.sh b/scripts/ubuntu_dev_env_setup.sh index fa63f3ad..ab698cb5 100755 --- a/scripts/ubuntu_dev_env_setup.sh +++ b/scripts/ubuntu_dev_env_setup.sh @@ -191,20 +191,23 @@ configure_git() { echo "Enter your primary email for git:" read git_email git config --global user.email "$git_email" - + echo "Enter your name for git:" read git_name git config --global user.name "$git_name" - - echo "Generating SSH key for GitHub..." - ssh-keygen -t rsa -b 4096 -C "$git_email" - eval "$(ssh-agent -s)" - ssh-add ~/.ssh/id_rsa - + + if [[ ! -f ~/.ssh/id_rsa ]]; then + echo "Generating SSH key for GitHub..." + ssh-keygen -t rsa -b 4096 -C "$git_email" + eval "$(ssh-agent -s)" + ssh-add ~/.ssh/id_rsa + fi + # Refer to Markdown Instructions echo "Copy your SSH key and add it to GitHub:" echo "cat ~/.ssh/id_rsa.pub" } + # Validate networking validate_network() { From 1d7cbbe978e9c6903e638d6eacabe560a28c0aaa Mon Sep 17 00:00:00 2001 From: haywirebanana <113632239+haywirebanana@users.noreply.github.com> Date: Tue, 29 Apr 2025 01:33:49 -0600 Subject: [PATCH 10/20] feat: add install verification notices on terminal --- scripts/ubuntu_dev_env_setup.sh | 69 ++++++++++++++++++++++++++------- 1 file changed, 55 insertions(+), 14 deletions(-) diff --git a/scripts/ubuntu_dev_env_setup.sh b/scripts/ubuntu_dev_env_setup.sh index ab698cb5..e0b275b7 100755 --- a/scripts/ubuntu_dev_env_setup.sh +++ b/scripts/ubuntu_dev_env_setup.sh @@ -1,7 +1,7 @@ #!/bin/bash -# Exit immediately on error -set -e +# # Exit immediately on error +# set -e # Colors for messages GREEN="\e[32m" @@ -38,7 +38,7 @@ install_vscode() { #flatpak install -y flathub com.visualstudio.code #flatpak info com.visualstudio.code || echo -e "${RED}VS Code installation verification failed!${RESET}" sudo snap install --classic code - code --version || echo -e "${RED}VS Code installation failed!${RESET}" + # code --version || echo -e "${RED}VS Code installation failed!${RESET}" } # Install Cloud CLIs @@ -48,7 +48,7 @@ install_azure_cli() { echo -e "${YELLOW}Installing Azure CLI...${RESET}" curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash # Verify Azure CLI has installed - az version || echo -e "${RED}Azure CLI installation verification failed!${RESET}" + # az version || echo -e "${RED}Azure CLI installation verification failed!${RESET}" } # AWS CLI @@ -58,7 +58,7 @@ install_aws_cli() { unzip awscliv2.zip sudo ./aws/install # Verify AWS CLI has installed - aws --version || echo -e "${RED}AWS CLI installation verification failed!${RESET}" + # aws --version || echo -e "${RED}AWS CLI installation verification failed!${RESET}" # Remove installation "junk" rm -rf aws awscliv2.zip } @@ -70,7 +70,7 @@ install_google_cloud_sdk() { echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list sudo apt update && sudo apt -y install google-cloud-cli # Verify Google Cloud SDK has installed - gcloud version || echo -e "${RED}Google Cloud SDK installation verification failed!${RESET}" + # gcloud version || echo -e "${RED}Google Cloud SDK installation verification failed!${RESET}" } # Install Infrastructure as Code tools @@ -88,7 +88,7 @@ install_terraform() { sudo apt update && sudo apt -y install terraform # Verify Terraform has installed - terraform version || echo -e "${RED}Terraform installation verification failed!${RESET}" + # terraform version || echo -e "${RED}Terraform installation verification failed!${RESET}" } # OpenTofu @@ -106,7 +106,7 @@ install_bicep() { chmod +x ./bicep sudo mv ./bicep /usr/local/bin/bicep # Verify Bicep has installed - bicep --version || echo -e "${RED}Bicep installation verification failed!${RESET}" + # bicep --version || echo -e "${RED}Bicep installation verification failed!${RESET}" } # Helm @@ -116,7 +116,7 @@ install_helm() { chmod 700 get_helm.sh ./get_helm.sh # Verify Helm has installed - helm version || echo -e "${RED}Helm installation verification failed!${RESET}" + # helm version || echo -e "${RED}Helm installation verification failed!${RESET}" } @@ -128,7 +128,7 @@ install_kubectl() { curl -LO "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/bin/kubectl # Verify kubectl has installed - kubectl version --client || echo -e "${RED}kubectl installation verification failed!${RESET}" + # kubectl version --client || echo -e "${RED}kubectl installation verification failed!${RESET}" # Remove installation "junk" rm -f kubectl @@ -144,7 +144,7 @@ install_k9s() { # Install K9s using the .deb package sudo apt install ./"$(basename "$latest_k9s")" # Verify K9s installation - k9s version || echo -e "${RED}K9s installation verification failed!${RESET}" + # k9s version || echo -e "${RED}K9s installation verification failed!${RESET}" # Remove Installation "junk" rm -f "$(basename "$latest_k9s")" @@ -156,7 +156,7 @@ install_minikube() { curl -LO https://github.com/kubernetes/minikube/releases/latest/download/minikube-linux-amd64 sudo install minikube-linux-amd64 /usr/local/bin/minikube # Verify minikube has installed - minikube version || echo -e "${RED}minikube installation verification failed!${RESET}" + # minikube version || echo -e "${RED}minikube installation verification failed!${RESET}" # Remove installation "junk" rm -f minikube-linux-amd64 @@ -167,8 +167,7 @@ install_oh_my_posh() { echo -e "${YELLOW}Installing Oh My Posh...${RESET}" curl -s https://ohmyposh.dev/install.sh | bash -s # Verify Oh My Posh has installed - oh-my-posh --version || echo -e "${RED}Oh My Posh installation verification failed!${RESET}" - + # oh-my-posh --version || echo -e "${RED}Oh My Posh installation verification failed!${RESET}" } # VScode extensions @@ -266,6 +265,46 @@ check_kubernetes_access() { fi } +check_installation() { + local cmd=$1 + local name=$2 + + if $cmd &>/dev/null; then + echo -e "${GREEN}${name} Installation: SUCCESS${RESET}" + else + echo -e "${RED}${name} Installation: FAILED${RESET}" + fi +} + +final_verification() { + echo -e "\n${YELLOW}Verifying all installations...${RESET}" + check_installation "git --version" "Git" + check_installation "vim --version" "Vim" + check_installation "tilix --version" "Tilix" + check_installation "curl --version" "cURL" + check_installation "wget --version" "Wget" + check_installation "jq --version" "jq" + check_installation "unzip -v" "Unzip" + check_installation "gpg --version" "GnuPG" + check_installation "apt-config dump" "APT Transport HTTPS (Check APT Config)" + check_installation "openssl version" "CA Certificates (Check OpenSSL)" + check_installation "apt-cache policy software-properties-common" "Software Properties Common" + check_installation "code --version" "VS Code" + check_installation "az version" "Azure CLI" + check_installation "aws --version" "AWS CLI" + check_installation "gcloud version" "Google Cloud SDK" + check_installation "terraform version" "Terraform" + check_installation "tofu version" "OpenTofu" + check_installation "bicep --version" "Bicep" + check_installation "helm version" "Helm" + check_installation "kubectl version --client" "kubectl" + check_installation "k9s version" "K9s" + check_installation "minikube version" "Minikube" + check_installation "oh-my-posh --version" "Oh My Posh" + echo "${YELLOW}Listing all VS Code Extentions${RESET}" + code --list-extensions +} + final_messages() { echo -e "${GREEN}Development environment setup complete!${RESET}" } @@ -317,6 +356,8 @@ main() { # Validate Kubernetes check_kubernetes_access + # Verify all installations + final_verification # Final message final_messages From 3c269c5b044effe14fabf2d0307ec41603c0cb17 Mon Sep 17 00:00:00 2001 From: haywirebanana <113632239+haywirebanana@users.noreply.github.com> Date: Tue, 29 Apr 2025 01:37:03 -0600 Subject: [PATCH 11/20] fix: remove space between pipe and backslash within install_terraform --- scripts/ubuntu_dev_env_setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ubuntu_dev_env_setup.sh b/scripts/ubuntu_dev_env_setup.sh index e0b275b7..0bedee13 100755 --- a/scripts/ubuntu_dev_env_setup.sh +++ b/scripts/ubuntu_dev_env_setup.sh @@ -79,8 +79,8 @@ install_google_cloud_sdk() { install_terraform() { echo -e "${YELLOW}Installing Terraform...${RESET}" - wget -O- https://apt.releases.hashicorp.com/gpg | \ - gpg --dearmor | \ + wget -O- https://apt.releases.hashicorp.com/gpg |\ + gpg --dearmor |\ sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg > /dev/null echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | \ From f7d0cc25fc029105519f7e2165fdfcd40bec7c5e Mon Sep 17 00:00:00 2001 From: haywirebanana <113632239+haywirebanana@users.noreply.github.com> Date: Tue, 29 Apr 2025 01:43:51 -0600 Subject: [PATCH 12/20] fix: aws and oh-my-posh installation verification commands --- scripts/ubuntu_dev_env_setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ubuntu_dev_env_setup.sh b/scripts/ubuntu_dev_env_setup.sh index 0bedee13..20302ad2 100755 --- a/scripts/ubuntu_dev_env_setup.sh +++ b/scripts/ubuntu_dev_env_setup.sh @@ -291,7 +291,7 @@ final_verification() { check_installation "apt-cache policy software-properties-common" "Software Properties Common" check_installation "code --version" "VS Code" check_installation "az version" "Azure CLI" - check_installation "aws --version" "AWS CLI" + check_installation "sudo aws --version" "AWS CLI" check_installation "gcloud version" "Google Cloud SDK" check_installation "terraform version" "Terraform" check_installation "tofu version" "OpenTofu" @@ -300,7 +300,7 @@ final_verification() { check_installation "kubectl version --client" "kubectl" check_installation "k9s version" "K9s" check_installation "minikube version" "Minikube" - check_installation "oh-my-posh --version" "Oh My Posh" + check_installation "~/.local/bin/oh-my-posh --version" "Oh My Posh" echo "${YELLOW}Listing all VS Code Extentions${RESET}" code --list-extensions } From 46e2bd69b14209d5fb2a45b96be1b098e0d2de3e Mon Sep 17 00:00:00 2001 From: haywirebanana <113632239+haywirebanana@users.noreply.github.com> Date: Tue, 29 Apr 2025 01:52:47 -0600 Subject: [PATCH 13/20] comment out current 'bugs' (AWS CLI, Azure CLI, and Kubernetes authentication --- scripts/ubuntu_dev_env_setup.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/ubuntu_dev_env_setup.sh b/scripts/ubuntu_dev_env_setup.sh index 20302ad2..e40de3c8 100755 --- a/scripts/ubuntu_dev_env_setup.sh +++ b/scripts/ubuntu_dev_env_setup.sh @@ -325,10 +325,12 @@ main() { # Install Cloud CLIs and validate them install_azure_cli - validate_azure_cli_permissions + # NEEDS FIXING + # validate_azure_cli_permissions install_aws_cli - validate_aws_cli_permissions + # NEEDS FIXING + # validate_aws_cli_permissions install_google_cloud_sdk validate_google_cloud_sdk_permissions @@ -354,7 +356,8 @@ main() { configure_git # Validate Kubernetes - check_kubernetes_access + # NEEDS FIXING + # check_kubernetes_access # Verify all installations final_verification From 27e86281048caa56d3d0e1be3d2d83e0a1492332 Mon Sep 17 00:00:00 2001 From: haywirebanana <113632239+haywirebanana@users.noreply.github.com> Date: Tue, 29 Apr 2025 01:54:11 -0600 Subject: [PATCH 14/20] fix: remove space char after backslash on terraform installation step :( --- scripts/ubuntu_dev_env_setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ubuntu_dev_env_setup.sh b/scripts/ubuntu_dev_env_setup.sh index e40de3c8..bcf56b54 100755 --- a/scripts/ubuntu_dev_env_setup.sh +++ b/scripts/ubuntu_dev_env_setup.sh @@ -79,7 +79,7 @@ install_google_cloud_sdk() { install_terraform() { echo -e "${YELLOW}Installing Terraform...${RESET}" - wget -O- https://apt.releases.hashicorp.com/gpg |\ + wget -O- https://apt.releases.hashicorp.com/gpg |\ gpg --dearmor |\ sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg > /dev/null From c393cb084e8955d06821600b8903e1cce0ed1b30 Mon Sep 17 00:00:00 2001 From: haywirebanana <113632239+haywirebanana@users.noreply.github.com> Date: Tue, 29 Apr 2025 02:17:28 -0600 Subject: [PATCH 15/20] fix: add -e onto final_verification() echo --- scripts/ubuntu_dev_env_setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ubuntu_dev_env_setup.sh b/scripts/ubuntu_dev_env_setup.sh index bcf56b54..a0696608 100755 --- a/scripts/ubuntu_dev_env_setup.sh +++ b/scripts/ubuntu_dev_env_setup.sh @@ -301,7 +301,7 @@ final_verification() { check_installation "k9s version" "K9s" check_installation "minikube version" "Minikube" check_installation "~/.local/bin/oh-my-posh --version" "Oh My Posh" - echo "${YELLOW}Listing all VS Code Extentions${RESET}" + echo -e "${YELLOW}Listing all VS Code Extentions${RESET}" code --list-extensions } From 6bce44da53bb3453005e37c90bd126e1ab602f3d Mon Sep 17 00:00:00 2001 From: haywirebanana <113632239+haywirebanana@users.noreply.github.com> Date: Tue, 29 Apr 2025 03:42:16 -0600 Subject: [PATCH 16/20] fix: oh-my-posh installation and verification --- scripts/ubuntu_dev_env_setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ubuntu_dev_env_setup.sh b/scripts/ubuntu_dev_env_setup.sh index a0696608..74bf63df 100755 --- a/scripts/ubuntu_dev_env_setup.sh +++ b/scripts/ubuntu_dev_env_setup.sh @@ -202,7 +202,7 @@ configure_git() { ssh-add ~/.ssh/id_rsa fi - # Refer to Markdown Instructions + # Refer to Markdown/Readme Instructions echo "Copy your SSH key and add it to GitHub:" echo "cat ~/.ssh/id_rsa.pub" } @@ -269,7 +269,7 @@ check_installation() { local cmd=$1 local name=$2 - if $cmd &>/dev/null; then + if eval $cmd &>/dev/null; then echo -e "${GREEN}${name} Installation: SUCCESS${RESET}" else echo -e "${RED}${name} Installation: FAILED${RESET}" From d3528e69705722944c7c5e5e62a81e576afc30ce Mon Sep 17 00:00:00 2001 From: haywirebanana <113632239+haywirebanana@users.noreply.github.com> Date: Tue, 29 Apr 2025 21:52:11 -0600 Subject: [PATCH 17/20] update SSH key generation to ed25519 algorithms --- scripts/ubuntu_dev_env_setup.sh | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/scripts/ubuntu_dev_env_setup.sh b/scripts/ubuntu_dev_env_setup.sh index 74bf63df..1f230c4f 100755 --- a/scripts/ubuntu_dev_env_setup.sh +++ b/scripts/ubuntu_dev_env_setup.sh @@ -187,24 +187,25 @@ install_vscode_extensions() { # The following portion would require manual inputs" configure_git() { echo -e "${YELLOW}Configuring Git with SSH...${RESET}" - echo "Enter your primary email for git:" + echo -e "${YELLOW}Enter your primary email for git:${RESET}" read git_email git config --global user.email "$git_email" - echo "Enter your name for git:" + echo -e "${YELLOW}Enter your name for git:${RESET}" read git_name git config --global user.name "$git_name" - if [[ ! -f ~/.ssh/id_rsa ]]; then - echo "Generating SSH key for GitHub..." - ssh-keygen -t rsa -b 4096 -C "$git_email" + if [[ ! -f ~/.ssh/id_ed25519 ]]; then + echo "${YELLOW}Generating SSH key for GitHub...${RESET}" + ssh-keygen -t ed25519 -C "$git_email" eval "$(ssh-agent -s)" - ssh-add ~/.ssh/id_rsa + ssh-add ~/.ssh/id_ed25519 fi # Refer to Markdown/Readme Instructions - echo "Copy your SSH key and add it to GitHub:" - echo "cat ~/.ssh/id_rsa.pub" + echo -e "${YELLOW}Copy your SSH key and add it to GitHub:${RESET}" + cat ~/.ssh/id_ed25519.pub + echo -e "${YELLOW}Refer to README notes on the next steps${RESET}" } @@ -306,7 +307,8 @@ final_verification() { } final_messages() { - echo -e "${GREEN}Development environment setup complete!${RESET}" + echo -e "${GREEN}Development environment setup is almost complete!${RESET}" + echo -e "${YELLOW}Last Step: SSH Authentication with GitHub${RESET}" } @@ -352,9 +354,6 @@ main() { # Install VSCode Extensions install_vscode_extensions - # Configure Git - configure_git - # Validate Kubernetes # NEEDS FIXING # check_kubernetes_access @@ -364,6 +363,9 @@ main() { # Final message final_messages + + # Configure Git + configure_git } main \ No newline at end of file From 38589a94aef2688276a57941b19df8d7e24784c5 Mon Sep 17 00:00:00 2001 From: haywirebanana <113632239+haywirebanana@users.noreply.github.com> Date: Tue, 29 Apr 2025 22:24:36 -0600 Subject: [PATCH 18/20] refactor: git configurations are done last & remove uncessary comments --- scripts/ubuntu_dev_env_setup.sh | 135 ++++++++++++-------------------- 1 file changed, 51 insertions(+), 84 deletions(-) diff --git a/scripts/ubuntu_dev_env_setup.sh b/scripts/ubuntu_dev_env_setup.sh index 1f230c4f..da603ce9 100755 --- a/scripts/ubuntu_dev_env_setup.sh +++ b/scripts/ubuntu_dev_env_setup.sh @@ -1,14 +1,22 @@ #!/bin/bash -# # Exit immediately on error -# set -e - # Colors for messages GREEN="\e[32m" RED="\e[31m" YELLOW="\e[33m" RESET="\e[0m" +# Validate network +validate_network() { + echo -e "${YELLOW}Checking network connectivity...${RESET}" + if ping -c 3 google.com; then + echo -e "${GREEN}Network connectivity: SUCCESSFUL${RESET}" + else + echo -e "${RED}Network connectivity: FAILED${RESET}" + exit 1 + fi +} + # Update and upgrade the system upgrade_system() { echo -e "${YELLOW}Updating and upgrading the system...${RESET}" @@ -35,10 +43,7 @@ install_dev_tools() { # Install VS Code (via Snap) install_vscode() { echo -e "${YELLOW}Installing VS Code (via Snap) ${RESET}" - #flatpak install -y flathub com.visualstudio.code - #flatpak info com.visualstudio.code || echo -e "${RED}VS Code installation verification failed!${RESET}" sudo snap install --classic code - # code --version || echo -e "${RED}VS Code installation failed!${RESET}" } # Install Cloud CLIs @@ -47,8 +52,6 @@ install_vscode() { install_azure_cli() { echo -e "${YELLOW}Installing Azure CLI...${RESET}" curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash - # Verify Azure CLI has installed - # az version || echo -e "${RED}Azure CLI installation verification failed!${RESET}" } # AWS CLI @@ -57,8 +60,6 @@ install_aws_cli() { curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" unzip awscliv2.zip sudo ./aws/install - # Verify AWS CLI has installed - # aws --version || echo -e "${RED}AWS CLI installation verification failed!${RESET}" # Remove installation "junk" rm -rf aws awscliv2.zip } @@ -69,8 +70,6 @@ install_google_cloud_sdk() { curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list sudo apt update && sudo apt -y install google-cloud-cli - # Verify Google Cloud SDK has installed - # gcloud version || echo -e "${RED}Google Cloud SDK installation verification failed!${RESET}" } # Install Infrastructure as Code tools @@ -87,16 +86,12 @@ install_terraform() { sudo tee /etc/apt/sources.list.d/hashicorp.list sudo apt update && sudo apt -y install terraform - # Verify Terraform has installed - # terraform version || echo -e "${RED}Terraform installation verification failed!${RESET}" } # OpenTofu install_opentofu() { echo -e "${YELLOW}Installing OpenTofu...${RESET}" sudo snap install --classic opentofu - # Verify OpenTofu has installed - tofu version || echo -e "${RED}OpenTofu installation verification failed!${RESET}" } # Bicep @@ -105,8 +100,6 @@ install_bicep() { curl -Lo bicep https://github.com/Azure/bicep/releases/latest/download/bicep-linux-x64 chmod +x ./bicep sudo mv ./bicep /usr/local/bin/bicep - # Verify Bicep has installed - # bicep --version || echo -e "${RED}Bicep installation verification failed!${RESET}" } # Helm @@ -115,8 +108,6 @@ install_helm() { curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 chmod 700 get_helm.sh ./get_helm.sh - # Verify Helm has installed - # helm version || echo -e "${RED}Helm installation verification failed!${RESET}" } @@ -127,11 +118,8 @@ install_kubectl() { echo -e "${YELLOW}Installing Kubectl...${RESET}" curl -LO "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/bin/kubectl - # Verify kubectl has installed - # kubectl version --client || echo -e "${RED}kubectl installation verification failed!${RESET}" # Remove installation "junk" rm -f kubectl - } # K9s @@ -143,11 +131,8 @@ install_k9s() { wget "$latest_k9s" # Install K9s using the .deb package sudo apt install ./"$(basename "$latest_k9s")" - # Verify K9s installation - # k9s version || echo -e "${RED}K9s installation verification failed!${RESET}" # Remove Installation "junk" rm -f "$(basename "$latest_k9s")" - } # minikube @@ -155,19 +140,14 @@ install_minikube() { echo -e "${YELLOW}Installing Minikube...${RESET}" curl -LO https://github.com/kubernetes/minikube/releases/latest/download/minikube-linux-amd64 sudo install minikube-linux-amd64 /usr/local/bin/minikube - # Verify minikube has installed - # minikube version || echo -e "${RED}minikube installation verification failed!${RESET}" # Remove installation "junk" rm -f minikube-linux-amd64 - } # Oh My Posh install_oh_my_posh() { echo -e "${YELLOW}Installing Oh My Posh...${RESET}" curl -s https://ohmyposh.dev/install.sh | bash -s - # Verify Oh My Posh has installed - # oh-my-posh --version || echo -e "${RED}Oh My Posh installation verification failed!${RESET}" } # VScode extensions @@ -183,43 +163,6 @@ install_vscode_extensions() { code --install-extension streetsidesoftware.code-spell-checker } -# Config git with ssh authentication -# The following portion would require manual inputs" -configure_git() { - echo -e "${YELLOW}Configuring Git with SSH...${RESET}" - echo -e "${YELLOW}Enter your primary email for git:${RESET}" - read git_email - git config --global user.email "$git_email" - - echo -e "${YELLOW}Enter your name for git:${RESET}" - read git_name - git config --global user.name "$git_name" - - if [[ ! -f ~/.ssh/id_ed25519 ]]; then - echo "${YELLOW}Generating SSH key for GitHub...${RESET}" - ssh-keygen -t ed25519 -C "$git_email" - eval "$(ssh-agent -s)" - ssh-add ~/.ssh/id_ed25519 - fi - - # Refer to Markdown/Readme Instructions - echo -e "${YELLOW}Copy your SSH key and add it to GitHub:${RESET}" - cat ~/.ssh/id_ed25519.pub - echo -e "${YELLOW}Refer to README notes on the next steps${RESET}" -} - - -# Validate networking -validate_network() { - echo -e "${YELLOW}Checking network connectivity...${RESET}" - if ping -c 3 google.com; then - echo -e "${GREEN}Network connectivity: SUCCESSFUL${RESET}" - else - echo -e "${RED}Network connectivity: FAILED${RESET}" - exit 1 - fi -} - # Validate Permissions and Authentication of Cloud CLI # ==================================== # Validate AWS CLI @@ -304,13 +247,42 @@ final_verification() { check_installation "~/.local/bin/oh-my-posh --version" "Oh My Posh" echo -e "${YELLOW}Listing all VS Code Extentions${RESET}" code --list-extensions + echo -e "${GREEN}Development environment setup is almost complete!${RESET}" + } -final_messages() { - echo -e "${GREEN}Development environment setup is almost complete!${RESET}" +# Config git with ssh authentication +# The following portion would require manual inputs" +configure_git() { + echo -e "${YELLOW}Configuring Git with SSH...${RESET}" + echo -e "${YELLOW}Enter your primary email for git:${RESET}" + read git_email + git config --global user.email "$git_email" + + echo -e "${YELLOW}Enter your name for git:${RESET}" + read git_name + git config --global user.name "$git_name" + + if [[ ! -f ~/.ssh/id_ed25519 ]]; then + echo "${YELLOW}Generating SSH key for GitHub...${RESET}" + ssh-keygen -t ed25519 -C "$git_email" + eval "$(ssh-agent -s)" + ssh-add ~/.ssh/id_ed25519 + fi + + # Refer to Markdown/Readme Instructions + echo -e "${YELLOW}Copy your SSH key and add it to GitHub:${RESET}" + cat ~/.ssh/id_ed25519.pub + echo -e "${YELLOW}Refer to README notes on the next steps${RESET}" +} + +next_steps_message() { echo -e "${YELLOW}Last Step: SSH Authentication with GitHub${RESET}" } +final_message() { + echo -e "${GREEN}Congratulations! You have reached the end of this script. Refer back to the verification step and ensure that all installations did not ${RED}FAIL.${RESET}" +} main() { # Initial validation @@ -325,17 +297,10 @@ main() { # Install VS Code install_vscode - # Install Cloud CLIs and validate them + # Install Cloud CLIs install_azure_cli - # NEEDS FIXING - # validate_azure_cli_permissions - install_aws_cli - # NEEDS FIXING - # validate_aws_cli_permissions - install_google_cloud_sdk - validate_google_cloud_sdk_permissions # Install Infrastructure tools and validate install_terraform @@ -354,18 +319,20 @@ main() { # Install VSCode Extensions install_vscode_extensions - # Validate Kubernetes - # NEEDS FIXING - # check_kubernetes_access - # Verify all installations final_verification - # Final message - final_messages + # "Step 1 - END" message + next_steps_message # Configure Git configure_git + + # Validate Cloud CLI's and Kubernetes Access (NEEDS FIXING!!!!!) + # validate_azure_cli_permissions + # validate_aws_cli_permissions + # validate_google_cloud_sdk_permissions + # check_kubernetes_access } main \ No newline at end of file From 745fca426343066c02de0d7549ef8ca27a3d33ca Mon Sep 17 00:00:00 2001 From: haywirebanana <113632239+haywirebanana@users.noreply.github.com> Date: Wed, 7 May 2025 21:00:18 -0600 Subject: [PATCH 19/20] remove CLI authentication steps --- scripts/ubuntu_dev_env_setup.sh | 52 --------------------------------- 1 file changed, 52 deletions(-) diff --git a/scripts/ubuntu_dev_env_setup.sh b/scripts/ubuntu_dev_env_setup.sh index da603ce9..b7d5c455 100755 --- a/scripts/ubuntu_dev_env_setup.sh +++ b/scripts/ubuntu_dev_env_setup.sh @@ -163,52 +163,6 @@ install_vscode_extensions() { code --install-extension streetsidesoftware.code-spell-checker } -# Validate Permissions and Authentication of Cloud CLI -# ==================================== -# Validate AWS CLI -validate_aws_cli_permissions() { - echo -e "${YELLOW}Checking AWS CLI authentication and permissions...${RESET}" - if aws sts get-caller-identity &>/dev/null; then - echo -e "${GREEN}AWS CLI authentication: SUCCESS${RESET}" - else - echo -e "${RED}AWS CLI authentication: FAILED${RESET}" - exit 1 - fi -} - -# Validate AZURE CLI -validate_azure_cli_permissions() { - echo -e "${YELLOW}Checking Azure CLI authentication and permissions...${RESET}" - if az account show &>/dev/null; then - echo -e "${GREEN}Azure CLI authentication: SUCCESS${RESET}" - else - echo -e "${RED}Azure CLI authentication: FAILED${RESET}" - exit 1 - fi -} - -# Validate GOOGLE SDK -validate_google_cloud_sdk_permissions() { - echo -e "${YELLOW}Checking Google Cloud SDK authentication and permissions...${RESET}" - if gcloud auth list &>/dev/null; then - echo -e "${GREEN}Google Cloud SDK authentication: SUCCESS${RESET}" - else - echo -e "${RED}Google Cloud SDK authentication: FAILED${RESET}" - exit 1 - fi -} - -# Validate Kubernetes -check_kubernetes_access() { - echo -e "${YELLOW}Checking Kubernetes cluster access...${RESET}" - if kubectl cluster-info &>/dev/null; then - echo -e "${GREEN}Kubernetes access: SUCCESS${RESET}" - else - echo -e "${RED}Kubernetes access: FAILED${RESET}" - exit 1 - fi -} - check_installation() { local cmd=$1 local name=$2 @@ -327,12 +281,6 @@ main() { # Configure Git configure_git - - # Validate Cloud CLI's and Kubernetes Access (NEEDS FIXING!!!!!) - # validate_azure_cli_permissions - # validate_aws_cli_permissions - # validate_google_cloud_sdk_permissions - # check_kubernetes_access } main \ No newline at end of file From 9f2b7216bf6ca79d43a006c11460b37a879e4bcf Mon Sep 17 00:00:00 2001 From: haywirebanana <113632239+haywirebanana@users.noreply.github.com> Date: Mon, 12 May 2025 20:08:13 -0600 Subject: [PATCH 20/20] feat: readme markdown added --- scripts/README.md | 87 +++++++++++++++++++++++++++++++++ scripts/ubuntu_dev_env_setup.sh | 4 +- 2 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 scripts/README.md diff --git a/scripts/README.md b/scripts/README.md new file mode 100644 index 00000000..64ceea08 --- /dev/null +++ b/scripts/README.md @@ -0,0 +1,87 @@ +# Development Environment Setup Script + +## Overview +This bash script automates the setup of a complete development environment on a Linux (Ubuntu) system. +The overall goal of this script is to install and configure your development environment to work on as a platform engineer. + +## Features +The following list involves all the installation in order to set up your development environment. +1. Network Connectivity Checks + * +2. System Updates and Upgrades + * +3. Installation of Essential Development Tools: + * git + * vim + * tilix + * curl + * wget + * jq + * unzip + * gnupg + * apt-transport-https + * ca-certificates + * software-properties-common +4. Installation of Major Cloud CLI Tools: + * Azure CLI + * AWS CLI + * Google Cloud SDK +5. Installation of Infrastructure as Code (IaC) Tools: + * Terraform + * OpenTofu + * Bicep + * Helm +6. Installation of Kubernetes Management Tools: + * kubectl + * K9s + * Minikube +7. Installation of Oh My Posh (Cosmetic Enhancements) +8. Installation of VS Code Extentions: + * Terraform + * Kubernetes + * Azure + * Bicep + * Gitlens + * Spell Checker +9. Semi-Automatic Git Configuration with SSH Setup + +## Prerequisites +* A Linux distribution with `sudo` privileges +* Active internet connection + +## How to Use +1. Clone this repository or copy the script into your local system. + * To copy, save the file `ubuntu_dev_env_setup.sh' onto your local machine. Remember the directory you placed it in +2. Open the terminal and head into the directory where this script is located. +3. Run the script using `./ubuntu_dev_env_setup.sh` +4. Follow along the on-screen prompts + +### Git Configuration Steps +The final step of this script will need manual inputs as generating an SSH key requires: +* Git username +* Git password +* Directory to save SSH keys properly + +When prompted on your terminal, ensure you fill out the following: +1. Primary email for git `Enter your primary email for git:` +2. Username for git `Enter your username for git:` +3. File Location to save the key `Enter file in which to save the key (/home/user/.ssh/id_ed25519)` + * Simply type out the folder location as written in the brackets +4. Leave passphrase empty by pressing your enter key +5. Leave passphrase empty (again) by pressing your enter key + #### Copying your SSH key to add into GitHub + * The terminal will write out the command `cat ~/.ssh/id_ed25519.pub` which allows you to view that generated SSH Key + * Highlight the following response and copy it + + 1. Log into your GitHub Account through a web browser + 2. Click on your account (top-right corner) + 3. Through the Settings page, head onto the SSH and GPG keys section on the left tab + 4. Click on the green "New SSH Key" + 5. Feel free to se the Title to whatever you would like, then ensure that Key Type is set to "Authentication key" + 6. In the Key Section, paste your SSH Key from your terminal + 7. Once you click the green "Add SSH Key" button, you are finished! + + + + + diff --git a/scripts/ubuntu_dev_env_setup.sh b/scripts/ubuntu_dev_env_setup.sh index b7d5c455..23b961af 100755 --- a/scripts/ubuntu_dev_env_setup.sh +++ b/scripts/ubuntu_dev_env_setup.sh @@ -213,7 +213,7 @@ configure_git() { read git_email git config --global user.email "$git_email" - echo -e "${YELLOW}Enter your name for git:${RESET}" + echo -e "${YELLOW}Enter your username for git:${RESET}" read git_name git config --global user.name "$git_name" @@ -235,7 +235,7 @@ next_steps_message() { } final_message() { - echo -e "${GREEN}Congratulations! You have reached the end of this script. Refer back to the verification step and ensure that all installations did not ${RED}FAIL.${RESET}" + echo -e "${GREEN}Congratulations! You have reached the end of this script. Refer back to the verification step and ensure that all installations did not ${RED}FAIL.${RESET} Ensure that your SSH key has been generated and set into your GitHub account." } main() {