The development computer needs to have the following installed:
- Git
- NodeJS v20
- Yarn v1
It is also highly recommended that you use Visual Studio Code for development. It is what the project was coded in and is setup to work with the ESLint rules.
Once you have the above installed, you can clone the repository and run the following commands to get the project up and running:
git clone https://github.police.nsw.gov.au/APS/career-pathway-tool ./nswpf-cpcd nswpf-cpyarn
To run a local development version of the application, create a new file called .env in the project directory. In this file, add the line DEVELOPMENT_MODE=true. This will set the application to load the data files from the static versions on the website, instead of the Azure File Storage.
After that is done, enter the following command in a terminal in the project directory yarn dev. This will start the development server, which can be accessed in a browser through the following http://localhost:3000/.
The application is built as a static site using Nuxt.js and is served through Express.
The following environment variables are required to be present to be embedded into this build. If you're building manually, a .env file that contains the required environment variables for the environment (non-prod or prod) that you are building for is required and will be read by the build process.
AI_CONNECTION_STRING
Make sure to remove or comment out the DEVELOPMENT_MODE environment variable in the .env file before building.
The following command builds the application, which will be available in the dist directory.
$ yarn build-genTo prepare the application for deployment, you need to follow these steps:
- Copy the
distdirectory to thedeployerdirectory - In the
deployerdirectory, runyarn - Zip the contents of the
deployerdirectory
The resulting zip file will be used to deploy the application into Azure.
When deployed the application will be served by running index.js.
The server that runs the application has a built in rate limiter. This is to prevent the application from being overwhelmed by requests.
This rate limiter is configured using the following environment variables:
RATE_LIMIT_WINDOW_MSRATE_LIMIT_MAX
These environment variables are accessed by the server at runtime.
The content for the application is handled through a connection to the Azure file storage. The application will use the following environment variables to connect to the file storage:
SMB_SHARE_NAMEFILE_SERVICE_SAS_URL
These environment variables wil be injected into the application at build time through environment variables.
When running the application locally, without environment variables, the application will use static data. This is ok to use for development but should not be used in production.
Analytics are tracked using Azure Application Insights. The application uses the following environment variables to connect to the application insights:
AI_CONNECTION_STRING
These environment variables wil be injected into the application at build time through environment variables.
When running the application locally, without environment variables, the application will log any calls to the analytics API to the console. This is ok to use for development but should not be used in production.