version 1.0.109 and above
Nomirun Host comes with predefined rules for exposed ports. This gives you ease of development and automatic configuration.
Ports that are exposed are:
Port Name | Default Port number | Description |
---|---|---|
HTTP Port | 5000 | This is a basic HTTP port that exposes REST API, Swagger and Health check endpoints. |
HTTPS Port | 5001 | This is a basic HTTP port that exposes REST API, Swagger and Health check endpoints with TLS. |
GRPC HTTP Port | 5002 | This is a GRPC HTTP port that exposes GRPC Server. |
GRPC HTTPS Port | 5003 | This is a GRPC HTTPS port that exposes GRPC Server with TLS. |
Metrics HTTP Port | 5004 | This is a HTTP Prometheus metrics port that exposes /metrics endpoint. This keeps metrics private on a separate port. |
Metrics HTTPS Port | 5005 | This is a HTTPS Prometheus metrics port that exposes /metrics endpoint with TLS. |
You can configure every port in the Nomirun.Host.Config
:
{
"Nomirun.Host": {
...
"ServerListeners": {
"HttpListener": {
"Enabled": true,
"Port": 5000,
"Protocol": "Http1AndHttp2"
},
"HttpsListener": {
"CertificatePath": null,
"CertificatePassword": null,
"Enabled": false,
"Port": 5001,
"Protocol": "Http1AndHttp2"
},
"GrpcListener": {
"Enabled": false,
"Port": 5002,
"Protocol": "Http2"
},
"GrpcsListener": {
"CertificatePath": null,
"CertificatePassword": null,
"Enabled": false,
"Port": 5003,
"Protocol": "Http2"
},
"MetricsHttpListener": {
"Enabled": true,
"Port": 5004,
"Protocol": "Http1AndHttp2"
},
"MetricsHttpsListener": {
"CertificatePath": null,
"CertificatePassword": null,
"Enabled": false,
"Port": 5005,
"Protocol": "Http1AndHttp2"
}
}
}
}
You can enable or disable the port listener, configure HTTP protocol and define certificate for TLS ports. By default, only HttpPort
and MetricsHttpPort
are enabled.
Whenever you create a new module, a set of 6 ports above are reserved for it. This way if you run multiple modules, they do not overlap with each other, and you can have a better experience developing and running modules.
The ports stay the same for your development machine no matter how you run the modules. If you run them as standalone apps or as containers, the ports are respected.
In your Kubernetes environment, you can always configure the JSON above to expose the correct ports that you want from container. For example this is an excerpt from Kubernetes deployment manifest:
env:
- name: Nomirun.Host__ServerListeners__HttpListener__Enabled
value: "true"
- name: Nomirun.Host__ServerListeners__HttpListener__Port
value: "5000"
- name: Nomirun.Host__ServerListeners__HttpsListener__Enabled
value: "false"
- name: Nomirun.Host__ServerListeners__GrpcListener__Enabled
value: "true"
- name: Nomirun.Host__ServerListeners__GrpcListener__Port
value: "5001"
- name: Nomirun.Host__ServerListeners__GrpcsListener__Enabled
value: "false"
- name: Nomirun.Host__ServerListeners__MetricsHttpListener__Enabled
value: "true"
- name: Nomirun.Host__ServerListeners__MetricsHttpListener__Port
value: "5002"
- name: Nomirun.Host__ServerListeners__MetricsHttpsListener__Enabled
value: "false"