Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update startup/developer docs #145

Merged
merged 3 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions app/.env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SSO_URL=https://dev.loginproxy.gov.bc.ca/auth/realms/standard
SSO_CLIENT_ID=sso-requests
SSO_CLIENT_SECRET=sso-requests-secret
SSO_CLIENT_ID=<<sso-requests>>
SSO_CLIENT_SECRET=<<sso-requests-secret>>
SSO_REDIRECT_URI=http://localhost:3000
SSO_LOGOUT_REDIRECT_URI=http://localhost:3000
SSO_AUTHORIZATION_RESPONSE_TYPE=code
Expand All @@ -19,8 +19,8 @@ JWT_SECRET=verysecuresecret
JWT_TOKEN_EXPIRY=1h
PGHOST=localhost
PGPORT=5432
PGUSER=
PGPASSWORD=
PGUSER=<postgres_username>
PGPASSWORD=<postgres_password>
PGDATABASE=realm_registry
PGSSL=false
APP_ENV=development
Expand All @@ -39,7 +39,7 @@ TF_GH_REPO=
TF_MODULE_GH_REF=
GH_ACCESS_TOKEN=
GH_API_TOKEN=
DATABASE_URL=
DATABASE_URL=postgresql://<postgres_username>:<postgres_password>@localhost:5432/realm_registry
IDIR_REQUESTOR_USER_GUID=
MS_GRAPH_API_AUTHORITY=
MS_GRAPH_API_CLIENT_ID=
Expand Down
19 changes: 18 additions & 1 deletion app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,24 @@ This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next

## Getting Started

First, run the development server:
In the app folder run:

Run `make local-setup`

Create the `.env` file from the `.env.example` file in the app folder.

The values can be found in the project's non-prod vault file. The local database creds are username "postgres", password is the local password for your database.

The CHES config can be changed. If you need to connect to the production CHES the config can be copied from the AWS dev environment variables for the sso-request lambda function.

Update the '<postgres_username>' value with a local postgres username in the `app/db/setup.sh` file. In the folder `app/db/` run:

```
pg_ctl start
./setup.sh
```

Then run the development server:

```bash
npm run dev
Expand Down
6 changes: 4 additions & 2 deletions app/db/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ else
db="realm_registry"
fi

echo "SELECT 'CREATE DATABASE $db' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = '$db')\gexec" | psql -d postgres
postgres_username=<<postgres_username>>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, the only thing with this is this file isn't gitignored, so setting it in the file will potentially lead to us pushing over eachothers. IDK though this script is only for local so don't want to burn too much time on it. Maybe just explicitly setting to postgres is okay, or passing it in as a script arg


psql -d $db -f "../../helm/webapp/migration.sql" -qtA --set ON_ERROR_STOP=1
echo "SELECT 'CREATE DATABASE $db' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = '$db')\gexec" | psql -U $postgres_username -d postgres

psql -U $postgres_username -d $db -f "../../helm/webapp/migration.sql" -qtA --set ON_ERROR_STOP=1
2 changes: 1 addition & 1 deletion docs/local-development-guid.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Run through the steps in [developer guide](./developer-guide.md)

## How to run the project locally

**TO DO**
The local development commands can be found in the [app README](../app/README.md)

## Building and deploying test images.

Expand Down
Loading