@paralect/hive 0.1.50-alpha.3 → 0.1.50
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.
- package/.claude/settings.local.json +13 -0
- package/cli/helpers/execCommand.js +10 -10
- package/cli/helpers/isProjectInit.js +3 -3
- package/cli/helpers/mergeDirs.js +1 -1
- package/cli/hive.js +105 -105
- package/{test-app → framework}/.cursor/commands/add-service.md +6 -6
- package/{test-app → framework}/.cursor/skills/hive-overview/SKILL.md +1 -1
- package/{test-app → framework}/.cursor/skills/hive-service/SKILL.md +2 -2
- package/framework/bin/start.sh +2 -0
- package/{.hive/bootstrap-hive.js → framework/bootstrap-hive.ts} +4 -4
- package/{.hive → framework}/package-lock.json +212 -156
- package/framework/package.json +42 -0
- package/{.hive/src/app.js → framework/src/app.ts} +1 -1
- package/{.hive/src/bullMqBus.js → framework/src/bullMqBus.ts} +1 -1
- package/{.hive/src/bullMqWrapper.js → framework/src/bullMqWrapper.ts} +1 -1
- package/{.hive/src/app-config/index.js → framework/src/config/index.ts} +7 -7
- package/{.hive/src/db.js → framework/src/db.ts} +21 -6
- package/framework/src/endpoint.ts +132 -0
- package/framework/src/helpers/generateDbTypes.ts +47 -0
- package/{.hive/src/helpers/getMiddlewares.js → framework/src/helpers/getMiddlewares.ts} +1 -1
- package/{.hive/src/helpers/getResourceEndpoints.js → framework/src/helpers/getResourceEndpoints.ts} +8 -8
- package/{.hive/src/helpers/getResources.js → framework/src/helpers/getResources.ts} +1 -1
- package/{.hive/src/helpers/getSchemas.js → framework/src/helpers/getSchemas.ts} +13 -13
- package/framework/src/index.ts +3 -0
- package/{.hive/src/ioEmitter.js → framework/src/ioEmitter.ts} +1 -1
- package/{.hive/src/lib/node-mongo/src/mongo-query-service.js → framework/src/lib/node-mongo/src/mongo-query-service.ts} +18 -7
- package/{.hive/src/lib/node-mongo/src/mongo-service.js → framework/src/lib/node-mongo/src/mongo-service.ts} +17 -9
- package/{starter/src/logger.js → framework/src/logger.ts} +4 -3
- package/{.hive/src/migrations/migrations-log/migration-log.schema.js → framework/src/migrations/migrations-log/migration-log.schema.ts} +1 -1
- package/{.hive/src/migrations/migrations-log/migration-log.service.js → framework/src/migrations/migrations-log/migration-log.service.ts} +1 -1
- package/{.hive/src/migrations/migrations.schema.js → framework/src/migrations/migrations.schema.ts} +1 -1
- package/{.hive/src/resources/_dev/endpoints/triggerSchedulerHandler.js → framework/src/resources/_dev/endpoints/triggerSchedulerHandler.ts} +2 -1
- package/framework/src/resources/health/endpoints/get.ts +14 -0
- package/{.hive/src/resources/schemaMappings/schemaMappings.schema.js → framework/src/resources/schemaMappings/schemaMappings.schema.ts} +1 -1
- package/{.hive/src/routes/index.js → framework/src/routes/index.ts} +23 -27
- package/framework/src/schema.ts +3 -0
- package/{.hive/src/services/emailService.js → framework/src/services/emailService.ts} +1 -1
- package/{.hive/src/socketIo.js → framework/src/socketIo.ts} +1 -1
- package/{.hive → framework}/tsconfig.json +17 -13
- package/package.json +43 -51
- package/starter/hive/autoMap/schemaMappings.json +1 -0
- package/starter/hive/config/.env.example +11 -0
- package/starter/hive/config/app.ts +19 -0
- package/{.hive/src/services/setCookie.js → starter/hive/helpers/setCookie.ts} +1 -2
- package/starter/hive/middlewares/_global.ts +9 -0
- package/{.hive/src/middlewares/attachUser.js → starter/hive/middlewares/attachUser.ts} +2 -2
- package/{.hive/src/middlewares/shouldExist.js → starter/hive/middlewares/shouldExist.ts} +1 -1
- package/{.hive/src/middlewares/shouldNotExist.js → starter/hive/middlewares/shouldNotExist.ts} +1 -1
- package/starter/hive/resources/files/endpoints/upload.ts +25 -0
- package/starter/hive/resources/files/files.schema.ts +20 -0
- package/{.hive/src/resources/tokens/methods/storeToken.js → starter/hive/resources/tokens/methods/storeToken.ts} +3 -3
- package/{.hive/src/resources/tokens/tokens.schema.js → starter/hive/resources/tokens/tokens.schema.ts} +1 -2
- package/starter/hive/resources/users/endpoints/getCurrentUser.ts +12 -0
- package/starter/hive/resources/users/endpoints/getUserProfile.ts +17 -0
- package/{.hive/src/resources/users/users.schema.js → starter/hive/resources/users/users.schema.ts} +1 -2
- package/starter/hive/services/cloudStorage.ts +102 -0
- package/starter/package.json +9 -98
- package/starter/tsconfig.json +16 -20
- package/.cursor/commands/deslop.md +0 -12
- package/.hive/.cursor/commands/add-service.md +0 -188
- package/.hive/.cursor/skills/hive-overview/SKILL.md +0 -50
- package/.hive/.cursor/skills/hive-service/SKILL.md +0 -90
- package/.hive/bin/start.sh +0 -2
- package/.hive/package.json +0 -98
- package/.hive/src/logger.js +0 -43
- package/.hive/src/middlewares/global/tryToAttachUser.js +0 -33
- package/.hive/src/resources/health/endpoints/get.js +0 -19
- package/.hive/src/resources/tokens/methods/setToken.js +0 -8
- package/.hive/src/resources/users/endpoints/getCurrentUser.js +0 -14
- package/.hive/src/resources/users/endpoints/getUserProfile.js +0 -19
- package/.hive/src/resources/users/methods/ensureUserCreated.js +0 -68
- package/.hive/src/security.util.js +0 -38
- package/.hive/src/services/globalTest.js +0 -0
- package/cli/helpers/docker.js +0 -59
- package/cli/helpers/envCheck.js +0 -127
- package/cli/helpers/findPort.js +0 -32
- package/starter/.babelrc +0 -6
- package/starter/.cursor/commands/add-endpoint.md +0 -262
- package/starter/.cursor/commands/add-handler.md +0 -137
- package/starter/.cursor/commands/add-middleware.md +0 -95
- package/starter/.cursor/commands/add-resource.md +0 -71
- package/starter/.cursor/commands/add-scheduler.md +0 -138
- package/starter/.cursor/commands/add-service.md +0 -188
- package/starter/.cursor/skills/hive-auth/SKILL.md +0 -134
- package/starter/.cursor/skills/hive-database/SKILL.md +0 -103
- package/starter/.cursor/skills/hive-endpoint/SKILL.md +0 -103
- package/starter/.cursor/skills/hive-handler/SKILL.md +0 -88
- package/starter/.cursor/skills/hive-mapping/SKILL.md +0 -85
- package/starter/.cursor/skills/hive-middleware/SKILL.md +0 -104
- package/starter/.cursor/skills/hive-overview/SKILL.md +0 -50
- package/starter/.cursor/skills/hive-scheduler/SKILL.md +0 -94
- package/starter/.cursor/skills/hive-schema/SKILL.md +0 -73
- package/starter/.cursor/skills/hive-service/SKILL.md +0 -90
- package/starter/.dockerignore +0 -1
- package/starter/Dockerfile +0 -22
- package/starter/Dockerfile.dev +0 -33
- package/starter/Dockerfile.prod +0 -29
- package/starter/README.md +0 -11
- package/starter/bin/deploy.sh +0 -5
- package/starter/bin/start.sh +0 -2
- package/starter/bootstrap-hive.js +0 -118
- package/starter/deploy/api/Chart.yaml +0 -6
- package/starter/deploy/api/staging.yaml +0 -3
- package/starter/deploy/api/templates/deployment.yaml +0 -44
- package/starter/deploy/api/templates/ingress.yaml +0 -26
- package/starter/deploy/api/templates/service.yaml +0 -14
- package/starter/deploy/script/Dockerfile +0 -39
- package/starter/deploy/script/package-lock.json +0 -1499
- package/starter/deploy/script/package.json +0 -12
- package/starter/deploy/script/src/config.js +0 -48
- package/starter/deploy/script/src/index.js +0 -108
- package/starter/deploy/script/src/util.js +0 -19
- package/starter/initial-data.json +0 -176
- package/starter/loader.mjs +0 -40
- package/starter/package-lock.json +0 -13492
- package/starter/register.mjs +0 -6
- package/starter/ship_logo.png +0 -0
- package/starter/src/app-config/app.js +0 -3
- package/starter/src/app-config/assertEnv.js +0 -15
- package/starter/src/app-config/index.js +0 -65
- package/starter/src/app.js +0 -65
- package/starter/src/assets/emails/components/header.mjml +0 -13
- package/starter/src/assets/emails/dist/.gitkeep +0 -0
- package/starter/src/assets/emails/signup-welcome.mjml +0 -34
- package/starter/src/assets/emails/styles/index.mjml +0 -77
- package/starter/src/autoMap/addHandlers.js +0 -142
- package/starter/src/autoMap/getDependentFields.js +0 -37
- package/starter/src/autoMap/mapSchema.js +0 -99
- package/starter/src/autoMap/schemaMappings.js +0 -13
- package/starter/src/autoMap/schemaMappings.json +0 -3
- package/starter/src/bullMqBus.js +0 -21
- package/starter/src/bullMqWrapper.js +0 -23
- package/starter/src/db.js +0 -53
- package/starter/src/emails/MyEmailComponent.jsx +0 -14
- package/starter/src/emails/compiled/MyEmailComponent.js +0 -6
- package/starter/src/emails/compiled/compiled/MyEmailComponent.js +0 -6
- package/starter/src/emails/compiled/compiled/compiled/MyEmailComponent.js +0 -6
- package/starter/src/emails/compiled/compiled/compiled/compiled/MyEmailComponent.js +0 -6
- package/starter/src/helpers/db/ifUpdated.js +0 -22
- package/starter/src/helpers/esm.js +0 -56
- package/starter/src/helpers/getMiddlewares.js +0 -41
- package/starter/src/helpers/getResourceEndpoints.js +0 -31
- package/starter/src/helpers/getResources.js +0 -35
- package/starter/src/helpers/getSchemas.js +0 -53
- package/starter/src/helpers/importHandlers.js +0 -20
- package/starter/src/helpers/isZodArray.js +0 -13
- package/starter/src/helpers/prettierFormat.js +0 -8
- package/starter/src/helpers/schema/db.schema.js +0 -9
- package/starter/src/helpers/schema/pagination.schema.js +0 -14
- package/starter/src/ioEmitter.js +0 -9
- package/starter/src/jsconfig.json +0 -5
- package/starter/src/lib/node-mongo/.github/workflows/npm-publish.yml +0 -32
- package/starter/src/lib/node-mongo/API.md +0 -654
- package/starter/src/lib/node-mongo/CHANGELOG.md +0 -98
- package/starter/src/lib/node-mongo/README.md +0 -97
- package/starter/src/lib/node-mongo/package-lock.json +0 -3682
- package/starter/src/lib/node-mongo/package.json +0 -74
- package/starter/src/lib/node-mongo/src/index.js +0 -64
- package/starter/src/lib/node-mongo/src/mongo-query-service.js +0 -78
- package/starter/src/lib/node-mongo/src/mongo-service-error.js +0 -15
- package/starter/src/lib/node-mongo/src/mongo-service.js +0 -303
- package/starter/src/middlewares/attachUser.js +0 -41
- package/starter/src/middlewares/global/extractUserTokens.js +0 -15
- package/starter/src/middlewares/global/tryToAttachUser.js +0 -33
- package/starter/src/middlewares/isAuthorized.js +0 -18
- package/starter/src/middlewares/shouldExist.js +0 -37
- package/starter/src/middlewares/shouldNotExist.js +0 -19
- package/starter/src/middlewares/uploadFile.js +0 -5
- package/starter/src/middlewares/validate.js +0 -32
- package/starter/src/migrations/migration.js +0 -8
- package/starter/src/migrations/migration.service.js +0 -76
- package/starter/src/migrations/migrations/1.js +0 -22
- package/starter/src/migrations/migrations-log/migration-log.schema.js +0 -13
- package/starter/src/migrations/migrations-log/migration-log.service.js +0 -50
- package/starter/src/migrations/migrations.schema.js +0 -6
- package/starter/src/migrations/migrator.js +0 -75
- package/starter/src/migrator.js +0 -3
- package/starter/src/resources/_dev/endpoints/triggerSchedulerHandler.js +0 -32
- package/starter/src/resources/health/endpoints/get.js +0 -19
- package/starter/src/resources/schemaMappings/schemaMappings.schema.js +0 -6
- package/starter/src/resources/tokens/methods/generateSecureToken.js +0 -9
- package/starter/src/resources/tokens/methods/setToken.js +0 -8
- package/starter/src/resources/tokens/methods/storeToken.js +0 -35
- package/starter/src/resources/tokens/tokens.schema.js +0 -11
- package/starter/src/resources/users/endpoints/getCurrentUser.js +0 -14
- package/starter/src/resources/users/endpoints/getUserProfile.js +0 -19
- package/starter/src/resources/users/handlers/test.js +0 -1
- package/starter/src/resources/users/methods/ensureUserCreated.js +0 -68
- package/starter/src/resources/users/users.schema.js +0 -16
- package/starter/src/routes/index.js +0 -172
- package/starter/src/routes/middlewares/attachCustomErrors.js +0 -28
- package/starter/src/routes/middlewares/routeErrorHandler.js +0 -27
- package/starter/src/scheduler.js +0 -35
- package/starter/src/security.util.js +0 -38
- package/starter/src/services/emailService.js +0 -15
- package/starter/src/services/globalTest.js +0 -0
- package/starter/src/services/setCookie.js +0 -21
- package/starter/src/socketIo.js +0 -99
- package/test-app/.cursor/commands/add-endpoint.md +0 -262
- package/test-app/.cursor/commands/add-handler.md +0 -137
- package/test-app/.cursor/commands/add-middleware.md +0 -95
- package/test-app/.cursor/commands/add-resource.md +0 -71
- package/test-app/.cursor/commands/add-scheduler.md +0 -138
- package/test-app/.cursor/skills/hive-auth/SKILL.md +0 -134
- package/test-app/.cursor/skills/hive-database/SKILL.md +0 -103
- package/test-app/.cursor/skills/hive-endpoint/SKILL.md +0 -103
- package/test-app/.cursor/skills/hive-handler/SKILL.md +0 -88
- package/test-app/.cursor/skills/hive-mapping/SKILL.md +0 -85
- package/test-app/.cursor/skills/hive-middleware/SKILL.md +0 -104
- package/test-app/.cursor/skills/hive-scheduler/SKILL.md +0 -94
- package/test-app/.cursor/skills/hive-schema/SKILL.md +0 -73
- package/test-app/package-lock.json +0 -462
- package/test-app/package.json +0 -25
- package/test-app/src/resources/tasks/tasks.schema.js +0 -2
- /package/{.hive → framework}/.babelrc +0 -0
- /package/{.hive → framework}/.cursor/commands/add-endpoint.md +0 -0
- /package/{.hive → framework}/.cursor/commands/add-handler.md +0 -0
- /package/{.hive → framework}/.cursor/commands/add-middleware.md +0 -0
- /package/{.hive → framework}/.cursor/commands/add-resource.md +0 -0
- /package/{.hive → framework}/.cursor/commands/add-scheduler.md +0 -0
- /package/{.hive → framework}/.cursor/skills/hive-auth/SKILL.md +0 -0
- /package/{.hive → framework}/.cursor/skills/hive-database/SKILL.md +0 -0
- /package/{.hive → framework}/.cursor/skills/hive-endpoint/SKILL.md +0 -0
- /package/{.hive → framework}/.cursor/skills/hive-handler/SKILL.md +0 -0
- /package/{.hive → framework}/.cursor/skills/hive-mapping/SKILL.md +0 -0
- /package/{.hive → framework}/.cursor/skills/hive-middleware/SKILL.md +0 -0
- /package/{.hive → framework}/.cursor/skills/hive-scheduler/SKILL.md +0 -0
- /package/{.hive → framework}/.cursor/skills/hive-schema/SKILL.md +0 -0
- /package/{.hive → framework}/.dockerignore +0 -0
- /package/{.hive → framework}/Dockerfile +0 -0
- /package/{.hive → framework}/Dockerfile.dev +0 -0
- /package/{.hive → framework}/Dockerfile.prod +0 -0
- /package/{.hive → framework}/README.md +0 -0
- /package/{.hive → framework}/bin/deploy.sh +0 -0
- /package/{.hive → framework}/deploy/api/Chart.yaml +0 -0
- /package/{.hive → framework}/deploy/api/staging.yaml +0 -0
- /package/{.hive → framework}/deploy/api/templates/deployment.yaml +0 -0
- /package/{.hive → framework}/deploy/api/templates/ingress.yaml +0 -0
- /package/{.hive → framework}/deploy/api/templates/service.yaml +0 -0
- /package/{.hive → framework}/deploy/script/Dockerfile +0 -0
- /package/{.hive → framework}/deploy/script/package-lock.json +0 -0
- /package/{.hive → framework}/deploy/script/package.json +0 -0
- /package/{.hive/deploy/script/src/config.js → framework/deploy/script/src/config.ts} +0 -0
- /package/{.hive/deploy/script/src/index.js → framework/deploy/script/src/index.ts} +0 -0
- /package/{.hive/deploy/script/src/util.js → framework/deploy/script/src/util.ts} +0 -0
- /package/{.hive → framework}/initial-data.json +0 -0
- /package/{.hive → framework}/ship_logo.png +0 -0
- /package/{.hive → framework}/src/assets/emails/components/header.mjml +0 -0
- /package/{.hive → framework}/src/assets/emails/dist/.gitkeep +0 -0
- /package/{.hive → framework}/src/assets/emails/signup-welcome.mjml +0 -0
- /package/{.hive → framework}/src/assets/emails/styles/index.mjml +0 -0
- /package/{.hive/src/autoMap/addHandlers.js → framework/src/autoMap/addHandlers.ts} +0 -0
- /package/{.hive/src/autoMap/getDependentFields.js → framework/src/autoMap/getDependentFields.ts} +0 -0
- /package/{.hive/src/autoMap/mapSchema.js → framework/src/autoMap/mapSchema.ts} +0 -0
- /package/{.hive → framework}/src/autoMap/schemaMappings.json +0 -0
- /package/{.hive/src/autoMap/schemaMappings.js → framework/src/autoMap/schemaMappings.ts} +0 -0
- /package/{.hive/src/helpers/schema/db.schema.js → framework/src/common/schema/db.schema.ts} +0 -0
- /package/{.hive/src/helpers/schema/pagination.schema.js → framework/src/common/schema/pagination.schema.ts} +0 -0
- /package/{.hive/src/app-config/app.js → framework/src/config/app.ts} +0 -0
- /package/{.hive/src/app-config/assertEnv.js → framework/src/config/assertEnv.ts} +0 -0
- /package/{.hive/src/emails/MyEmailComponent.jsx → framework/src/emails/MyEmailComponent.tsx} +0 -0
- /package/{.hive/src/emails/compiled/MyEmailComponent.js → framework/src/emails/compiled/MyEmailComponent.ts} +0 -0
- /package/{.hive/src/emails/compiled/compiled/MyEmailComponent.js → framework/src/emails/compiled/compiled/MyEmailComponent.ts} +0 -0
- /package/{.hive/src/helpers/db/ifUpdated.js → framework/src/helpers/db/ifUpdated.ts} +0 -0
- /package/{.hive/src/helpers/importHandlers.js → framework/src/helpers/importHandlers.ts} +0 -0
- /package/{.hive/src/helpers/isZodArray.js → framework/src/helpers/isZodArray.ts} +0 -0
- /package/{.hive/src/helpers/prettierFormat.js → framework/src/helpers/prettierFormat.ts} +0 -0
- /package/{.hive → framework}/src/jsconfig.json +0 -0
- /package/{.hive → framework}/src/lib/node-mongo/.github/workflows/npm-publish.yml +0 -0
- /package/{.hive → framework}/src/lib/node-mongo/API.md +0 -0
- /package/{.hive → framework}/src/lib/node-mongo/CHANGELOG.md +0 -0
- /package/{.hive → framework}/src/lib/node-mongo/README.md +0 -0
- /package/{.hive → framework}/src/lib/node-mongo/package-lock.json +0 -0
- /package/{.hive → framework}/src/lib/node-mongo/package.json +0 -0
- /package/{.hive/src/lib/node-mongo/src/index.js → framework/src/lib/node-mongo/src/index.ts} +0 -0
- /package/{.hive/src/lib/node-mongo/src/mongo-service-error.js → framework/src/lib/node-mongo/src/mongo-service-error.ts} +0 -0
- /package/{.hive/src/middlewares/allowNoAuth.js → framework/src/middlewares/allowNoAuth.ts} +0 -0
- /package/{.hive/src/middlewares/global/extractUserTokens.js → framework/src/middlewares/global/extractUserTokens.ts} +0 -0
- /package/{.hive/src/middlewares/validate.js → framework/src/middlewares/validate.ts} +0 -0
- /package/{.hive/src/migrations/migration.service.js → framework/src/migrations/migration.service.ts} +0 -0
- /package/{.hive/src/migrations/migration.js → framework/src/migrations/migration.ts} +0 -0
- /package/{.hive/src/migrations/migrations/1.js → framework/src/migrations/migrations/1.ts} +0 -0
- /package/{.hive/src/migrations/migrator.js → framework/src/migrations/migrator.ts} +0 -0
- /package/{.hive/src/migrator.js → framework/src/migrator.ts} +0 -0
- /package/{.hive/src/routes/middlewares/attachCustomErrors.js → framework/src/routes/middlewares/attachCustomErrors.ts} +0 -0
- /package/{.hive/src/routes/middlewares/routeErrorHandler.js → framework/src/routes/middlewares/routeErrorHandler.ts} +0 -0
- /package/{.hive/src/scheduler/handlers/sendDailyReport.example.js → framework/src/scheduler/handlers/sendDailyReport.example.ts} +0 -0
- /package/{.hive/src/scheduler.js → framework/src/scheduler.ts} +0 -0
- /package/starter/{src/middlewares/allowNoAuth.js → hive/middlewares/allowNoAuth.ts} +0 -0
- /package/{.hive/src/middlewares/isAuthorized.js → starter/hive/middlewares/isAuthorized.ts} +0 -0
- /package/{.hive/src/middlewares/uploadFile.js → starter/hive/middlewares/uploadFile.ts} +0 -0
- /package/{.hive/src/resources/tokens/methods/generateSecureToken.js → starter/hive/resources/tokens/methods/generateSecureToken.ts} +0 -0
- /package/{.hive/src/resources/users/handlers/test.js → starter/hive/resources/users/handlers/test.ts} +0 -0
- /package/starter/{src/scheduler/handlers/sendDailyReport.example.js → hive/scheduler/handlers/dailyExample.ts} +0 -0
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: hive-scheduler
|
|
3
|
-
description: How to create scheduled jobs in Hive framework
|
|
4
|
-
globs:
|
|
5
|
-
- src/scheduler/handlers/*.js
|
|
6
|
-
alwaysApply: false
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# Scheduler Jobs
|
|
10
|
-
|
|
11
|
-
Background jobs on cron schedules.
|
|
12
|
-
|
|
13
|
-
Location: `/src/scheduler/handlers/{jobName}.js`
|
|
14
|
-
|
|
15
|
-
## Template
|
|
16
|
-
|
|
17
|
-
```javascript
|
|
18
|
-
import db from 'db';
|
|
19
|
-
|
|
20
|
-
export const handler = async () => {
|
|
21
|
-
// Job logic
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const cron = '0 * * * *'; // Every hour
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## Cron Patterns
|
|
28
|
-
|
|
29
|
-
```
|
|
30
|
-
┌─ minute (0-59)
|
|
31
|
-
│ ┌─ hour (0-23)
|
|
32
|
-
│ │ ┌─ day of month (1-31)
|
|
33
|
-
│ │ │ ┌─ month (1-12)
|
|
34
|
-
│ │ │ │ ┌─ day of week (0-6)
|
|
35
|
-
* * * * *
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
| Pattern | Schedule |
|
|
39
|
-
|---------|----------|
|
|
40
|
-
| `* * * * *` | Every minute |
|
|
41
|
-
| `*/5 * * * *` | Every 5 minutes |
|
|
42
|
-
| `0 * * * *` | Every hour |
|
|
43
|
-
| `0 */12 * * *` | Every 12 hours |
|
|
44
|
-
| `0 0 * * *` | Daily at midnight |
|
|
45
|
-
| `0 9 * * 1` | Mondays at 9am |
|
|
46
|
-
|
|
47
|
-
## Examples
|
|
48
|
-
|
|
49
|
-
**Sync external data:**
|
|
50
|
-
```javascript
|
|
51
|
-
import db from 'db';
|
|
52
|
-
import moment from 'moment';
|
|
53
|
-
import externalApi from 'services/externalApi';
|
|
54
|
-
|
|
55
|
-
export const handler = async () => {
|
|
56
|
-
const items = await externalApi.list({
|
|
57
|
-
updatedSince: moment().subtract(5, 'minutes').toDate(),
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
for (const item of items) {
|
|
61
|
-
await db.services.items.updateOne(
|
|
62
|
-
{ externalId: item.id },
|
|
63
|
-
(doc) => ({ ...doc, ...item })
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export const cron = '*/5 * * * *';
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
**Mark overdue:**
|
|
72
|
-
```javascript
|
|
73
|
-
import db from 'db';
|
|
74
|
-
import moment from 'moment';
|
|
75
|
-
|
|
76
|
-
export const handler = async () => {
|
|
77
|
-
await db.services.invoices.updateMany(
|
|
78
|
-
{
|
|
79
|
-
isPaid: { $ne: true },
|
|
80
|
-
isDue: { $ne: true },
|
|
81
|
-
dueOn: { $lt: new Date() },
|
|
82
|
-
},
|
|
83
|
-
(doc) => ({ ...doc, isDue: true })
|
|
84
|
-
);
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
export const cron = '0 */12 * * *';
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
## Rules
|
|
91
|
-
|
|
92
|
-
- Export both `handler` and `cron`
|
|
93
|
-
- Keep jobs idempotent (safe to re-run)
|
|
94
|
-
- Log progress for debugging
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: hive-schema
|
|
3
|
-
description: How to create database schemas in Hive framework
|
|
4
|
-
globs:
|
|
5
|
-
- src/resources/**/*.schema.js
|
|
6
|
-
alwaysApply: false
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# Creating Database Schemas
|
|
10
|
-
|
|
11
|
-
Location: `/src/resources/{name}/{name}.schema.js`
|
|
12
|
-
|
|
13
|
-
## Template
|
|
14
|
-
|
|
15
|
-
```javascript
|
|
16
|
-
import { z } from 'zod';
|
|
17
|
-
import dbSchema from 'helpers/schema/db.schema.js';
|
|
18
|
-
|
|
19
|
-
const schema = dbSchema.extend({
|
|
20
|
-
// Fields here
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
export default schema;
|
|
24
|
-
|
|
25
|
-
export const secureFields = []; // Hidden from API responses
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Field Patterns
|
|
29
|
-
|
|
30
|
-
**Simple fields:**
|
|
31
|
-
```javascript
|
|
32
|
-
title: z.coerce.string().nullable().optional(),
|
|
33
|
-
count: z.coerce.number().nullable().optional(),
|
|
34
|
-
isActive: z.coerce.boolean().nullable().optional(),
|
|
35
|
-
dueOn: z.coerce.date().nullable().optional(),
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
**Reference to another document:**
|
|
39
|
-
```javascript
|
|
40
|
-
user: z
|
|
41
|
-
.object({
|
|
42
|
-
_id: z.string(),
|
|
43
|
-
fullName: z.coerce.string().nullable().optional(),
|
|
44
|
-
avatarUrl: z.coerce.string().nullable().optional(),
|
|
45
|
-
})
|
|
46
|
-
.nullable()
|
|
47
|
-
.optional(),
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
**Array of references:**
|
|
51
|
-
```javascript
|
|
52
|
-
managers: z
|
|
53
|
-
.array(
|
|
54
|
-
z.object({
|
|
55
|
-
_id: z.string(),
|
|
56
|
-
fullName: z.coerce.string().nullable().optional(),
|
|
57
|
-
}).nullable().optional(),
|
|
58
|
-
)
|
|
59
|
-
.nullable()
|
|
60
|
-
.optional(),
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
**Flexible object:**
|
|
64
|
-
```javascript
|
|
65
|
-
data: z.object({}).passthrough().nullable().optional(),
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
## Rules
|
|
69
|
-
|
|
70
|
-
- Always use `z.coerce` for type safety
|
|
71
|
-
- Always add `.nullable().optional()` unless required
|
|
72
|
-
- Include fields you need in references (for auto-sync)
|
|
73
|
-
- Add sensitive fields to `secureFields` array
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: hive-service
|
|
3
|
-
description: How to create external services in Hive framework
|
|
4
|
-
globs:
|
|
5
|
-
- src/services/*.js
|
|
6
|
-
alwaysApply: false
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# Services
|
|
10
|
-
|
|
11
|
-
Services wrap external APIs and utilities.
|
|
12
|
-
|
|
13
|
-
Location: `/src/services/{name}.js`
|
|
14
|
-
|
|
15
|
-
## API Client Template
|
|
16
|
-
|
|
17
|
-
```javascript
|
|
18
|
-
import config from 'app-config';
|
|
19
|
-
import axios from 'axios';
|
|
20
|
-
|
|
21
|
-
const client = axios.create({
|
|
22
|
-
baseURL: 'https://api.example.com',
|
|
23
|
-
headers: {
|
|
24
|
-
Authorization: `Bearer ${config.example.apiKey}`,
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
export default {
|
|
29
|
-
getItems: async (params) => {
|
|
30
|
-
const response = await client.get('/items', { params });
|
|
31
|
-
return response.data;
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
createItem: async (data) => {
|
|
35
|
-
const response = await client.post('/items', data);
|
|
36
|
-
return response.data;
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
## SDK Wrapper Template
|
|
42
|
-
|
|
43
|
-
```javascript
|
|
44
|
-
import config from 'app-config';
|
|
45
|
-
import { WebClient } from '@slack/web-api';
|
|
46
|
-
|
|
47
|
-
const client = new WebClient(config.slack.botToken);
|
|
48
|
-
|
|
49
|
-
export default {
|
|
50
|
-
client,
|
|
51
|
-
|
|
52
|
-
postMessage: async ({ channel, text }) => {
|
|
53
|
-
return client.chat.postMessage({ channel, text });
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
## Utility Service Template
|
|
59
|
-
|
|
60
|
-
```javascript
|
|
61
|
-
import _ from 'lodash';
|
|
62
|
-
|
|
63
|
-
export const when = (condition, result, elseResult = {}) => {
|
|
64
|
-
if (_.isUndefined(condition)) return {};
|
|
65
|
-
if (!condition) return elseResult;
|
|
66
|
-
return _.isFunction(result) ? result() : result;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export const base64 = {
|
|
70
|
-
encode: (obj) => Buffer.from(JSON.stringify(obj)).toString('base64'),
|
|
71
|
-
decode: (str) => JSON.parse(Buffer.from(str, 'base64').toString()),
|
|
72
|
-
};
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
## Using Services
|
|
76
|
-
|
|
77
|
-
```javascript
|
|
78
|
-
import harvest from 'services/harvest';
|
|
79
|
-
import slackService from 'services/slack';
|
|
80
|
-
import { when } from 'services/utils';
|
|
81
|
-
|
|
82
|
-
// API calls
|
|
83
|
-
const invoices = await harvest.getInvoices({ projectId });
|
|
84
|
-
|
|
85
|
-
// SDK usage
|
|
86
|
-
await slackService.postMessage({ channel: '#general', text: 'Hello' });
|
|
87
|
-
|
|
88
|
-
// Utilities
|
|
89
|
-
const query = { ...when(status, { status }) };
|
|
90
|
-
```
|
package/starter/.dockerignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
node_modules
|
package/starter/Dockerfile
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
FROM --platform=linux/amd64 node:16.13.1-alpine3.13 as base
|
|
2
|
-
RUN apk add --no-cache python3 py3-pip
|
|
3
|
-
|
|
4
|
-
ENV NODE_ENV=production
|
|
5
|
-
ENV APP_ENV=production
|
|
6
|
-
|
|
7
|
-
WORKDIR /app
|
|
8
|
-
EXPOSE 3001
|
|
9
|
-
COPY ["./package*.json", "/app/"]
|
|
10
|
-
|
|
11
|
-
RUN npm set progress=false && npm config set depth 0
|
|
12
|
-
|
|
13
|
-
RUN npm set-script prepare ""
|
|
14
|
-
|
|
15
|
-
RUN npm ci --only=production --quiet
|
|
16
|
-
|
|
17
|
-
COPY ./ ./
|
|
18
|
-
|
|
19
|
-
RUN mkdir -p /project/logs
|
|
20
|
-
RUN touch /project/logs/log.txt
|
|
21
|
-
|
|
22
|
-
CMD npm start 2>&1 | tee /project/logs/log.txt
|
package/starter/Dockerfile.dev
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
FROM node:16.13.1-alpine3.13 as base
|
|
2
|
-
RUN apk add --no-cache python3 py3-pip
|
|
3
|
-
|
|
4
|
-
ARG NODE_ENV=development
|
|
5
|
-
ARG APP_ENV
|
|
6
|
-
ARG PROJECT_SRC=/project
|
|
7
|
-
|
|
8
|
-
ENV NODE_ENV=$NODE_ENV
|
|
9
|
-
ENV APP_ENV=$APP_ENV
|
|
10
|
-
ENV PROJECT_SRC=$PROJECT_SRC
|
|
11
|
-
|
|
12
|
-
WORKDIR /app
|
|
13
|
-
COPY ["./package*.json", "/app/"]
|
|
14
|
-
# Disable husky
|
|
15
|
-
RUN npm set-script prepare ""
|
|
16
|
-
|
|
17
|
-
RUN npm ci --quiet
|
|
18
|
-
COPY . ./
|
|
19
|
-
|
|
20
|
-
RUN npm run build-assets
|
|
21
|
-
|
|
22
|
-
FROM base as migrator
|
|
23
|
-
CMD npm run migrate
|
|
24
|
-
|
|
25
|
-
FROM base as scheduler
|
|
26
|
-
CMD npm run schedule-dev
|
|
27
|
-
|
|
28
|
-
FROM base as api
|
|
29
|
-
|
|
30
|
-
EXPOSE 3001
|
|
31
|
-
EXPOSE 3012
|
|
32
|
-
|
|
33
|
-
CMD npm run dev 2>&1 | tee /logs/log.txt
|
package/starter/Dockerfile.prod
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
FROM node:16.13.1-alpine3.13 as base
|
|
2
|
-
RUN apk add --no-cache python3 py3-pip
|
|
3
|
-
|
|
4
|
-
ENV NODE_ENV=production
|
|
5
|
-
ENV APP_ENV=production
|
|
6
|
-
|
|
7
|
-
WORKDIR /app
|
|
8
|
-
EXPOSE 3001
|
|
9
|
-
COPY ["./package*.json", "./.eslintrc.js", "/app/"]
|
|
10
|
-
|
|
11
|
-
RUN npm set progress=false && npm config set depth 0
|
|
12
|
-
|
|
13
|
-
RUN npm set-script prepare ""
|
|
14
|
-
|
|
15
|
-
RUN npm ci --only=production --quiet
|
|
16
|
-
|
|
17
|
-
COPY ./ ./
|
|
18
|
-
|
|
19
|
-
RUN ls /app/src/config/.env
|
|
20
|
-
|
|
21
|
-
RUN rm /app/src/config/.env
|
|
22
|
-
RUN mv /app/src/config/.env.production /app/src/config/.env
|
|
23
|
-
|
|
24
|
-
RUN cat /app/src/config/.env
|
|
25
|
-
|
|
26
|
-
RUN mkdir -p /project/logs
|
|
27
|
-
RUN touch /project/logs/log.txt
|
|
28
|
-
|
|
29
|
-
CMD npm start 2>&1 | tee /project/logs/log.txt
|
package/starter/README.md
DELETED
package/starter/bin/deploy.sh
DELETED
package/starter/bin/start.sh
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
const fs = require("fs");
|
|
2
|
-
const path = require("path");
|
|
3
|
-
|
|
4
|
-
// Function to create directories recursively
|
|
5
|
-
function mkdirRecursive(dir) {
|
|
6
|
-
if (!fs.existsSync(dir)) {
|
|
7
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// Function to convert JSON schema to JavaScript code
|
|
12
|
-
function convertJsonToJs(schema) {
|
|
13
|
-
let jsCode = "const Joi = require('joi');\n\n";
|
|
14
|
-
jsCode += `const ${schema.name} = Joi.object({\n`;
|
|
15
|
-
for (const [key, value] of Object.entries(schema.schema)) {
|
|
16
|
-
if (typeof value === "object" && !Array.isArray(value)) {
|
|
17
|
-
jsCode += ` ${key}: Joi.object({\n`;
|
|
18
|
-
for (const [subKey, subValue] of Object.entries(value)) {
|
|
19
|
-
jsCode += ` ${subKey}: ${subValue},\n`;
|
|
20
|
-
}
|
|
21
|
-
jsCode += ` }),\n`;
|
|
22
|
-
} else {
|
|
23
|
-
jsCode += ` ${key}: ${value},\n`;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
jsCode += "});\n\n";
|
|
27
|
-
jsCode += `module.exports = ${schema.name};\n`;
|
|
28
|
-
return jsCode;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Function to generate endpoint code
|
|
32
|
-
function createEndpointCode(endpoint) {
|
|
33
|
-
let requestSchema = "const Joi = require('joi');\n\n";
|
|
34
|
-
requestSchema += "module.exports.requestSchema = Joi.object({\n";
|
|
35
|
-
for (const [key, value] of Object.entries(endpoint.requestSchema)) {
|
|
36
|
-
requestSchema += ` ${key}: ${value},\n`;
|
|
37
|
-
}
|
|
38
|
-
requestSchema += "});\n\n";
|
|
39
|
-
|
|
40
|
-
return `
|
|
41
|
-
${endpoint.handler}
|
|
42
|
-
|
|
43
|
-
${requestSchema}
|
|
44
|
-
module.exports.endpoint = ${JSON.stringify(endpoint.endpoint, null, 2)};
|
|
45
|
-
`;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Main function to generate the project structure
|
|
49
|
-
function generateProjectStructure(resources) {
|
|
50
|
-
resources.forEach((resource) => {
|
|
51
|
-
const resourceDir = path.join(__dirname, "src", "resources", resource.name);
|
|
52
|
-
mkdirRecursive(resourceDir);
|
|
53
|
-
|
|
54
|
-
// Create schemas directory and files
|
|
55
|
-
if (resource.schemas) {
|
|
56
|
-
const schemaDir = path.join(resourceDir);
|
|
57
|
-
mkdirRecursive(schemaDir);
|
|
58
|
-
resource.schemas.forEach((schema) => {
|
|
59
|
-
const schemaCode = convertJsonToJs(schema);
|
|
60
|
-
fs.writeFileSync(
|
|
61
|
-
path.join(schemaDir, `${schema.name.toLowerCase()}.schema.js`),
|
|
62
|
-
schemaCode
|
|
63
|
-
);
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Create endpoints directory and files
|
|
68
|
-
if (resource.endpoints) {
|
|
69
|
-
const endpointDir = path.join(resourceDir, "endpoints");
|
|
70
|
-
mkdirRecursive(endpointDir);
|
|
71
|
-
resource.endpoints.forEach((endpoint) => {
|
|
72
|
-
const endpointCode = createEndpointCode(endpoint);
|
|
73
|
-
fs.writeFileSync(
|
|
74
|
-
path.join(endpointDir, `${endpoint.name}.js`),
|
|
75
|
-
endpointCode
|
|
76
|
-
);
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// Create handlers directory and files
|
|
81
|
-
if (resource.handlers) {
|
|
82
|
-
const handlerDir = path.join(resourceDir, "handlers");
|
|
83
|
-
mkdirRecursive(handlerDir);
|
|
84
|
-
resource.handlers.forEach((handler) => {
|
|
85
|
-
const handlerCode = handler.handler;
|
|
86
|
-
fs.writeFileSync(
|
|
87
|
-
path.join(handlerDir, `${handler.name}.js`),
|
|
88
|
-
handlerCode
|
|
89
|
-
);
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// Create methods directory and files
|
|
94
|
-
if (resource.methods) {
|
|
95
|
-
const methodDir = path.join(resourceDir, "methods");
|
|
96
|
-
mkdirRecursive(methodDir);
|
|
97
|
-
resource.methods.forEach((method) => {
|
|
98
|
-
const methodCode = method.handler;
|
|
99
|
-
fs.writeFileSync(path.join(methodDir, `${method.name}.js`), methodCode);
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// Main entry point
|
|
106
|
-
const [, , jsonFilePath] = process.argv;
|
|
107
|
-
|
|
108
|
-
if (!jsonFilePath) {
|
|
109
|
-
console.error("Please provide the path to the JSON file.");
|
|
110
|
-
process.exit(1);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
const rawData = fs.readFileSync(jsonFilePath, "utf8");
|
|
114
|
-
const { resources } = JSON.parse(rawData);
|
|
115
|
-
|
|
116
|
-
generateProjectStructure(resources);
|
|
117
|
-
|
|
118
|
-
console.log("Hive-based project structure generated successfully.");
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
kind: Deployment
|
|
2
|
-
apiVersion: apps/v1
|
|
3
|
-
metadata:
|
|
4
|
-
name: {{ .Values.service }}
|
|
5
|
-
labels:
|
|
6
|
-
app: {{ .Values.service }}
|
|
7
|
-
spec:
|
|
8
|
-
replicas: 1
|
|
9
|
-
selector:
|
|
10
|
-
matchLabels:
|
|
11
|
-
app: {{ .Values.service }}
|
|
12
|
-
template:
|
|
13
|
-
metadata:
|
|
14
|
-
labels:
|
|
15
|
-
app: {{ .Values.service }}
|
|
16
|
-
spec:
|
|
17
|
-
restartPolicy: Always
|
|
18
|
-
containers:
|
|
19
|
-
- name: {{ .Values.service }}
|
|
20
|
-
image: {{ .Values.containerRegistry }}:{{ .Values.imagesVersion }}
|
|
21
|
-
env:
|
|
22
|
-
- name: PROJECT_ID
|
|
23
|
-
value: {{ .Values.projectId }}
|
|
24
|
-
{{- range .Values.env }}
|
|
25
|
-
- name: {{ .name }}
|
|
26
|
-
value: {{ .value }}
|
|
27
|
-
{{- end }}
|
|
28
|
-
imagePullPolicy: Always
|
|
29
|
-
livenessProbe:
|
|
30
|
-
httpGet:
|
|
31
|
-
path: /health
|
|
32
|
-
port: {{ .Values.port }}
|
|
33
|
-
initialDelaySeconds: 300
|
|
34
|
-
periodSeconds: 10
|
|
35
|
-
ports:
|
|
36
|
-
- containerPort: {{ .Values.port }}
|
|
37
|
-
protocol: TCP
|
|
38
|
-
nodeSelector:
|
|
39
|
-
doks.digitalocean.com/node-pool: {{ .Values.nodePool }}
|
|
40
|
-
strategy:
|
|
41
|
-
type: RollingUpdate
|
|
42
|
-
rollingUpdate:
|
|
43
|
-
maxUnavailable: 0
|
|
44
|
-
maxSurge: 1
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
kind: Ingress
|
|
2
|
-
apiVersion: networking.k8s.io/v1
|
|
3
|
-
metadata:
|
|
4
|
-
name: {{ .Values.service }}
|
|
5
|
-
labels:
|
|
6
|
-
app: {{ .Values.service }}
|
|
7
|
-
annotations:
|
|
8
|
-
nginx.ingress.kubernetes.io/proxy-read-timeout: "180"
|
|
9
|
-
nginx.ingress.kubernetes.io/proxy-body-size: "20m"
|
|
10
|
-
external-dns.alpha.kubernetes.io/hostname: {{ first .Values.domain }}
|
|
11
|
-
external-dns.alpha.kubernetes.io/ttl: "120" #optional
|
|
12
|
-
spec:
|
|
13
|
-
ingressClassName: nginx
|
|
14
|
-
rules:
|
|
15
|
-
{{- range $domain := .Values.domain }}
|
|
16
|
-
- host: {{ $domain }}
|
|
17
|
-
http:
|
|
18
|
-
paths:
|
|
19
|
-
- path: /
|
|
20
|
-
pathType: Prefix
|
|
21
|
-
backend:
|
|
22
|
-
service:
|
|
23
|
-
name: {{ $.Values.service }}
|
|
24
|
-
port:
|
|
25
|
-
number: {{ $.Values.port }}
|
|
26
|
-
{{- end}}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
FROM --platform=linux/amd64 node:16.13.1-alpine3.13
|
|
2
|
-
|
|
3
|
-
RUN apk add docker
|
|
4
|
-
|
|
5
|
-
ARG VCS_REF
|
|
6
|
-
ARG BUILD_DATE
|
|
7
|
-
|
|
8
|
-
# Metadata
|
|
9
|
-
LABEL org.label-schema.vcs-ref=$VCS_REF \
|
|
10
|
-
org.label-schema.name="helm-kubectl" \
|
|
11
|
-
org.label-schema.url="https://hub.docker.com/r/dtzar/helm-kubectl/" \
|
|
12
|
-
org.label-schema.vcs-url="https://github.com/dtzar/helm-kubectl" \
|
|
13
|
-
org.label-schema.build-date=$BUILD_DATE
|
|
14
|
-
|
|
15
|
-
# Note: Latest version of kubectl may be found at:
|
|
16
|
-
# https://github.com/kubernetes/kubernetes/releases
|
|
17
|
-
ENV KUBE_LATEST_VERSION="v1.22.4"
|
|
18
|
-
|
|
19
|
-
# Note: Latest version of helm may be found at:
|
|
20
|
-
# https://github.com/kubernetes/helm/releases
|
|
21
|
-
ENV HELM_VERSION="v3.7.1"
|
|
22
|
-
|
|
23
|
-
RUN apk add --no-cache ca-certificates bash git openssh curl \
|
|
24
|
-
&& wget -q https://storage.googleapis.com/kubernetes-release/release/${KUBE_LATEST_VERSION}/bin/linux/amd64/kubectl -O /usr/local/bin/kubectl \
|
|
25
|
-
&& chmod +x /usr/local/bin/kubectl \
|
|
26
|
-
&& wget -q https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz -O - | tar -xzO linux-amd64/helm > /usr/local/bin/helm \
|
|
27
|
-
&& chmod +x /usr/local/bin/helm
|
|
28
|
-
|
|
29
|
-
WORKDIR /home/node/app
|
|
30
|
-
|
|
31
|
-
ADD ./deploy/script/package.json \
|
|
32
|
-
./deploy/script/package-lock.json \
|
|
33
|
-
./deploy/script/
|
|
34
|
-
|
|
35
|
-
RUN npm i --prefix ./deploy/script --progress=false --no-audit --production
|
|
36
|
-
|
|
37
|
-
ADD ./ ./
|
|
38
|
-
|
|
39
|
-
CMD node ./deploy/script/src/index.js
|