UI Applications for MCS.
If this is your first time setting up the repository go to the section: UI Setup
docker build --tag node-graphql node-graphql/.
docker build --tag node-graphql-staging node-graphql/. --build-arg PORT_ARG=9111
NOTE: IF you are on a MAC with a M1 CHIP you need to build the graphql end points with these commands:
docker build --tag node-graphql node-graphql/. --build-arg BUILD_ENV=ARM
docker build --tag node-graphql-staging node-graphql/. --build-arg PORT_ARG=9111 --build-arg BUILD_ENV=ARM
docker build --tag analysis-ui analysis-ui/.
docker build --tag analysis-ui-staging analysis-ui/. --build-arg PORT_ARG=2000
cd docker_setup
docker-compose -f docker-compose-dev.yml up -d
This setup will enable auto updating and refreshing whenever an analysis-ui component is changed and saved with having to run docker-compose after every saved change.
- Copy
config.js
from analysis-ui/public/configs/dev - Paste
config.js
in analysis-ui/src/services - Run
npm install
in analysis-ui/ (may need to run with--force
)
- Run
docker-compose -f docker-compose-dev.yml up -d
inside docker_setup/ - Run
docker stop analysis-ui
- Inside the analysis-ui/ directory run
npm start
(Note: if this step fails, you may need to runexport NODE_OPTIONS=--openssl-legacy-provider
, then retry)
- Download
data_con_backup_all.tar.gz
from mcs-ui EC2 instance. These instructions assume the tar is in themcs-ui/node-graphql/
directory. You might need the UI PEM file; get it from the AWS Secrets Manager dashboard. - Get a copy of
account-configs.js
from a teammate and put it in themcs-ui/node-graphql
directory.
docker build --tag node-graphql node-graphql/.
docker build --tag node-graphql-staging node-graphql/. --build-arg PORT_ARG=9111
docker build --tag analysis-ui analysis-ui/.
docker build --tag analysis-ui-staging analysis-ui/. --build-arg PORT_ARG=2000
cd docker_setup
docker-compose -f docker-compose-dev.yml up -d
data_con_backup_all.tar.gz
contains the base collections needed for the app to function,
as well as scene + result collections.
cd to the node-graphql
directory.
cd ../node-graphql/
docker cp data_con_backup_all.tar.gz mcs-mongo:data_con_backup_all.tar.gz
docker exec -it mcs-mongo bash
gunzip -c data_con_backup_all.tar.gz | tar xopf -
# Unzip and import necessary collections
gunzip -c data_con_backup_except_eval.tar.gz | tar xopf -
mongorestore -u mongomcs --authenticationDatabase mcs -p mongomcspassword -d mcs ./data_con_except_eval/mcs
# Then download whichever collections you'd like to have locally
gunzip -c data_con_backup_scenes_<eval_num>.tar.gz | tar xopf -
gunzip -c data_con_backup_results_<eval_num>.tar.gz | tar xopf -
mongorestore -u mongomcs --authenticationDatabase mcs -p mongomcspassword -d mcs ./data_con_scenes_<eval_num>/mcs
mongorestore -u mongomcs --authenticationDatabase mcs -p mongomcspassword -d mcs ./data_con_results_<eval_num>/mcs
exit
the mongo bash in your UI terminal and cd to the root mcs-ui
directory to rebuild.
exit
cd ../docker_setup/
docker-compose -f docker-compose-dev.yml up -d
Navigate to http://localhost:3000/login in a web browser. You should see the login page. Login or create an account. Then you should see charts within a 30 seconds. If you see charts you are done. If it takes over minute then make sure step 6 worked. You can now implement the optional running from docker with npm start
With the docker containers running, navigate to http://localhost:9100/graphql
You should see a graphql test UI.
In the left hand side, enter:
query {
getHistorySceneFieldAggregation(fieldName:"eval")
}
The following indicates an empty database:
{
"data": {
"getHistorySceneFieldAggregation": []
}
}
- Make sure the docker containers running
- Run the following, replacing and with mongo username and password):
docker exec -it mcs-mongo bash
# Note: if running Mongo 6+, legacy shell is no longer included -- you
# will need to reference `/usr/bin/mongosh` instead of `mongo` at the
# beginning
mongo -u <user> --authenticationDatabase mcs -p <password>
use mcs
# Replace <eval_num> with whatever collection(s) you've loaded
db.eval_<eval_num>_results.find().count()
db.eval_<eval_num>_scenes.find().count()
Verify the result of the last two commands are 0. If they are not, the database is not loaded.
docker-compose stop
Note: Using docker-compose down will cause the mongo database to be cleared
Be sure to update any values wrapped in < > below
db.eval_<eval_num>_scenes.count()
db.eval_<eval_num>_results.count()
db.eval_<eval_num>_scenes.findOne()
db.eval_<eval_num>_results.find()
First, start your Mongo database and UI. Second, put your debug scene files in one folder and their corresponding scene history files in another folder. Next, verify the following:
- Your debug scene files must have an
"evaluation"
property (in the"debug"
dictionary) of"Evaluation X Scenes"
(replaceX
with the eval number). Depending on how they were generated, the"evaluation"
property may benull
. You can usesed
to edit all of the files in place, like this:sed -i 's/"evaluation": null/"evaluation": "Evaluation X Scenes"/' <scenes_folder>/*
- Your scene history files must have an
"evaluation_name"
property of"eval_X"
(replaceX
with the eval number) and a"team"
of any non-empty, non-null string. You can usesed
to edit all of the files in place (see above for a similar example).
Then, from the mcs-ingest repository, activate your python virtual environment and run the following scripts:
python local_scene_ingest.py --folder <scene_folder>
python local_history_ingest.py --folder <history_folder>
You may also need to run update_collection_keys_if_missing.py
afterward:
cd <mcs-ingest>
cp scripts/update_collection_keys_if_missing.py .
python update_collection_keys_if_missing.py eval_6_scenes "Evaluation 6 Scenes"
python update_collection_keys_if_missing.py eval_6_results "Evaluation 6 Results"
- Install the Mongo CLI with (on Linux)
sudo apt-get install mongodb
- Start the Mongo Shell with
mongo
- Run
use_mcs
, thendb.auth(username, password)
(with the correct Mongo MCS username and password -- refer to yourmcs-ui/node-graphql/account-configs.js
file) - To see your collections:
show collections
- To delete a collection (like "eval_x_scenes"):
db.eval_x_scenes.drop()
This material is based upon work supported by the Defense Advanced Research Projects Agency (DARPA) and Naval Information Warfare Center, Pacific (NIWC Pacific) under Contract No. N6600119C4030. Any opinions, findings and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the DARPA or NIWC Pacific.