Local Development - bcgov/BCAT GitHub Wiki

Initial Setup

  • api/.env
KC_AUTH_URL= https://dev.loginproxy.gov.bc.ca/auth
KC_AUTH_REALM=standard
KC_AUTH_CLIENT_ID=bcat-standard-4952
INFRASTRUCTURE_FORM=<Grab the id from url>
INFRASTRUCTURE_API_KEY=<Grab the key from secret>
NETWORK_FORM=<Grab the id from url>
NETWORK_API_KEY=<Grab the key from secret>

CleanShot 2024-11-27 at 17 10 48@2x

  • client/.env
NEXT_PUBLIC_REDIRECT_URI= http://localhost:3000
NEXT_PUBLIC_KC_AUTH_URL= https://dev.loginproxy.gov.bc.ca/auth
NEXT_PUBLIC_KC_AUTH_REALM=standard
NEXT_PUBLIC_KC_AUTH_CLIENT_ID=bcat-standard-4952
NEXT_PUBLIC_SERVER_URL= http://localhost:8080/api/v1
NEXT_PUBLIC_INFRASTRUCTURE_PROJECT=<Grab the id from url>
NEXT_PUBLIC_NETWORK_PROJECT=<Grab the id from url>

Run

  • start: make run-local

DB Migration

  • There is no migration files as I believe when project started, it was urgent, so they used sql files to directly interact with db. So you need to follow the following steps to create db and tables locally.
  • I have fetched the latest db schema from openshift. This file is called dump.dump

(Because Github not support .dump extension here, so please right click the following link and save as dump.dump as file name with ext.)

dump

  • And now run this command to create db with this dump.dump file. (you have to install pg_restore command on mac) pg_restore -h localhost -U db2inst1 --no-owner --role=db2inst1 -v -e -c -C -d template1 dump.dump

  • Run these sql to insert some default values


INSERT INTO app_bcat."BCAT_STATUS"  ("STATUS_ID", "NAME") VALUES (1, 'RECEIVED');
INSERT INTO app_bcat."BCAT_STATUS"  ("STATUS_ID", "NAME") VALUES (2, 'ASSIGNED');
INSERT INTO app_bcat."BCAT_STATUS"  ("STATUS_ID", "NAME") VALUES (3, 'APPROVED');
INSERT INTO app_bcat."BCAT_STATUS"  ("STATUS_ID", "NAME") VALUES (4, 'DENIED');
INSERT INTO app_bcat."BCAT_STATUS"  ("STATUS_ID", "NAME") VALUES (5, 'WORKSHOP');


--
-- BCAT_COMPLETION_STATUS
--
INSERT INTO app_bcat."BCAT_COMPLETION_STATUS"  ("COMPLETION_STATUS_ID", "NAME") VALUES (1, 'IN_PROGRESS');
INSERT INTO app_bcat."BCAT_COMPLETION_STATUS"  ("COMPLETION_STATUS_ID", "NAME") VALUES (2, 'COMPLETE');

--
-- BCAT_APPLICATION_TYPE
--
INSERT INTO app_bcat."BCAT_APPLICATION_TYPE"  ("APPLICATION_TYPE_ID", "NAME") VALUES (1, 'INFRASTRUCTURE');
INSERT INTO app_bcat."BCAT_APPLICATION_TYPE"  ("APPLICATION_TYPE_ID", "NAME") VALUES (2, 'NETWORK');

Final

  • Once you login with your IDIR, it will create a user in table BCAT_USER, then you update the values as the following screenshot, then you should be able to see the page. CleanShot 2024-11-27 at 17 20 57@2x