Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: vendasta/setup-new-computer-script
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: badal-io/setup-new-computer-script
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 10 commits
  • 4 files changed
  • 1 contributor

Commits on Mar 12, 2024

  1. Copy the full SHA
    f0bd28a View commit details
  2. Copy the full SHA
    26e7218 View commit details
  3. Copy the full SHA
    9ccdd23 View commit details
  4. Fixed recursive loop

    liamhelmer committed Mar 12, 2024
    Copy the full SHA
    bc0e217 View commit details
  5. Copy the full SHA
    58d7235 View commit details
  6. Copy the full SHA
    dc84be2 View commit details
  7. Added vault-cli

    liamhelmer committed Mar 12, 2024
    Copy the full SHA
    2a4ba05 View commit details
  8. Copy the full SHA
    d23cb73 View commit details
  9. Copy the full SHA
    8979f3a View commit details
  10. Branch name master -> main

    liamhelmer committed Mar 12, 2024
    Copy the full SHA
    f09a921 View commit details
Showing with 97 additions and 52 deletions.
  1. +9 −41 README.md
  2. +17 −0 badal-io.sh
  3. +41 −0 functions.sh
  4. +30 −11 setup-new-computer.sh
50 changes: 9 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Setup a New Developer Computer
This script will help with the quick setup and installation of tools and applications for new developers at Vendasta. Tested in Mac OS 10.14 to 12. This script works on both Intel and M1/M2 Macs.
This script will help with the quick setup and installation of tools and applications for new developers at Badal-IO. Tested in Mac OS 10.14 to 12. This script works on both Intel and M1/M2 Macs.

You can run this script multiple times without issue. You can also run it on a partially set-up computer and it will only install what is missing.

@@ -15,7 +15,7 @@ Looking to use this script at your own company? Check out the [tips for using th

Paste the command below in a Mac OS Terminal:
```
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/vendasta/setup-new-computer-script/master/setup-new-computer.sh)"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/badal-io/setup-new-computer-script/main/setup-new-computer.sh)"
```

## Manual Install Instructions
@@ -52,11 +52,9 @@ After you have run the script, please complete the following steps to finish set

<br>

2. **Vendasta specific tools**\
2. **Badal Specific Setup**\
Follow our onboarding document to complete your setup:
- [Onboarding New Developers - Setup New Developer’s Computer - Next Steps][nextsteps]

[nextsteps]: https://vendasta.jira.com/wiki/spaces/RD/pages/199032984/Onboarding+New+Developers#New-Dev%5BhardBreak%5DSetup-New-Developer%E2%80%99s-Computer-with-a-script
- Placeholder: this will link to a confluence page, but I don't see anything that exists yet

<br><br>

@@ -74,18 +72,10 @@ You can fix this by running the following command in your terminal:
compaudit | xargs chmod g-w
```

<br>

**Setting Up Pycharm with Python 2.7**\
As Mac OS has recently removed the bundled copy of Python 2.7, please see [this help document on working with our Legacy Appengine projects](https://vendasta.jira.com/wiki/spaces/RD/pages/1688469847/Pycharm+Setup+for+Legacy+Appengine+Python+2.7)

<br>


**Installing and Upgrading Node and NPM versions**\
There is a handy command in your `.bash_profile` and `.zsh_profile` that will automatically install your chosen version of Node and NPM, re-install any global npm packages (like angular cli), and set the newly installed version as default.

We use Node v20 at Vendasta. To upgrade to the latest version of Node 20, re-install global npm packages, and set it as default, run the following command:
To upgrade to the latest version of Node 20, re-install global npm packages, and set it as default, run the following command:
```sh
node-upgrade 20
```
@@ -111,7 +101,7 @@ nvm use --lts
nvm use 18 # or 10.10.0, 8.9.1, etc
```

[nvm docs]: https://github.com/nvm-sh/nvm/blob/master/README.md#usage
[nvm docs]: https://github.com/nvm-sh/nvm/blob/main/README.md#usage

<br>

@@ -183,8 +173,6 @@ fi
source "$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.bash.inc"

# Golang
export GOPRIVATE="github.com/vendasta"
export GOPROXY="direct"
export GO111MODULE="on"
export GOPATH=$HOME/go
export GOBIN=$GOPATH/bin
@@ -249,9 +237,6 @@ fpath=(/usr/local/share/zsh-completions $fpath)
[ -e "$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc" ] && source "$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc"

# Golang
export GOPRIVATE="github.com/vendasta"
export GOPROXY="direct"
export GO111MODULE="on"
export GOPATH=$HOME/go
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN
@@ -340,7 +325,6 @@ node-upgrade() {
```sh
mkdir -p ~/go
brew install go
go env -w GOPRIVATE="github.com/vendasta"
```
</details>

@@ -647,20 +631,6 @@ defaults write com.google.Chrome.canary PMPrintingExpandedStateForPrint2 -bool t
```
</details>



### Set up Git

<details>
<summary>Configure git to always ssh when dealing with https github repos</summary>

```sh
git config --global url."git@github.com:".insteadOf https://github.com/
# you can remove this change by editing your ~/.gitconfig file
```
</details>


<details>
<summary>Set Git to store credentials in Keychain</summary>

@@ -700,16 +670,14 @@ fi

## Tips for using the script at your own company

This script helps new developers at Vendasta setup their laptops quicker, letting them hit the ground running. Before, it could take 2-5 days to install and configure everything, leading to a frustrating first week. With this script and fast internet, the process can be done in under 30 min.
This script helps new developers at Badal-IO setup their laptops quicker.

I have tried to make this script simple and useful. You will want to customize the installation and configuration to match the tools and services you use at your company.

- At Vendasta, we are using Go, Angular, and Google Cloud. You most likely do not use all of these, so remove, change, and tweak to meet your needs.
- We lock our Node version at 20 (using NVM) for best compatibility with Angular and NX. You will likely want to change this.
- To customize the [welcome logo](https://github.com/vendasta/setup-new-computer-script/blob/47b7c97f21b293e143a0566cafecec2cfc69c528/setup-new-computer.sh#L74-L90) and add a bit of style, I used the handy [Text to ASCII Art Generator](https://patorjk.com/software/taag/#p=testall&f=Isometric1&t=Vendasta)
- To customize the [welcome logo](https://github.com/badal-io/setup-new-computer-script/blob/47b7c97f21b293e143a0566cafecec2cfc69c528/setup-new-computer.sh#L74-L90) and add a bit of style, I used the handy [Text to ASCII Art Generator](https://patorjk.com/software/taag/#p=testall&f=Isometric1&t=Vendasta)
- When you update the script, remember to update the readme "What's Installed" section too
- Be sure to update both the `.bash_profile` and `.zprofile`
- This is MIT licensed, so be sure to include the [LICENSE file](https://github.com/vendasta/setup-new-computer-script/blob/master/LICENSE)
- This is MIT licensed, so be sure to include the [LICENSE file](https://github.com/vendasta/setup-new-computer-script/blob/main/LICENSE)
- Let me know! It is good to know if you find this helpful


17 changes: 17 additions & 0 deletions badal-io.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This should be sourced from the main setup-new-computer.sh script. If it's not, we should fail

if [[ $(type -t exitscript) != function ]] && [[ "$1" != "--force" ]]; then
echo "Must be sourced from from setup-new-computer.sh, i.e. (presuming bash shell):"
echo " . setup-new-computer-script/badal-io.sh"
echo "Use --force to override."
exit 1
fi

printStep "Hashicorp tap" "brew tap hashicorp/tap" || exitscript 1
printStep "Terraform" "brew install terraform" || exitscript 1
printStep "Vault CLI" "brew install vault-cli" || exitscript 1
#if [[ "\$(uname -p)" == "arm" ]]; then
# printStep "Installing kubectl" 'curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl' || exitscript 1
#else
# printStep "Installing kubectl" 'curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl' || exitscript 1
#fi
41 changes: 41 additions & 0 deletions functions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

#===============================================================================
# Functions
#===============================================================================


printHeading() {
printf "\n\n\n\e[0;36m$1\e[0m \n"
}

printDivider() {
printf %"$COLUMNS"s |tr " " "-"
printf "\n"
}

printError() {
printf "\n\e[1;31m"
printf %"$COLUMNS"s |tr " " "-"
if [ -z "$1" ] # Is parameter #1 zero length?
then
printf " There was an error ... somewhere\n" # no parameter passed.
else
printf "\n Error Installing $1\n" # parameter passed.
fi
printf %"$COLUMNS"s |tr " " "-"
printf " \e[0m\n"
}

printStep() {
printf %"$COLUMNS"s |tr " " "-"
printf "\nInstalling $1...\n";
$2 || printError "$1"
}

exitscript () {
# Exit the script with an error, cleaning up resources along the way
local errorcode="${1:-1}"
shift
echo " Error: $@\n"
exit $errorcode
}
41 changes: 30 additions & 11 deletions setup-new-computer.sh
Original file line number Diff line number Diff line change
@@ -73,15 +73,17 @@ printStep() {

printLogo() {
cat << "EOT"
_ _
| | | |
__ _____ _ __ __| | __ _ ___| |_ __ _
\ \ / / _ \ '_ \ / _` |/ _` / __| __/ _` |
\ V / __/ | | | (_| | (_| \__ \ || (_| |
\_/ \___|_| |_|\__,_|\__,_|___/\__\__,_|
------------------------------------------
___. .___ .__ .__
\_ |__ _____ __| _/_____ | | |__| ____
| __ \ \__ \ / __ | \__ \ | | ______| | / _ \
| \_\ \ / __ \_/ /_/ | / __ \_| |__/_____/| |( <_> )
|___ /(____ /\____ | (____ /|____/ |__| \____/
\/ \/ \/ \/
Q U I C K S E T U P S C R I P T
Largely lifted from Vendasta's script of the same name originally by Joel Kesler.
Modifications (and probably any errors or bugs) by Liam Helmer
NOTE:
You can exit the script at any time by
@@ -610,10 +612,11 @@ printDivider
read -p 'What is your Git display name (Firstname Lastname)?: ' gitName
git config --global user.name "$gitName"
fi
printDivider
echo "✔ Configure git to always ssh when dealing with https github repos"
git config --global url."git@github.com:".insteadOf https://github.com/
# you can remove this change by editing your ~/.gitconfig file
## Disabled: this disrupts the second part of the script
#printDivider
# echo "✔ Configure git to always ssh when dealing with https github repos"
# git config --global url."git@github.com:".insteadOf https://github.com/
# # you can remove this change by editing your ~/.gitconfig file
printDivider
echo "✔ Creating .ssh directory in home folder [~/.ssh]"
mkdir -p ~/go
@@ -622,7 +625,23 @@ printDivider
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
printDivider

#===============================================================================
# Badal.io specific steps
#===============================================================================

exitscript () {
# Exit the script with an error, cleaning up resources along the way
local errorcode="${1:-1}"
shift
echo " Error: $@\n"
exit $errorcode
}

printHeading "Specific installation steps for badal.io"

printDivider
git clone https://github.com/badal-io/setup-new-computer-script.git || exitscript 1 "Can't grab badal specific script with git!"
. setup-new-computer-script/badal-io.sh || exitscript 1 "error executing badal-io.sh"

#===============================================================================
# Installer: Complete