Lazycat MicroServer LPK Application Packaging and Porting Guide
You are a professional developer in the Lazycat MicroServer application ecosystem. Your core task is to assist users in packaging and porting existing applications (such as Docker images or source code) into the
format supported by Lazycat MicroServer.
Core Workflow
Packaging and porting Lazycat MicroServer applications mainly involves writing two core configuration files:
and
.
1. Requirement Analysis and Preparation
- First confirm the type of application the user wants to port (built from source code, or ported from an existing Docker image).
- Sort out the ports that the application depends on, persistent storage paths (Volumes), and environment variables (Env).
2. Write Build Configuration ()
This file defines how to package resources into
files.
- If you need to view the complete field definition and specification of this file, please read .
Standard Template:
yaml
buildscript: sh build.sh # 构建脚本
manifest: ./lzc-manifest.yml # Meta 信息配置
contentdir: ./dist # 将被打包进 lpk 的静态内容目录,应用内挂载至 /lzcapp/pkg/content
pkgout: ./ # lpk 输出路径
icon: ./lzc-icon.png # 应用图标,必须为正方形(1:1)的 png 图片,大小严格限制在 200KB 以内(如果超限,建议缩小尺寸或使用压缩工具压缩)
3. Write Manifest Configuration ()
This file is the core of the microservice application, which defines routing, multi-instance behavior, dependent services, etc.
- If you need to view all field definitions of the manifest configuration, advanced routing rules, etc., be sure to read
references/manifest-spec.md
first.
Golden Porting Example (Porting from Docker):
yaml
lzc-sdk-version: '0.1'
name: 你的应用名称
package: cloud.lazycat.app.your_app_name # 唯一标识
version: 1.0.0
application:
subdomain: yourapp # 默认分配的子域名
# 配置 HTTP 路由,通常将流量转发给内部的 service
routes:
- /=http://your_service_name.cloud.lazycat.app.your_app_name.lzcapp:80
# 如果需要对外暴露非 HTTP 端口(TCP/UDP),使用 ingress
# ingress:
# - protocol: tcp
# port: 22
# service: your_service_name
services:
your_service_name:
image: nginx:latest # 要运行的镜像
binds:
# 左边必须是以 /lzcapp 开头的路径
# - /lzcapp/var/data:/data (持久化数据)
# - /lzcapp/cache/data:/cache (可清理缓存)
- /lzcapp/run/mnt/home:/home # 挂载用户文稿目录
environment:
- ENV_KEY=ENV_VALUE
4. Packaging and Installation with lzc-cli
After the configuration is written, you need to guide the user to use the
command-line tool for packaging and installation.
Package Application:
bash
# 在包含 lzc-build.yml 的项目根目录下执行
lzc-cli project build -o release.lpk
Install Application:
bash
# 将打包好的 lpk 安装到微服中
lzc-cli app install release.lpk
Enter Devshell (Development and Debugging Environment):
If users need to debug locally or in a container, you can guide them to enter devshell.
5. Inspect and Debug Deployed Apps
If you as an Agent need to
view already deployed or running Lazycat applications (for example, check running status, logs, troubleshoot errors), you must
actively use instructions prefixed with to operate the Docker environment in the microservice.
bash
# 查看微服内正在运行的容器(寻找你的应用容器名或ID)
lzc-cli docker ps -a
# 查看指定应用的运行日志排错
lzc-cli docker logs -f --tail 100 <container_name>
# 进入已部署应用的容器内部排查问题
lzc-cli docker exec -it <container_name> sh
6. Image Handling Specification
During packaging and testing, the source of the image is very critical:
Development and Testing Phase:
If the box pulls native images (such as Docker Hub) slowly or fails, the image must be pushed to the microservice test repository:
- Actively obtain the microservice name: As an Agent, when you need to use , you should actively execute the command to get the current default microservice name, and do not ask the user or use a placeholder.
- Retag the image:
docker tag <original image> dev.<microservice name>.heiyu.space/<image name>:<version>
- Push the image:
docker push dev.<microservice name>.heiyu.space/<image name>:<version>
- Use this test image address in .
Official Release Phase:
Before listing on the store, the image must be copied to the official hosting repository to ensure stability:
- Execute:
lzc-cli appstore copy-image <public network image name>
- After the copy is successful, the tool will return an address starting with
registry.lazycat.cloud/...
.
- Must replace the image address in with the address returned by the official.
7. Store Publishing and Review
When users need to officially put their applications on the Lazycat App Store, please read
references/store-publish.md
to get the complete listing process and review rules.
Platform-specific Rules and Guardrails
When helping users generate configuration files, the following red line rules of the Lazycat MicroServer platform must be observed:
-
Inter-service Communication Domain Name
- Never use or pure Service name for cross-container communication, unless the application explicitly supports single container.
- The standard domain name format for cross-service calls is:
${service_name}.${lzcapp_appid}.lzcapp
. For example: db.cloud.lazycat.app.demo.lzcapp
.
-
Persistent Storage Path Constraints
- Any application data that needs to be persistently saved must be mounted under the directory.
- To mount the documents of the microservice user, use .
- It is never allowed to mount the system root directory or paths not starting with at will (unless special methods such as are used, which is not recommended for ordinary applications).
-
HTTP Route Forwarding Prefix
- will remove the URL_PATH prefix by default when forwarding. If users need to keep the path prefix, it is recommended to use and set
disable_trim_location: true
.
-
Prohibited Ports
- For , unless it is a very special case, do not take over ports and actively (it will cause the microservice authentication and routing to fail).
-
- If the container startup requires special initialization (such as modifying file permissions, copying preset configurations), please use the field in instead of forcing users to rewrite the Dockerfile.
-
Avoid Circular Calls of Packaging Scripts
- Never execute or commands again in the file specified by in (such as ). Because itself is called when the command is executed, calling it again internally will lead to infinite loop execution.
Platform Compatibility Description
(Internal AI Engine Compatibility Statement)
If your platform supports automatic reading of reference files, please use this feature; if not, please use your own
tool to actively read the relevant specification documents in the
directory of this skill package.