Skip to content
Snippets Groups Projects
Commit adfba2f2 authored by Ramesh Kumar's avatar Ramesh Kumar
Browse files

TMSS-2175: Documentation Updated

parent 717589fc
No related branches found
No related tags found
1 merge request!1035Resolve TMSS-2175
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
The TMSS frontend web application was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
To run and work on this application the TMSS-backend must have been started locally or in a docker container with rabbitmq or running rabbitmq separately.
## Running TMSS Backend with dependant services in docker
In the local development environment, the docker image of any branch can be downloaded and started with dependent services like rabbitmq to test the TMSS application as a whole.
1. First identify the docker image to be downloaded from the gitlab CI/CD pipelines.
![Alt text](./images/gitlab_pipeline_docker_id.png?raw=true "Title")
2. Create a **docker-compose-tmss.yml** file in a folder. For example **./TMSS-backend-docker**
3. Copy the code to the **docker-compose-tmss.yml**.
```
# This docker-compose is used to run TMSS together with rabbitmq
version: "3"
services:
rabbitmq:
image: rabbitmq:latest
hostname: rabbitmq
ports:
- 5672:5672
- 15672:15672
tmss-backend:
image: git.astron.nl:5000/ro/lofar/tmss_django:69bfeb28
restart: unless-stopped
stdin_open: true # docker run -i
tty: true # docker run -t
environment:
- RABBITMQ_DEFAULT_USER=guest
- RABBITMQ_DEFAULT_PASS=guest
- RABBITMQ_DEFAULT_PORT=5672
- LOFAR_DEFAULT_BROKER=rabbitmq
- LOFARENV=TEST
#network_mode: "host"
ports:
- "8008:8008"
- "5678:5678"
- "5444:5444"
command: bash -c 'source /opt/lofar/lofarinit.sh && ALLOWED_HOSTS=* tmss_test_environment -p 8008 -ldmMsSwV --simulate' #includes legacy
```
4. Replace the identified docker image id in the above code.
```
tmss-backend:
image: git.astron.nl:5000/ro/lofar/tmss_django:8bbef603
```
5. Open the windows powershell or terminal and go to the folder **./TMSS-backend-docker**
```
cd ./TMSS-backend-docker
```
6. Use `docker-compose` command to start the backend and rabbitmq using the **docker-compose-tmss.yml**
```
docker-compose -f ./docker-compose-tmss.yml up
```
7. In few seconds, the docker image will be downloaded and the required services will be started in the docker container.
8. The TMSS backend API can be accessed with url http://localhost:8008/api/ and swagger can be accessed with url http://localhost:8008/api/swagger/
NOTE: This docker container also runs the TMSS Frontend application (http://localhost:8008/).
## Running TMSS Backend in docker and rabbitmq locally.
It is assumed that you run some debian/ubuntu derived distro:First of all, make sure your machine runs a rabbitmq server. (This is needed for more lofar development, so it's a good thing to setup now)
```
sudo apt-get install rabbitmq-server
```
Then pull the latest tmss docker image from gitlab:
```
docker pull git.astron.nl:5000/ro/lofar/tmss_django:8bbef603
```
Start the image:
```
docker run --rm -it --net=host git.astron.nl:5000/ro/lofar/tmss_django:112eb497
```
In the image, source the lofarenvironment:
```
source /opt/lofar/lofarinit.sh
```
And finally, in the image, start tmss. We have a development "program"/script that gives you an entire TMSS server with a fresh test database and all side-services all running in one.
For your task at hand, this set of options would give you a nice enviroment:
```
tmss_test_environment -p 8008 -dMSVw
```
Wait until started, and then visit: http://localhost:8008/api/
## TMSS Frontend Application
Once the TMSS API is accessible with one of the above mentioned methods, it is good to clone the `lofar` project and start the TMSS frontend application.
Before cloning the project, install the required node version. The application is developed, tested and deployed with version 14.20.0. Though it supports all version ^14.20.0, it is not tested yet.
Now clone the lofar project to your local directory.
```
git clone https://git.astron.nl/ro/lofar.git lofar
```
Then goto ./lofar/SAS/TMSS/frontend/tmss_webapp
```
cd ./lofar/SAS/TMSS/frontend/tmss_webapp
```
Run npm install command to download and install all required modules/packages into node_modules folder.
```
npm install
```
When all the dependencies are installed, it is ready to run the application.
## Available Scripts
In the project directory, you can run:
### `yarn start`
### `npm start`
Runs the app in the development mode.<br />
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
The page will reload if you make edits.<br />
You will also see any lint errors in the console.
### `npm run prepareTemplateSchemasDev`
Prepares and creates the template schema json files from the latest backend source schemas to run the unit tests locally in development environment with test data. The schema json files are created in build/schemas folder and public/schemas folder. These files are not tracked in the git repository.
### `npm run prepareTemplateSchemas`
Prepares and creates the template schema json files from the latest backend source schemas to run the unit tests in CI/CD pipelines with test data. The schema json files are created in build/schemas folder and public/schemas folder. These files are not tracked in the git repository.
### `npm run cleanTemplateSchemas`
Deletes all schema json files created in build/schemas folder and public.schemas folder.
### `yarn test`
### `npm test`
Launches the test runner in the interactive watch mode.<br />
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
### `yarn build`
### `npm build`
Builds the app for production to the `build` folder.<br />
It correctly bundles React in production mode and optimizes the build for the best performance.
......@@ -27,7 +136,7 @@ Your app is ready to be deployed!
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
### `yarn eject`
### `npm eject`
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
......@@ -37,6 +146,16 @@ Instead, it will copy all the configuration files and the transitive dependencie
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
## Available test users credentials
There are four test users available in the backend API which can be used to test the application for different role permission.
Username | Password | Role
-------- | -------- | -----
test | test | super user
scientist| scientist| telescope scientist
operator | operator | telescope operator
shared_support_user | shared_support_user | shared support user
## Learn More
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
......@@ -63,6 +182,6 @@ This section has moved here: https://facebook.github.io/create-react-app/docs/ad
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
### `yarn build` fails to minify
### `npm build` fails to minify
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
SAS/TMSS/frontend/tmss_webapp/images/gitlab_pipeline_docker_id.png

96 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment