To ensure the frontend application functions properly, it's necessary to have a backend instance up and running. Follow these steps to run the backend application:
# run backend server on a known address, set it appopriately in src/config.ts and also in Backend KNOWN_HOSTS
# first run backend in different pane
poetry run python manage.py runserver
After ensuring that the backend is properly configured and running, proceed with the installation steps for frontend outlined in [INSTALLATION.md](INSTALLATION.md).
To run the frontend, you have two options, each with its own set of requirements. The first method utilizes [yarn](#running-with-yarn) and is mostly used for development setup, while the second employs [Docker](INSTALLATION.md).
## Running with yarn
To run the frontend application using yarn, ensure you have the following prerequisites:
*[Node 20 LTS](https://nodejs.org/en)
*[Yarn](https://yarnpkg.com/)
Further make sure that the backend server is running. Make sure to set its address in `src/config.ts` and also in the backend's `KNOWN_HOSTS`.
Once you have these installed and everything configured, follow these steps:
# then after running backend, run frontend dev
First run the following command to install project dependencies:
```
yarn
```
Then run the frontend development server:
```
yarn dev
# if on windows, make sure that Git is installed and run on GitBash
```
If you're on Windows, ensure that Git is installed and run the command in GitBash:
```
GIT_ENABLED=1 yarn dev
```
# if building
If you want to build the app for deployment, then follow these steps.
# this step is mandatory, it compiles `graphql` and `shared` library
Compile the graphql and shared library:
```
yarn prebuild
# this builds the `dist/` artifact from `frontend` repo.
```
Then build the `dist/` artifact from the frontend repository:
```
yarn build
```
@@ -56,28 +77,6 @@ This tool needs to be executed every time when it's expected that there are chan
3. If headers change (signifying new behaviour), please revalidate if application works and fix it
4. Done, don't forget to mark your MR with [x] that the MR is tested with new backend
## Docker deployment
Repository has a prepared Dockerfile which can be compiled accordingly.
```
docker build . -t inject-fe
```
To deploy the docker container, you only need to execute:
```
docker run -p 80:80 inject-fe
```
During runtime of the container it's required to bind the container to a given `backend` instance. This can be done accordingly
```
docker run -p 80:80 -e VITE_HTTP_HOST=secure-be.inject.muni.cz -e VITE_HTTP_WS=wss://secure-be.inject.muni.cz/ttxbackend/v1/graphql inject-fe
```
Please mind, that changing environment variables requires restart of the container if done during the runtime.
## How to test the Monorepo
Run `yarn test`, the tests should take no more than a minute now.