@vaharoni/devops 1.2.13 → 1.2.14
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/dist/chunk-N7EX3HJH.js +139 -0
- package/dist/chunk-RZ46YYZZ.js +420 -0
- package/dist/chunk-WKP7EQNU.js +421 -0
- package/dist/devops.d.ts +0 -2
- package/dist/devops.js +3235 -91
- package/dist/index.d.ts +972 -4
- package/dist/index.js +67 -3
- package/dist/plugins.d.ts +95 -4
- package/dist/plugins.js +20 -6
- package/dist/src/target-templates/README.md +1 -0
- package/dist/src/target-templates/cluster-resource-options/README.md +2 -0
- package/dist/src/target-templates/cluster-resource-options/dns-test/dns-test.yaml +60 -0
- package/dist/src/target-templates/cluster-resource-options/milvus/production/milvus-values.yaml +2 -0
- package/dist/src/target-templates/cluster-resource-options/milvus/staging/milvus-values.yaml +2 -0
- package/dist/src/target-templates/cluster-resource-options/monitoring-ingress/monitoring-ingress.yaml +62 -0
- package/dist/src/target-templates/cluster-resource-options/postgres/daily-operator-restart.yaml +54 -0
- package/dist/src/target-templates/cluster-resource-options/postgres/production/cluster/PodDisruptionBudget.yaml +27 -0
- package/dist/src/target-templates/cluster-resource-options/postgres/production/cluster/SGCluster.yaml +47 -0
- package/dist/src/target-templates/cluster-resource-options/postgres/production/cluster/StackGres-alerts.yaml +191 -0
- package/dist/src/target-templates/cluster-resource-options/postgres/production/configurations/06-SGDistributedLogs.yaml +11 -0
- package/dist/src/target-templates/cluster-resource-options/postgres/production/configurations/07-SGObjectStorage.yaml +18 -0
- package/dist/src/target-templates/cluster-resource-options/postgres/production/configurations/08-SGScript.yaml +12 -0
- package/dist/src/target-templates/cluster-resource-options/postgres/stackgres-ui-ingress.yaml +35 -0
- package/dist/src/target-templates/cluster-resource-options/postgres/staging/cluster/SGCluster.yaml +42 -0
- package/dist/src/target-templates/cluster-resource-options/postgres/staging/configurations/07-SGObjectStorage.yaml +18 -0
- package/dist/src/target-templates/cluster-resource-options/postgres/staging/configurations/08-SGScript.yaml +12 -0
- package/dist/src/target-templates/cluster-resource-options/prefect/production/prefect-values.yaml +14 -0
- package/dist/src/target-templates/cluster-resource-options/prefect/staging/prefect-values.yaml +14 -0
- package/dist/src/target-templates/cluster-resource-options/redis/production/redis-values.yaml +20 -0
- package/dist/src/target-templates/cluster-resource-options/redis/staging/redis-values.yaml +8 -0
- package/dist/src/target-templates/infra-variants/README.md +2 -0
- package/dist/src/target-templates/infra-variants/digitalocean/.devops/config/constants.yaml +18 -0
- package/dist/src/target-templates/infra-variants/digitalocean/.github/workflows/k8s-build.yaml +91 -0
- package/dist/src/target-templates/infra-variants/gcloud/.devops/config/constants.yaml +15 -0
- package/dist/src/target-templates/infra-variants/gcloud/.devops/manifests/ingress.yaml.hb +22 -0
- package/dist/src/target-templates/infra-variants/gcloud/.github/workflows/k8s-build.yaml +95 -0
- package/dist/src/target-templates/infra-variants/hetzner/.devops/config/constants.yaml +18 -0
- package/dist/src/target-templates/infra-variants/hetzner/.devops/infra/hetzner/abandoned/harbor-values.yaml +30 -0
- package/dist/src/target-templates/infra-variants/hetzner/.devops/infra/hetzner/abandoned/hcloud-config.yaml +134 -0
- package/dist/src/target-templates/infra-variants/hetzner/.devops/infra/hetzner/cert-manager.yaml +25 -0
- package/dist/src/target-templates/infra-variants/hetzner/.devops/infra/hetzner/harbor-cert.yaml +13 -0
- package/dist/src/target-templates/infra-variants/hetzner/.devops/infra/hetzner/harbor-values.yaml +76 -0
- package/dist/src/target-templates/infra-variants/hetzner/.devops/infra/hetzner/hcloud-config.yaml +113 -0
- package/dist/src/target-templates/infra-variants/hetzner/.devops/infra/hetzner/ingress-nginx-annotations.yaml +49 -0
- package/dist/src/target-templates/infra-variants/hetzner/.devops/infra/hetzner/ingress-nginx-configmap.yaml +8 -0
- package/dist/src/target-templates/infra-variants/hetzner/.devops/infra/hetzner/retain-storage-class.yaml +8 -0
- package/dist/src/target-templates/infra-variants/hetzner/.github/workflows/k8s-build.yaml +93 -0
- package/dist/src/target-templates/lang-variants-common/README.md +4 -0
- package/dist/src/target-templates/lang-variants-common/python/.cursor/rules/monorepo-python.mdc +56 -0
- package/dist/src/target-templates/lang-variants-common/python/.devops/config/images.yaml +89 -0
- package/dist/src/target-templates/lang-variants-common/python/.devops/docker-images/python-services/python-exec.sh +8 -0
- package/dist/src/target-templates/lang-variants-common/python/.devops/docker-images/python-services/python-run.sh +8 -0
- package/dist/src/target-templates/lang-variants-common/python/.devops/docker-images/python-services.Dockerfile +29 -0
- package/dist/src/target-templates/lang-variants-common/python/.devops/manifests/_index.yaml +21 -0
- package/dist/src/target-templates/lang-variants-common/python/.devops/manifests/prefect.yaml.hb +63 -0
- package/dist/src/target-templates/lang-variants-common/python/applications/example-data-pipeline/pyproject.toml +14 -0
- package/dist/src/target-templates/lang-variants-common/python/applications/example-data-pipeline/src/example_data_pipeline/main.py +38 -0
- package/dist/src/target-templates/lang-variants-common/python/applications/example-python/pyproject.toml +20 -0
- package/dist/src/target-templates/lang-variants-common/python/applications/example-python/src/example_python/__init__.py +0 -0
- package/dist/src/target-templates/lang-variants-common/python/applications/example-python/src/example_python/main.py +13 -0
- package/dist/src/target-templates/lang-variants-common/python/applications/example-python/src/example_python/scripts.py +17 -0
- package/dist/src/target-templates/lang-variants-common/python/applications/example-python/tests/__init__.py +0 -0
- package/dist/src/target-templates/lang-variants-common/python/devopspy +3 -0
- package/dist/src/target-templates/lang-variants-common/python/libs/example-python-lib/pyproject.toml +11 -0
- package/dist/src/target-templates/lang-variants-common/python/libs/example-python-lib/src/example_python_lib/__init__.py +2 -0
- package/dist/src/target-templates/lang-variants-common/python/pyproject.toml +16 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.cursor/rules/monorepo-typescript.mdc +51 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.devops/config/images.yaml +69 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.devops/docker-images/cloudrun.Dockerfile +31 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.devops/docker-images/common/docker-common.sh +23 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.devops/docker-images/node-services/node-exec.sh +8 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.devops/docker-images/node-services/node-run.sh +8 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.devops/docker-images/node-services.Dockerfile +31 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.devops/env.example.yaml +23 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.devops/manifests/_index.yaml +19 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.devops/manifests/cron-jobs.yaml.hb +56 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.devops/manifests/db-migrate-job.yaml.hb +43 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.devops/manifests/deployment-debug.yaml.hb +42 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.devops/manifests/deployment-process.yaml.hb +48 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.devops/manifests/deployment-web.yaml.hb +54 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.devops/manifests/ingress.yaml.hb +21 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.devops/manifests/service.yaml.hb +15 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.envrc +5 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.github/actions/build-image@v1/action.yaml +81 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.github/actions/connect-to-digital-ocean@v1/action.yaml +29 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.github/actions/connect-to-gke@v1/action.yaml +43 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.github/actions/connect-to-hetzner@v1/action.yaml +31 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.github/actions/db-migrate@v1/action.yaml +23 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.github/actions/deploy-image-cloudrun@v1/action.yaml +71 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.github/actions/deploy-image-k8s@v1/action.yaml +37 -0
- package/dist/src/target-templates/lang-variants-common/typescript/.github/actions/setup-prereq@v1/action.yaml +24 -0
- package/dist/src/target-templates/lang-variants-common/typescript/applications/example-node/index.ts +30 -0
- package/dist/src/target-templates/lang-variants-common/typescript/applications/example-node/package.json +26 -0
- package/dist/src/target-templates/lang-variants-common/typescript/applications/example-node/tsconfig.json +3 -0
- package/dist/src/target-templates/lang-variants-common/typescript/applications/jobs/README.md +68 -0
- package/dist/src/target-templates/lang-variants-common/typescript/applications/jobs/index.ts +1 -0
- package/dist/src/target-templates/lang-variants-common/typescript/applications/jobs/package.json +30 -0
- package/dist/src/target-templates/lang-variants-common/typescript/applications/jobs/tsconfig.json +3 -0
- package/dist/src/target-templates/lang-variants-common/typescript/config/.env.development +1 -0
- package/dist/src/target-templates/lang-variants-common/typescript/config/.env.global +4 -0
- package/dist/src/target-templates/lang-variants-common/typescript/config/.env.test +1 -0
- package/dist/src/target-templates/lang-variants-common/typescript/devops +3 -0
- package/dist/src/target-templates/lang-variants-common/typescript/libs/example-node-lib/index.ts +3 -0
- package/dist/src/target-templates/lang-variants-common/typescript/libs/example-node-lib/package.json +12 -0
- package/dist/src/target-templates/lang-variants-common/typescript/libs/example-node-lib/tsconfig.json +3 -0
- package/dist/src/target-templates/lang-variants-common/typescript/tmp/.gitkeep +0 -0
- package/dist/src/target-templates/lang-variants-common/typescript/tsconfig.json +27 -0
- package/dist/src/target-templates/lang-variants-prisma/README.md +3 -0
- package/dist/src/target-templates/lang-variants-prisma/python/.cursor/rules/prisma-python.mdc +55 -0
- package/dist/src/target-templates/lang-variants-prisma/python/.cursor/rules/testing-python.mdc +89 -0
- package/dist/src/target-templates/lang-variants-prisma/python/db/db/__init__.py +0 -0
- package/dist/src/target-templates/lang-variants-prisma/python/db/db/db_client_test.py +46 -0
- package/dist/src/target-templates/lang-variants-prisma/python/db/pyproject.toml +14 -0
- package/dist/src/target-templates/lang-variants-prisma/typescript/.cursor/rules/prisma-typescript.mdc +54 -0
- package/dist/src/target-templates/lang-variants-prisma/typescript/.cursor/rules/testing-typescript.mdc +103 -0
- package/dist/src/target-templates/lang-variants-prisma/typescript/db/db-client-test.ts +142 -0
- package/dist/src/target-templates/lang-variants-prisma/typescript/db/db-client.ts +19 -0
- package/dist/src/target-templates/lang-variants-prisma/typescript/db/env.yaml +4 -0
- package/dist/src/target-templates/lang-variants-prisma/typescript/db/package.json +17 -0
- package/dist/src/target-templates/lang-variants-prisma/typescript/db/prisma/schema.prisma +24 -0
- package/dist/src/target-templates/lang-variants-prisma/typescript/db/prisma-setup-vitest.ts +27 -0
- package/dist/src/target-templates/lang-variants-prisma/typescript/db/tsconfig.json +3 -0
- package/dist/src/target-templates/lang-variants-prisma/typescript/dml/package.json +7 -0
- package/dist/src/target-templates/lang-variants-prisma/typescript/dml/tsconfig.json +3 -0
- package/package.json +3 -2
- package/src/cli/core/exec.ts +2 -4
- package/src/cli/core/run.ts +2 -4
- package/src/cli/extensions/prisma.ts +2 -4
- package/src/libs/init-generator.ts +2 -4
- package/src/pkg-root.ts +14 -0
- package/src/plugins.ts +2 -4
- package/dist/app-support/crypto/aes.d.ts +0 -15
- package/dist/app-support/crypto/aes.d.ts.map +0 -1
- package/dist/app-support/crypto/aes.js +0 -56
- package/dist/app-support/crypto/aes.spec.d.ts +0 -2
- package/dist/app-support/crypto/aes.spec.d.ts.map +0 -1
- package/dist/app-support/crypto/aes.spec.js +0 -58
- package/dist/app-support/crypto/index.d.ts +0 -16
- package/dist/app-support/crypto/index.d.ts.map +0 -1
- package/dist/app-support/crypto/index.js +0 -31
- package/dist/app-support/crypto/internal-token.d.ts +0 -20
- package/dist/app-support/crypto/internal-token.d.ts.map +0 -1
- package/dist/app-support/crypto/internal-token.js +0 -42
- package/dist/app-support/crypto/internal-token.spec.d.ts +0 -2
- package/dist/app-support/crypto/internal-token.spec.d.ts.map +0 -1
- package/dist/app-support/crypto/internal-token.spec.js +0 -45
- package/dist/app-support/crypto/secret.d.ts +0 -3
- package/dist/app-support/crypto/secret.d.ts.map +0 -1
- package/dist/app-support/crypto/secret.js +0 -12
- package/dist/app-support/crypto/secret.spec.d.ts +0 -2
- package/dist/app-support/crypto/secret.spec.d.ts.map +0 -1
- package/dist/app-support/crypto/secret.spec.js +0 -15
- package/dist/app-support/discovery/dev-discovery-loader.d.ts +0 -2
- package/dist/app-support/discovery/dev-discovery-loader.d.ts.map +0 -1
- package/dist/app-support/discovery/dev-discovery-loader.js +0 -30
- package/dist/app-support/discovery/service-endpoint.d.ts +0 -2
- package/dist/app-support/discovery/service-endpoint.d.ts.map +0 -1
- package/dist/app-support/discovery/service-endpoint.js +0 -10
- package/dist/cli/common.d.ts +0 -89
- package/dist/cli/common.d.ts.map +0 -1
- package/dist/cli/common.js +0 -246
- package/dist/cli/common.spec.d.ts +0 -2
- package/dist/cli/common.spec.d.ts.map +0 -1
- package/dist/cli/common.spec.js +0 -64
- package/dist/cli/core/affected.d.ts +0 -9
- package/dist/cli/core/affected.d.ts.map +0 -1
- package/dist/cli/core/affected.js +0 -101
- package/dist/cli/core/cloudrun.d.ts +0 -9
- package/dist/cli/core/cloudrun.d.ts.map +0 -1
- package/dist/cli/core/cloudrun.js +0 -119
- package/dist/cli/core/console.d.ts +0 -10
- package/dist/cli/core/console.d.ts.map +0 -1
- package/dist/cli/core/console.js +0 -50
- package/dist/cli/core/constant.d.ts +0 -9
- package/dist/cli/core/constant.d.ts.map +0 -1
- package/dist/cli/core/constant.js +0 -20
- package/dist/cli/core/env.d.ts +0 -9
- package/dist/cli/core/env.d.ts.map +0 -1
- package/dist/cli/core/env.js +0 -65
- package/dist/cli/core/exec.d.ts +0 -9
- package/dist/cli/core/exec.d.ts.map +0 -1
- package/dist/cli/core/exec.js +0 -48
- package/dist/cli/core/image.d.ts +0 -9
- package/dist/cli/core/image.d.ts.map +0 -1
- package/dist/cli/core/image.js +0 -153
- package/dist/cli/core/index.d.ts +0 -16
- package/dist/cli/core/index.d.ts.map +0 -1
- package/dist/cli/core/index.js +0 -15
- package/dist/cli/core/init.d.ts +0 -9
- package/dist/cli/core/init.d.ts.map +0 -1
- package/dist/cli/core/init.js +0 -219
- package/dist/cli/core/job.d.ts +0 -9
- package/dist/cli/core/job.d.ts.map +0 -1
- package/dist/cli/core/job.js +0 -65
- package/dist/cli/core/namespace.d.ts +0 -9
- package/dist/cli/core/namespace.d.ts.map +0 -1
- package/dist/cli/core/namespace.js +0 -67
- package/dist/cli/core/prep-build.d.ts +0 -10
- package/dist/cli/core/prep-build.d.ts.map +0 -1
- package/dist/cli/core/prep-build.js +0 -109
- package/dist/cli/core/registry.d.ts +0 -9
- package/dist/cli/core/registry.d.ts.map +0 -1
- package/dist/cli/core/registry.js +0 -66
- package/dist/cli/core/run-many.d.ts +0 -10
- package/dist/cli/core/run-many.d.ts.map +0 -1
- package/dist/cli/core/run-many.js +0 -48
- package/dist/cli/core/run.d.ts +0 -9
- package/dist/cli/core/run.d.ts.map +0 -1
- package/dist/cli/core/run.js +0 -35
- package/dist/cli/core/test.d.ts +0 -9
- package/dist/cli/core/test.d.ts.map +0 -1
- package/dist/cli/core/test.js +0 -26
- package/dist/cli/extensions/dml.d.ts +0 -9
- package/dist/cli/extensions/dml.d.ts.map +0 -1
- package/dist/cli/extensions/dml.js +0 -114
- package/dist/cli/extensions/index.d.ts +0 -9
- package/dist/cli/extensions/index.d.ts.map +0 -1
- package/dist/cli/extensions/index.js +0 -8
- package/dist/cli/extensions/internal-curl.d.ts +0 -10
- package/dist/cli/extensions/internal-curl.d.ts.map +0 -1
- package/dist/cli/extensions/internal-curl.js +0 -41
- package/dist/cli/extensions/jwt.d.ts +0 -9
- package/dist/cli/extensions/jwt.d.ts.map +0 -1
- package/dist/cli/extensions/jwt.js +0 -25
- package/dist/cli/extensions/prisma.d.ts +0 -9
- package/dist/cli/extensions/prisma.d.ts.map +0 -1
- package/dist/cli/extensions/prisma.js +0 -23
- package/dist/cli/extensions/redis-bitnami.d.ts +0 -11
- package/dist/cli/extensions/redis-bitnami.d.ts.map +0 -1
- package/dist/cli/extensions/redis-bitnami.js +0 -74
- package/dist/cli/extensions/redis-ha.d.ts +0 -11
- package/dist/cli/extensions/redis-ha.d.ts.map +0 -1
- package/dist/cli/extensions/redis-ha.js +0 -51
- package/dist/cli/extensions/stackgres.d.ts +0 -10
- package/dist/cli/extensions/stackgres.d.ts.map +0 -1
- package/dist/cli/extensions/stackgres.js +0 -117
- package/dist/cli/extensions/template.d.ts +0 -9
- package/dist/cli/extensions/template.d.ts.map +0 -1
- package/dist/cli/extensions/template.js +0 -121
- package/dist/devops.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/libs/affected-entities.d.ts +0 -15
- package/dist/libs/affected-entities.d.ts.map +0 -1
- package/dist/libs/affected-entities.js +0 -52
- package/dist/libs/cloudrun-helpers.d.ts +0 -16
- package/dist/libs/cloudrun-helpers.d.ts.map +0 -1
- package/dist/libs/cloudrun-helpers.js +0 -81
- package/dist/libs/config.d.ts +0 -7
- package/dist/libs/config.d.ts.map +0 -1
- package/dist/libs/config.js +0 -102
- package/dist/libs/digital-ocean/container-reg.d.ts +0 -6
- package/dist/libs/digital-ocean/container-reg.d.ts.map +0 -1
- package/dist/libs/digital-ocean/container-reg.js +0 -74
- package/dist/libs/discovery/dependencies.d.ts +0 -19
- package/dist/libs/discovery/dependencies.d.ts.map +0 -1
- package/dist/libs/discovery/dependencies.js +0 -62
- package/dist/libs/discovery/dependencies.spec.d.ts +0 -2
- package/dist/libs/discovery/dependencies.spec.d.ts.map +0 -1
- package/dist/libs/discovery/dependencies.spec.js +0 -21
- package/dist/libs/discovery/images.d.ts +0 -5
- package/dist/libs/discovery/images.d.ts.map +0 -1
- package/dist/libs/discovery/images.js +0 -45
- package/dist/libs/discovery/index.d.ts +0 -6
- package/dist/libs/discovery/index.d.ts.map +0 -1
- package/dist/libs/discovery/index.js +0 -67
- package/dist/libs/discovery/process-common.d.ts +0 -25
- package/dist/libs/discovery/process-common.d.ts.map +0 -1
- package/dist/libs/discovery/process-common.js +0 -40
- package/dist/libs/discovery/process-package-json.d.ts +0 -3
- package/dist/libs/discovery/process-package-json.d.ts.map +0 -1
- package/dist/libs/discovery/process-package-json.js +0 -40
- package/dist/libs/discovery/process-pyproject-toml.d.ts +0 -3
- package/dist/libs/discovery/process-pyproject-toml.d.ts.map +0 -1
- package/dist/libs/discovery/process-pyproject-toml.js +0 -49
- package/dist/libs/git-helpers.d.ts +0 -8
- package/dist/libs/git-helpers.d.ts.map +0 -1
- package/dist/libs/git-helpers.js +0 -20
- package/dist/libs/hetzner/reg-secret.d.ts +0 -3
- package/dist/libs/hetzner/reg-secret.d.ts.map +0 -1
- package/dist/libs/hetzner/reg-secret.js +0 -39
- package/dist/libs/init-generator.d.ts +0 -41
- package/dist/libs/init-generator.d.ts.map +0 -1
- package/dist/libs/init-generator.js +0 -123
- package/dist/libs/k8s-constants.d.ts +0 -13
- package/dist/libs/k8s-constants.d.ts.map +0 -1
- package/dist/libs/k8s-constants.js +0 -91
- package/dist/libs/k8s-db.d.ts +0 -18
- package/dist/libs/k8s-db.d.ts.map +0 -1
- package/dist/libs/k8s-db.js +0 -73
- package/dist/libs/k8s-generate.d.ts +0 -17
- package/dist/libs/k8s-generate.d.ts.map +0 -1
- package/dist/libs/k8s-generate.js +0 -193
- package/dist/libs/k8s-helpers.d.ts +0 -11
- package/dist/libs/k8s-helpers.d.ts.map +0 -1
- package/dist/libs/k8s-helpers.js +0 -42
- package/dist/libs/k8s-image-config.d.ts +0 -8
- package/dist/libs/k8s-image-config.d.ts.map +0 -1
- package/dist/libs/k8s-image-config.js +0 -113
- package/dist/libs/k8s-job-waiter.d.ts +0 -8
- package/dist/libs/k8s-job-waiter.d.ts.map +0 -1
- package/dist/libs/k8s-job-waiter.js +0 -84
- package/dist/libs/k8s-namespace.d.ts +0 -7
- package/dist/libs/k8s-namespace.d.ts.map +0 -1
- package/dist/libs/k8s-namespace.js +0 -27
- package/dist/libs/k8s-redis-bitnami.d.ts +0 -6
- package/dist/libs/k8s-redis-bitnami.d.ts.map +0 -1
- package/dist/libs/k8s-redis-bitnami.js +0 -31
- package/dist/libs/k8s-redis-ha.d.ts +0 -3
- package/dist/libs/k8s-redis-ha.d.ts.map +0 -1
- package/dist/libs/k8s-redis-ha.js +0 -15
- package/dist/libs/k8s-secrets-manager.d.ts +0 -6
- package/dist/libs/k8s-secrets-manager.d.ts.map +0 -1
- package/dist/libs/k8s-secrets-manager.js +0 -64
- package/dist/libs/validate-env.d.ts +0 -56
- package/dist/libs/validate-env.d.ts.map +0 -1
- package/dist/libs/validate-env.js +0 -214
- package/dist/libs/validate-env.spec.d.ts +0 -2
- package/dist/libs/validate-env.spec.d.ts.map +0 -1
- package/dist/libs/validate-env.spec.js +0 -168
- package/dist/plugins.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -939
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -82
package/dist/src/target-templates/lang-variants-common/typescript/.devops/manifests/ingress.yaml.hb
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
apiVersion: networking.k8s.io/v1
|
|
2
|
+
kind: Ingress
|
|
3
|
+
metadata:
|
|
4
|
+
name: {{app_name}}
|
|
5
|
+
namespace: {{namespace}}
|
|
6
|
+
labels:
|
|
7
|
+
app: {{app_name}}
|
|
8
|
+
env: {{monorepo_env}}
|
|
9
|
+
spec:
|
|
10
|
+
ingressClassName: nginx
|
|
11
|
+
rules:
|
|
12
|
+
- host: {{subdomain}}.{{domain_name}}
|
|
13
|
+
http:
|
|
14
|
+
paths:
|
|
15
|
+
- path: /
|
|
16
|
+
pathType: Prefix
|
|
17
|
+
backend:
|
|
18
|
+
service:
|
|
19
|
+
name: {{service_name}}
|
|
20
|
+
port:
|
|
21
|
+
number: 80
|
package/dist/src/target-templates/lang-variants-common/typescript/.devops/manifests/service.yaml.hb
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
apiVersion: v1
|
|
2
|
+
kind: Service
|
|
3
|
+
metadata:
|
|
4
|
+
name: {{service_name}}
|
|
5
|
+
labels:
|
|
6
|
+
app: {{app_name}}
|
|
7
|
+
env: {{monorepo_env}}
|
|
8
|
+
namespace: {{namespace}}
|
|
9
|
+
spec:
|
|
10
|
+
selector:
|
|
11
|
+
app: {{app_name}}
|
|
12
|
+
ports:
|
|
13
|
+
- protocol: TCP
|
|
14
|
+
port: 80
|
|
15
|
+
targetPort: {{port}}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
name: "Build image"
|
|
2
|
+
description: "Build the specified image if it's affected"
|
|
3
|
+
inputs:
|
|
4
|
+
image_name:
|
|
5
|
+
description: 'The image key in images.yaml'
|
|
6
|
+
required: true
|
|
7
|
+
cache_path:
|
|
8
|
+
description: "The path to cache inside the container"
|
|
9
|
+
required: true
|
|
10
|
+
outputs:
|
|
11
|
+
affected:
|
|
12
|
+
description: "Whether the image is affected"
|
|
13
|
+
value: ${{ steps.check_affected.outputs.affected }}
|
|
14
|
+
runs:
|
|
15
|
+
using: "composite"
|
|
16
|
+
steps:
|
|
17
|
+
- name: Setup basic vars
|
|
18
|
+
shell: bash
|
|
19
|
+
run: |
|
|
20
|
+
echo "IMAGE_NAME=${{ inputs.image_name }}" >> $GITHUB_ENV
|
|
21
|
+
|
|
22
|
+
- name: Set up Docker Buildx
|
|
23
|
+
uses: docker/setup-buildx-action@v3
|
|
24
|
+
|
|
25
|
+
- name: Check if affected
|
|
26
|
+
id: check_affected
|
|
27
|
+
shell: bash
|
|
28
|
+
run: |
|
|
29
|
+
AFFECTED=$(devops affected image $IMAGE_NAME --from-live-version)
|
|
30
|
+
echo "affected=$AFFECTED" >> $GITHUB_OUTPUT
|
|
31
|
+
if [[ "$AFFECTED" == "true" ]]; then
|
|
32
|
+
echo "${{ env.IMAGE_NAME }} is affected. Proceeding with build."
|
|
33
|
+
else
|
|
34
|
+
echo "${{ env.IMAGE_NAME }} is not affected. Skipping."
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
- name: Prepare build
|
|
38
|
+
shell: bash
|
|
39
|
+
if: steps.check_affected.outputs.affected == 'true'
|
|
40
|
+
run: |
|
|
41
|
+
echo "CACHE_PREFIX=v1-${{ runner.os }}-${{ env.IMAGE_NAME }}-${{ github.ref_name }}" >> $GITHUB_ENV
|
|
42
|
+
echo "ECR_URL=$(devops registry repo-url ${{ env.IMAGE_NAME }} ${{ github.sha }})" >> $GITHUB_ENV
|
|
43
|
+
folder=$(devops prep-build ${{ env.IMAGE_NAME }})
|
|
44
|
+
mv $folder /home/runner/build
|
|
45
|
+
echo MONOREPO_ENV=${{ env.MONOREPO_ENV }}
|
|
46
|
+
|
|
47
|
+
- name: Setup cache
|
|
48
|
+
if: steps.check_affected.outputs.affected == 'true'
|
|
49
|
+
id: setup-cache
|
|
50
|
+
uses: actions/cache@v4
|
|
51
|
+
with:
|
|
52
|
+
path: cache-path
|
|
53
|
+
key: ${{ env.CACHE_PREFIX }}
|
|
54
|
+
|
|
55
|
+
- name: Inject cache into docker
|
|
56
|
+
if: steps.check_affected.outputs.affected == 'true'
|
|
57
|
+
uses: reproducible-containers/buildkit-cache-dance@v3.1.0
|
|
58
|
+
with:
|
|
59
|
+
cache-map: |
|
|
60
|
+
{
|
|
61
|
+
"cache-path": "${{ inputs.cache_path }}"
|
|
62
|
+
}
|
|
63
|
+
skip-extraction: ${{ steps.setup-cache.outputs.cache-hit }}
|
|
64
|
+
|
|
65
|
+
- name: Build and push Docker image
|
|
66
|
+
if: steps.check_affected.outputs.affected == 'true'
|
|
67
|
+
uses: docker/build-push-action@v6
|
|
68
|
+
with:
|
|
69
|
+
context: /home/runner/build
|
|
70
|
+
push: true
|
|
71
|
+
tags: ${{ env.ECR_URL }}
|
|
72
|
+
cache-from: type=gha
|
|
73
|
+
cache-to: type=gha,mode=max
|
|
74
|
+
build-args: |
|
|
75
|
+
MONOREPO_ENV=${{ env.MONOREPO_ENV }}
|
|
76
|
+
|
|
77
|
+
- name: Prune registry
|
|
78
|
+
if: steps.check_affected.outputs.affected == 'true'
|
|
79
|
+
shell: bash
|
|
80
|
+
run: |
|
|
81
|
+
devops registry prune ${{ env.IMAGE_NAME }}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: "Connect to Digital Ocean"
|
|
2
|
+
description: "Sets up kubernetes connection to Digital Ocean and ensures connection"
|
|
3
|
+
inputs:
|
|
4
|
+
access_token:
|
|
5
|
+
description: "DigitalOcean access token"
|
|
6
|
+
required: true
|
|
7
|
+
cluster_name:
|
|
8
|
+
description: "DigitalOcean cluster name"
|
|
9
|
+
required: true
|
|
10
|
+
runs:
|
|
11
|
+
using: "composite"
|
|
12
|
+
steps:
|
|
13
|
+
- name: Install doctl
|
|
14
|
+
uses: digitalocean/action-doctl@v2
|
|
15
|
+
with:
|
|
16
|
+
token: ${{ inputs.access_token }}
|
|
17
|
+
|
|
18
|
+
- name: Log in to DigitalOcean Container Registry with short-lived credentials
|
|
19
|
+
run: doctl registry login --expiry-seconds 1200
|
|
20
|
+
shell: bash
|
|
21
|
+
|
|
22
|
+
- name: Save DigitalOcean kubeconfig with short-lived credentials
|
|
23
|
+
run: |
|
|
24
|
+
doctl kubernetes cluster kubeconfig save --expiry-seconds 1200 ${{ inputs.cluster_name }}
|
|
25
|
+
shell: bash
|
|
26
|
+
|
|
27
|
+
- name: verify namepsace exists
|
|
28
|
+
run: devops namespace check --env ${{ github.ref_name }}
|
|
29
|
+
shell: bash
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
name: "Connect to Google Cloud GKE"
|
|
2
|
+
description: "Sets up kubernetes connection to Google Cloud and ensures connection"
|
|
3
|
+
inputs:
|
|
4
|
+
project_id:
|
|
5
|
+
description: "Google Cloud project ID"
|
|
6
|
+
required: true
|
|
7
|
+
zone:
|
|
8
|
+
description: "Google Cloud GKE zone (e.g., us-central1)"
|
|
9
|
+
required: true
|
|
10
|
+
cluster_name:
|
|
11
|
+
description: "Google Cloud GKE cluster name"
|
|
12
|
+
required: true
|
|
13
|
+
service_account_key:
|
|
14
|
+
description: "Google Cloud service account key in JSON format"
|
|
15
|
+
required: true
|
|
16
|
+
runs:
|
|
17
|
+
using: "composite"
|
|
18
|
+
steps:
|
|
19
|
+
- name: Authenticate to Google Cloud
|
|
20
|
+
uses: google-github-actions/auth@v2
|
|
21
|
+
with:
|
|
22
|
+
project_id: ${{ inputs.project_id }}
|
|
23
|
+
credentials_json: ${{ inputs.service_account_key }}
|
|
24
|
+
|
|
25
|
+
- name: Install gcloud
|
|
26
|
+
uses: google-github-actions/setup-gcloud@v2
|
|
27
|
+
with:
|
|
28
|
+
project_id: ${{ inputs.project_id }}
|
|
29
|
+
|
|
30
|
+
- name: Configure Docker auth
|
|
31
|
+
shell: bash
|
|
32
|
+
run: gcloud --quiet auth configure-docker
|
|
33
|
+
|
|
34
|
+
- name: Fetch GKE credentials
|
|
35
|
+
uses: google-github-actions/get-gke-credentials@v2
|
|
36
|
+
with:
|
|
37
|
+
cluster_name: ${{ inputs.cluster_name }}
|
|
38
|
+
location: ${{ inputs.zone }}
|
|
39
|
+
project_id: ${{ inputs.project_id }}
|
|
40
|
+
|
|
41
|
+
- name: verify namepsace exists
|
|
42
|
+
run: devops namespace check --env ${{ github.ref_name }}
|
|
43
|
+
shell: bash
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: "Connect to Hetzner"
|
|
2
|
+
description: "Sets up kubernetes connection to Hetzner and ensures connection"
|
|
3
|
+
inputs:
|
|
4
|
+
kubeconfig:
|
|
5
|
+
description: "The Hetzner kubeconfig file"
|
|
6
|
+
required: true
|
|
7
|
+
harbor_user:
|
|
8
|
+
description: "The user name for the harbor registry"
|
|
9
|
+
required: true
|
|
10
|
+
harbor_password:
|
|
11
|
+
description: "The password for the harbor registry"
|
|
12
|
+
required: true
|
|
13
|
+
runs:
|
|
14
|
+
using: "composite"
|
|
15
|
+
steps:
|
|
16
|
+
- name: Create a kubeconfig file
|
|
17
|
+
run: |
|
|
18
|
+
mkdir -p ~/.kube
|
|
19
|
+
echo "${{ inputs.kubeconfig }}" > ~/.kube/config
|
|
20
|
+
chmod 600 ~/.kube/config
|
|
21
|
+
shell: bash
|
|
22
|
+
|
|
23
|
+
- name: Verify cluster connection and that namepsace exists
|
|
24
|
+
run: devops namespace check --env ${{ github.ref_name }}
|
|
25
|
+
shell: bash
|
|
26
|
+
|
|
27
|
+
- name: Connect to the registry
|
|
28
|
+
run: |
|
|
29
|
+
server_url=$(devops registry server-url)
|
|
30
|
+
docker login $server_url -u '${{ inputs.harbor_user }}' -p ${{ inputs.harbor_password }}
|
|
31
|
+
shell: bash
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
name: "DB Migrate"
|
|
2
|
+
description: "Run DB migrate on an affected image, if applicable"
|
|
3
|
+
runs:
|
|
4
|
+
using: "composite"
|
|
5
|
+
steps:
|
|
6
|
+
- name: run-db-migrate
|
|
7
|
+
shell: bash
|
|
8
|
+
run: |
|
|
9
|
+
set +e
|
|
10
|
+
IMAGE=$(devops affected find-migrator --from-live-version)
|
|
11
|
+
status=$?
|
|
12
|
+
set -e
|
|
13
|
+
if [[ $status -eq 13 ]]; then
|
|
14
|
+
echo "db project missing, skipping DB migration"
|
|
15
|
+
elif [[ $status -ne 0 ]]; then
|
|
16
|
+
exit $status
|
|
17
|
+
elif [[ "$IMAGE" != "" ]]; then
|
|
18
|
+
devops job db-migrate create $IMAGE ${{ github.sha }} --timeout 240
|
|
19
|
+
else
|
|
20
|
+
echo "No image requires a DB migration"
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
name: "Deploy image"
|
|
2
|
+
description: "Deploy the specified image if it's affected and set its version"
|
|
3
|
+
inputs:
|
|
4
|
+
project_id:
|
|
5
|
+
description: 'The GCP project ID of the Cloud Run service'
|
|
6
|
+
required: true
|
|
7
|
+
image_name:
|
|
8
|
+
description: 'The image key in images.yaml'
|
|
9
|
+
required: true
|
|
10
|
+
region:
|
|
11
|
+
description: 'The region of the Cloud Run service'
|
|
12
|
+
required: true
|
|
13
|
+
sa_id:
|
|
14
|
+
description: 'The name of the service account used to run the Cloud Run service'
|
|
15
|
+
required: true
|
|
16
|
+
forward_env:
|
|
17
|
+
description: 'The environment variables to forward to the Cloud Run service (comma separated, e.g. ENV1,ENV2)'
|
|
18
|
+
required: false
|
|
19
|
+
allow_unauthenticated:
|
|
20
|
+
description: 'Whether to allow unauthenticated access to the Cloud Run service. Send "true" to allow unauthenticated access.'
|
|
21
|
+
required: false
|
|
22
|
+
outputs:
|
|
23
|
+
affected:
|
|
24
|
+
description: 'Whether the specified image is affected (computed before deploy)'
|
|
25
|
+
value: ${{ steps.check_affected.outputs.affected }}
|
|
26
|
+
runs:
|
|
27
|
+
using: "composite"
|
|
28
|
+
steps:
|
|
29
|
+
- name: Setup basic vars
|
|
30
|
+
shell: bash
|
|
31
|
+
run: |
|
|
32
|
+
echo "IMAGE_NAME=${{ inputs.image_name }}" >> $GITHUB_ENV
|
|
33
|
+
|
|
34
|
+
- name: Check if affected
|
|
35
|
+
id: check_affected
|
|
36
|
+
shell: bash
|
|
37
|
+
run: |
|
|
38
|
+
AFFECTED=$(devops affected image $IMAGE_NAME --from-live-version)
|
|
39
|
+
echo "affected=$AFFECTED" >> $GITHUB_OUTPUT
|
|
40
|
+
echo "affected=$AFFECTED"
|
|
41
|
+
if [[ "$AFFECTED" == "true" ]]; then
|
|
42
|
+
echo "${{ env.IMAGE_NAME }} is affected. Proceeding with deployment."
|
|
43
|
+
else
|
|
44
|
+
echo "${{ env.IMAGE_NAME }} is not affected. Skipping."
|
|
45
|
+
fi
|
|
46
|
+
|
|
47
|
+
- name: Deploy
|
|
48
|
+
shell: bash
|
|
49
|
+
if: steps.check_affected.outputs.affected == 'true'
|
|
50
|
+
run: |
|
|
51
|
+
RUNTIME_SA="${{ inputs.sa_id }}@${{ inputs.project_id }}.iam.gserviceaccount.com"
|
|
52
|
+
|
|
53
|
+
if [[ -z "${{ inputs.forward_env }}" ]]; then
|
|
54
|
+
FORWARD_ENV=""
|
|
55
|
+
else
|
|
56
|
+
FORWARD_ENV="--forward-env ${{ inputs.forward_env }}"
|
|
57
|
+
fi
|
|
58
|
+
|
|
59
|
+
if [[ "${{ inputs.allow_unauthenticated }}" == "true" ]]; then
|
|
60
|
+
ALLOW_UNAUTHENTICATED="--allow-unauthenticated"
|
|
61
|
+
else
|
|
62
|
+
ALLOW_UNAUTHENTICATED="--no-allow-unauthenticated"
|
|
63
|
+
fi
|
|
64
|
+
|
|
65
|
+
devops cloudrun deploy ${{ env.IMAGE_NAME }} ${{ github.sha }} \
|
|
66
|
+
--region ${{ inputs.region }} \
|
|
67
|
+
--service-account ${RUNTIME_SA} \
|
|
68
|
+
${FORWARD_ENV} \
|
|
69
|
+
${ALLOW_UNAUTHENTICATED}
|
|
70
|
+
|
|
71
|
+
devops image version set ${{ env.IMAGE_NAME }} ${{ github.sha }}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: "Deploy image"
|
|
2
|
+
description: "Deploy the specified image if it's affected and set its version"
|
|
3
|
+
inputs:
|
|
4
|
+
image_name:
|
|
5
|
+
description: 'The image key in images.yaml'
|
|
6
|
+
required: true
|
|
7
|
+
outputs:
|
|
8
|
+
affected:
|
|
9
|
+
description: 'Whether the specified image is affected (computed before deploy)'
|
|
10
|
+
value: ${{ steps.check_affected.outputs.affected }}
|
|
11
|
+
runs:
|
|
12
|
+
using: "composite"
|
|
13
|
+
steps:
|
|
14
|
+
- name: Setup basic vars
|
|
15
|
+
shell: bash
|
|
16
|
+
run: |
|
|
17
|
+
echo "IMAGE_NAME=${{ inputs.image_name }}" >> $GITHUB_ENV
|
|
18
|
+
|
|
19
|
+
- name: Check if affected
|
|
20
|
+
id: check_affected
|
|
21
|
+
shell: bash
|
|
22
|
+
run: |
|
|
23
|
+
AFFECTED=$(devops affected image $IMAGE_NAME --from-live-version)
|
|
24
|
+
echo "affected=$AFFECTED" >> $GITHUB_OUTPUT
|
|
25
|
+
echo "affected=$AFFECTED"
|
|
26
|
+
if [[ "$AFFECTED" == "true" ]]; then
|
|
27
|
+
echo "${{ env.IMAGE_NAME }} is affected. Proceeding with deployment."
|
|
28
|
+
else
|
|
29
|
+
echo "${{ env.IMAGE_NAME }} is not affected. Skipping."
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
- name: Deploy
|
|
33
|
+
shell: bash
|
|
34
|
+
if: steps.check_affected.outputs.affected == 'true'
|
|
35
|
+
run: |
|
|
36
|
+
devops image deployment create ${{ env.IMAGE_NAME }} ${{ github.sha }}
|
|
37
|
+
devops image version set ${{ env.IMAGE_NAME }} ${{ github.sha }}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: "Install prerequesites"
|
|
2
|
+
description: "Sets up Node, Bun, and devops"
|
|
3
|
+
runs:
|
|
4
|
+
using: "composite"
|
|
5
|
+
steps:
|
|
6
|
+
- name: Setup Node.js
|
|
7
|
+
uses: actions/setup-node@v4
|
|
8
|
+
with:
|
|
9
|
+
node-version: 23
|
|
10
|
+
|
|
11
|
+
- name: Setup bun
|
|
12
|
+
uses: oven-sh/setup-bun@v2
|
|
13
|
+
|
|
14
|
+
- name: set $MONOREPO_ENV
|
|
15
|
+
shell: bash
|
|
16
|
+
run: |
|
|
17
|
+
BRANCH_NAME=${{ github.ref_name }}
|
|
18
|
+
echo "MONOREPO_ENV=$BRANCH_NAME" >> $GITHUB_ENV
|
|
19
|
+
|
|
20
|
+
- name: Install the devops tool
|
|
21
|
+
shell: bash
|
|
22
|
+
run: |
|
|
23
|
+
bun install @vaharoni/devops
|
|
24
|
+
echo "$(pwd)/node_modules/.bin" >> $GITHUB_PATH
|
package/dist/src/target-templates/lang-variants-common/typescript/applications/example-node/index.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import express from "express";
|
|
2
|
+
import { InternalToken } from '@vaharoni/devops';
|
|
3
|
+
|
|
4
|
+
const app = express();
|
|
5
|
+
const port = 3001;
|
|
6
|
+
|
|
7
|
+
app.get("/", (req, res) => {
|
|
8
|
+
res.send("Hello from node");
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
// See applications/jobs/README.md for more information
|
|
12
|
+
app.post("/ping-from-jobs", (req, res) => {
|
|
13
|
+
const authorizationHeader = req.headers['authorization'];
|
|
14
|
+
try {
|
|
15
|
+
new InternalToken('jobs').verifyFromHeaderOrThrow(authorizationHeader);
|
|
16
|
+
} catch {
|
|
17
|
+
res.status(401).json({ status: 'unauthorized' });
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
console.log('Pong');
|
|
21
|
+
res.json({ status: 'ok' });
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
app.get("/healthz", (req, res) => {
|
|
25
|
+
res.send("OK");
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
app.listen(port, () => {
|
|
29
|
+
console.log(`Server is listening on ${port}`);
|
|
30
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "example-node",
|
|
3
|
+
"module": "index.ts",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"private": true,
|
|
6
|
+
"deployment": {
|
|
7
|
+
"service_name": "example-node",
|
|
8
|
+
"port": 3001,
|
|
9
|
+
"template": "external-service"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"start": "tsx index.ts",
|
|
13
|
+
"verify": "tsc -p ./tsconfig.json --noEmit"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"express": "^4.21.2",
|
|
17
|
+
"example-node-lib": "workspace:*"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@types/bun": "latest",
|
|
21
|
+
"@types/express": "^5.0.0"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"typescript": "^5"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
This application allows running commands at a certain schedule via k8s cron jobs.
|
|
2
|
+
Currently only curl is supported. A special auth token is injected to the Authorization Bearer which can
|
|
3
|
+
be verified by the receiver.
|
|
4
|
+
|
|
5
|
+
## Adding a cron job
|
|
6
|
+
|
|
7
|
+
To add a cron job, add an entry in `package.json` under `deployments.cronJobs`:
|
|
8
|
+
```json
|
|
9
|
+
"deployment": {
|
|
10
|
+
"template": "cron-job",
|
|
11
|
+
"cronJobs": [
|
|
12
|
+
{
|
|
13
|
+
"name": "call-check-something-in-example",
|
|
14
|
+
"cron": "*/15 * * * *",
|
|
15
|
+
"curl": ["jobs", "-X", "POST", "http://example/jobs/check-something"]
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
- `name` - must be unique across jobs and a valid k8s name. No spaces are allowed.
|
|
22
|
+
- `cron` - must be a valid Cron format per [here](https://en.wikipedia.org/wiki/Cron).
|
|
23
|
+
- `curl` - must be an array of strings, where each arg is an element in the array.
|
|
24
|
+
|
|
25
|
+
A few things to note about the `curl` argument:
|
|
26
|
+
- We use an array here, since curl relies heavily on args with spaces, e.g. `Content-Type: application/json` is a single arg.
|
|
27
|
+
- The first element must be the subject of the token sent to the endpoint. The endpoint should verify the request header contains a bearer token with the expected subject.
|
|
28
|
+
- The endpoint can be a DNS internal to the cluster, i.e. simply use the service name if it is in the same namepsace.
|
|
29
|
+
|
|
30
|
+
Downsides of this approach:
|
|
31
|
+
- the domain name used is a duplication of the `deployment.service_name` of the target application. This can be addressed in the future, e.g. by adding another arg to the cronjob with the `appName` that performs service discovery.
|
|
32
|
+
|
|
33
|
+
## Securing an API endpoint
|
|
34
|
+
|
|
35
|
+
Next.js example:
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
// app/someroute/route.ts
|
|
39
|
+
|
|
40
|
+
import { NextResponse } from 'next/server';
|
|
41
|
+
import { InternalToken } from '@vaharoni/devops';
|
|
42
|
+
|
|
43
|
+
export async function POST(request: Request) {
|
|
44
|
+
const authorizationHeader = request.headers.get('Authorization');
|
|
45
|
+
try {
|
|
46
|
+
new InternalToken('jobs').verifyFromHeaderOrThrow(authorizationHeader);
|
|
47
|
+
} catch {
|
|
48
|
+
return NextResponse.json({ status: 'unauthorized' }, { status: 401 });
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Do something
|
|
52
|
+
|
|
53
|
+
return NextResponse.json({ status: 'ok' });
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Testing a secure endpoint in local development
|
|
58
|
+
|
|
59
|
+
Make sure your `config/.env.global` has something like the following. This represents hex of 32 bytes. When creating a namespace, devops properly set these for you in a k8s secret. Locally, something like this suffices.
|
|
60
|
+
```text
|
|
61
|
+
MONOREPO_BASE_SECRET=0000111122223333444455556666777788889999aaaabbbbccccddddeeeeffff
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Then run:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
devops internal-curl jobs -v -X POST localhost:3001/jobs/someroute
|
|
68
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// no-op
|
package/dist/src/target-templates/lang-variants-common/typescript/applications/jobs/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "jobs",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"main": "index.ts",
|
|
6
|
+
"nx": {
|
|
7
|
+
"projectType": "application"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"print-token": "bunx tsx print-token.ts",
|
|
11
|
+
"verify": "tsc -p ./tsconfig.json --noEmit"
|
|
12
|
+
},
|
|
13
|
+
"author": "",
|
|
14
|
+
"license": "ISC",
|
|
15
|
+
"deployment": {
|
|
16
|
+
"template": "cron-jobs",
|
|
17
|
+
"cronJobs": [
|
|
18
|
+
{
|
|
19
|
+
"name": "test",
|
|
20
|
+
"cron": "*/15 * * * *",
|
|
21
|
+
"curl": [
|
|
22
|
+
"jobs",
|
|
23
|
+
"-X",
|
|
24
|
+
"POST",
|
|
25
|
+
"http://example-node/ping-from-jobs"
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Add here env variables that are for local development environment
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Add here env variables that are for local test environment
|
|
File without changes
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
// Enable latest features
|
|
4
|
+
"lib": ["ESNext", "DOM"],
|
|
5
|
+
"target": "ESNext",
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"moduleDetection": "force",
|
|
8
|
+
"jsx": "react-jsx",
|
|
9
|
+
"allowJs": true,
|
|
10
|
+
|
|
11
|
+
// Bundler mode
|
|
12
|
+
"moduleResolution": "bundler",
|
|
13
|
+
"allowImportingTsExtensions": true,
|
|
14
|
+
"verbatimModuleSyntax": true,
|
|
15
|
+
"noEmit": true,
|
|
16
|
+
|
|
17
|
+
// Best practices
|
|
18
|
+
"strict": true,
|
|
19
|
+
"skipLibCheck": true,
|
|
20
|
+
"noFallthroughCasesInSwitch": true,
|
|
21
|
+
|
|
22
|
+
// Some stricter flags (disabled by default)
|
|
23
|
+
"noUnusedLocals": false,
|
|
24
|
+
"noUnusedParameters": false,
|
|
25
|
+
"noPropertyAccessFromIndexSignature": false
|
|
26
|
+
}
|
|
27
|
+
}
|