Skip to content

Deployment how tos

Amy Glen edited this page May 10, 2023 · 38 revisions

To start our Plover instance when ITRB's Plover is down

(Note: This example is for KG2.7.4, but the steps should be analogous for future KG2 versions.)

Start the kg2cplover.rtx.ai ec2 instance and run the following:

ssh [email protected]
cd PloverDB/
sudo docker start plovercontainer2.7.4

If the above gave some sort of error, instead try this:

sudo docker stop plovercontainer2.7.4
sudo docker rm plovercontainer2.7.4
sudo docker run -d --name plovercontainer2.7.4 -p 9990:80 ploverimage2.7.4

Wait about 5 minutes for the indexes to finish loading. You can check the logs with:

sudo docker logs plovercontainer2.7.4

When it's ready the last few lines of the log should look something like this:

2022-03-02 00:25:58,807 INFO: Indexes are fully loaded! Took 5.27 minutes.
WSGI app 0 (mountpoint='') ready in 317 seconds on interpreter 0x pid: 11 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 11)
spawned uWSGI worker 1 (pid: 14, cores: 1)
spawned uWSGI worker 2 (pid: 15, cores: 1)
running "unix_signal:15 gracefully_kill_them_all" (master-start)...

While you're waiting for the above command to finish, you can point the ARAX code to this Plover instead of the ITRB Plover:

  1. Change all three Plover URLs in the "plover" slot of RTX/code/config_dbs.json to this Plover endpoint (http://kg2cplover.rtx.ai:9990)
  2. Push that change to master
  3. Roll master out to the /kg2 and /kg2beta endpoints on arax.ncats.io

At this point, once Plover has finished loading indexes, /kg2 and /kg2beta should be running normally again.

To build Plover from a new KG2 version

(Note: This example is for KG2.8.2, but the steps should be analogous for future KG2 versions.)

First create a new branch in the PloverDB repo for this KG2 version - we'll name ours kg2.8.2c for this example:

git checkout -b kg2.8.2c

Then update the default KG2 version in our new branch:

  1. In app/kg_config.json, change "kg2c_lite_2.8.0.json.gz" to "kg2c_lite_2.8.2.json.gz", or whatever exactly the new KG2c JSON file is called in the translator-lfs-artifacts repo.
  2. Commit and push this change to your branch
  3. Make any other Plover code changes that this new KG2 version necessitates in your branch (usually only needed if KG2's core schema changed)

Then start the kg2cplover.rtx.ai ec2 instance and run the following (with your branch name subbed in):

ssh [email protected]
cd PloverDB/
git fetch
git checkout kg2.8.2c
screen
bash -x run.sh ploverimage2.8.2 plovercontainer2.8.2 "sudo docker"

The build will take around 50 minutes to finish.

After it's done, verify the new Plover service is working by running the test suite against it. From your own machine (assuming you have cloned the PloverDB repo and done pip install -r requirements.txt):

cd PloverDB/
pytest -v test/test.py --endpoint http://kg2cplover.rtx.ai:9990

Note that sometimes tests need to be updated due to changes in the new KG2 version, though the majority of tests should pass. For any failing tests, ensure they're failing due to expected topological changes in the new KG2 version; if so, tweak them to get them passing again (via adjusting pinned curies, predicates, or whatever makes sense).

When we're ready for the ITRB CI Plover instance to be running this new KG2 version, merge your branch into main. This should automatically deploy to the ITRB CI Plover. Ping Kanna and/or Pouyan in Slack to update the ITRB Test and Prod Plovers.

Clone this wiki locally