Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

environment types #179

Merged
merged 1 commit into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@ Build the Machine repo:
```
dotnet build machine
```
Make sure that the environment variable ASPNETCORE_ENVIRONMENT is set to "Development" by running `export ASPNETCORE_ENVIRONMENT=Development` or adding it to your `.bashrc`.
Now, if you are using a local docker image and have a GPU with at least 12 GB of RAM:
* Clone the [Machine repo](https://github.com/sillsdev/machine.py) into an adjacent folder to Serval:
* Build the docker image with `docker build . -t mpy.local`
* Register your machine as a ClearML agent (see dev team for details)
* In docker-compose.yml, update `ClearML__Queue` to be the queue that your computer (agent) is listening to
If you will use the standard Machine.py images:
* In docker-compose.yml, update `ClearML__Queue` and `ClearML__DockerImage` to the appropriate values

In the Serval root, run docker compose up
```
cd serval && docker compose up
Expand Down Expand Up @@ -70,6 +77,15 @@ There are 3 different environments that Serval is deployed to:
- `kubectl config use-context aws-rke`
- `helm upgrade serval deploy/serval -n serval -f deploy/values.yaml`

### Environments:
- Production:
- Full deployment, full NMT and SMT builds
- Staging:
- Full Deploymnet, dummy NMT building (10 steps, small model)
- Also used for Docker-compose local staging
- Development:
- Non-docker use only

## Debugging
### To access Serval API
* Internal QA:
Expand Down
2 changes: 1 addition & 1 deletion deploy/qa-ext-values.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
externalHost: qa.serval-api.org
environment: Staging
enableTls: true
namespace: serval
auth0Domain: dev-sillsdev.auth0.com
Expand All @@ -7,7 +8,6 @@ lokiUrl: http://loki-distributed-gateway.loki.svc.cluster.local
servalImage: ghcr.io/sillsdev/serval:0.7.1
machineImage: ghcr.io/sillsdev/machine:3.3.2
ClearMLDockerImage: ghcr.io/sillsdev/machine.py:0.9.5
ClearMLMaxSteps: 10
ClearMLQueue: lambert_24gb
SharedFileLocation: s3://aqua-ml-data/ext-qa/
enableEcho: true
2 changes: 1 addition & 1 deletion deploy/qa-int-values.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
externalHost: qa-int.serval-api.org
environment: Staging
enableTls: true
namespace: nlp
auth0Domain: sil-appbuilder.auth0.com
Expand All @@ -7,7 +8,6 @@ lokiUrl: http://loki-distributed-gateway.loki.svc.cluster.local
servalImage: ghcr.io/sillsdev/serval:0.7.1
machineImage: ghcr.io/sillsdev/machine:3.3.2
ClearMLDockerImage: ghcr.io/sillsdev/machine.py:0.9.5
ClearMLMaxSteps: 10
ClearMLQueue: lambert_24gb
SharedFileLocation: s3://aqua-ml-data/int-qa/
enableEcho: true
6 changes: 2 additions & 4 deletions deploy/serval/templates/echo-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,14 @@ spec:
- /app/echo_server/EchoTranslationEngine.dll
workingDir: /app/echo_server
env:
- name: ASPNETCORE_ENVIRONMENT
value: {{ .Values.environment}}
- name: ASPNETCORE_Kestrel__Endpoints__Grpc__Url
value: http://*:80
- name: ASPNETCORE_Kestrel__Endpoints__Grpc__Protocols
value: Http2
- name: ASPNETCORE_ConnectionStrings__TranslationPlatformApi
value: http://serval-api:81
- name: ASPNETCORE_Logging__LogLevel__Default
value: Information
- name: ASPNETCORE_Logging__LogLevel__Microsoft.AspNetCore
value: Warning
image: {{ .Values.servalImage}}
imagePullPolicy: "Always"
name: echo
Expand Down
10 changes: 2 additions & 8 deletions deploy/serval/templates/machine-engine-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ spec:
- /app/engine_server/SIL.Machine.Serval.EngineServer.dll
workingDir: /app/engine_server
env:
- name: ASPNETCORE_ENVIRONMENT
value: {{ .Values.environment }}
- name: ASPNETCORE_Kestrel__Endpoints__Grpc__Url
value: http://*:80
- name: ASPNETCORE_Kestrel__Endpoints__Grpc__Protocols
Expand All @@ -33,14 +35,6 @@ spec:
value: mongodb://mongo:27017/machine?replicaSet=myRS
- name: ASPNETCORE_ConnectionStrings__Serval
value: http://serval-api:81
- name: ASPNETCORE_Logging__LogLevel__Default
value: Information
- name: ASPNETCORE_Logging__LogLevel__Microsoft.AspNetCore
value: Warning
- name: ASPNETCORE_TranslationEngines__0
value: SmtTransfer
- name: ASPNETCORE_TranslationEngines__1
value: Nmt
{{- template "secrets.clearml" . }}
{{- template "secrets.s3" . }}
image: {{ .Values.machineImage}}
Expand Down
10 changes: 2 additions & 8 deletions deploy/serval/templates/machine-job-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ spec:
- /app/job_server/SIL.Machine.Serval.JobServer.dll
workingDir: /app/job_server
env:
- name: ASPNETCORE_ENVIRONMENT
value: {{ .Values.environment}}
- name: ASPNETCORE_Kestrel__Endpoints__Grpc__Url
value: http://*:80
- name: ASPNETCORE_Kestrel__Endpoints__Grpc__Protocols
Expand All @@ -33,14 +35,6 @@ spec:
value: mongodb://mongo:27017/machine?replicaSet=myRS
- name: ASPNETCORE_ConnectionStrings__Serval
value: http://serval-api:81
- name: ASPNETCORE_Logging__LogLevel__Default
value: Information
- name: ASPNETCORE_Logging__LogLevel__Microsoft.AspNetCore
value: Warning
- name: ASPNETCORE_TranslationEngines__0
value: SmtTransfer
- name: ASPNETCORE_TranslationEngines__1
value: Nmt
{{- template "secrets.clearml" . }}
{{- template "secrets.s3" . }}
image: {{ .Values.machineImage}}
Expand Down
14 changes: 7 additions & 7 deletions deploy/serval/templates/secrets.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{{- define "secrets.clearml" }}
- name: ClearMLNmtEngine__ApiServer
- name: ClearML__ApiServer
value: https://api.sil.hosted.allegro.ai
- name: ClearMLNmtEngine__Queue
- name: ClearML__Queue
value: {{ .Values.ClearMLQueue}}
- name: ClearMLNmtEngine__DockerImage
- name: ClearML__DockerImage
value: {{ .Values.ClearMLDockerImage}}
- name: ClearMLNmtEngine__MaxSteps
value: "{{ .Values.ClearMLMaxSteps}}"
- name: ClearMLNmtEngine__AccessKey
- name: ClearML__Project
value: {{ .Values.externalHost}}
- name: ClearML__AccessKey
valueFrom:
secretKeyRef:
name: aqua-ml-data
key: ClearML_AccessKey
- name: ClearMLNmtEngine__SecretKey
- name: ClearML__SecretKey
valueFrom:
secretKeyRef:
name: aqua-ml-data
Expand Down
6 changes: 2 additions & 4 deletions deploy/serval/templates/serval-api-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ spec:
env:
- name: Auth__Domain
value: {{ .Values.auth0Domain}}
- name: ASPNETCORE_ENVIRONMENT
value: {{ .Values.environment}}
- name: ASPNETCORE_Kestrel__Endpoints__Http__Url
value: http://*:80
- name: ASPNETCORE_Kestrel__Endpoints__Http2__Url
Expand All @@ -35,10 +37,6 @@ spec:
value: mongodb://mongo:27017/serval_jobs?replicaSet=myRS
- name: ASPNETCORE_ConnectionStrings__Mongo
value: mongodb://mongo:27017/serval?replicaSet=myRS
- name: ASPNETCORE_Logging__LogLevel__Default
value: Information
- name: ASPNETCORE_Logging__LogLevel__Microsoft.AspNetCore
value: Warning
- name: ASPNETCORE_Translation__Engines__0__Type
value: Echo
- name: ASPNETCORE_Translation__Engines__0__Address
Expand Down
2 changes: 1 addition & 1 deletion deploy/values.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
externalHost: prod.serval-api.org
environment: Production
enableTls: true
namespace: serval
auth0Domain: languagetechnology.auth0.com
Expand All @@ -7,7 +8,6 @@ lokiUrl: http://loki-distributed-gateway.loki.svc.cluster.local
servalImage: ghcr.io/sillsdev/serval:0.7.1
machineImage: ghcr.io/sillsdev/machine:3.3.2
ClearMLDockerImage: ghcr.io/sillsdev/machine.py:0.9.5
ClearMLMaxSteps: 20000
ClearMLQueue: production
SharedFileLocation: s3://aqua-ml-data/production/
enableEcho: true
26 changes: 10 additions & 16 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@ services:
context: .
dockerfile: dockerfile.development
environment:
- ASPNETCORE_ENVIRONMENT=Staging
- Auth__Domain=sil-appbuilder.auth0.com
- Auth__Audience=https://machine.sil.org
- ASPNETCORE_Kestrel__Endpoints__Http__Url=http://*:80
- ASPNETCORE_Kestrel__Endpoints__Http2__Url=http://*:81
- ASPNETCORE_Kestrel__Endpoints__Http2__Protocols=Http2
- ASPNETCORE_ConnectionStrings__Hangfire=mongodb://mongo:27017/serval_jobs?replicaSet=myRS
- ASPNETCORE_ConnectionStrings__Mongo=mongodb://mongo:27017/serval?replicaSet=myRS
- ASPNETCORE_Logging__LogLevel__Default=Information
- ASPNETCORE_Logging__LogLevel__Microsoft.AspNetCore=Warning
- ASPNETCORE_Translation__Engines__0__Type=Echo
- ASPNETCORE_Translation__Engines__0__Address=http://echo
- ASPNETCORE_Translation__Engines__1__Type=SmtTransfer
Expand Down Expand Up @@ -49,10 +48,9 @@ services:
context: .
dockerfile: dockerfile.development
environment:
- ASPNETCORE_ENVIRONMENT=Staging
- ASPNETCORE_Kestrel__Endpoints__Http__Url=http://*:80
- ASPNETCORE_Kestrel__EndpointDefaults__Protocols=Http2
- ASPNETCORE_Logging__LogLevel__Default=Information
- ASPNETCORE_Logging__LogLevel__Microsoft.AspNetCore=Warning
- ASPNETCORE_ConnectionStrings__TranslationPlatformApi=http://serval-api:81
expose:
- 80
Expand Down Expand Up @@ -81,18 +79,16 @@ services:
dockerfile: ../machine/dockerfile.development

environment:
- ASPNETCORE_ENVIRONMENT=Staging
- ASPNETCORE_Kestrel__Endpoints__Https__Url=http://*:80
- ASPNETCORE_Kestrel__EndpointDefaults__Protocols=Http2
- ASPNETCORE_ConnectionStrings__Hangfire=mongodb://mongo:27017/machine_jobs?replicaSet=myRS
- ASPNETCORE_ConnectionStrings__Mongo=mongodb://mongo:27017/machine?replicaSet=myRS
- ASPNETCORE_ConnectionStrings__Serval=http://serval-api:81
- ASPNETCORE_Logging__LogLevel__Default=Information
- ASPNETCORE_Logging__LogLevel__Microsoft.AspNetCore=Warning
- ASPNETCORE_TranslationEngines__0=SmtTransfer
- ASPNETCORE_TranslationEngines__1=Nmt
- ClearML__ApiServer=https://api.sil.hosted.allegro.ai
- ClearML__Queue=production
- ClearML__DockerImage=ghcr.io/sillsdev/machine.py:0.9.5.1
- ClearML__Queue=lambert_24gb
- ClearML__DockerImage=mpy.local
- ClearML__Project=docker-compose
- "ClearML__AccessKey=${ClearML_AccessKey:?access key needed}"
- "ClearML__SecretKey=${ClearML_SecretKey:?secret key needed}"
- SharedFile__Uri=s3://aqua-ml-data/docker-compose/
Expand Down Expand Up @@ -126,18 +122,16 @@ services:
context: ../machine
dockerfile: ../machine/dockerfile.development
environment:
- ASPNETCORE_ENVIRONMENT=Staging
- ASPNETCORE_ConnectionStrings__Hangfire=mongodb://mongo:27017/machine_jobs?replicaSet=myRS
- ASPNETCORE_ConnectionStrings__Mongo=mongodb://mongo:27017/machine?replicaSet=myRS
- ASPNETCORE_ConnectionStrings__Serval=http://serval-api:81
- ASPNETCORE_Logging__LogLevel__Default=Information
- ASPNETCORE_Logging__LogLevel__Microsoft.AspNetCore=Warning
- ASPNETCORE_Kestrel__Endpoints__Http__Url=http://*:80
- ASPNETCORE_Kestrel__EndpointDefaults__Protocols=Http2
- ASPNETCORE_TranslationEngines__0=SmtTransfer
- ASPNETCORE_TranslationEngines__1=Nmt
- ClearML__ApiServer=https://api.sil.hosted.allegro.ai
- ClearML__Queue=production
- ClearML__DockerImage=ghcr.io/sillsdev/machine.py:0.9.5.1
- ClearML__Queue=lambert_24gb
- ClearML__DockerImage=mpy.local
- ClearML__Project=docker-compose
- "ClearML__AccessKey=${ClearML_AccessKey:?access key needed}"
- "ClearML__SecretKey=${ClearML_SecretKey:?secret key needed}"
- SharedFile__Uri=s3://aqua-ml-data/docker-compose/
Expand Down
8 changes: 8 additions & 0 deletions samples/EchoTranslationEngine/appsettings.Production.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
8 changes: 8 additions & 0 deletions samples/EchoTranslationEngine/appsettings.Staging.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
8 changes: 8 additions & 0 deletions src/Serval.ApiServer/appsettings.Production.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
8 changes: 8 additions & 0 deletions src/Serval.ApiServer/appsettings.Staging.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}