Take a look at the schema definition in tye.yaml in the Tye configuration file

2 minute read

Tye, a microservices development tool, defines configurations in Yaml files. The file name is tye.yaml.
This time we will learn about the schema of this tye.yaml.

The schema of tye.yaml is managed on GitHub and can be viewed by anyone.
https://github.com/dotnet/tye/blob/master/docs/reference/schema.md

Preparing to write tye.yaml in Visual Studio Code

By adjusting the environment according to this document, you will be able to see intellisense when writing tye.yaml in Visual Studio Code.
[https://github.com/dotnet/tye/blob/master/src/schema/README.md]

  1. Install Yaml Extension in Visual Studio Code
  2. Launch the Visual Studio Code settings screen (Ctrl +,)
  3. Find the “Yaml: Schemas” settings and edit settings.json
  4. Specify Tye’s schema file in " yaml.schemas "
{
  "yaml.schemas": {
    "https://raw.githubusercontent.com/dotnet/tye/master/src/schema/tye-schema.json": [
      "tye.yaml"
    ]
  }
}

Schema definition

Let’s take tye.yaml used in the sample application of the previous article as an example.
https://github.com/tsubakimoto/project-tye-sample/blob/master/tye.yaml

name: microservice
registry: tsubakimoto
services:
- name: backend
  project: backend\backend.csproj
- name: frontend
  project: frontend\frontend.csproj
- name: redis
  image: redis
  bindings:
  - port: 6379
    connectionString: "${host}:${port}"
- name: redis-cli
  image: redis
  args: "redis-cli -h redis MONITOR"

name property

The name of the application in Tye. This property is rarely used, but it is used for label names when deployed to Kubernetes.
If this property is not specified, the directory name (lowercase) with tye.yaml is used.

registry property

Specifies the name of the container registry. You can specify the name of Docker Hub or Azure Container Registry.
The image or tag is pushed to the container registry specified here.

namespace property

Used as the Kubernetes namespace when deploying to Kubernetes.
The previous sample application did not use the namespace property, so I’ll try to verify it at a later date.

services property

Specifies the services that make up the application. At least one is required.
The following properties can be defined in the services property.

name property

It must be a service name and a character type that can be used as a DNS name.

–Maximum 63 characters
–Only alphanumeric characters or “-“
–Starts with alphanumeric characters
–Ends with alphanumeric characters

project property

Specify the path of the .csproj file or the .fsproj file. The file path is relative to tye.yaml.
The project specified in this property will be built or run locally and will be packaged.

ʻImage` property

Specify the image name and tag when using a Docker image.
In the sample above, ʻimage: redis is the latest tag for the image redis`.

bindings property

The documentation says “List of bindings exposed by the service”.
This is the setting related to the protocol when the corresponding service is published (executed).

port property
–The port number used for port binding.

  • connectionString
    –A connection string bound to the service. It seems that there is a mechanism called Service Discovery on how it is interpreted on the referencing service side.

ʻArgs` property

This is a command line argument used when starting the service.


In addition, https://github.com/dotnet/tye/blob/master/docs/reference/schema.md describes the schema definition, so I will verify what I care about at a later date. ..