Local Developer Environment Setup
There is no prescribed dev environment in CSE, and everyone is free to set up their machine and work how they wish. The wide range of customer projects we engage on requires us to be flexible and willing to work with many languages, toolchains and platforms. This is in line with our “meet the customer where they are” aspiration.
This section contains a suggested set of tools and dev environment which many in CSE use, it has been found to be flexible and works well in nearly every scenario.
Windows Users
The two core pieces of software you’ll need installed within Windows, are VS Code and the new Windows Terminal. You can install these manually if you wish, however using WinGet (details below) can automate and simplify this.
- Install Visual Studio Code
- Install Windows Terminal
WinGet is the standard package manager for Windows and is included as part of the OS. With it you can automate the install of what you need. A “pack” for WinGet has been created and it contains all of the tools & software you will need
For all the development tools, software, SDKs and other things you will be using day to day - these should be installed in WSL (Windows Subsystem For Linux) and not into Windows. This is the STRONGLY recommended route for Windows users to carry out their work.
- Install WSL
- It is recommended to use a Debian based Linux distro such as Ubuntu
- You can simply run
wsl --install
(from an elevated/admin prompt) and this will take care of everything (it will pick Ubuntu for you)
- Install the remote development extensions in VS Code to work with WSL.
WSL Setup
These steps should be run inside WSL. This repo https://github.com/benc-uk/tools-install contains a maintained library of easy install scripts which can accelerate this stage
Setup Tools Install Repo
- Latest WSL Ubuntu versions come with
git
installed. You can check if git installed by runninggit --version
in your WSL Terminal tab. - Clone Tools Install repo to your WSL
cd ~ git clone https://github.com/benc-uk/tools-install cd tools-install
-
There is a load of bash scripts in this repo. Not every project would need all of these tools. So here is a suggested list of tools to install as sane defaults for optimial experience.
- Common Tools Installation
./base.sh
- Docker Installation
./docker.sh
- Node Installation
./node.sh
- Dotnet Installation
./dotnet.sh
- Go Installation
./golang.sh
- Java Installation
./jdk.sh
- Azure CLI Installation
./azure-cli.sh
- Common Tools Installation
-
Install VS Code extensions for relevant languages.
This is a list of recommended VS Code extensions
- Azure (extension bundle pack)
- Code Spell Checker
- REST Client
- Docker
- Kubernetes
- Terraform
- Bicep
- YAML
- Shellcheck (If working with bash a lot)
- Live Share
- GitHub Copilot (If you have been accepted into the technical preview)
- ESLint (For JS/Node/TS work)
- Prettier (For HTML/JS/Node/TS work)
- Draw.io
- Install Docker in WSL. There are a number of ways to do this but this script will quickly and easily install Docker CLI and container runtime
- Many guides including the VS Code docs will claim that Docker Desktop is required. However that is no longer the case, as long as you open the project folder in WSL first, then open it as a container.
- However you can use Docker Desktop should you wish - Docker Desktop
- Install Azure CLI, see above tools-install repo for a helper script or follow the docs
- Pushing and pulling code with Azure DevOps from WSL can be tricky due to the credentials & auth required, there are two options
- Use git with SSH. Create a SSH keypair, and add this to any Azure DevOps projects
- Install and configure Git Credential Manager (Mixed results trying to get this to work)
Docker in WSL - Quality of Life
When using Docker in WSL without Docker Desktop there are a few things you can do to make your life easier
-
Create aliases for stopping & starting Docker, add these to your rc files (e.g.
.bashrc
or.zshrc
or other file which is sourced when you open a shell)alias start-docker='sudo /etc/init.d/docker start' alias stop-docker='sudo /etc/init.d/docker stop'
-
To have docker start every time you open a WSL shell, also add the following to your startup script (e.g.
.bashrc
or.zshrc
)if [[ ! -f /var/run/docker.pid ]]; then { echo "🐳 Starting Docker..."; start-docker; }; fi
-
Fed up with entering your password when running
sudo
? Then edit/etc/sudoers
and allow sudo without password prompt.
Runsudo nano /etc/sudoers
and addNOPASSWD: ALL
to the line starting%sudo
e.g.
# Allow members of group sudo to execute any command %sudo ALL=(ALL:ALL) NOPASSWD: ALL
MacOS Users
MacOS setup can be completed on terminal with following commands. It is better to run them in order and see successful installation in each step.
# Xcode Tools
sudo xcode-select --install
# Oh My Zsh
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# Brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# git and Github
brew install git gh
# Github Login
gh auth login
# Setup Git
git config --global user.name "Cool Name"
git config --global user.email "your@email.com"
# Browsers
brew install --cask google-chrome firefox
# Window Management App
brew install --cask rectangle
# Language Tools
brew install go node npm python3 pipenv virtualenv pyenv nodejs temurin dotnet-sdk
# Dev Tools
brew install --cask docker postman drawio visual-studio-code azure-data-studio microsoft-azure-storage-explorer
# Build Tools
brew install cmake autogen autoconf automake gcc
# CLI tools
brew install wget rsync socat pv azure-cli kubectl jq
# Login Azure and Set Default Subscription
az login
az account set --subscription {SubscriptionName}
# Azure Functions Core Tools
brew tap azure/functions
brew install azure-functions-core-tools@4
# Mac App Store CLI
brew install mas
# Xcode
mas install 497799835
# Set Xcode Version and Accept Licence
sudo xcode-select -r
sudo xcodebuild -license accept
# Show Hidden Files
defaults write com.apple.Finder AppleShowAllFiles true
# Office dogfood crashes regularly has caused data loss on more than one occasion
# for more details, see https://teams.microsoft.com/l/message/19:efc6ebdedaa34bebbea96ac0de83223a@thread.skype/1621529390589?tenantId=72f988bf-86f1-41af-91ab-2d7cd011db47&groupId=070a6bff-7541-4a26-b9f5-35f93be0b7ca&parentMessageId=1621524351171&teamName=CSE%20Community&channelName=Mac%20Users&createdTime=1621529390589
#
# Install office using retail installers (once a month) via our direct pkg links at https://macadmins.software
#
# Stop MS autoupdate from using internal builds
defaults write com.microsoft.autoupdate2 ChannelName Production
# Stop MS autoupate from popping up all the time
defaults write com.microsoft.autoupdate2 HowToCheck Manual
# Disable (very slow) scanning of large folders by Defender
mdatp exclusion folder add --path /usr/local/Cellar
mdatp exclusion folder add --path /usr/local/Caskroom
mdatp exclusion folder add --path "${HOME}/Parallels"
mdatp exclusion folder add --path "${HOME}/.docker"
Dev Containers
Many in CSE use “Dev Containers” which is a feature of VS Code, where you run VS code from inside a container which can include all the tools and setup needed to work with a particular code base.
Install the remote development extensions
To validate this feature is working, you can clone this repo to your local machine.
For windows users, open the repo from WSL in VS Code, then select the option “Reopen in container”, if you get no errors and can open a terminal in VS Code and execute make run
also without error, then Dev Containers is working. NOTE. You must ensure that VS Code has the project open using WSL (You will see ‘WSL’ the very bottom left) before reopening in a container.
For MacOs users, open the repo in VS Code, then select the option “Reopen in container”, if you get no errors and can open a terminal in VS Code and execute make run
also without error, then Dev Containers is working.