Developing the Analytical Platform
Analytical Platform is built using many differenct core technolgies (AWS, Kubernetes, Container and Python, etc.)
To ease the development process of each component/repository, we have created a dev container that contains all the tools required.
There are two methods for using dev containers:
GitHub Codespaces, but this optional, as the Ministry of Justice doesn’t pay for this, it is down to the user to pick up the cost.
Locally on macOS
This documentation will cover running locally on macOS, because GitHub Codespaces is a one-click operation.
Getting Started on macOS
Prerequisites
macOS
Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
1Password
You will need to request access to 1Password via Operations Engineering.
brew install 1password
Docker
If you are have an Apple Silicon Mac, you will need to enable Rosetta emulation, see Docker’s documentation for more information.
brew install --cask docker
Node
brew install node
Dev Container CLI
sudo npm install --location=global @devcontainers/cli@latest
Visual Studio Code
brew install --cask visual-studio-code
Dev Containers Visual Studio Code Extension
/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code --install-extension ms-vscode-remote.remote-containers
Setup
Your GPG and SSH agents are mounted from macOS, so GPG and SSH commands inside the container should work without any configuration updates
We recommend using 1Password to manage your SSH keys, and this document will reflect that
- Follow 1Password’s instructions on how to setup SSH keys and their SSH agent (link)
If you already have an existing key, you can add it to 1Password (link) and skip to step 3 of 1Password’s instructions.
Permanently set
SSH_AUTH_SOCK
by adding the following to your~/.zshrc
or~/.bashrc
fileexport SSH_AUTH_SOCK=~/Library/Group\ Containers/2BUA8C4S2C.com.1password/t/agent.sock
Clone one of the Analytical Platform repositories, for this example we’ll use
analytical-platform
Example mkdir -p ~/Developer/github.com/ministryofjustice git clone git@github.com:ministryofjustice/analytical-platform.git ~/Developer/github.com/ministryofjustice/analytical-platform
Open the Analytical Platform repository in Visual Studio Code
Example cd ~/Developer/github.com/ministryofjustice/analytical-platform /Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code .
Open the Visual Studio Code Command Palette using
Shift-Command-P
Run
Dev Container: Reopen in Container
Wait for the container to build, it may take 5 to 10 minutes
Updating
When new functionality is added you will need to rebuild the container, to do this:
Pull the latest changes from the Analytical Platform repository on the host machine
Example cd ~/Developer/github.com/ministryofjustice/analytical-platform git fetch git pull
Open the Analytical Platform repository in Visual Studio Code
Example cd ~/Developer/github.com/ministryofjustice/analytical-platform /Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code .
Open the Visual Studio Code Command Palette using
Shift-Command-P
Run
Dev Container: Rebuild and Reopen in Container