Skip to content

Commit 9ca814d

Browse files
Merge pull request #38 from opendatagroup/gitsecrets
updated the github integration with secrets
2 parents 0df7491 + cd1ea33 commit 9ca814d

File tree

1 file changed

+44
-21
lines changed
  • Product Manuals/Github Integration

1 file changed

+44
-21
lines changed
Lines changed: 44 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,55 @@
11
## Github Integration
22

3-
FastScore can use Github repo as a storage backend.
4-
In this case all assets are stored as plain files in single repo with a mandated directory structure.
5-
Every change to asset (via CLI or API) immediately pushed to Github repo.
6-
And vice versa - external changes to repo (via git client or Github web interface) are propagated to Model Manage.
3+
FastScore can use a Github repository as a storage backend for all the model assets.
4+
5+
All assets are stored as plain text files in a single repository with a mandated directory structure detailed below.
6+
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.
77

88
### Configuration
99

10-
To use repo as a storage your `db` section in `config.yaml` should look like this:
10+
Setup the configuration to the repository in the `db` section of the `config.yaml` as shown below:
1111
```yaml
1212
db:
1313
type: git
1414
url: https://github.com/org/repo.git
1515
branch: master
16-
username: joe
17-
password: secret
16+
username: secret://git_user
17+
password: secret://git_pass
1818
```
1919
20-
* `type: git` tells FastScore to use Github as storage backend.
21-
* `url` should point to your existing Github repo.
20+
* `type: git` tells FastScore to use Github as the storage backend.
21+
* `url` points to the existing Github repository.
2222
* `branch` tells which git branch to use.
23-
* `username` is the name of your Github user with read/write access to repo.
24-
* `password` Github user password in a plain text.
23+
* `username` is the Docker Secret storing the user name of a Github user with read/write access to repository.
24+
* `password` is the Docker Secret storing the user password.
25+
26+
27+
### Docker Secrets for Credentials
28+
29+
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:
30+
31+
```
32+
secrets:
33+
git_user:
34+
external: true
35+
git_pass:
36+
external: true
37+
```
38+
39+
In addition, the secret must be injected by running the ['docker secret create'](https://docs.docker.com/engine/reference/commandline/secret_create/) command. This can be automated or handled within UCP.
40+
41+
For example:
42+
43+
```
44+
echo joe | docker secret create git_user -
45+
echo password | docker secret create git_pass -
46+
```
2547

26-
Only HTTPS URLs to repos are supported for now. With Vault integration SSH URLs will be supported and plaintext passwords in config will be gone.
48+
Note: Only HTTPS URLs to respositories are currently supported.
2749

28-
### Repo directories structure
50+
### Repository directories structure
2951

30-
All kinds of FastScore assets are stored in the following directories:
52+
All FastScore assets must be stored in the directory structure shown below:
3153
```
3254
attachments
3355
models
@@ -36,10 +58,11 @@ sensors
3658
streams
3759
```
3860

39-
* Each asset stored as a separate file.
40-
* File name is an asset name and file extension is an asset type.
41-
* No assets of same kind could share the same name.
42-
* Attachments are grouped into subdirs named after model they are belong.
61+
The integration between the system follows these rules:
62+
* Each asset must be stored as a separate file.
63+
* File name is the asset name and file extension is an asset type.
64+
* No assets of same kind can share the same name.
65+
* Attachments are grouped into subdirectories named after model they belong to.
4366

4467
Example:
4568
```
@@ -55,11 +78,11 @@ streams\
5578
out.json
5679
```
5780

58-
Here, attachments in `attachments/model1` dir are belong to model `model1.py`.
81+
Here, attachments in `attachments/model1` directory belong to model `model1.py`.
5982

6083
### Github webhooks
61-
To make FastScore aware of external changes to repo you can use Github webhooks.
62-
To set up a webhook on GitHub, head over to the **Settings** page of your repo, and click on **Webhooks & services**. After that, click on **Add webhook**. Paste publicly accessible URL of your FastScore proxy instance into Payload URL:
84+
To make FastScore aware of external changes to the repository you will need to set up a Github webhook.
85+
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:
6386
```
6487
https://<FASTSCORE_PROXY>/api/1/service/model-manage-1/1/git
6588
```

0 commit comments

Comments
 (0)