Skip to content

Latest commit

 

History

History
88 lines (57 loc) · 2.12 KB

README.md

File metadata and controls

88 lines (57 loc) · 2.12 KB

Stackable Feature Tracker

for Stackable.

Development

Hosted dev version available here

Run with Docker Compose

Starts Postgres, applies the Prisma migrations and runs the app built from the Dockerfile:

docker compose up --build

Open http://localhost:3000 and sign in with the PASSWORD from .env (default changeme). The database starts empty. Reset it with docker compose down -v.

To use npm run dev against the Compose database instead, start only Postgres and the migrations (docker compose up postgres migrate) and set DATABASE_URL=postgres://postgres:postgres@localhost:5432/feature_tracker in .env.

Manual setup

Install dependencies

npm i

Export the Postgres password (needed for the container and psql below)

export PGPASSWORD=...

Create .env file from .env.example

cp .env.example .env

Edit the .env file with the Postgres connection string and the app password. The connection string should look like postgres://postgres:<password>@localhost:5432 where <password> should match the PGPASSWORD env var from above.

Start Postgres in a container

# create a volume to persist data between restarts
docker volume create feature-tracker

# start Postgres
docker run --rm --name postgres -e PGDATA=/var/lib/postgresql/data/pgdata -e POSTGRES_PASSWORD=${PGPASSWORD} -d -p 5432:5432 -v feature-tracker:/var/lib/postgresql/data postgres:alpine

Create and populate the database

npx prisma migrate dev --name init
psql -h localhost -U postgres -f sample/data.sql

Run the app

npm run dev -- --open

Committing

Feature-tracker uses husky & lint-staged to format files and lint staged changes before each commit.

Migrating the DB

Create baseline migration

Only needed once

git switch main
mkdir -p prisma/migrations/0_init
npx prisma migrate diff --from-empty --to-schema-datamodel prisma/schema.prisma --script
npx prisma migrate resolve --applied 0_init

Migrate the life cycle DB schema

git switch feat/lifecycle
npx prisma migrate dev --name lifecycle