Skip to content
Snippets Groups Projects
Commit 8441cc1f authored by Roman Dvořák's avatar Roman Dvořák
Browse files

change and split readme

parent f09b96a4
No related branches found
No related tags found
No related merge requests found
## How to run
To run the frontend of INJECT, you have two options, each with its own set of requirements. The first method utilizes [yarn](#running-with-yarn), while the second employs [Docker](#docker-deployment).
## 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 backend server is running and on a known address. Make sure to set the appropriate address in src/config.ts and also in Backend KNOWN_HOSTS.
Once you have these installed and everything configured, follow these steps:
First run the following command to install project dependencies:
```
yarn
```
Then run the frontend development server:
```
yarn dev
```
If you're on Windows, ensure that Git is installed and run the command on GitBash:
```
GIT_ENABLED=1 yarn dev
```
If you want to build the frontend, then follow these steps:
Compile the graphql and shared library:
```
yarn prebuild
```
Then biuld the `dist/` artifact from the frontend repository:
```
yarn build
```
## 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.
\ No newline at end of file
......@@ -12,8 +12,7 @@ Subrepos:
## How to run
Install Node 20 LTS, Yarn, Python 3.8
To ensure the frontend functions properly, it's crucial to have the backend up and running. Below are the steps to get backend operational:
```
# https://stackoverflow.com/questions/16773642/pull-git-submodules-after-cloning-project-from-github
git submodule update --init
......@@ -24,46 +23,9 @@ poetry install
poetry run python manage.py migrate
poetry run python manage.py createcachetable
cd ..
yarn
# 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
# then after running backend, run frontend dev
yarn dev
# if on windows, make sure that Git is installed and run on GitBash
GIT_ENABLED=1 yarn dev
# if building
# this step is mandatory, it compiles `graphql` and `shared` library
yarn prebuild
# this builds the `dist/` artifact from `frontend` repo.
yarn build
```
## 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.
After ensuring that the backend is properly configured and running, proceed with the installation steps for frontend outlined in [INSTALATION.md](INSTALATION.md).
## How to test the Monorepo
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment