Home > Product Manuals > Github Integration > Github Integration

Github Integration

FastScore can use a Github repository as a storage backend for all the model assets.

All assets are stored as plain text files in a single repository with a mandated directory structure detailed below. Every change to an asset (via CLI or API) is immediately pushed to Github repository. The integration is bi-directional with external changes to the repository (via git client or Github web interface) propagated to Model Manage.

Configuration

Setup the configuration to the repository in the db section of the config.yaml as shown below:

db:
  type: git
  url: https://github.com/org/repo.git
  branch: master
  username: secret://git_user
  password: secret://git_pass

Docker Secrets for Credentials

It is best practice to obscure passwords using Docker Secrets. These secrets are defined by adding the following section to end of the docker-compose.yml file:

secrets:
  git_user:
    external: true
  git_pass:
    external: true

In addition, the secret must be injected by running the ‘docker secret create’ command. This can be automated or handled within UCP.

For example:

echo joe | docker secret create git_user -
echo password | docker secret create git_pass -

Note: Only HTTPS URLs to respositories are currently supported.

Repository directories structure

All FastScore assets must be stored in the directory structure shown below:

attachments
models
schemas
sensors
streams

The integration between the system follows these rules:

Example:

models\
  model1.py
  mymodel.R
attachments\
  model1\
    att1.zip
    mylib1.tgz
streams\
  input1.json
  out.json

Here, attachments in attachments/model1 directory belong to model model1.py.

Github webhooks

To make FastScore aware of external changes to the repository you will need to set up a Github webhook. To set up a webhook on GitHub, head over to the Settings page of your repository, and click on Webhooks & Services. After that, click on Add Webhook. Paste the publicly accessible URL of your FastScore proxy instance into Payload URL:

https://<FASTSCORE_PROXY>/api/1/service/model-manage-1/1/git