uwblueprint / sistering

Sistering's volunteer scheduling and management web application.
https://volunteer.sistering.org
8 stars 0 forks source link

Sistering

A volunteer management web application built for Sistering.

Made with starter-code-v2, brought to you by the UW Blueprint Internal Tools team!

Table of Contents

Getting Started

Prerequisites

Set up

  1. Clone this repository and cd into the project folder
    git clone https://github.com/uwblueprint/sistering.git
    cd sistering
  2. Pull secrets from Vault
    vault kv get -format=json kv/sistering | python update_secret_files.py
  3. Set a post-merge Git hook to automatically pull from Vault after every pull on origin's main branch
    ./setup.sh "kv/sistering" "main"
  4. Run the application
    docker-compose up --build

Useful Commands

Get Names and Statuses of Running Containers

docker ps

Accessing PostgreSQL Database

# run a psql shell in the DB container (postgres is the default user)
docker exec -it <container-name> /bin/bash -c "psql -U postgres -d sistering"

# in postgres shell, some common commands:
# display all table names
\dt
# display user-defined types, including enums
\dT+
# quit
\q
# you can run any SQL query, don't forget the semicolon!
SELECT * FROM <table-name>;

Linting and Formatting

# linting & formatting warnings only
docker exec -it <container-name> /bin/bash -c "yarn lint"

# linting with fix & formatting
docker exec -it <container-name> /bin/bash -c "yarn fix"

Running Tests

docker exec -it <container-name> /bin/bash -c "yarn test"

Migration

To create a new migration, change the schema.prisma file as required and run npx prisma migrate dev --name <DESCRIPTIVE_NAME> --create-only

NOTE: You should be running this in the backend docker container cli, not locally. This is because the DB secrets will only be injected in that container

Version Control Guide

Branching

# currently working on feature branch, there are new commits on main
git pull origin main --rebase

# if there are conflicts, resolve them and then:
git add .
git rebase --continue

# force push to remote feature branch
git push -f

Commits

# last commit contained a typo, fixed now
git add .
git commit -m "Fix typo"

# fixup into previous commit through interactive rebase
# x in HEAD~x refers to the last x commits you want to view
git rebase -i HEAD~2
# text editor opens, follow instructions in there to fixup

# force push to remote feature branch
git push -f

1: From Git's own guidelines