Skip to main content

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

  1. 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.

  1. Permanently set SSH_AUTH_SOCK by adding the following to your ~/.zshrc or ~/.bashrc file

    export SSH_AUTH_SOCK=~/Library/Group\ Containers/2BUA8C4S2C.com.1password/t/agent.sock
    
  2. 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
    

  3. 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 .
    

  4. Open the Visual Studio Code Command Palette using Shift-Command-P

  5. Run Dev Container: Reopen in Container

  6. 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:

  1. 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
    

  2. 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 .
    

  3. Open the Visual Studio Code Command Palette using Shift-Command-P

  4. Run Dev Container: Rebuild and Reopen in Container

This page was last reviewed on 23 May 2024. It needs to be reviewed again on 23 November 2024 by the page owner #data-platform-notifications .
This page was set to be reviewed before 23 November 2024 by the page owner #data-platform-notifications. This might mean the content is out of date.