Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
pbolduc committed May 17, 2023
1 parent 55b7af1 commit add1159
Show file tree
Hide file tree
Showing 10 changed files with 85 additions and 45 deletions.
7 changes: 7 additions & 0 deletions .docker/postgres-initdb/01-create-masstransit-db.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CREATE ROLE masstransit WITH
NOSUPERUSER
NOCREATEDB
NOINHERIT
LOGIN
PASSWORD 'password';
CREATE DATABASE masstransit WITH OWNER = masstransit;
2 changes: 2 additions & 0 deletions .gitops/charts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,6 @@ Add route

## RabbitMQ

`helm upgrade rabbitmq-dev .\rabbitmq-11.10.0.tgz --values .\rabbitmq-values.yaml`

## Redis
29 changes: 15 additions & 14 deletions .gitops/charts/form-recognizer-dev-values.yaml
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
api:
replicaCount: 2
resources:
limits:
cpu: 20m
memory: 100Mi
cpu: 500m
memory: 256Mi
requests:
cpu: 10m
memory: 75Mi
cpu: 100m
memory: 128Mi

layout:
resources:
limits:
cpu: 4
memory: 4000Mi
memory: 3Gi
requests:
cpu: 2
memory: 3000Mi
cpu: 100m
memory: 2Gi

proxy:
resources:
limits:
cpu: 20m
memory: 128Mi
cpu: 100m
memory: 256Mi
requests:
cpu: 10m
cpu: 50m
memory: 64Mi

supervised:
resources:
limits:
cpu: 20m
memory: 128Mi
cpu: 200m
memory: 256Mi
requests:
cpu: 10m
memory: 75Mi
cpu: 100m
memory: 128Mi
27 changes: 14 additions & 13 deletions .gitops/charts/form-recognizer-test-values.yaml
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
api:
replicaCount: 2
resources:
limits:
cpu: 20m
memory: 100Mi
cpu: 500m
memory: 256Mi
requests:
cpu: 10m
memory: 75Mi
cpu: 100m
memory: 128Mi

layout:
resources:
limits:
cpu: 8
memory: 8Gi
memory: 6Gi
requests:
cpu: 4
cpu: 500m
memory: 4Gi

proxy:
resources:
limits:
cpu: 20m
memory: 128Mi
cpu: 100m
memory: 256Mi
requests:
cpu: 10m
cpu: 50m
memory: 64Mi

supervised:
resources:
limits:
cpu: 20m
memory: 128Mi
cpu: 200m
memory: 256Mi
requests:
cpu: 10m
memory: 75Mi
cpu: 100m
memory: 128Mi
25 changes: 22 additions & 3 deletions .gitops/charts/form-recognizer/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apps/v1
metadata:
name: {{ include "form-recognizer.fullname" . }}-api
spec:
replicas: 1
replicas: {{ .Values.api.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/instance: {{ include "form-recognizer.fullname" . }}-api
Expand Down Expand Up @@ -63,6 +63,15 @@ spec:
ports:
- containerPort: 5000
protocol: TCP
readinessProbe:
httpGet:
path: /ready
port: 5000
initialDelaySeconds: 15
periodSeconds: 15
timeoutSeconds: 10
successThreshold: 1
failureThreshold: 10
volumeMounts:
- name: shared
mountPath: /shared
Expand All @@ -79,7 +88,7 @@ apiVersion: apps/v1
metadata:
name: {{ include "form-recognizer.fullname" . }}-layout
spec:
replicas: 1
replicas: {{ .Values.layout.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/instance: {{ include "form-recognizer.fullname" . }}-layout
Expand Down Expand Up @@ -161,7 +170,7 @@ apiVersion: apps/v1
metadata:
name: {{ include "form-recognizer.fullname" . }}-proxy
spec:
replicas: 1
replicas: {{ .Values.proxy.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/instance: {{ include "form-recognizer.fullname" . }}-proxy
Expand Down Expand Up @@ -191,6 +200,16 @@ spec:
ports:
- containerPort: 8080
protocol: TCP
# /ready will be proxied to the api
readinessProbe:
httpGet:
path: /ready
port: 8080
initialDelaySeconds: 15
periodSeconds: 15
timeoutSeconds: 10
successThreshold: 1
failureThreshold: 10
image: "{{ .Values.proxy.image.repository }}:{{ .Values.proxy.image.tag }}"
volumeMounts:
- name: configuration
Expand Down
4 changes: 2 additions & 2 deletions .gitops/charts/rabbitmq-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ resources:
livenessProbe:
enabled: true
initialDelaySeconds: 120
timeoutSeconds: 20
timeoutSeconds: 60
periodSeconds: 30
failureThreshold: 6
successThreshold: 1
Expand All @@ -687,7 +687,7 @@ livenessProbe:
readinessProbe:
enabled: true
initialDelaySeconds: 10
timeoutSeconds: 20
timeoutSeconds: 60
periodSeconds: 30
failureThreshold: 3
successThreshold: 1
Expand Down
2 changes: 1 addition & 1 deletion .gitops/charts/traffic-court-test-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ citizen-api:
"FormRecognizer__ApiVersion": "2.1"
"FormRecognizer__ModelId": "75f5614c-eded-4413-a3d9-c67281e8402e"
"Swagger__Enabled": "true"
"TicketSearch__SearchType": "Mock"
"TicketSearch__SearchType": "RoadSafety"
"MassTransit__Transport": "RabbitMq"
"COMS__BASEURL": "http://common-object-management-service:3000"
"JWT__AUTHORITY": "https://idtest.gov.bc.ca/login"
Expand Down
18 changes: 6 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,18 +246,6 @@ Develop the `citizen-portal`. Run the associated API, `citizen-api`. This start
docker-compose -f docker-compose.yml up -d citizen-api
```

Run `citizen-api` and have the backend logs go to [local Seq](http://localhost:8001),

```
docker-compose -f docker-compose.yml -f ./.docker/docker-compose.seq.yml up -d citizen-api
```

To stop when running Seq,

```
docker-compose -f docker-compose.yml -f ./.docker/docker-compose.seq.yml down
```

Run `citizen-api` and have the backend logs go to [local Splunk](http://localhost:8000)

Note, this is currently getting an error: "Error response from daemon: network ... not found"
Expand Down Expand Up @@ -365,6 +353,12 @@ docker-compose -f docker-compose.yml -f .docker/docker-compose-ocr.yml up -d
Use 2.1 as the FORMRECOGNIZER__APIVERSION to target Form Recognizer running locally in Docker (or in OpenShift).
Use 2022-06-30-preview to target Form Recognizer running in Azure cloud (which runs the latest api version, not 2.1).

The API key and Billing URL are found in the Azure Portal. Either Key 1 or Key 2 can be used for the API key.

![ Form Recognizer](docs/form-recognizer-api-key-and-billing-url.png)

See [Form Recognizer Containers (2.1)](https://learn.microsoft.com/en-us/azure/applied-ai-services/form-recognizer/containers/form-recognizer-container-install-run?view=form-recog-2.1.0&preserve-view=true&tabs=read) and [Form Recognizer Containers (3.0)](https://learn.microsoft.com/en-us/azure/applied-ai-services/form-recognizer/containers/form-recognizer-container-install-run?view=form-recog-3.0.0&tabs=read) for information.

## Debugging

A Developer can debug the application by attaching debugging instances to the processes running inside the docker containers.
Expand Down
Binary file added docs/form-recognizer-api-key-and-billing-url.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions tools/performance-testing/ocr/k6/run.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

import http from 'k6/http';

const ticketFile = open('./data/6aca50aa-f898-4de2-b540-2be6eb12b7d7.png', 'b');


export default function () {

const data = {
file: http.file(ticketFile, 'ticket.png', 'image/png'),
modelId: '75f5614c-eded-4413-a3d9-c67281e8402e'
};

const res = http.post('http://localhost:5257/api/ocr', data);

}

0 comments on commit add1159

Please sign in to comment.