This repository was archived by the owner on Dec 9, 2022. It is now read-only.
File tree 18 files changed +665
-113
lines changed
18 files changed +665
-113
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ RUN pip install \
68
68
tensorflow==1.12.0 \
69
69
seldon-core==0.2.6
70
70
71
+
71
72
COPY requirements.txt .
72
73
RUN pip install -r requirements.txt
73
74
COPY flask_app flask_app/
Original file line number Diff line number Diff line change @@ -5,6 +5,21 @@ with mlbot.net.
5
5
6
6
This is currently running on a GKE cluster.
7
7
8
+ See [ machine-learning-apps/Issue-Label-Bot #57 ] ( https://github.com/machine-learning-apps/Issue-Label-Bot/issues/57 ) for a log of how
9
+ the service was deployed.
10
+
11
+ To build a new image
12
+
13
+ ```
14
+ skaffold build
15
+ ```
16
+
17
+ Then to update the image
18
+
19
+ ```
20
+ cd overlays/dev|prod
21
+ kustomize edit set image gcr.io/github-probots/label-bot-frontend=gcr.io/github-probots/label-bot-frontend:${TAG}@${SHA}
22
+ ```
8
23
9
24
## github-probots
10
25
@@ -40,12 +55,18 @@ Deploying it
40
55
41
56
There is a staging cluster for testing running in
42
57
43
- * ** GCP project** : issue-label-bot-dev
44
- * ** cluster** : github-mlapp-test
45
- * ** namespace** : mlapp
58
+ * ** GCP project** : github-probots
59
+ * ** cluster** : kf-ci-ml
60
+ * ** namespace** : label-bot-dev
46
61
47
62
Deploying it
48
63
64
+ 1 . Create the secrets
65
+
66
+
67
+
68
+ TODO(jlewi): instructions below are outdated
69
+
49
70
1 . Create the deployment
50
71
51
72
```
Original file line number Diff line number Diff line change
1
+ apiVersion : apps/v1
2
+ kind : Deployment
3
+ metadata :
4
+ name : ml-github-app
5
+ labels :
6
+ app : ml-github-app
7
+ spec :
8
+ replicas : 9
9
+ selector :
10
+ matchLabels :
11
+ app : ml-github-app
12
+ template :
13
+ metadata :
14
+ labels :
15
+ app : ml-github-app
16
+ spec :
17
+ containers :
18
+ - name : frontend
19
+ image : gcr.io/github-probots/label-bot-frontend
20
+ command : ["python", "app.py"]
21
+ workingDir : " /flask_app"
22
+ readinessProbe :
23
+ httpGet :
24
+ path : /
25
+ port : 3000
26
+ initialDelaySeconds : 10
27
+ periodSeconds : 3
28
+ env :
29
+ - name : DATABASE_URL
30
+ valueFrom :
31
+ secretKeyRef :
32
+ name : ml-app-inference-secret
33
+ key : DATABASE_URL
34
+ - name : WEBHOOK_SECRET
35
+ valueFrom :
36
+ secretKeyRef :
37
+ name : ml-app-inference-secret
38
+ key : WEBHOOK_SECRET
39
+ # The values for the Kubeflow kf-label-bot-dev application
40
+ # See kubeflow/code-intelligence#84. This is suitable
41
+ # for development but shouldn't be used in production
42
+ - name : APP_ID
43
+ value : " 50112"
44
+ # Pato the GitHub app PEM key
45
+ - name : GITHUB_APP_PEM_KEY
46
+ value : /var/secrets/github/kf-label-bot-dev.private-key.pem
47
+ # The GCP project and pubsub topic to publish to.
48
+ # Default to the test/dev topic
49
+ - name : GCP_PROJECT_ID
50
+ value : issue-label-bot-dev
51
+ - name : GCP_PUBSUB_TOPIC_NAME
52
+ value : TEST_event_queue
53
+ - name : GOOGLE_APPLICATION_CREDENTIALS
54
+ value : /var/secrets/google/user-gcp-sa.json
55
+ - name : FLASK_ENV
56
+ value : production
57
+ - name : PORT
58
+ value : ' 3000'
59
+ - name : APP_URL
60
+ value : https://mlbot.net/
61
+ - name : authors
62
+ value : ' c'
63
+ ports :
64
+ - containerPort : 443
65
+ - containerPort : 80
66
+ - containerPort : 3000
67
+ volumeMounts :
68
+ - name : user-gcp-sa
69
+ mountPath : /var/secrets/google
70
+ - name : github-app
71
+ mountPath : /var/secrets/github
72
+ volumes :
73
+ - name : user-gcp-sa
74
+ secret :
75
+ secretName : user-gcp-sa
76
+ - name : github-app
77
+ secret :
78
+ secretName : github-app
Original file line number Diff line number Diff line change
1
+ apiVersion : extensions/v1beta1
2
+ kind : Ingress
3
+ metadata :
4
+ name : frontend
5
+ annotations :
6
+ # The ip and certificate name should be overwritten for each
7
+ # overlay and set to the correct values
8
+ kubernetes.io/ingress.global-static-ip-name : fake-ip
9
+ networking.gke.io/managed-certificates : fake-certificate
10
+ spec :
11
+ backend :
12
+ serviceName : ml-github-app
13
+ servicePort : 3000
14
+ rules :
15
+ - http :
16
+ paths :
17
+ - path : /
18
+ backend :
19
+ serviceName : ml-github-app
20
+ servicePort : 3000
Original file line number Diff line number Diff line change
1
+ apiVersion : kustomize.config.k8s.io/v1beta1
2
+ kind : Kustomization
3
+ namePrefix : label-bot-
4
+ commonLabels :
5
+ app : label-bot
6
+ service : label-bot
7
+ images :
8
+ - name : gcr.io/github-probots/label-bot-frontend
9
+ newName : gcr.io/github-probots/label-bot-frontend
10
+ resources :
11
+ - deployment.yaml
12
+ - service.yaml
13
+ - ingress.yaml
Original file line number Diff line number Diff line change
1
+ apiVersion : v1
2
+ kind : Service
3
+ metadata :
4
+ name : ml-github-app
5
+ labels :
6
+ app : ml-github-app
7
+ spec :
8
+ ports :
9
+ - port : 3000
10
+ protocol : TCP
11
+ selector :
12
+ app : ml-github-app
13
+ type : NodePort
Original file line number Diff line number Diff line change
1
+ apiVersion : networking.gke.io/v1beta1
2
+ kind : ManagedCertificate
3
+ metadata :
4
+ name : certificate
5
+ spec :
6
+ domains :
7
+ - label-bot-dev.mlbot.net
Original file line number Diff line number Diff line change
1
+ apiVersion : apps/v1
2
+ kind : Deployment
3
+ metadata :
4
+ name : ml-github-app
5
+ spec :
6
+ replicas : 1
7
+ template :
8
+ spec :
9
+ containers :
10
+ - name : frontend
11
+ env :
12
+ - name : DATABASE_URL
13
+ valueFrom :
14
+ secretKeyRef :
15
+ name : ml-app-inference-secret
16
+ key : DATABASE_URL
17
+ - name : WEBHOOK_SECRET
18
+ valueFrom :
19
+ secretKeyRef :
20
+ name : ml-app-inference-secret
21
+ key : WEBHOOK_SECRET
22
+ # The values for the Kubeflow kf-label-bot-dev application
23
+ # See kubeflow/code-intelligence#84. This is suitable
24
+ # for development but shouldn't be used in production
25
+ - name : APP_ID
26
+ value : " 50112"
27
+ # Path the GitHub app PEM key
28
+ - name : GITHUB_APP_PEM_KEY
29
+ value : /var/secrets/github/kf-label-bot-dev.private-key.pem
30
+ # The GCP project and pubsub topic to publish to should
31
+ # correspond to the production backend
32
+ - name : GCP_PROJECT_ID
33
+ value : issue-label-bot-dev
34
+ - name : GCP_PUBSUB_TOPIC_NAME
35
+ value : TEST_event_queue
36
+ - name : GOOGLE_APPLICATION_CREDENTIALS
37
+ value : /var/secrets/google/user-gcp-sa.json
38
+ - name : FLASK_ENV
39
+ value : production
40
+
Original file line number Diff line number Diff line change
1
+ apiVersion : extensions/v1beta1
2
+ kind : Ingress
3
+ metadata :
4
+ name : frontend
5
+ annotations :
6
+ kubernetes.io/ingress.global-static-ip-name : label-bot-dev
7
+ networking.gke.io/managed-certificates : certificate
Original file line number Diff line number Diff line change
1
+ apiVersion : kustomize.config.k8s.io/v1beta1
2
+ kind : Kustomization
3
+ bases :
4
+ - ../../base
5
+ commonLabels :
6
+ environment : dev
7
+ namespace : label-bot-dev
8
+ resources :
9
+ - certificate.yaml
10
+ patchesStrategicMerge :
11
+ - deployment.yaml
12
+ - ingress.yaml
Original file line number Diff line number Diff line change
1
+ apiVersion : apps/v1
2
+ kind : Deployment
3
+ metadata :
4
+ name : ml-github-app
5
+ spec :
6
+ replicas : 9
7
+ spec :
8
+ containers :
9
+ - name : frontend
10
+ env :
11
+ - name : DATABASE_URL
12
+ valueFrom :
13
+ secretKeyRef :
14
+ name : ml-app-inference-secret
15
+ key : DATABASE_URL
16
+ - name : WEBHOOK_SECRET
17
+ valueFrom :
18
+ secretKeyRef :
19
+ name : ml-app-inference-secret
20
+ key : WEBHOOK_SECRET
21
+ # The values for the Kubeflow issue-label-bot application
22
+ # that is available in the GitHub marketplace
23
+ - name : APP_ID
24
+ value : " 27079"
25
+ # Pato the GitHub app PEM key
26
+ - name : GITHUB_APP_PEM_KEY
27
+ value : /var/secrets/github/kf-label-bot-dev.private-key.pem
28
+ # The GCP project and pubsub topic to publish to should
29
+ # correspond to the production backend
30
+ - name : GCP_PROJECT_ID
31
+ value : issue-label-bot-dev
32
+ - name : GCP_PUBSUB_TOPIC_NAME
33
+ value : event_queue
34
+ - name : GOOGLE_APPLICATION_CREDENTIALS
35
+ value : /var/secrets/google/user-gcp-sa.json
36
+ - name : FLASK_ENV
37
+ value : production
38
+
Original file line number Diff line number Diff line change
1
+ # Developer guide
2
+
3
+ 1 . You can deploy the front end using skaffold
4
+
5
+ ```
6
+ skaffold dev --cleanup=False
7
+ ```
8
+
9
+ * Your Kubernetes context should be set to using the ` github-probots-dev ` namespace
10
+ * This will continually rebuild and upate your code
11
+ * Skaffold's file sync feature is used to update the code in the image without rebuilding and
12
+ redeploying
13
+ * This makes redeploying very easy.
14
+
15
+ 1 . To send a GitHub webhook event you can either open up an issue or you can use ` scripts/send_request.py `
16
+
17
+ * The latter is useful because it avoids needing to open up a new GitHub issue
18
+
19
+ * Right now the bot is only designed to respond to issues opened events.
You can’t perform that action at this time.
0 commit comments