Serval is a REST API for natural language processing services.
This is the simplest way to develop. First, git clone the repo:
git clone https://github.com/sillsdev/serval.git
Then build Serval:
dotnet build serval
Clone the Machine repo into an adjacent folder to Serval:
git clone https://github.com/sillsdev/machine.git
Build the Machine repo:
dotnet build machine
Now, if you are using a local docker image and have a GPU with at least 12 GB of RAM:
- Clone the Machine repo 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
andClearML__DockerImage
to the appropriate values
In the Serval root, run docker compose up
cd serval && docker compose up
If using vscode, launch "DockerComb" to debug Serval and the for-testing-only Echo Engine.
Alternatively, you can develop without containerizing Serval.
Install MongoDB 6.0 as a replica set run it on localhost:27017. (You can run docker compose -f docker-compose.mongo.yml up
from the root of the serval repo to do so).
Make sure that the environment variable ASPNETCORE_ENVIRONMENT is set to "Development" by running export ASPNETCORE_ENVIRONMENT=Development
or adding it to your .bashrc
.
Open "Serval.sln" and debug the ApiServer.
There are 3 different environments that Serval is deployed to:
- Internal QA for testing out the deployment
- External QA for clients to test new updates before production
- Production
- Add the dallas-rke KubeConfig to your kubectl configs
- Run
kubectl config use-context dallas-rke
- First, startup the storage (using internal qa for example)
helm install serval-pvc deploy/serval-pvc -n nlp -f deploy/qa-int-values.yaml
- Now you can turn on Serval
helm install serval deploy/serval -n nlp -f deploy/qa-int-values.yaml
- To upgrade Serval:
- For QA internal Run:
kubectl config use-context dallas-stage
helm upgrade serval deploy/serval -n nlp -f deploy/qa-int-values.yaml
- For QA external Run:
kubectl config use-context dallas-rke
helm upgrade serval deploy/serval -n serval -f deploy/qa-ext-values.yaml
- For Production Run:
kubectl config use-context aws-rke
helm upgrade serval deploy/serval -n serval -f deploy/values.yaml
- For QA internal Run:
- 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
- Internal QA:
- Use the VPN
- In
C:\Windows\System32\drivers\etc\hosts
, enter in a line for10.3.0.119 serval-api.org
- go to
https://machine-api.org/swagger
and accept the security warning
- External QA:
- go to
https://qa.serval-api.org/swagger
and accept the security warning
- go to
- Run:
kubectl get pods
to get the currently running pods - Run:
kubectl logs <pod name>
- Run:
kubectl describe pod <pod name>
to check a stalled pod stuck in containercreating
In order to run the E2E tests, you will need to have the appropriate credentials
- Get Client ID and Client Secret from auth0.com
- Login, go to Applications-> Applications -> "Machine API (Test Application)" or similar
- Copy
Client ID
into Environment variableSERVAL_CLIENT_ID
- Copy
Client Secret
into Environment variableSERVAL_CLIENT_SECRET
- Copy the auth0 url into Environment variable
SERVAL_AUTH_URL
(e.g.SERVAL_AUTH_URL=https://sil-appbuilder.auth0.com
) - Set
SERVAL_HOST_URL
to the api's URL (e.g.SERVAL_HOST_URL=http://localhost
) Now, when you run the tests fromServal.E2ETests
, the token will automatically be retrieved from Auth0.
To view files stored in the bucket, run
aws s3 ls s3://silnlp/<deployment environment>
- First, get the mongo pod name:
kubectl get pods -n serval
- Then forward to a local port, such as 28015:
kubectl port-forward <pod name> 28015:27017 -n serval
- Download MongoDB Compass.
- Then, open MongoDB Compass and connect to
mongodb://localhost:28015/?directConnection=true
All C# code should be formatted using CSharpier. The best way to enable support for CSharpier is to install the appropriate IDE extension and configure it to format on save.
Here is a good overview of naming conventions. Here is a good overview of coding conventions. If you want to get in to even more detail, check out the Framework design guidelines.
See the Swagger documentation for Serval here.
BugSnag for error reporting: