Skip to content

Routing to AI Services in LZC ​

A simple AI application with a single AI Pod hosting the service, including the UI components.

After the service is deployed within the AI Pod, it can be accessed via https://${服务名称}-ai.${微服名称}.heiyu.space.

In the LPK application routing, you might write something like this:

yml
routers:
  - /=https://${服务名称}-ai.${微服名称}.heiyu.space

LCMD 1.3.8+ System ​

This feature uses the LCMD 1.3.8 upstreams system.

yml
application:
  upstreams:
    - location: /
      backend: https://comfyui-ai.{{ .S.BoxDomain }}
      use_backend_host: true
      dump_http_headers_when_5xx: true

Using template manifest.yml

System before Microservice 1.3.8 ​

In this case, the router cannot know the current accessed ${微服名称}, so a forwarding tool is required to handle it, such as nginx or caddy.

yml
application:
  routes:
    - /=http://caddy:80

services:
  caddy:
    image: registry.lazycat.cloud/caddy:2.9.1-alpine
    setup_script: |
      cat <<'EOF' > /etc/caddy/Caddyfile
      {
          auto_https off
          http_port 80
          https_port 0
      }

      :80 {
          redir https://${服务名称}-ai.{$LAZYCAT_BOX_DOMAIN} permanent
      }
      EOF
      cat /etc/caddy/Caddyfile