Getting Started - AndersenLab/CAENDR GitHub Wiki

Overview

This page describes how to install all the required software to run CaeNDR locally.

NOTE: This project was developed on MacOS, and as such this documentation will focus on Mac.

Note: Once you have set up the project, please consult the page External Resources for documentation on the tools & software we use to build the site.


Credentials

GCP Credentials

To authenticate with the Google Cloud services used by this project, you must use a service account credential JSON file.

  1. Obtain the JSON file for the relevant service account and GCP project, if one exists - ask your team about this. If one does not exist yet, you'll need to create a new service account.

    • If you have the content for the JSON file, but not the filename, create a JSON file with a name matching the ID of the GCP project you're working in. Importantly, this MAY NOT be the same as the project name! For example, if you are working in a project named sample-gcp-project with an ID sample-gcp-project-12345, then you should name the JSON credentials file sample-gcp-project-12345.json.
    • NOTE: Some existing credentials files have an additional string of numbers at the end - this is okay! For example, you might receive a JSON file named sample-gcp-project-12345-0987654321.json - don't worry about this.
  2. In your local file browser (Terminal, Finder, etc.), navigate to ~/.gcp under your home directory. If this folder does not yet exist, you will need to create it:

    # Create the GCP credentials folder
    mkdir ~/.gcp
    
    # Optional - open the current location in Finder (MacOS)
    open -a Finder ~/.gcp 
  3. Add / move the service account JSON file to the .gcp folder.


Software / App Downloads

A list of applications used for development, along with download & app-specific setup instructions.

Visual Studio Code

Docker


MacOS / Linux Requirements

Install Homebrew

  1. Install Homebrew using cURL on the command line:

    cd $HOME
    mkdir homebrew && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
  2. Find out which shell you are using:

    echo $SHELL

    If you see "bash" then update the ~/.bash_profile in the next step. If you see zsh as your shell, then update the file ~/.zprofile

  3. Add this line to the bottom of your file ~/.bash_profile, or .zprofile, as determined in the previous step:

    export PATH=$HOME/homebrew/bin:$PATH

Install Make

Setup requires make which can be installed with:

sudo apt-get update && sudo apt-get install build-essential

Configuration

Configure Terminal to use x86_64

This appears to be a holdover from a (much) earlier stage of the project, and may or may not be relevant on modern devices. If your terminal puts out the correct result for the final step, you may be able to skip this.

  1. Open Finder on your Mac
  2. Navigate to Applications/Utilities/Terminal.app
  3. Right-click "GetInfo"
  4. Enable the checkbox "Open with Rosetta"
  5. Close and reopen the Terminal app
  6. Inside Terminal, type:
    arch
    Expected result:
    i386

Install Dependencies with Homebrew

Installing the project software dependencies.

  1. Make sure to install Homebrew on your machine (instructions above).

  2. Update Homebrew to the latest version & install the dependencies.

    arch -x86_64 brew update
    arch -x86_64 brew install pyenv OpenSSL readline gettext xz
  3. Edit your ~/.bash_profile and add this to the bottom of the file. If the file ~/.bash_profile doesn't exist, check if you are using a different shell (eg: zsh, etc); in that case, you might need to edit the file ~/.zshrc or ~/.zprofile instead.

    1. Determine whether to use .bash_profile, .zprofile, etc.

    2. Open your file in the text editor of your choice, e.g.:

      # if using Vim as a file editor on a bash terminal, then do:
      vim ~/.bash_profile
      
      # if using Nano as a file editor on a zsh terminal, then do:
      vim ~/.zprofile
      
      # etc etc
      
    3. Add the following lines to the bottom of the file:

      export PATH=$HOME/.pyenv/bin:$PATH
      eval "$(pyenv init --path)"
      eval "$(pyenv init -)"
    4. Re-apply your profile.

      # if using bash, then do:
      source ~/.bash_profile
      
      # if using zsh, then do:
      source ~/.zprofile
      
      # etc etc
  4. Install PyEnv and VirtualEnv requirements with the correct versions.

    pyenv install 3.7.12
    pyenv global 3.7.12
    pip install virtualenv

    Expected Outputs:

    $ python -V
    Python 3.7.12
    
    $ virtualenv --version
    virtualenv 20.13.0 from /Users/rbv218/.pyenv/versions/3.7.12/lib/python3.7/site-packages/virtualenv/__init__.py
    

Install Requirements

To automatically install system package requirements for development and deployment:

make configure

Set the Environment & Log In to Google Cloud

To configure your local environment to use the correct cloud resources, you must set the default project and credentials for the Google Cloud SDK and define the 'ENV' environment variable:

gcloud init
gcloud auth login
gcloud auth application-default login
gcloud auth configure-docker
export ENV={ENV_TO_DEPLOY}

Show Available Resources

Makefile Help

To list all available MakeFile targets and their descriptions in the current directory:

make

or

make help

External Resources

Once you have set up the project, please consult the page External Resources for documentation on the tools & software we use to build the site.


Troubleshooting

???

⚠️ **GitHub.com Fallback** ⚠️