...
Git: What is it and why?
Git is a version control system and GitHub is an internet hosting service using the version control that Git provides. You can find a great presentation on what Git is here.
In order to set up Git on your computer please follow these steps (after creating a GitHub account if you do not already have one). Make sure to do the authentication step so that your computer is tied to your GitHub account.
Now that you have Git installed and have a GitHub account, clone the repository from here to your computer, potentially using
git clone
in your preferred CLI (i.e. Terminal/Powershell; please use Powershell over Command Prompt on Windows) to pull the project down to your computer.After this onboarding, if you are not already, familiarize yourself with Git! There will be some resources at the end of the environment setup and Fall Learning Session #1 is all about Git!
NodeJS: Version
1416 PleaseEnsure that you have Node.js v16 installed (14 also works though, 18 doesn’t). Any iteration of version 16 will do as long as it is version 16! [Note: as of September 2022, this is the LTS version found on the main download page. For the future, if this is not an iteration of version 16, either scroll down on this page and search for it manually or download the package for your operating system from this link.]
Check the box to install any additional tools during installation to ensure functionality with VSCode while installing (don’t worry if there are a couple errors here - this tends to happen on new installs).
After installation, confirm that the version is some variant of 16 with the command
node -v
.
NPM & Yarn
Navigate to the folder of the cloned repository using your CLI (via the cd command).
In your CLI, run
npm install -g yarn
.Run
yarn install
to instruct npm to install all the necessary packages.
Database
There are now two methods to setup Docker is the new method to run the database. Please use the first one (please).Method 1: DockerIf you’re a returning developer and still have the old way, that’s ok, you can keep using it. This way is just easier to setup!
Install Docker
Download Docker Desktop for your OS and install it following the default steps (there are a few weird steps for Windows so make sure to do those).
After installation, restart your computer if required.
.env setup
Navigate to the
src/backend
directory in the repo and add a .env file here via the commandni .env
[Windows] ortouch .env
[Mac] in the CLI or create the new file manually in your File Explorer or IDE (we use VSCode - more on that later).Paste the following line into the .env file:
DATABASE_URL="postgresql://postgres:docker@localhost:5432/nerpm?schema=public"
Navigate to the root directory of the project and run the Run the following two commands in your CLI (note - if you are already running Postgres from the old manual installation, you must stop it first):
docker run --name finishline -e POSTGRES_PASSWORD=docker -p 5432:5432 -d postgres
docker exec -ti finishline psql -U postgres -c "CREATE DATABASE nerpm;"
Go to your Docker desktop app and the container you just made should appear. If it says “running”, then everything is working
!
Method 2: Manual Setup (Not Recommended - Skip to Initial Database Migration if completed above)
PostgreSQL Setup
Mac Setup: The easiest way to install PostgreSQL on a Mac is with Postgres.app.
Windows Setup: Install the newest PostgreSQL and follow all default steps. At points where it asks for any psql package installs, please include them. If a password or multiple are required, remember these passwords (they will be important later). After the installation, please restart your CLI of choice (Powershell, Command Prompt, etc).
Database Initialization
After downloading and installing PostgreSQL properly, you'll need to run PostgreSQL and create a database named nerpm. By default, PostgreSQL typically has a postgres database. You can use psql in the CLI to create a database by running this SQL statement (after running psql):CREATE DATABASE nerpm;
(make sure to include the semicolon!
). Naming the new databasenerpm
will ensure it matches with the database URL specified in the project preparation section below.Alternatively, if the psql command does not work (likely due to the PATH variable not being set), try the command
psql -U postgres
(as postgres is the default username) and mimic the above steps after that. If these both fail, you can use pgAdmin instead. Search for the "pgAdmin 4" application on your computer's search bar and open it. Here, click on "Servers" and right click on "Databases" and then navigate to "Create" and then "Database..." and then use the name nerpm (for the same reason as above).Navigate to the src/backend directory and add a .env file here via
ni .env
[Windows] ortouch .env
[Mac] in the CLI or create the new file manually in your IDE.Mac setup: Paste the following line into the .env file and replace <USERNAME> with your computer username:
DATABASE_URL="postgresql://<USERNAME>:@localhost:5432/nerpm?schema=public"
Windows setup: Paste the following line into the .env file and replace <PASSWORD> with the password you created earlier:
.env setup
DATABASE_URL="postgresql://postgres:<PASSWORD>@localhost:5432/nerpm?schema=public"
Initial Database Migration
...