CX Cloud Docs
Search…
Configuring Routing Manifest
Routing manifest is needed to make multiple services available in the same domain.
For example, let's assume you have created a front-end and 3 microservices and you want them all to be available on the same domain:
  • newsite.example.com/ should load frontend service
  • newsite.example.com/api/service-commerce/ should load package-commerce service
  • newsite.example.com/api/service-content should load package-content service
  • newsite.example.com/api/service-search should load package-search service
You have to create a routing manifest to achieve this. (In addition to pointing the domain in question to your Kubernetes cluster during infra generation)

Create manifest

Add .cxcloud.yaml to the root folder of your monorepo.
my-monorepo/.cxcloud.yaml
1
namespace: $GIT_BRANCH
2
routing:
3
domain: $GIT_BRANCH.dev.newsite.example.com
4
ingressClass: $INGRESS_CLASS
5
lbCert: $LB_CERT
6
scheme: $SCHEME
7
ssl: false
8
rules:
9
- path: /api/service-commerce
10
serviceName: package-commerce
11
servicePort: 4003
12
- path: /api/service-content
13
serviceName: package-content
14
servicePort: 4003
15
- path: /api/service-search
16
serviceName: package-search
17
servicePort: 4003
18
- path: /
19
serviceName: package-frontend
20
servicePort: 80
Copied!
Please note that path should match the API prefix you defined when generating the service with CLI. By default, during service generation, CX Cloud CLI suggests service name as the API prefix.
After committing changes to Git repository, CI/CD pipeline will deploy changes automatically.

Test

To test for example commerce service, newsite.example.com/api/service-commerce/ should return {"health":"OK"} and newsite.example.com/api/service-commerce/v1/api-docs should present to you Swagger documentation.
Last modified 2yr ago
Copy link