@lazycatcloud/lzc-cli 1.1.5 → 1.1.6

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 (51) hide show
  1. package/cmds/app.js +1 -5
  2. package/cmds/dev.js +11 -5
  3. package/lib/api.js +21 -7
  4. package/lib/app/index.js +92 -0
  5. package/lib/app/lpk_build.js +229 -0
  6. package/lib/app/lpk_create.js +201 -0
  7. package/lib/app/lpk_devshell.js +621 -0
  8. package/lib/app/lpk_installer.js +67 -0
  9. package/lib/archiver.js +0 -42
  10. package/lib/autologin.js +84 -0
  11. package/lib/box/check_qemu.js +39 -16
  12. package/lib/box/hportal.js +7 -1
  13. package/lib/box/index.js +7 -6
  14. package/lib/box/qemu_vm_mgr.js +12 -11
  15. package/lib/dev.js +0 -4
  16. package/lib/env.js +9 -5
  17. package/lib/generator.js +2 -2
  18. package/lib/sdk.js +5 -6
  19. package/lib/utils.js +69 -46
  20. package/package.json +7 -1
  21. package/scripts/cli.js +91 -12
  22. package/template/_lazycat/debug/shell/Dockerfile +5 -3
  23. package/template/_lazycat/debug/shell/docker-compose.override.yml.in +2 -12
  24. package/template/_lazycat/debug/shell/entrypoint.sh +3 -1
  25. package/template/_lpk/Dockerfile.in +8 -0
  26. package/template/_lpk/devshell/Dockerfile +18 -0
  27. package/template/_lpk/devshell/build.sh +5 -0
  28. package/template/_lpk/devshell/entrypoint.sh +8 -0
  29. package/template/_lpk/devshell/sshd_config +117 -0
  30. package/template/_lpk/manifest.yml.in +17 -0
  31. package/template/_lpk/sync/Dockerfile +16 -0
  32. package/template/_lpk/sync/build.sh +5 -0
  33. package/template/_lpk/sync/entrypoint.sh +8 -0
  34. package/template/_lpk/sync/sshd_config +117 -0
  35. package/template/_lpk/sync.manifest.yml.in +3 -0
  36. package/template/golang/build.sh +6 -0
  37. package/template/golang/lzc-build.yml +52 -0
  38. package/template/ionic_vue3/lzc-build.yml +53 -0
  39. package/template/ionic_vue3/vite.config.ts +1 -1
  40. package/template/release/golang/build.sh +1 -1
  41. package/template/release/ionic_vue3/Dockerfile +1 -1
  42. package/template/release/ionic_vue3/build.sh +1 -3
  43. package/template/release/ionic_vue3/docker-compose.yml.in +0 -5
  44. package/template/release/vue/Dockerfile +1 -1
  45. package/template/release/vue/build.sh +2 -3
  46. package/template/release/vue/docker-compose.yml.in +0 -5
  47. package/template/vue/lzc-build.yml +53 -0
  48. package/template/vue/src/main.js +3 -14
  49. package/template/vue/vue.config.js +2 -1
  50. package/template/_lazycat/debug/shell/nginx.conf.template +0 -64
  51. package/template/vue/src/lzc.js +0 -110
package/lib/utils.js CHANGED
@@ -8,13 +8,14 @@ import glob from "fast-glob";
8
8
  import yaml from "js-yaml";
9
9
  import mergeWith from "lodash.mergewith";
10
10
  import isArray from "lodash.isarray";
11
- import fetch from "node-fetch";
11
+ import { request } from "./autologin.js";
12
12
  import { dirname } from "path";
13
13
  import { fileURLToPath } from "url";
14
14
  import ignore from "ignore";
15
15
  import ora from "ora";
16
16
  import { desireStatusTimer } from "../lib/api.js";
17
17
  import { warn } from "console";
18
+ import { createHash } from "node:crypto";
18
19
 
19
20
  const META_MARK = "x-lazycat-app";
20
21
  const APP_FOLDER = ".lazycat";
@@ -33,7 +34,7 @@ export const envsubstr = async (templateContents, args) => {
33
34
  async function InstallSDK(box_url) {
34
35
  try {
35
36
  let url = `${box_url}/api/app/apply?id=sdk`;
36
- const resp = await fetch(url, { method: "post" });
37
+ const resp = await request(url, { method: "post" });
37
38
  if (resp.status != 200) {
38
39
  throw new Error(
39
40
  chalk.red(
@@ -54,7 +55,7 @@ async function InstallSDK(box_url) {
54
55
  async function checkSDKInstallStatus(box_url) {
55
56
  const checkSDKstatus = async function (box_url) {
56
57
  let url = `${box_url}/api/app/status?id=sdk`;
57
- const resp = await fetch(url);
58
+ const resp = await request(url);
58
59
  if (resp.status == 200) {
59
60
  const status = await resp.json();
60
61
  return status;
@@ -102,7 +103,7 @@ async function checkSDKInstallStatus(box_url) {
102
103
  async function getInstalledApps(box_url) {
103
104
  try {
104
105
  let url = `${box_url}/api/app/dump`;
105
- const resp = await fetch(url);
106
+ const resp = await request(url);
106
107
  if (resp.status != 200) throw new Error(chalk.red("获取所有已安装App失败"));
107
108
  return await resp.json();
108
109
  } catch (e) {
@@ -191,9 +192,10 @@ function findAppRootPath(aPath) {
191
192
 
192
193
  function toPair(object) {
193
194
  return Object.keys(object).map((key) => {
195
+ let value = object[key] ? object[key].toString() : "";
194
196
  return {
195
197
  name: key,
196
- value: object[key].toString(),
198
+ value,
197
199
  };
198
200
  });
199
201
  }
@@ -203,43 +205,14 @@ function getMetaInfo(composeFile) {
203
205
  return doc[META_MARK];
204
206
  }
205
207
 
206
- async function createTemplateFile(templateFile, outputFile, env) {
208
+ async function envTemplateFile(templateFile, env) {
207
209
  const template = yaml.load(fs.readFileSync(templateFile, "utf8"));
208
- // const meta = template[META_MARK];
209
- // if (
210
- // meta &&
211
- // Array.isArray(meta["permissions"]) &&
212
- // meta["permissions"].includes("lzcapis")
213
- // ) {
214
- // template[META_MARK]["ingress"].push({
215
- // service: "lazycat-apis-sidecar",
216
- // port: 8888,
217
- // subdomain: "${APP_NAME}",
218
- // path: "/lzcapis/",
219
- // auth: "oidc",
220
- // authcallback: "/lzcapis/oidc-callback",
221
- // });
222
- // template["services"]["lazycat-apis-sidecar"] = {
223
- // image: "registry.lazycat.cloud/lazycat-apis-sidecar",
224
- // // volumes_from: ["${APP_NAME}:rw"],
225
- // volumes: ["lzcapis-lzcapp:/lzcapp"],
226
- // command: [
227
- // "--client-id=${LAZYCAT_AUTH_OIDC_CLIENT_ID}",
228
- // "--client-secret=${LAZYCAT_AUTH_OIDC_CLIENT_SECRET}",
229
- // "--client-url=https://${LAZYCAT_APP_ORIGIN}/lzcapis/",
230
- // "--issuer=${LAZYCAT_AUTH_OIDC_ISSUER_URL}",
231
- // "--prefix=lzcapis",
232
- // "--fs-root=/lzcapp/documents",
233
- // ],
234
- // };
235
- // }
236
- //
237
210
  const options = {
238
211
  envs: toPair(env),
239
212
  syntax: "default",
240
213
  protect: false,
241
214
  };
242
- const output = await envsubstr(
215
+ return await envsubstr(
243
216
  yaml.dump(template, {
244
217
  styles: {
245
218
  "!!null": "empty", // dump null as ""
@@ -247,7 +220,23 @@ async function createTemplateFile(templateFile, outputFile, env) {
247
220
  }),
248
221
  { options }
249
222
  );
223
+ }
224
+
225
+ async function createTemplateFile(templateFile, outputFile, env) {
226
+ let output = await envTemplateFile(templateFile, env);
227
+ fs.writeFileSync(outputFile, output);
228
+ }
250
229
 
230
+ async function createTemplateFileCommon(templateFile, outputFile, env) {
231
+ const template = yaml.load(fs.readFileSync(templateFile, "utf8"));
232
+ const options = {
233
+ envs: toPair(env),
234
+ syntax: "default",
235
+ protect: false,
236
+ };
237
+ const output = await envsubstr(fs.readFileSync(templateFile, "utf-8"), {
238
+ options,
239
+ });
251
240
  fs.writeFileSync(outputFile, output);
252
241
  }
253
242
 
@@ -262,7 +251,7 @@ async function copyDotAppDir(from, to, opts = {}) {
262
251
  if (fs.existsSync(to)) {
263
252
  fs.rmSync(to, { recursive: true });
264
253
  }
265
- const _files = await glob(["*"].concat(include), {
254
+ const _files = await glob(["**"].concat(include), {
266
255
  cwd: from,
267
256
  dot: true,
268
257
  ignore: ignore,
@@ -289,6 +278,22 @@ async function copyDotAppDir(from, to, opts = {}) {
289
278
  }
290
279
  }
291
280
 
281
+ function mergeYamlInMemory(args) {
282
+ if (args.length == 0) {
283
+ return {};
284
+ } else if (args.length == 1) {
285
+ return args[0];
286
+ }
287
+ return args.reduce((prev, curr) => {
288
+ let result = mergeWith(prev, curr, (objValue, srcValue) => {
289
+ if (isArray(objValue)) {
290
+ return objValue.concat(srcValue);
291
+ }
292
+ });
293
+ return result;
294
+ }, {});
295
+ }
296
+
292
297
  // override yaml, notice this will change target file
293
298
  function mergeYaml(target, source) {
294
299
  const targetContent = yaml.load(fs.readFileSync(target, "utf8"));
@@ -302,15 +307,7 @@ function mergeYaml(target, source) {
302
307
  }
303
308
  }
304
309
  );
305
-
306
- fs.writeFileSync(
307
- target,
308
- yaml.dump(merged, {
309
- styles: {
310
- "!!null": "empty", // dump null as ""
311
- },
312
- })
313
- );
310
+ dumpToYaml(merged, target);
314
311
  }
315
312
 
316
313
  function archiveFolder(appDir, format = "zip") {
@@ -393,6 +390,14 @@ function isDirSync(path) {
393
390
  return stat.isDirectory();
394
391
  }
395
392
 
393
+ function isDirExist(path) {
394
+ try {
395
+ return isDirSync(path);
396
+ } catch {
397
+ return false;
398
+ }
399
+ }
400
+
396
401
  function isFileExist(path) {
397
402
  try {
398
403
  fs.accessSync(
@@ -416,6 +421,18 @@ function parse2CorrectName(name) {
416
421
  return name.replaceAll(" ", "-").toLowerCase();
417
422
  }
418
423
 
424
+ async function sleep(ms) {
425
+ return new Promise((resolve) => {
426
+ setTimeout(resolve, ms);
427
+ });
428
+ }
429
+
430
+ async function md5String(str) {
431
+ const hash = createHash("md5");
432
+ hash.update(str);
433
+ return hash.digest("hex");
434
+ }
435
+
419
436
  export {
420
437
  ensureDir,
421
438
  copyDotAppDir,
@@ -424,6 +441,7 @@ export {
424
441
  findAppRootPath,
425
442
  archiveFolder,
426
443
  mergeYaml,
444
+ mergeYamlInMemory,
427
445
  loadFromYaml,
428
446
  dumpToYaml,
429
447
  importDefault,
@@ -434,6 +452,7 @@ export {
434
452
  toPair,
435
453
  contextDirname,
436
454
  isDirSync,
455
+ isDirExist,
437
456
  GitIgnore,
438
457
  isFileExist,
439
458
  urlHostname,
@@ -441,6 +460,10 @@ export {
441
460
  findAppIsInstalled,
442
461
  getInstalledApps,
443
462
  checkSDKInstallStatus,
463
+ envTemplateFile,
444
464
  createTemplateFile,
445
465
  parse2CorrectName,
466
+ sleep,
467
+ md5String,
468
+ createTemplateFileCommon
446
469
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lazycatcloud/lzc-cli",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "description": "lazycat cloud developer kit",
5
5
  "scripts": {
6
6
  "test": "mocha",
@@ -48,6 +48,7 @@
48
48
  "lodash.merge": "^4.6.2",
49
49
  "lodash.mergewith": "^4.6.2",
50
50
  "log-update": "^5.0.0",
51
+ "loglevel": "^1.8.0",
51
52
  "minimist": "^1.2.5",
52
53
  "node-fetch": "^2.6.6",
53
54
  "node-stream-zip": "^1.15.0",
@@ -55,6 +56,7 @@
55
56
  "semver": "^7.3.5",
56
57
  "ssh2": "^1.5.0",
57
58
  "ssh2-promise": "^1.0.2",
59
+ "tar": "^6.1.11",
58
60
  "yargs": "^17.5.1"
59
61
  },
60
62
  "devDependencies": {
@@ -62,5 +64,9 @@
62
64
  "chai": "^4.3.6",
63
65
  "mocha": "^9.2.2",
64
66
  "prettier": "^2.5.0"
67
+ },
68
+ "publishConfig": {
69
+ "registry": "https://registry.npmjs.org",
70
+ "access": "public"
65
71
  }
66
72
  }
package/scripts/cli.js CHANGED
@@ -2,25 +2,82 @@
2
2
  import process from "process";
3
3
  import path from "path";
4
4
  import fs from "fs";
5
- import { contextDirname, importDefault } from "../lib/utils.js";
5
+ import logger from "loglevel";
6
6
  import yargs from "yargs";
7
7
  import { hideBin } from "yargs/helpers";
8
+ import chalk from "chalk";
8
9
 
10
+ import { contextDirname, importDefault } from "../lib/utils.js";
9
11
  import Env from "../lib/env.js";
10
12
  import { boxCommand } from "../lib/box/index.js";
13
+ import { lpkAppCommand, lpkProjectCommand } from "../lib/app/index.js";
11
14
  const pkgInfo = JSON.parse(
12
15
  fs.readFileSync(path.join(contextDirname(import.meta.url), "../package.json"))
13
16
  );
14
17
 
18
+ // logger level middleware
19
+ const logLevelOriginalFactory = logger.methodFactory;
20
+ logger.methodFactory = function (methodName, logLevel, loggerName) {
21
+ let rawMethod = logLevelOriginalFactory(methodName, logLevel, loggerName);
22
+ return function (...args) {
23
+ let color = (msg) => chalk.gray;
24
+ switch (methodName) {
25
+ case "trace":
26
+ color = chalk.dim.cyan;
27
+ break;
28
+ case "debug":
29
+ color = chalk.blue;
30
+ break;
31
+ case "info":
32
+ color = chalk.green;
33
+ break;
34
+ case "warn":
35
+ color = chalk.magenta;
36
+ break;
37
+ case "error":
38
+ color = chalk.bold.red;
39
+ break;
40
+ }
41
+ rawMethod(
42
+ `[${methodName}] ` +
43
+ args
44
+ .map((a) => {
45
+ let res = a;
46
+ if (typeof a == "object") {
47
+ res = JSON.stringify(a, undefined, 4);
48
+ }
49
+ return color(res);
50
+ })
51
+ .join(" ")
52
+ );
53
+ };
54
+ };
55
+ logger.setDefaultLevel("info");
56
+ function setLoggerLevel({ log }) {
57
+ logger.setLevel(log, false);
58
+ }
59
+
15
60
  const program = yargs(hideBin(process.argv))
16
61
  .scriptName("lzc-cli")
17
62
  .usage("<command> [options]")
18
63
  .version(`lzc-cli ${pkgInfo.version}`)
19
- .completion("completion", "生成bash/zsh补全脚本");
64
+ .option("log", {
65
+ type: "string",
66
+ default: "info",
67
+ describe: "log level 'trace', 'debug', 'info', 'warn', 'error'",
68
+ })
69
+ .option("help", {
70
+ alias: "h",
71
+ type: "boolean",
72
+ default: false,
73
+ })
74
+ .completion("completion", false);
20
75
 
76
+ // Set desc to false to create a hidden command. Hidden commands don’t show up
77
+ // in the help output and aren’t available for completion.
21
78
  program.command({
22
79
  command: "create <name>",
23
- desc: "创建懒猫云应用",
80
+ desc: false,
24
81
  aliases: ["c"],
25
82
  handler: async ({ name }) => {
26
83
  let create = await importDefault("../cmds/create.js");
@@ -30,7 +87,7 @@ program.command({
30
87
 
31
88
  program.command({
32
89
  command: "init",
33
- desc: "初始化懒猫云应用配置",
90
+ desc: false,
34
91
  handler: async () => {
35
92
  const { Init } = await import("../cmds/init.js");
36
93
  new Init({ cwd: process.cwd() }).create();
@@ -39,7 +96,7 @@ program.command({
39
96
 
40
97
  program.command({
41
98
  command: "uninstall",
42
- desc: "卸载应用",
99
+ desc: false,
43
100
  handler: async () => {
44
101
  const { uninstall } = await importDefault("../cmds/app.js");
45
102
  await uninstall();
@@ -48,7 +105,7 @@ program.command({
48
105
 
49
106
  program.command({
50
107
  command: "publish",
51
- desc: "发布应用",
108
+ desc: false,
52
109
  handler: async () => {
53
110
  // 第一步 打包镜像
54
111
  const Publisher = await importDefault("../cmds/publish.js");
@@ -64,7 +121,7 @@ program.command({
64
121
 
65
122
  program.command({
66
123
  command: "deploy",
67
- desc: "部署应用至设备",
124
+ desc: false,
68
125
  handler: async () => {
69
126
  const { deploy } = await importDefault("../cmds/app.js");
70
127
  await deploy();
@@ -73,7 +130,7 @@ program.command({
73
130
 
74
131
  program.command({
75
132
  command: "build [context]",
76
- desc: "构建",
133
+ desc: false,
77
134
  builder: (args) => {
78
135
  args.option("f", {
79
136
  alias: "file",
@@ -116,7 +173,7 @@ let devSubCommands = [
116
173
  ];
117
174
  program.command({
118
175
  command: "dev",
119
- desc: "dev [forward [addr] | shell]",
176
+ desc: false,
120
177
  builder: (args) => {
121
178
  args.command(devSubCommands);
122
179
  },
@@ -124,7 +181,7 @@ program.command({
124
181
 
125
182
  program.command({
126
183
  command: "log [project]",
127
- desc: "查看应用日志",
184
+ desc: false,
128
185
  builder: (args) => {
129
186
  args.option("u", {
130
187
  alias: "user",
@@ -141,7 +198,7 @@ program.command({
141
198
 
142
199
  program.command({
143
200
  command: "config [key] [value]",
144
- desc: "应用配置项",
201
+ desc: false,
145
202
  builder: (args) => {
146
203
  args.implies("key", "value");
147
204
  args.option("g", {
@@ -158,5 +215,27 @@ program.command({
158
215
  });
159
216
 
160
217
  boxCommand(program);
218
+ lpkAppCommand(program);
219
+ lpkProjectCommand(program);
220
+
221
+ const parser = program
222
+ .strict()
223
+ .showHelpOnFail(false, "使用 lzc-cli help 查看更多帮助")
224
+ .middleware([setLoggerLevel])
225
+ .parse();
161
226
 
162
- program.showHelpOnFail(false, "使用 lzc-cli help 查看更多帮助").parse();
227
+ // 当没有参数的时候,默认显示帮助。
228
+ (async () => {
229
+ const argv = await parser;
230
+ if (argv._.length == 1) {
231
+ switch (argv._[0]) {
232
+ case "box":
233
+ case "app":
234
+ case "project":
235
+ program.showHelp();
236
+ return;
237
+ }
238
+ } else if (argv._.length == 0) {
239
+ program.showHelp();
240
+ }
241
+ })();
@@ -1,8 +1,10 @@
1
- FROM node:16-alpine3.12
1
+ FROM registry.lazycat.cloud/lzc/lzcapp:0.1
2
2
 
3
3
  RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
4
4
 
5
- RUN apk add --no-cache openssh rsync \
5
+ COPY --from=golang:1.18-alpine /usr/local/go/ /usr/local/go/
6
+
7
+ RUN apk add --no-cache openssh rsync musl-dev curl openssl curl nodejs npm \
6
8
  && echo "root:root" | chpasswd
7
9
 
8
10
  EXPOSE 22
@@ -13,4 +15,4 @@ COPY entrypoint.sh /entrypoint.sh
13
15
 
14
16
  RUN chmod +x /entrypoint.sh
15
17
 
16
- ENTRYPOINT ["/entrypoint.sh"]
18
+ ENTRYPOINT ./entrypoint.sh
@@ -1,20 +1,10 @@
1
1
  services:
2
2
  ${APP_ID}:
3
- image: nginx:1.21.4-alpine
4
- volumes:
5
- - ./nginx.conf.template:/etc/nginx/templates/nginx.conf.template
6
- - ./50x.html:/etc/nginx/50x.html
7
- environment:
8
- - NGINX_ENVSUBST_OUTPUT_DIR=/etc/nginx
9
- - APP_DEBUG_PORT=${HTTP_SERVICE_PORT}
10
- - APP_DEBUG_SHELL=debug-shell.${APP_ID}.lzcapp
11
- command: [nginx, '-g', 'daemon off;']
12
- depends_on:
13
- - debug-shell
14
- debug-shell:
15
3
  image: ${APP_IMAGE_NAME}
16
4
  pull_policy: build
17
5
  build: .
6
+ environment:
7
+ - HTTP_SERVICE_PORT=${HTTP_SERVICE_PORT}
18
8
  volumes:
19
9
  - ./debug/ssh:/root/.ssh
20
10
  - project-data:/root/
@@ -7,4 +7,6 @@ ssh-keygen -A
7
7
  rsync --daemon
8
8
 
9
9
  # do not detach (-D), log to stderr (-e), passthrough other arguments
10
- exec /usr/sbin/sshd -D -e "$@"
10
+ /usr/sbin/sshd -e "$@"
11
+
12
+ exec /usr/bin/lzcinit -listen :$HTTP_SERVICE_PORT -up /="http://127.0.0.1:3000"
@@ -0,0 +1,8 @@
1
+ FROM alpine:3.16
2
+
3
+ RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
4
+
5
+ RUN apk add --no-cache bash ${dependencies} \
6
+ && echo "root:root" | chpasswd
7
+
8
+ CMD ["sleep", "infinity"]
@@ -0,0 +1,18 @@
1
+ FROM alpine
2
+
3
+ RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
4
+
5
+ COPY --from=golang:1.18-alpine /usr/local/go/ /usr/local/go/
6
+
7
+ RUN apk add --no-cache openssh musl-dev curl openssl curl nodejs npm sshfs rsync \
8
+ && echo "root:root" | chpasswd
9
+
10
+ EXPOSE 22
11
+
12
+ COPY sshd_config /etc/ssh/sshd_config
13
+
14
+ COPY entrypoint.sh /entrypoint.sh
15
+
16
+ RUN chmod +x /entrypoint.sh
17
+
18
+ CMD ["./entrypoint.sh"]
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/sh
2
+
3
+ VERSION=0.0.4
4
+ docker build -f Dockerfile . -t registry.lazycat.cloud/lzc-cli/devshell:$VERSION
5
+ docker push registry.lazycat.cloud/lzc-cli/devshell:$VERSION
@@ -0,0 +1,8 @@
1
+ #!/bin/sh
2
+ set -ex
3
+
4
+ # generate host keys if not present
5
+ ssh-keygen -A
6
+
7
+ # do not detach (-D), log to stderr (-e), passthrough other arguments
8
+ exec /usr/sbin/sshd -D -e "$@"
@@ -0,0 +1,117 @@
1
+ # $OpenBSD: sshd_config,v 1.104 2021/07/02 05:11:21 dtucker Exp $
2
+
3
+ # This is the sshd server system-wide configuration file. See
4
+ # sshd_config(5) for more information.
5
+
6
+ # This sshd was compiled with PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
7
+
8
+ # The strategy used for options in the default sshd_config shipped with
9
+ # OpenSSH is to specify options with their default value where
10
+ # possible, but leave them commented. Uncommented options override the
11
+ # default value.
12
+
13
+ # Port 22
14
+ #AddressFamily any
15
+ #ListenAddress 0.0.0.0
16
+ #ListenAddress ::
17
+
18
+ #HostKey /etc/ssh/ssh_host_rsa_key
19
+ #HostKey /etc/ssh/ssh_host_ecdsa_key
20
+ #HostKey /etc/ssh/ssh_host_ed25519_key
21
+
22
+ # Ciphers and keying
23
+ #RekeyLimit default none
24
+
25
+ # Logging
26
+ #SyslogFacility AUTH
27
+ #LogLevel INFO
28
+
29
+ # Authentication:
30
+
31
+ #LoginGraceTime 2m
32
+ PermitRootLogin yes
33
+ #StrictModes yes
34
+ #MaxAuthTries 6
35
+ #MaxSessions 10
36
+
37
+ PubkeyAuthentication yes
38
+
39
+ # The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
40
+ # but this is overridden so installations will only check .ssh/authorized_keys
41
+ AuthorizedKeysFile /lzcapp/pkg/content/devshell/authorized_keys
42
+
43
+ #AuthorizedPrincipalsFile none
44
+
45
+ #AuthorizedKeysCommand none
46
+ #AuthorizedKeysCommandUser nobody
47
+
48
+ # For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
49
+ #HostbasedAuthentication no
50
+ # Change to yes if you don't trust ~/.ssh/known_hosts for
51
+ # HostbasedAuthentication
52
+ #IgnoreUserKnownHosts no
53
+ # Don't read the user's ~/.rhosts and ~/.shosts files
54
+ #IgnoreRhosts yes
55
+
56
+ # To disable tunneled clear text passwords, change to no here!
57
+ PasswordAuthentication no
58
+ PermitEmptyPasswords no
59
+
60
+ # Change to no to disable s/key passwords
61
+ #KbdInteractiveAuthentication yes
62
+
63
+ # Kerberos options
64
+ #KerberosAuthentication no
65
+ #KerberosOrLocalPasswd yes
66
+ #KerberosTicketCleanup yes
67
+ #KerberosGetAFSToken no
68
+
69
+ # GSSAPI options
70
+ #GSSAPIAuthentication no
71
+ #GSSAPICleanupCredentials yes
72
+
73
+ # Set this to 'yes' to enable PAM authentication, account processing,
74
+ # and session processing. If this is enabled, PAM authentication will
75
+ # be allowed through the KbdInteractiveAuthentication and
76
+ # PasswordAuthentication. Depending on your PAM configuration,
77
+ # PAM authentication via KbdInteractiveAuthentication may bypass
78
+ # the setting of "PermitRootLogin without-password".
79
+ # If you just want the PAM account and session checks to run without
80
+ # PAM authentication, then enable this but set PasswordAuthentication
81
+ # and KbdInteractiveAuthentication to 'no'.
82
+ #UsePAM no
83
+
84
+ #AllowAgentForwarding yes
85
+ # Feel free to re-enable these if your use case requires them.
86
+ AllowTcpForwarding yes
87
+ GatewayPorts yes
88
+ X11Forwarding no
89
+ #X11DisplayOffset 10
90
+ #X11UseLocalhost yes
91
+ #PermitTTY yes
92
+ #PrintMotd yes
93
+ #PrintLastLog yes
94
+ #TCPKeepAlive yes
95
+ #PermitUserEnvironment no
96
+ #Compression delayed
97
+ ClientAliveInterval 3
98
+ ClientAliveCountMax 0
99
+ #UseDNS no
100
+ #PidFile /run/sshd.pid
101
+ #MaxStartups 10:30:100
102
+ #PermitTunnel no
103
+ #ChrootDirectory none
104
+ #VersionAddendum none
105
+
106
+ # no default banner path
107
+ #Banner none
108
+
109
+ # override default of no subsystems
110
+ Subsystem sftp /usr/lib/ssh/sftp-server
111
+
112
+ # Example of overriding settings on a per-user basis
113
+ #Match User anoncvs
114
+ # X11Forwarding no
115
+ # AllowTcpForwarding no
116
+ # PermitTTY no
117
+ # ForceCommand cvs server
@@ -0,0 +1,17 @@
1
+ lzc-sdk-version: 0.1
2
+
3
+ package: ${package} # app的唯一标识符
4
+ version: ${version} # app的版本
5
+ name: ${name} # app名称
6
+ description: ${description} # app描述
7
+ icon: ./icon.svg #必须是当前pkg内路径,会提供给启动器等地方使用
8
+
9
+ license: https://choosealicense.com/licenses/mit/
10
+ homepage: ${homepage} # 出现bug时候提交反馈的地方
11
+ author: ${author} # app author
12
+
13
+ #application作为一个特殊的container运行,对应的service名称为固定的`app`,其他service可以通过此名称与app进行通讯
14
+ application:
15
+ subdomain: ${subdomain} #期望的app域名
16
+ routes:
17
+ - /=file:///lzcapp/pkg/content/
@@ -0,0 +1,16 @@
1
+ FROM alpine
2
+
3
+ RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
4
+
5
+ RUN apk add --no-cache openssh openssl sshfs rsync \
6
+ && echo "root:root" | chpasswd
7
+
8
+ EXPOSE 22
9
+
10
+ COPY sshd_config /etc/ssh/sshd_config
11
+
12
+ COPY entrypoint.sh /entrypoint.sh
13
+
14
+ RUN chmod +x /entrypoint.sh
15
+
16
+ CMD ["./entrypoint.sh"]