@lazycatcloud/lzc-cli 1.3.17 → 2.0.0-pre.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/README.md +47 -7
  2. package/changelog.md +14 -0
  3. package/lib/app/apkshell.js +7 -44
  4. package/lib/app/index.js +178 -64
  5. package/lib/app/lpk_build.js +446 -61
  6. package/lib/app/lpk_build_images.js +749 -0
  7. package/lib/app/lpk_create.js +192 -45
  8. package/lib/app/lpk_create_generator.js +141 -13
  9. package/lib/app/lpk_devshell.js +33 -19
  10. package/lib/app/lpk_embed_images.js +257 -0
  11. package/lib/app/lpk_installer.js +17 -9
  12. package/lib/app/manifest_build.js +259 -0
  13. package/lib/app/project_cp.js +59 -0
  14. package/lib/app/project_deploy.js +58 -0
  15. package/lib/app/project_exec.js +82 -0
  16. package/lib/app/project_info.js +106 -0
  17. package/lib/app/project_log.js +62 -0
  18. package/lib/app/project_runtime.js +356 -0
  19. package/lib/app/project_start.js +95 -0
  20. package/lib/app/project_sync.js +499 -0
  21. package/lib/appstore/apkshell.js +50 -0
  22. package/lib/box/index.js +101 -4
  23. package/lib/box/ssh_remote.js +259 -0
  24. package/lib/build_remote.js +21 -0
  25. package/lib/debug_bridge.js +891 -83
  26. package/lib/docker/index.js +30 -10
  27. package/lib/i18n/locales/en/translation.json +262 -255
  28. package/lib/i18n/locales/zh/translation.json +262 -255
  29. package/lib/lpk/core.js +488 -0
  30. package/lib/lpk/index.js +210 -0
  31. package/lib/migrate/index.js +52 -0
  32. package/lib/package_info.js +135 -0
  33. package/lib/shellapi.js +35 -1
  34. package/lib/sig/core.js +254 -0
  35. package/lib/sig/index.js +88 -0
  36. package/lib/utils.js +94 -15
  37. package/package.json +3 -3
  38. package/scripts/cli.js +6 -0
  39. package/scripts/smoke/frontend-dev-entry.mjs +104 -0
  40. package/scripts/smoke/template-project.mjs +311 -0
  41. package/template/_lpk/README.md +15 -4
  42. package/template/_lpk/gui-vnc.manifest.yml.in +18 -0
  43. package/template/_lpk/hello-vue.manifest.yml.in +38 -0
  44. package/template/_lpk/manifest.yml.in +4 -11
  45. package/template/_lpk/package.yml.in +7 -0
  46. package/template/_lpk/todolist-golang.manifest.yml.in +30 -0
  47. package/template/_lpk/todolist-java.manifest.yml.in +29 -0
  48. package/template/_lpk/todolist-python.manifest.yml.in +37 -0
  49. package/template/_lpk/todolist-serverless.manifest.yml.in +38 -0
  50. package/template/_lpk/vue.lzc-build.yml.in +0 -44
  51. package/template/blank/lzc-build.dev.yml +4 -0
  52. package/template/blank/lzc-build.yml +24 -41
  53. package/template/blank/lzc-manifest.yml +7 -9
  54. package/template/blank/package.yml +7 -0
  55. package/template/golang/Dockerfile +19 -0
  56. package/template/golang/Dockerfile.dev +20 -0
  57. package/template/golang/README.md +44 -0
  58. package/template/golang/_gitignore +3 -0
  59. package/template/golang/_lzcdevignore +21 -0
  60. package/template/golang/go.mod +3 -0
  61. package/template/golang/lzc-build.dev.yml +12 -0
  62. package/template/golang/lzc-build.yml +16 -0
  63. package/template/golang/lzc-icon.png +0 -0
  64. package/template/golang/main.go +252 -0
  65. package/template/golang/manifest.dev.page.js +24 -0
  66. package/template/golang/run.sh +10 -0
  67. package/template/golang/web/index.html +238 -0
  68. package/template/gui-vnc/README.md +23 -0
  69. package/template/gui-vnc/_gitignore +2 -0
  70. package/template/gui-vnc/images/Dockerfile +30 -0
  71. package/template/gui-vnc/images/kasmvnc.yaml +33 -0
  72. package/template/gui-vnc/images/startup-script.desktop +9 -0
  73. package/template/gui-vnc/images/startup-script.sh +6 -0
  74. package/template/gui-vnc/lzc-build.dev.yml +4 -0
  75. package/template/gui-vnc/lzc-build.yml +18 -0
  76. package/template/gui-vnc/lzc-icon.png +0 -0
  77. package/template/python/Dockerfile +15 -0
  78. package/template/python/Dockerfile.dev +18 -0
  79. package/template/python/README.md +50 -0
  80. package/template/python/_gitignore +3 -0
  81. package/template/python/_lzcdevignore +21 -0
  82. package/template/python/app.py +110 -0
  83. package/template/python/lzc-build.dev.yml +12 -0
  84. package/template/python/lzc-build.yml +16 -0
  85. package/template/python/lzc-icon.png +0 -0
  86. package/template/python/manifest.dev.page.js +25 -0
  87. package/template/python/requirements.txt +1 -0
  88. package/template/python/run.sh +14 -0
  89. package/template/python/web/index.html +238 -0
  90. package/template/springboot/Dockerfile +20 -0
  91. package/template/springboot/Dockerfile.dev +20 -0
  92. package/template/springboot/README.md +44 -0
  93. package/template/springboot/_gitignore +3 -0
  94. package/template/springboot/_lzcdevignore +21 -0
  95. package/template/springboot/lzc-build.dev.yml +12 -0
  96. package/template/springboot/lzc-build.yml +16 -0
  97. package/template/springboot/lzc-icon.png +0 -0
  98. package/template/springboot/manifest.dev.page.js +24 -0
  99. package/template/springboot/pom.xml +38 -0
  100. package/template/springboot/run.sh +10 -0
  101. package/template/springboot/src/main/java/cloud/lazycat/app/Application.java +132 -0
  102. package/template/springboot/src/main/resources/application.properties +1 -0
  103. package/template/springboot/src/main/resources/static/index.html +238 -0
  104. package/template/vue/README.md +18 -21
  105. package/template/vue/lzc-build.dev.yml +7 -0
  106. package/template/vue/lzc-build.yml +30 -43
  107. package/template/vue/manifest.dev.page.js +50 -0
  108. package/template/vue/src/App.vue +36 -25
  109. package/template/vue/src/style.css +106 -49
  110. package/template/vue-minidb/README.md +26 -0
  111. package/template/vue-minidb/_gitignore +25 -0
  112. package/template/vue-minidb/index.html +13 -0
  113. package/template/vue-minidb/lzc-build.dev.yml +7 -0
  114. package/template/vue-minidb/lzc-build.yml +46 -0
  115. package/template/vue-minidb/lzc-icon.png +0 -0
  116. package/template/vue-minidb/manifest.dev.page.js +50 -0
  117. package/template/vue-minidb/package.json +21 -0
  118. package/template/vue-minidb/public/vite.svg +1 -0
  119. package/template/vue-minidb/src/App.vue +206 -0
  120. package/template/vue-minidb/src/assets/vue.svg +1 -0
  121. package/template/vue-minidb/src/main.ts +5 -0
  122. package/template/vue-minidb/src/style.css +136 -0
  123. package/template/vue-minidb/src/vite-env.d.ts +1 -0
  124. package/template/vue-minidb/tsconfig.app.json +24 -0
  125. package/template/vue-minidb/tsconfig.json +7 -0
  126. package/template/vue-minidb/tsconfig.node.json +22 -0
  127. package/template/vue-minidb/vite.config.ts +10 -0
  128. /package/template/{vue → vue-minidb}/src/components/HelloWorld.vue +0 -0
@@ -0,0 +1,38 @@
1
+ application:
2
+ subdomain: ${subdomain} # 默认访问子域名前缀
3
+ #@build if env.DEV_MODE=1
4
+ injects:
5
+ - id: frontend-dev-proxy
6
+ on: request
7
+ auth_required: false
8
+ when:
9
+ - "/*"
10
+ do:
11
+ - src: |
12
+ const devPort = 3000;
13
+ #@build include ./manifest.dev.page.js
14
+
15
+ if (!ctx.dev.id) {
16
+ ctx.response.send(200, renderDevPage("not_linked", devPort));
17
+ return;
18
+ }
19
+
20
+ const via = ctx.net.via.client(ctx.dev.id);
21
+ if (!ctx.dev.online()) {
22
+ ctx.response.send(200, renderDevPage("offline", devPort));
23
+ return;
24
+ }
25
+
26
+ if (!ctx.net.reachable("tcp", "127.0.0.1", devPort, via)) {
27
+ ctx.response.send(200, renderDevPage("not_ready", devPort));
28
+ return;
29
+ }
30
+
31
+ ctx.proxy.to("http://127.0.0.1:" + String(devPort), {
32
+ via: via,
33
+ use_target_host: true,
34
+ });
35
+ #@build else
36
+ routes:
37
+ - /=file:///lzcapp/pkg/content/dist
38
+ #@build end
@@ -1,14 +1,7 @@
1
- name: ${name} # app名称
2
- package: ${package} # app的唯一标识符
3
- version: 0.0.1 # app的版本
4
- description: # app描述
5
-
6
- license: https://choosealicense.com/licenses/mit/
7
- homepage: # 出现bug时候提交反馈的地方
8
- author: # app author
9
-
10
- #application作为一个特殊的container运行,对应的service名称为固定的`app`,其他service可以通过此名称与app进行通讯
1
+ # application 作为默认前台容器运行,对应固定 service 名 app
11
2
  application:
12
- subdomain: ${subdomain} #期望的app域名
3
+ subdomain: ${subdomain} # 默认访问子域名前缀
13
4
  routes:
5
+ # file:// 路由:直接返回静态文件(前端构建产物)
6
+ # 该示例默认读取 /lzcapp/pkg/content/dist 下的内容
14
7
  - /=file:///lzcapp/pkg/content/dist
@@ -0,0 +1,7 @@
1
+ package: ${package} # app的唯一标识符
2
+ version: 0.0.1 # app的版本
3
+ name: ${name} # app名称
4
+ description: # app描述
5
+ author: # app author
6
+ license: https://choosealicense.com/licenses/mit/
7
+ homepage: # 出现bug时候提交反馈的地方
@@ -0,0 +1,30 @@
1
+ application:
2
+ subdomain: ${subdomain} # 默认访问子域名前缀
3
+ image: embed:app-runtime # 引用 lzc-build.yml 里的 images.app-runtime
4
+ #@build if env.DEV_MODE=1
5
+ injects:
6
+ - id: backend-dev-proxy
7
+ on: request
8
+ auth_required: false
9
+ when:
10
+ - "/*"
11
+ do:
12
+ - src: |
13
+ const backendPort = 3000;
14
+ const backendURL = "http://127.0.0.1:" + String(backendPort);
15
+ #@build include ./manifest.dev.page.js
16
+
17
+ if (!ctx.net.reachable("tcp", "127.0.0.1", backendPort)) {
18
+ ctx.response.send(200, renderDevPage(backendPort));
19
+ return;
20
+ }
21
+
22
+ ctx.proxy.to(backendURL, {
23
+ use_target_host: true,
24
+ });
25
+ #@build else
26
+ routes:
27
+ # exec:// 路由会执行 /app/run.sh,并把请求转发到 3000 端口
28
+ # 适合「一个容器同时承载前端+后端」的入门场景
29
+ - /=exec://3000,/app/run.sh
30
+ #@build end
@@ -0,0 +1,29 @@
1
+ application:
2
+ subdomain: ${subdomain} # 默认访问子域名前缀
3
+ image: embed:app-runtime # 引用 lzc-build.yml 里的 images.app-runtime
4
+ #@build if env.DEV_MODE=1
5
+ injects:
6
+ - id: backend-dev-proxy
7
+ on: request
8
+ auth_required: false
9
+ when:
10
+ - "/*"
11
+ do:
12
+ - src: |
13
+ const backendPort = 8080;
14
+ const backendURL = "http://127.0.0.1:" + String(backendPort);
15
+ #@build include ./manifest.dev.page.js
16
+
17
+ if (!ctx.net.reachable("tcp", "127.0.0.1", backendPort)) {
18
+ ctx.response.send(200, renderDevPage(backendPort));
19
+ return;
20
+ }
21
+
22
+ ctx.proxy.to(backendURL, {
23
+ use_target_host: true,
24
+ });
25
+ #@build else
26
+ routes:
27
+ # exec:// 路由会执行 /app/run.sh,并把请求转发到 8080 端口
28
+ - /=exec://8080,/app/run.sh
29
+ #@build end
@@ -0,0 +1,37 @@
1
+ application:
2
+ subdomain: ${subdomain} # 默认访问子域名前缀
3
+ #@build if env.DEV_MODE=1
4
+ injects:
5
+ - id: backend-dev-proxy
6
+ on: request
7
+ auth_required: false
8
+ when:
9
+ - "/*"
10
+ do:
11
+ - src: |
12
+ const backendHost = "backend";
13
+ const backendPort = 3000;
14
+ const backendURL = "http://" + backendHost + ":" + String(backendPort);
15
+ #@build include ./manifest.dev.page.js
16
+
17
+ if (!ctx.net.reachable("tcp", backendHost, backendPort)) {
18
+ ctx.response.send(200, renderDevPage(backendPort));
19
+ return;
20
+ }
21
+
22
+ ctx.proxy.to(backendURL, {
23
+ use_target_host: true,
24
+ });
25
+ #@build else
26
+ image: embed:app-runtime # 引用 lzc-build.yml 里的 images.app-runtime
27
+ routes:
28
+ # exec:// 路由会执行 /app/run.sh,并把请求转发到 3000 端口
29
+ - /=exec://3000,/app/run.sh
30
+ #@build end
31
+
32
+ #@build if env.DEV_MODE=1
33
+ services:
34
+ backend:
35
+ image: embed:app-runtime
36
+ command: /app/run.sh
37
+ #@build end
@@ -0,0 +1,38 @@
1
+ application:
2
+ subdomain: ${subdomain} # 默认访问子域名前缀
3
+ #@build if env.DEV_MODE=1
4
+ injects:
5
+ - id: frontend-dev-proxy
6
+ on: request
7
+ auth_required: false
8
+ when:
9
+ - "/*"
10
+ do:
11
+ - src: |
12
+ const devPort = 3000;
13
+ #@build include ./manifest.dev.page.js
14
+
15
+ if (!ctx.dev.id) {
16
+ ctx.response.send(200, renderDevPage("not_linked", devPort));
17
+ return;
18
+ }
19
+
20
+ const via = ctx.net.via.client(ctx.dev.id);
21
+ if (!ctx.dev.online()) {
22
+ ctx.response.send(200, renderDevPage("offline", devPort));
23
+ return;
24
+ }
25
+
26
+ if (!ctx.net.reachable("tcp", "127.0.0.1", devPort, via)) {
27
+ ctx.response.send(200, renderDevPage("not_ready", devPort));
28
+ return;
29
+ }
30
+
31
+ ctx.proxy.to("http://127.0.0.1:" + String(devPort), {
32
+ via: via,
33
+ use_target_host: true,
34
+ });
35
+ #@build else
36
+ routes:
37
+ - /=file:///lzcapp/pkg/content/dist
38
+ #@build end
@@ -1,5 +1,3 @@
1
- # 整个文件中,可以通过 ${var} 的方式,使用 manifest 字段指定的文件定义的值
2
-
3
1
  # buildscript
4
2
  # - 可以为构建脚本的路径地址
5
3
  # - 如果构建命令简单,也可以直接写 sh 的命令
@@ -20,45 +18,3 @@ icon: ./lazycat.png
20
18
 
21
19
  # deploy_params 指定用户运行时输入的模板字段
22
20
  # deploy_params: ./lzc-deploy-params.yml
23
-
24
- # devshell 自定义应用的开发容器环境
25
- # - routes 指定应用容器的访问路由
26
-
27
- # devshell 没有指定 image 的情况,将会默认使用 registry.lazycat.cloud/lzc-cli/devshell:v0.0.5
28
- # devshell:
29
- # routes:
30
- # - /=http://127.0.0.1:8080
31
-
32
- # devshell 指定 image 的情况
33
- # devshell:
34
- # routes:
35
- # - /=http://127.0.0.1:3000
36
- # image: registry.lazycat.cloud/lzc-cli/devshell:v0.0.5
37
-
38
- # devshell 指定构建Dockerfile
39
- # image 字段如果没有定义,将默认使用 ${package}-devshell:${version}
40
- # devshell:
41
- # routes:
42
- # - /=http://127.0.0.1:3000
43
- # image: ${package}-devshell:${version}
44
- # pull_policy: build
45
- # build: .
46
-
47
- # dvshell 指定开发依赖的情况
48
- # 这种情况下,选用 alpine:latest 作为基础镜像,在 dependencies 中添加所需要的开发依赖即可
49
- # 如果 dependencies 和 build 同时存在,将会优先使用 dependencies
50
- devshell:
51
- routes:
52
- - /=http://127.0.0.1:3000
53
- dependencies:
54
- - nodejs
55
- - vim
56
- - npm
57
- # setupscript 每次进入到app container后都会执行的配置脚本
58
- # - 可以为脚本的路径地址
59
- # - 如果构建命令简单,也可以直接写 sh 的命令
60
- # setupscript: export GOPROXY=https://goproxy.cn
61
- # setupscript: ./setupscript.sh
62
- setupscript: |
63
- export GOPROXY=https://goproxy.cn
64
- export npm_config_registry=https://registry.npmmirror.com
@@ -0,0 +1,4 @@
1
+ # 开发态覆盖配置
2
+
3
+ # pkg_id_suffix: append an extra package id segment for dev deploys
4
+ pkg_id_suffix: dev
@@ -1,5 +1,3 @@
1
- # 整个文件中,可以通过 ${var} 的方式,使用 manifest 字段指定的文件定义的值
2
-
3
1
  # buildscript
4
2
  # - 可以为构建脚本的路径地址
5
3
  # - 如果构建命令简单,也可以直接写 sh 的命令
@@ -11,48 +9,33 @@ manifest: ./lzc-manifest.yml
11
9
  # contentdir: 指定打包的内容,将会打包到 lpk 中
12
10
  # contentdir: ./
13
11
 
12
+ # images: 在盒子侧构建镜像并写入 lpk v2 images 目录
13
+ # - key 是 image alias
14
+ # - 在 lzc-manifest.yml 中通过 embed:alias 引用
15
+ # - dockerfile 与 dockerfile-content 二选一
16
+ # - context 可选,默认是 dockerfile 所在目录
17
+ # images:
18
+ # my-nginx:
19
+ # context: ./image
20
+ # dockerfile: ./image/Dockerfile
21
+ # # 可选,默认 registry.lazycat.cloud
22
+ # upstream-match: registry.lazycat.cloud
23
+ # other-image:
24
+ # dockerfile: ./other/Dockerfile
25
+ # inline-image:
26
+ # context: ./
27
+ # dockerfile-content: |
28
+ # FROM alpine:3.20
29
+ # RUN echo "hello"
30
+ #
31
+ # 构建时默认是混合模式:
32
+ # - 先沿父镜像链向上找 upstream
33
+ # - 找到 upstream 后,仅 embed 非 upstream 的 layers
34
+ # - 如果未匹配到 upstream,则自动全量 embed
35
+
14
36
  # pkgout: lpk 包的输出路径
15
37
  pkgout: ./
16
38
 
17
39
  # icon 指定 lpk 包 icon 的路径路径,如果不指定将会警告
18
40
  # icon 仅仅允许 png 后缀的文件
19
41
  icon: ./lzc-icon.png
20
- # devshell 自定义应用的开发容器环境
21
- # - routes 指定应用容器的访问路由
22
-
23
- # devshell 没有指定 image 的情况,将会默认使用 registry.lazycat.cloud/lzc-cli/devshell:v0.0.5
24
- # devshell:
25
- # routes:
26
- # - /=http://127.0.0.1:8080
27
-
28
- # devshell 指定 image 的情况
29
- # devshell:
30
- # routes:
31
- # - /=http://127.0.0.1:3000
32
- # image: registry.lazycat.cloud/lzc-cli/devshell:v0.0.5
33
-
34
- # devshell 指定构建Dockerfile
35
- # image 字段如果没有定义,将默认使用 ${package}-devshell:${version}
36
- # devshell:
37
- # routes:
38
- # - /=http://127.0.0.1:3000
39
- # image: ${package}-devshell:${version}
40
- # pull_policy: build
41
- # build: .
42
-
43
- # dvshell 指定开发依赖的情况
44
- # 这种情况下,选用 alpine:latest 作为基础镜像,在 dependencies 中添加所需要的开发依赖即可
45
- # 如果 dependencies 和 build 同时存在,将会优先使用 dependencies
46
- # devshell:
47
- # routes:
48
- # - /=http://127.0.0.1:3000
49
- # dependencies:
50
- # - nodejs
51
- # - npm
52
- # # setupscript 每次进入到app container后都会执行的配置脚本
53
- # # - 可以为脚本的路径地址
54
- # # - 如果构建命令简单,也可以直接写 sh 的命令
55
- # # setupscript: export GOPROXY=https://goproxy.cn
56
- # # setupscript: ./setupscript.sh
57
- # setupscript: |
58
- # export npm_config_registry=https://registry.npmmirror.com
@@ -1,11 +1,9 @@
1
- name: helloworld
2
- package: cloud.lazycat.app.helloworld
3
- version: 0.0.1
4
- description:
5
- license: https://choosealicense.com/licenses/mit/
6
- homepage:
7
- author:
1
+ # application 是默认前台服务,对应固定 service 名 app
8
2
  application:
9
- subdomain: helloworld
3
+ subdomain: helloworld # 默认访问子域名前缀
10
4
  routes:
11
- - /=https://developer.lazycat.cloud/
5
+ # 路由示例:把首页转发到一个外部站点
6
+ # 常见写法:
7
+ # - /=http://example.com
8
+ # - /=file:///lzcapp/pkg/content/html
9
+ - /=http://example.com
@@ -0,0 +1,7 @@
1
+ package: cloud.lazycat.app.helloworld # 应用唯一ID,建议使用反向域名格式
2
+ version: 0.0.1 # 应用版本
3
+ name: helloworld # 应用名称
4
+ description: # 应用描述
5
+ author: # 作者信息
6
+ license: https://choosealicense.com/licenses/mit/
7
+ homepage: # 项目主页或文档地址
@@ -0,0 +1,19 @@
1
+ FROM registry.lazycat.cloud/lzc/lzcapp:3.20.3 AS builder
2
+
3
+ RUN apk add --no-cache go
4
+ WORKDIR /workspace
5
+
6
+ COPY go.mod ./
7
+ COPY main.go ./
8
+ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /workspace/app ./main.go
9
+
10
+ FROM registry.lazycat.cloud/lzc/lzcapp:3.20.3
11
+
12
+ WORKDIR /app
13
+ COPY --from=builder /workspace/app /app/app
14
+ COPY run.sh /app/run.sh
15
+ RUN chmod +x /app/run.sh /app/app
16
+ COPY web /app/web
17
+
18
+ EXPOSE 3000
19
+ CMD ["/app/run.sh"]
@@ -0,0 +1,20 @@
1
+ FROM registry.lazycat.cloud/lzc/lzcapp:3.20.3 AS builder
2
+
3
+ RUN apk add --no-cache go
4
+ WORKDIR /workspace
5
+
6
+ COPY go.mod ./
7
+ COPY main.go ./
8
+ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /workspace/app ./main.go
9
+
10
+ FROM registry.lazycat.cloud/lzc/lzcapp:3.20.3
11
+
12
+ RUN apk add --no-cache go
13
+ WORKDIR /app
14
+ COPY --from=builder /workspace/app /app/app
15
+ COPY run.sh /app/run.sh
16
+ RUN chmod +x /app/run.sh /app/app
17
+ COPY web /app/web
18
+
19
+ EXPOSE 3000
20
+ CMD ["sh", "-lc", "trap : TERM INT; sleep infinity & wait"]
@@ -0,0 +1,44 @@
1
+ # Lazycat Golang Todo App
2
+
3
+ ## First Deploy
4
+ ```bash
5
+ lzc-cli project deploy
6
+ lzc-cli project info
7
+ ```
8
+
9
+ By default, project commands use `lzc-build.dev.yml` when it exists.
10
+ Each command prints the active `Build config`.
11
+ Use `--release` if you want to operate on `lzc-build.yml`.
12
+
13
+ Open the app first.
14
+ In dev mode, the app will not auto-start the Golang service.
15
+ If the backend service is not ready yet, the app page will show the expected port and what to do next.
16
+
17
+ ## Recommended Backend Dev Loop
18
+ ```bash
19
+ lzc-cli project sync --watch
20
+ lzc-cli project exec /bin/sh
21
+ /app/run.sh
22
+ ```
23
+
24
+ You can also build locally and use `lzc-cli project cp` instead of `project sync --watch`.
25
+
26
+ ## Troubleshooting
27
+ ```bash
28
+ lzc-cli project log -f
29
+ lzc-cli project exec /bin/sh
30
+ ```
31
+
32
+ ## API
33
+ ```text
34
+ GET /api/health
35
+ GET /api/todos
36
+ POST /api/todos
37
+ PUT /api/todos/{id}/toggle
38
+ DELETE /api/todos/{id}
39
+ ```
40
+
41
+ ## Data Path
42
+ ```text
43
+ /lzcapp/var/todos.json
44
+ ```
@@ -0,0 +1,3 @@
1
+ /bin/
2
+ *.lpk
3
+ /cloud.lazycat.app.golang-template
@@ -0,0 +1,21 @@
1
+ .git
2
+ .git/**
3
+ node_modules
4
+ node_modules/**
5
+ .venv
6
+ .venv/**
7
+ dist
8
+ dist/**
9
+ build
10
+ build/**
11
+ __pycache__
12
+ __pycache__/**
13
+ .idea
14
+ .idea/**
15
+ .vscode
16
+ .vscode/**
17
+ .DS_Store
18
+ .lzc-cli-*
19
+ .lzc-cli-*/**
20
+ *.lpk
21
+ *.lpk.tar
@@ -0,0 +1,3 @@
1
+ module cloud.lazycat.app.golang-template
2
+
3
+ go 1.22
@@ -0,0 +1,12 @@
1
+ # 开发态覆盖配置
2
+
3
+ # pkg_id_suffix: append an extra package id segment for dev deploys
4
+ pkg_id_suffix: dev
5
+
6
+ envs:
7
+ - DEV_MODE=1
8
+
9
+ images:
10
+ app-runtime:
11
+ context: ./
12
+ dockerfile: ./Dockerfile.dev
@@ -0,0 +1,16 @@
1
+ # manifest: 指定 lpk 的 manifest 文件
2
+ manifest: ./lzc-manifest.yml
3
+
4
+ # pkgout: lpk 输出目录
5
+ pkgout: ./
6
+
7
+ # icon: 应用图标(png)
8
+ icon: ./lzc-icon.png
9
+
10
+ # images: 构建容器镜像并写入 lpk v2 的 images 目录
11
+ images:
12
+ app-runtime:
13
+ # context: Docker 构建上下文目录
14
+ context: ./
15
+ # dockerfile: 镜像构建文件
16
+ dockerfile: ./Dockerfile
Binary file