Cartblanche22 Build Instructions

From DISI
Jump to navigation Jump to search

Local environment

  • Clone repo
 Git clone https://gitlab.docking.org/chinzo/molecule-shopping-cart
 Cd molecule-shopping-cart
  • Create conda environment with python 3.7, install dependencies
 conda env create -f environment.yml
 conda activate cartblanche
  • Open ssh tunnel to machines, sshuttle is a good tool to avoid having to open the tunnel to each tin machine individually. This does not work for vendor lookup at the moment since antimony machines have the alias stored and not the actual IP
 sudo sshuttle --auto-hosts --dns -v -vvvv -r jcastanon@gimel.ucsf.bkslab.org:22 -x gimel.ucsf.bkslab.org:22 0/0
  • Start application
 ./boot-test.sh

Deployment Information

Live site runs on n-9-22:5067. Pushing to master branch will deploy here. Dev server runs on n-1-17:5068. Pushing to the dev branch will deploy to this server.

Useful Commands (Use these in the respective server to debug):

 docker restart molecule-shopping-cart (restart the docker container)
 docker logs molecule-shopping-cart (view app logs, only stdout)
 docker exec -it molecule-shopping-cart /bin/bash (open a shell inside of the docker container, useful for making quick minimal changes without having to redeploy)

To view error logs (stderr)

 docker exec -it molecule-shopping-cart /bin/bash
 cat std.log

Some troubleshooting tips: Cartblanche relies on other outside services (smallworld, arthur, databases) so it’s good to check the status of those before looking into the code.

For smallworld, check the status of api calls, or run a sample query.

For arthor, check the status of api class, or run a sample query.


For search errors (zincid, smiles, vendor), the docker app logs are usually very informative.

Deployment Process

Deployment is as simple as pushing changes to the respective branch. A docker image will be created with the new version of the code, which will then replace the current version. To redeploy manually, go to https://gitlab.docking.org/chinzo/molecule-shopping-cart/-/pipelines/new

Setting up Auto-Deployment

  • Follow the instructions on setting up a new gitlab runner, found here.
  • Register the runner with the credentials provided in the link above.
  • Set ‘shell’ as the executor for the runner when prompted.
  • After configuration, the gitlab-runner config found in /etc/gitlab-runner/config.toml should look something like this:
 oncurrent = 1
 check_interval = 0
 [session_server]
   session_timeout = 1800
 runners
   name = "cartblanche n-1-17"
   url = "http://gitlab.docking.org/"
   token = "Lvp2X3zRFAN_JQuVZK3y"
   privileged = true
   executor = "shell"
   builds_dir = "/home/cartblanche"
   [runners.custom_build_dir]
   [runners.docker]
     privileged = true
     disable_cache = false
     cache_dir = "cache"
    [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]
    [runners.cache.azure]

Return to https://gitlab.docking.org/admin/runners, where the new runner will be displayed. Edit the runner’s tags to describe what the runner will be deploying. For example, the test server has the tag ‘cartblanche-dev’ and the production server has ‘cartblanche22’. Once the tag is set, a new job will need to be added to the gitlab deployment script to deploy the correct branch to the correct machine. https://gitlab.docking.org/chinzo/molecule-shopping-cart/-/blob/master/.gitlab-ci.yml

A sample job will look like so:

 services:
   - redis:latest
 deploy-dev job:
     only:
         - dev
     stage: deploy
     services:
         - redis:latest
     tags:
         - cartblanche-dev
     script:
         - docker build -t "${CI_PROJECT_NAME}:${CI_COMMIT_REF_NAME}-0.1.${CI_JOB_ID}" .
         - docker stop ${CI_PROJECT_NAME}
         - docker rm ${CI_PROJECT_NAME}
         - docker stop redis
         - docker rm redis
         - docker run --net cartblanche --name redis -d redis
         - docker run --net cartblanche -v /nfs/db2/smallworld_anon_21Q4:/nfs/db3/private_smallworld_4th_gen/anon
                    -v /export/db4/smallworld-java:/export/db4/smallworld-java
                    -v /nfs/db3/private_smallworld_4th_gen/smallworld.cfg:/nfs/db3/private_smallworld_4th_gen/smallworld.cfg
                    -v /nfs/db3/private_smallworld_4th_gen/maps:/nfs/db3/private_smallworld_4th_gen/maps
                    --name ${CI_PROJECT_NAME} -d -p 0.0.0.0:5068:5000 ${CI_PROJECT_NAME}:${CI_COMMIT_REF_NAME}-0.1.${CI_JOB_ID}
  • The name ‘deploy-dev’ refers to the job name.
  • 'only: -dev' refers to the script only deploying the dev branch. More branches can be added to deploy pushes to different branches to the same machine.
  • 'tags: -cartblanche-dev' refers to the job tags, which determines which machine will take care of that deployment job. This can be changed to the tag that was set up earlier. You can also add multiple tags to deploy the same branch (or branches) to multiple machines at the same time.
  • 0.0.0.0:5068 refers to the port that points to the application.