Skip to content

Setup & Run Instructions

Dylan Barkowsky edited this page Jul 17, 2023 · 5 revisions

Setup

Create a .env file in the root of the project. Populate it with values for each key specified in .env.template.

Example values

KEY EXAMPLE DESCRIPTION
API_PORT 3004 The port the API will listen on.
MONGO_PORT 27017 The port used by MongoDB.
MONGO_USERNAME username The root admin name for MongoDB.
MONGO_PASSWORD password The root admin password for MongoDB.
MONGO_DATABASE my-db The database name for MongoDB.
MONGO_SERVICE mongo Prod only. The name of the Docker service for MongoDB.
ENVIRONMENT local Keycloak. Local only. Set to local when running locally.
FRONTEND_PORT 8080 Keycloak. Local only. The port of the frontend application.
FRONTEND_URL https://... Keycloak. Production only. URL of frontend application.
BACKEND_URL https://... Keycloak. Production only. URL of backend application.
SSO_CLIENT_ID my-id-1234 Keycloak. Client ID.
SSO_CLIENT_SECRET somesecret Keycloak. Client secret.
SSO_AUTH_SERVER_URL https://... Keycloak. Authorization URL.
GC_NOTIFY_API_KEY somesecret API Key for GC Notify.
GC_NOTIFY_ADMIN_EMAIL [email protected] Email address for admin mailbox.
CSS_API_TOKEN_URL https://... URL for getting CSS API Token.
CSS_API_CLIENT_ID my-id-1234 Client ID for CSS API account.
CSS_API_CLIENT_SECRET somesecret Secret for CSS API account.
CSS_API_BASE_URL https://... Base URL for CSS API. Used for API calls.
JIRA_ACCOUNT_EMAIL [email protected] The email account used to access the JIRA project.
JIRA_TOKEN sometoken Token generated by JIRA to access their API.
TESTING true Disables Keycloak for API testing.
TEST_USERNAME username Username used for testing.
TEST_PASSWORD password Password used for testing.

Running

This project assumes that you have Docker installed on your system. If not, please install it first.

Docker

To start all three local components (Frontend, API, MongoDB), run the following command:

docker-compose up -d.

To stop the entire application, run the following:

docker-compose down

Developer Instructions

  1. Clone the repository with: git clone https://github.com/bcgov/citz-imb-staff-purchasing-reimbursement.git.
  2. Create the .env file and populate its values using the instructions mentioned above in Setup.
  3. Start the MongoDB container with docker-compose up -d mongo.
  4. Navigate to /api and run npm run dev.
  5. Navigate to /app and run npm run dev.
  6. View the frontend at http://localhost:8080 or whichever port was populated in the .env.

Other Helpful Commands

/app

Command Description
npm run lint Runs ESLint, which looks for style and syntax errors.
npm run cypress:component Runs any component frontend tests.
npm run cypress:e2e Runs any end-to-end frontend tests.
npx cypress open Opens the Cypress GUI.

/api

Command Description
npm run lint Runs ESLint, which looks for style and syntax errors.
npm run test Runs integration tests using Jest. TESTING ENV must be true.
Clone this wiki locally