Skip to content

Dev Environment Setup

Jacob Fredericksen edited this page Mar 1, 2021 · 75 revisions

Prereqs

MacOS prereqs

Click to expand

Windows prereqs

Click to expand

  1. Windows Subsystem for Linux with WSL 2 and Ubuntu 20.04.
    • Follow the installation instructions carefully!
  2. Docker Desktop
  3. WSL integration to allow executing Docker commands within your Linux subsystem
  4. Recommended: Windows Terminal, with the default shell set to Ubuntu-20.04.
    • To make Ubuntu-20.04 the default shell for Windows Terminal, click Settings, as shown below:
      Then, in the settings.json file, replace the "defaultProfile" value with the guid of Windows.Terminal.Wsl, as shown below:
    • Alternatively, to open a shell in your Linux subsystem without making WSL the default shell, just click the caret and select Ubuntu 20.04, as shown below:

Universal prereqs

Visual Studio Code IDE

  1. Install Visual Studio Code.
  2. MacOS users: To add code to PATH, follow the directions at https://code.visualstudio.com/docs/setup/mac#_launching-from-the-command-line.

Storage space

ModularHistory takes up ~7 GB without media files. Including media files (downloaded during setup), it takes up ~14 GB.

For Windows users, WSL takes up another ~2 GB.


Setup steps

Follow these steps to set up your dev environment:

  1. Open a bash shell.

    • On MacOS, use your preferred terminal application (e.g., iTerm2 or the standard Terminal application).
    • On Windows, open the Ubuntu 20.04 LTS app. (This requires WSL.)
  2. Enter the project directory and pull the latest main:

    cd ~/modularhistory
    git checkout main
    git pull
    

    Or, if you haven't yet cloned the project repo, use the command below to clone the modularhistory repo into your home directory and enter the project directory.

    cd ~ && git clone https://github.com/ModularHistory/modularhistory.git && cd ~/modularhistory
    
  3. Run ModularHistory's setup script (using a bash subshell). Warning: This could take a while to complete. For the most part, you can leave it running without paying attention to it; however, it may prompt for your password a couple times in order to install packages that require root access.

    bash setup.sh
    

    If you encounter any errors in running the setup script, see Troubleshooting for guidance.

  4. Watch the container logs to make sure things are healthy.

    docker-compose logs -f
    
  5. Open the project in Visual Studio Code.

    code .
    
  6. Install the Visual Studio Code plugins that are recommended for the project workspace.

  7. Setup complete! Read the Development Guidelines before starting development.

Troubleshooting

docker.errors.DockerException: Error while fetching server API version: 502 Server Error ...

Update and/or restart Docker, then run the setup script again.

Other Docker-related issues on Windows/WSL

Confirm that you've taken care of the Windows prereqs.

Here are some things you might want to try (in order):

  • To verify that you are using WSL version 2, run the following in Powershell:
    wsl --list --verbose
    
  • Restart your computer. This is the magical solution to so many weird, unexpected issues encountered on Windows.
  • If simply restarting your computer does not work,
    1. Uninstall Docker Desktop
    2. Restart your computer
    3. Reinstall Docker Desktop (with WSL 2 integration)
    4. Restart your computer again

Other issues

If the setup script fails (and doesn't provide instructions on how to proceed), please report the issue.