github.com/Bio-core/jtree@v0.0.0-20190705165106-1d7a7e7d6272/Jtree_Documentation.md (about)

     1  # JTree Project Documentation
     2  
     3  Find the source code on [GitHub](https://github.com/Bio-core/Jtree)
     4  See the README on github for a overview of the endpoints available
     5  
     6  ## Building and Running the Code
     7  In the base directory of the project folder
     8  ```sh
     9  $ make database 
    10  #This will tear down any existing database structure and create the new datbase structure
    11  #Note that the database username and password may have to be changed in the stript for your system
    12  $ make build
    13  #This will build the go code and put it in the ./bin/ folder
    14  $ ./bin/jtree 
    15  #This is what runs the code
    16  ```
    17  ### Arguments for Running the Code
    18  -g=X -> This will generate X number of patient records </br>
    19  -s -> This will run the code with keycloak security on </br>
    20  
    21  ## Testing
    22  All of the test cases can be run locally or will also run on travis every commit.  The travis build status can be found on the github readme document.
    23  To run the test locally you need to build the test database strucure and then run the tests package.
    24  ```sh
    25  $ bash ./tests/sql/DatabaseRebuild.sh
    26  $ make test
    27  ```
    28  
    29  ## Server Dependencies
    30  The results db can be accessed on node 38 of mordor
    31  The Jtree source code can be found within the _go_ directory
    32  The front end code can be found within the _flask_ directory
    33  
    34  **Dependencies**
    35  - Go
    36  - Go Libraries
    37  - MySQL
    38  - Database Schema Copy
    39  
    40  # Docker
    41  For golang code, may need to change the connection string with the update ip for the docker continer
    42  ```bash
    43  $ docker inspect <container name> | grep IPAddr
    44  ```
    45  Then git commit and puch to master (because it does a goget) and run the docker commands below
    46  ```bash
    47  $ docker network create -d bridge mysql-network
    48  $ docker run --name mysqldb -p 3306:3306 -e MYSQL_ROOT_PASSWORD=waterloo -d --network=mysql-network mysql/mysql-server
    49  $ docker exec -i mysqldb mysql -u root -pwaterloo -e "CREATE DATABASE JTree"
    50  $ docker exec -i mysqldb mysql -u root -pwaterloo JTree < ./sql/jtree_backup.sql
    51  $ docker exec -i mysqldb mysql -u root -pwaterloo -e "grant SELECT on JTree.* to 'select'@'%' identified by 'passwords';flush privileges;grant SELECT,INSERT, UPDATE on JTree.* to 'update'@'%' identified by 'passwordu';flush privileges;"
    52  $ docker build -t docker/jtree .
    53  $ docker run --network=mysql-network --name jtree -p 8000:8000 -d docker/jtree
    54  ```
    55  
    56  
    57  ## Appendix
    58  ### Notes
    59   - The name of the database is JTree
    60   - The name of the test database is TestJTree