Created
May 26, 2023 09:10
-
-
Save lingxiankong/4ce3fe4fa30673348946e8f1a1781afc to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #!/bin/sh | |
| set -e | |
| gum style \ | |
| --foreground 212 --border-foreground 212 --border double \ | |
| --margin "1 2" --padding "2 4" \ | |
| 'Setup for the | |
| "How To Create A Complete Internal Developer Platform (IDP)?" | |
| video.' | |
| gum confirm ' | |
| Are you ready to start? | |
| Feel free to say "No" and inspect the script if you prefer setting up resources manually. | |
| ' || exit 0 | |
| rm -f .env | |
| ################ | |
| # Requirements # | |
| ################ | |
| echo " | |
| ## You will need following tools installed: | |
| |Name |Required |More info | | |
| |----------------|---------------------|---------------------------------------------------| | |
| |Charm Gum |Yes |'https://github.com/charmbracelet/gum#installation'| | |
| |gitHub CLi |Yes |'https://youtu.be/BII6ZY2Rnlc' | | |
| |jq |Yes |'https://stedolan.github.io/jq/download' | | |
| |yq |Yes |'https://github.com/mikefarah/yq#install' | | |
| |Google Cloud CLI|If using Google Cloud|'https://cloud.google.com/sdk/docs/install' | | |
| |AWS CLI |If using AWS |'https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html'| | |
| |eksctl |If using AWS |'https://eksctl.io/introduction/#installation' | | |
| " | gum format | |
| gum confirm " | |
| Do you have those tools installed? | |
| " || exit 0 | |
| ################ | |
| # Hyperscalers # | |
| ################ | |
| echo " | |
| Which Hyperscaler do you want to use?" | |
| HYPERSCALER=$(gum choose "google" "aws" "azure") | |
| echo "export HYPERSCALER=$HYPERSCALER" >> .env | |
| if [[ "$HYPERSCALER" == "azure" ]]; then | |
| gum style \ | |
| --foreground 212 --border-foreground 212 --border double \ | |
| --margin "1 2" --padding "2 4" \ | |
| 'Unfortunately, the demo currently does NOT work in Azure.' \ | |
| ' | |
| Please let me know in the comments of the video if you would like | |
| me to add the commands for Azure.' \ | |
| ' | |
| I will do my best to add the commands if there is interest or you | |
| can create a pull request if you would like to contribute.' | |
| exit 0 | |
| fi | |
| ############### | |
| # GitHub Repo # | |
| ############### | |
| GITHUB_ORG=$(gum input --placeholder "GitHub organization (do NOT use GitHub username)" --value "$GITHUB_ORG") | |
| echo "export GITHUB_ORG=$GITHUB_ORG" >> .env | |
| GITHUB_USER=$(gum input --placeholder "GitHub username" --value "$GITHUB_USER") | |
| gum confirm " | |
| We need to authorize GitHub CLI to manage your secrets. | |
| Choose \"No\" if you already authorized it previously. | |
| " && gh auth refresh --hostname github.com --scopes admin:org | |
| gum input --placeholder " | |
| Press the enter key to continue." | |
| ########### | |
| # The End # | |
| ########### | |
| gum style \ | |
| --foreground 212 --border-foreground 212 --border double \ | |
| --margin "1 2" --padding "2 4" \ | |
| 'The setup is almost finished.' \ | |
| ' | |
| Execute "source .env" to set the environment variables.' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment