Skip to content
This repository was archived by the owner on Jun 1, 2024. It is now read-only.

Onboarding for Developers

zoeyvf edited this page May 18, 2023 · 47 revisions

Install Required Programs

Note: It is beneficial to follow the back-end installation steps even if you only plan on working on the front-end as the front-end won't work without the back-end.

  1. macOS users
    1. Probably want to install Homebrew (it's good for everything) (After the completion of the installation on the terminal, it'll ask you to run 3 commands. If there's no output after running them, you're probably fine.)
      1. To verify that Homebrew is installed, you can run $ brew -v to see version information.
      2. IF YOU HAVE AN M1 MAC and your computer inherited Homebrew from a non-M1 device, you'll probably need to uninstall and reinstall it.
      3. Use /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)" in terminal to uninstall.
      4. Then reinstall with /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    2. Make sure Xcode is installed from the app store.
    3. You might need to download the Xcode command line tools from developer.apple.com/ xcode-select --install
  2. VS Code
  3. python 3.8 (not 3.9 or 3.10)
    • as we are using an older version of python, it's useful to have a version manager such as asdf or pyenv
    1. Install asdf.
  4. node 16.8+ (but < 17), preferably via installed via nvm (Node Package Manager) or
    • (on windows, which maybe happens automatically) chocolatey:
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
    exec $SHELL
    nvm install 16
    nvm use 16
    
    • on macOS
      1. $ brew install nvm
      2. Add nvm to your ~/.zshrc using the instructions that brew gives you after the install.
    export NVM_DIR="$HOME/.nvm"
    [ -s "$(brew --prefix)/opt/nvm/nvm.sh" ] && \. "$(brew --prefix)/opt/nvm/nvm.sh" # This loads nvm
    [ -s "$(brew --prefix)/opt/nvm/etc/bash_completion.d/nvm" ] && \. "$(brew --prefix)/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
    
    1. $ nvm install 16.x where x >= 8
  5. Postgres
    1. keep note of the username and password you create in the installation process (or when you launch it for the first time)
    2. macOS: $ brew install postgresql and $ brew install --cask pgadmin4 if you want
  6. git
    1. macOS: brew install git
  7. GitHub Desktop
  8. Fork project repositories
    1. https://github.com/JMU-CIME/CPR-Music-Backend
    2. https://github.com/JMU-CIME/CPR-Music
  9. clone the forks onto your local machine
    • usually Documents/GitHub or something (I usually consider putting them "side-by-side" in the filesystem)

Set Up the Backend

Setting Up Postgres

  1. Download pgAdmin4 from the Homebrew website
    • Once downloaded, open the app and create a master password of your choice (AND BE SURE TO NOT FORGET IT!)
    • Click on create a server and fill out the required red text
  2. Create file called .env in project root (/CPR-MUSIC-BACKEND/.env) with this line:
    • DATABASE_URL=postgres://user:pass@localhost/teleband
    • user and pass are the username and password of the postgres user you created
  3. Create Postgres Database in the pgAdmin program server with your created user

Setting up the venv (Virtual Environment)

  1. open a terminal (git bash, Terminal, command prompt, powershell)
    • For windows: press windows + R this should bring up the Run Dialog and type cmd and press ctrl + shift + enter to open the command prompt
  2. Navigate to the backend repo (clone)
    1. cd <place where you cloned it>
    2. get the accompaniments files from a teammate and put them in <place where you cloned backend>/teleband/media/accompaniments
    3. dir or ls to show the contents to make sure
    4. cd .. back up so you are in the directory containing the CPR-Music-Backend directory
    5. create a venv with python3 -m venv venv-musiccpr
    6. cd down into the cloned repo again cd CPR-Music-Backend
  3. activate venv
    • Windows - ..\venv-musiccpr\Scripts\activate.bat
    • macOS - ../venv-musiccpr/bin/activate
      • if this doesn't work and you have pyenv, perhaps try creating a venv that way

Set up the server

With the activated venv in your CPR-Music-Backend directory, do the following:

  1. install requirements pip3 install -r requirements/local.txt (this may take a while)
    1. might need to run pip3 install --upgrade pip before
  2. python3 manage.py migrate
  3. python3 manage.py createsuperuser
    1. remember what you put here! Put it in a password manager or something.
    2. doesn't have to be a real email. (but it has to validate the form)
  4. python3 manage.py runserver
  5. Fingers crossed everything worked!
  6. You need to login to http://127.0.0.1:8000/admin/ not http://127.0.0.1:8000/
    • Use the username and password you made with your superuser

Set up the front end

  1. cd into the /CPR-Music/
  2. npm i (this will install the dependencies listed in package.json (and any of their dependencies, and so on)
  3. Create a file in the root of the frontend repository called .env.local (there should already be .env.production and .env.development). In this file, have contents like:
    SECRET=anythingyouwantexceptImNotSureWhatSymbolsAreOKInHere
    NEXTAUTH_URL="http://localhost:3000"
    
  4. npm run dev
  5. Go to http://localhost:3000
  6. Everything (hopefully) should be peachy!

You can ignore the rest of this I think

Fix for too new node version on windows

choco install nodejs.install --version 16.13.0 --allow-downgrade from slack

Action Items

  1. Form opinion about usefulness of WSL

v0 login for testing (back over in https://tele.band)

  1. student: 860f629b
  2. teacher:
Clone this wiki locally