@seeka-labs/cli-apps 1.1.38 → 2.0.7-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +31 -36
- package/dist/index.js.map +4 -4
- package/dist/init-template/.gitlab-ci.yml +47 -0
- package/dist/init-template/.yarnrc.yml +8 -0
- package/dist/init-template/README.md +7 -0
- package/dist/{init-templates → init-template/app}/browser/jest.config.js +11 -11
- package/dist/{init-templates → init-template/app}/browser/package.json +16 -12
- package/dist/{init-templates → init-template/app}/browser/scripts/esbuild/build-browser-plugin.mjs +110 -110
- package/dist/{init-templates → init-template/app}/browser/scripts/esbuild/plugins/importAsGlobals.mjs +38 -38
- package/dist/{init-templates → init-template/app}/browser/src/browser.ts +12 -12
- package/dist/{init-templates → init-template/app}/browser/src/plugin/index.test.ts +6 -6
- package/dist/{init-templates → init-template/app}/browser/src/plugin/index.ts +47 -49
- package/dist/{init-templates → init-template/app}/browser/tsconfig.json +34 -34
- package/dist/{init-templates/netlify-function → init-template/app/server-azure-function}/.eslintrc.cjs +2 -10
- package/dist/{init-templates/azure-function → init-template/app/server-azure-function}/.funcignore +12 -7
- package/dist/init-template/app/server-azure-function/.nvmrc +1 -0
- package/dist/{init-templates/azure-function → init-template/app/server-azure-function}/README.md +104 -107
- package/dist/{init-templates/azure-function → init-template/app/server-azure-function}/host.json +1 -10
- package/dist/init-template/app/server-azure-function/package.json +52 -0
- package/dist/{init-templates/azure-function → init-template/app/server-azure-function}/src/functions/seekaAppWebhook.ts +235 -236
- package/dist/{init-templates/azure-function → init-template/app/server-azure-function}/src/lib/browser/index.ts +54 -54
- package/dist/{init-templates/azure-function → init-template/app/server-azure-function}/src/lib/jobs/index.ts +1 -1
- package/dist/{init-templates/azure-function → init-template/app/server-azure-function}/src/lib/logging/index.ts +92 -92
- package/dist/{init-templates/azure-function/src/lib/browser → init-template/app/server-azure-function/src/lib}/models/index.ts +6 -6
- package/dist/{init-templates/azure-function → init-template/app/server-azure-function}/src/lib/state/redis/index.ts +96 -65
- package/dist/{init-templates/azure-function → init-template/app/server-azure-function}/src/lib/state/seeka/installations.ts +64 -66
- package/dist/{init-templates/azure-function → init-template/app/server-azure-function}/tsconfig.json +1 -1
- package/dist/init-template/package.json +28 -0
- package/dist/init-template/tsconfig.json +25 -0
- package/package.json +5 -4
- package/dist/init-templates/aws-lambda/.env.example +0 -15
- package/dist/init-templates/aws-lambda/.eslintrc.cjs +0 -19
- package/dist/init-templates/aws-lambda/.example.gitignore +0 -49
- package/dist/init-templates/aws-lambda/.gitlab-ci.yml +0 -39
- package/dist/init-templates/aws-lambda/.nvmrc +0 -1
- package/dist/init-templates/aws-lambda/.vscode/extensions.json +0 -5
- package/dist/init-templates/aws-lambda/.vscode/launch.json +0 -20
- package/dist/init-templates/aws-lambda/.vscode/settings.json +0 -3
- package/dist/init-templates/aws-lambda/.vscode/tasks.json +0 -12
- package/dist/init-templates/aws-lambda/README.md +0 -77
- package/dist/init-templates/aws-lambda/jest.config.js +0 -5
- package/dist/init-templates/aws-lambda/package.json +0 -53
- package/dist/init-templates/aws-lambda/scripts/ngrok.js +0 -28
- package/dist/init-templates/aws-lambda/src/index.test.ts +0 -7
- package/dist/init-templates/aws-lambda/src/index.ts +0 -33
- package/dist/init-templates/aws-lambda/src/lib/logging/index.ts +0 -88
- package/dist/init-templates/aws-lambda/src/lib/services/index.ts +0 -41
- package/dist/init-templates/aws-lambda/src/lib/state/redis/index.ts +0 -65
- package/dist/init-templates/aws-lambda/src/lib/state/seeka/installations.ts +0 -67
- package/dist/init-templates/aws-lambda/src/routes/seekaAppWebhook.ts +0 -194
- package/dist/init-templates/aws-lambda/tsconfig.json +0 -31
- package/dist/init-templates/aws-lambda/yarn.lock +0 -4392
- package/dist/init-templates/azure-function/.eslintrc.cjs +0 -19
- package/dist/init-templates/azure-function/.example.gitignore +0 -48
- package/dist/init-templates/azure-function/.gitlab-ci.yml +0 -48
- package/dist/init-templates/azure-function/.nvmrc +0 -1
- package/dist/init-templates/azure-function/.vscode/extensions.json +0 -7
- package/dist/init-templates/azure-function/.vscode/launch.json +0 -13
- package/dist/init-templates/azure-function/.vscode/settings.json +0 -9
- package/dist/init-templates/azure-function/.vscode/tasks.json +0 -39
- package/dist/init-templates/azure-function/jest.config.js +0 -5
- package/dist/init-templates/azure-function/package.json +0 -47
- package/dist/init-templates/azure-function/scripts/dev-queue-setup.js +0 -30
- package/dist/init-templates/azure-function/src/index.test.ts +0 -7
- package/dist/init-templates/azure-function/yarn.lock +0 -3772
- package/dist/init-templates/browser/.editorconfig +0 -14
- package/dist/init-templates/browser/.eslintrc.cjs +0 -1
- package/dist/init-templates/browser/.yarnrc +0 -1
- package/dist/init-templates/browser/yarn.lock +0 -3045
- package/dist/init-templates/netlify-function/.env.example +0 -18
- package/dist/init-templates/netlify-function/.example.gitignore +0 -36
- package/dist/init-templates/netlify-function/.nvmrc +0 -1
- package/dist/init-templates/netlify-function/.vscode/launch.json +0 -45
- package/dist/init-templates/netlify-function/README.md +0 -62
- package/dist/init-templates/netlify-function/jest.config.js +0 -5
- package/dist/init-templates/netlify-function/netlify.toml +0 -7
- package/dist/init-templates/netlify-function/package.json +0 -39
- package/dist/init-templates/netlify-function/src/api/example-job-background/index.ts +0 -52
- package/dist/init-templates/netlify-function/src/api/polling-example-job-scheduled/index.ts +0 -46
- package/dist/init-templates/netlify-function/src/api/seeka-app-webhook/index.ts +0 -217
- package/dist/init-templates/netlify-function/src/index.test.ts +0 -7
- package/dist/init-templates/netlify-function/src/lib/jobs/index.ts +0 -68
- package/dist/init-templates/netlify-function/src/lib/logging/index.ts +0 -91
- package/dist/init-templates/netlify-function/src/lib/services/index.ts +0 -41
- package/dist/init-templates/netlify-function/src/lib/state/redis/index.ts +0 -65
- package/dist/init-templates/netlify-function/src/lib/state/seeka/installations.ts +0 -67
- package/dist/init-templates/netlify-function/tsconfig.json +0 -25
- package/dist/init-templates/netlify-function/yarn.lock +0 -9337
- /package/dist/{init-templates → init-template/app}/browser/README.md +0 -0
- /package/dist/{init-templates/azure-function → init-template/app/server-azure-function}/local.settings.example.json +0 -0
- /package/dist/{init-templates/azure-function → init-template/app/server-azure-function}/scripts/ngrok.js +0 -0
- /package/dist/{init-templates/azure-function → init-template/app/server-azure-function}/src/functions/healthCheck.ts +0 -0
- /package/dist/{init-templates/azure-function → init-template/app/server-azure-function}/src/functions/pollingExample.ts +0 -0
- /package/dist/{init-templates/azure-function → init-template/app/server-azure-function}/src/functions/queueExample.ts +0 -0
- /package/dist/{init-templates/azure-function → init-template/app/server-azure-function}/src/lib/services/index.ts +0 -0
package/dist/{init-templates/azure-function → init-template/app/server-azure-function}/.funcignore
RENAMED
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
*.js.map
|
|
2
1
|
*.ts
|
|
3
|
-
.git*
|
|
4
|
-
.vscode
|
|
5
2
|
local.settings.json
|
|
6
3
|
test
|
|
7
4
|
scripts/
|
|
8
5
|
src/
|
|
9
|
-
|
|
6
|
+
README.md
|
|
7
|
+
tsconfig.json
|
|
8
|
+
.eslintrc.cjs
|
|
9
|
+
|
|
10
|
+
node_modules/@jest/globals/
|
|
10
11
|
node_modules/@types/
|
|
11
|
-
node_modules/azure-functions-core-tools/
|
|
12
|
-
node_modules/typescript/
|
|
13
12
|
node_modules/@typescript-eslint/eslint-plugin/
|
|
14
13
|
node_modules/@typescript-eslint/parser/
|
|
14
|
+
node_modules/azure-functions-core-tools/
|
|
15
15
|
node_modules/eslint/
|
|
16
|
+
node_modules/jest/
|
|
16
17
|
node_modules/ngrok/
|
|
17
|
-
node_modules/rimraf/
|
|
18
|
+
node_modules/rimraf/
|
|
19
|
+
node_modules/ts-jest/
|
|
20
|
+
node_modules/typescript/
|
|
21
|
+
|
|
22
|
+
.gitignore
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
20
|
package/dist/{init-templates/azure-function → init-template/app/server-azure-function}/README.md
RENAMED
|
@@ -1,108 +1,105 @@
|
|
|
1
|
-
# Seeka app - Azure functions
|
|
2
|
-
|
|
3
|
-
## Development
|
|
4
|
-
|
|
5
|
-
- See [Configure your environment](https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-vs-code-typescript?pivots=nodejs-model-v4#configure-your-environment) for dependencies
|
|
6
|
-
- For emulating Azure storage queues, blobs and tables: `docker run --name azurite -p 10000:10000 -p 10001:10001 -p 10002:10002 --detach mcr.microsoft.com/azure-storage/azurite`
|
|
7
|
-
- Set `AzureWebJobsStorage` setting in local.settings.json to `UseDevelopmentStorage=true`
|
|
8
|
-
- If not using WSL:
|
|
9
|
-
`UseDevelopmentStorage=true`
|
|
10
|
-
- If using WSL, the following may be required to allow your app to reach Azure storage emulator:
|
|
11
|
-
|
|
12
|
-
Replace `MY-MACHINE-NAME` with your hostname. Below connection string allows running Azurite on your host machine and lets WSL connect to it
|
|
13
|
-
`DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://MY-MACHINE-NAME.local:10000/devstoreaccount1;QueueEndpoint=http://MY-MACHINE-NAME.local:10001/devstoreaccount1;TableEndpoint=http://MY-MACHINE-NAME.local:10002/devstoreaccount1;`
|
|
14
|
-
- Install Azure Storage explorer and create your queues (see `./src/lib/jobs/index.ts` for `queueNames`). Azure Storage explorer can be used to view your queue items.
|
|
15
|
-
- `yarn install`
|
|
16
|
-
- `yarn dev`
|
|
17
|
-
|
|
18
|
-
### Debugging
|
|
19
|
-
Supports VSCode debugging via the debugger and utilisation of breakpoints.
|
|
20
|
-
This is only tested on Linux but may work on Windows.
|
|
21
|
-
If using Windows then use WSL with an Ubuntu distro for support of attaching the VS code debugger
|
|
22
|
-
|
|
23
|
-
### Live urls
|
|
24
|
-
You can expose your app locally to the internet via Ngrok to test your app before deploying.
|
|
25
|
-
|
|
26
|
-
#### Setup
|
|
27
|
-
1. Sign up for a Ngrok account
|
|
28
|
-
2. Get your auth token
|
|
29
|
-
3. `yarn ngrok config add-authtoken [auth token here]` replacing `[auth token]` with the auth token retrieved from your Ngrok dashboard
|
|
30
|
-
|
|
31
|
-
#### Running
|
|
32
|
-
1. `yarn start` OR start debugging in VSCode
|
|
33
|
-
2. In separate terminal window run `yarn tunnel` and observe the log entry that starts with `Live url exposed`.
|
|
34
|
-
3. Input the URL into your Seeka app configuration as the "Webook URL" via the Seeka UI.
|
|
35
|
-
|
|
36
|
-
## Included sample functions
|
|
37
|
-
### Seeka app webhook
|
|
38
|
-
`src/functions/seekaAppWebhook.ts`
|
|
39
|
-
|
|
40
|
-
Handles inbound webhooks sent from Seeka to your app.
|
|
41
|
-
|
|
42
|
-
### Queue example
|
|
43
|
-
`src/functions/queueExample.ts`
|
|
44
|
-
|
|
45
|
-
Handles taking a message and placing it on an Azure storage queue for later processing. This concept can be used to offload long running operations based on data sent to your app from Seeka and can help to ensure Azure Function time execution limits are respected.
|
|
46
|
-
|
|
47
|
-
### Polling example
|
|
48
|
-
`src/functions/pollingExample.ts`
|
|
49
|
-
|
|
50
|
-
Handles scheduled invoking of a function. This concept can be used to "fan out" long running operations based on data sent to your app from Seeka and can help to ensure Azure Function time execution limits are respected by splitting long running operations into smaller, less time consuming parts.
|
|
51
|
-
|
|
52
|
-
## Invoking functions
|
|
53
|
-
### Development environment
|
|
54
|
-
Scheduled / timer function: `curl -i -d '{"input": null}' -H "Content-Type: application/json" -X POST http://localhost:7072/admin/functions/pollingExample`
|
|
55
|
-
|
|
56
|
-
### Azure cloud
|
|
57
|
-
Scheduled / timer function: `curl -i -d '{"input": null}' -H "Content-Type: application/json" -H "x-functions-key: <key from azure portal>" -X POST https://seeka-app-example-name.azurewebsites.net/admin/functions/pollingExample`
|
|
58
|
-
|
|
59
|
-
See [this doc](https://learn.microsoft.com/en-us/azure/azure-functions/functions-manually-run-non-http?tabs=azure-portal#get-the-master-key) on how to get the functions (master) key
|
|
60
|
-
|
|
61
|
-
## Logging
|
|
62
|
-
Centralised logging handled by [Winston](https://www.npmjs.com/package/winston). Winston is installed in this template and is also used in the Seeka SDK NPM packages.
|
|
63
|
-
|
|
64
|
-
[Seq](https://datalust.co/seq) Winston transport is installed in this template (optional).
|
|
65
|
-
|
|
66
|
-
To configure Seq options, see `_SEQ_` environment variables.
|
|
67
|
-
|
|
68
|
-
To install Seq on your development machine
|
|
69
|
-
1. Run `docker run --name seq -d --restart=always -e ACCEPT_EULA=Y -p 5341:80 datalust/seq:2024.2`
|
|
70
|
-
2. Update your `LOGGING_SEQ_SERVERURL` environment variable to `http://localhost:5341` or `http://[YOUR MACHINE NAME].local:5341` if using WSL.
|
|
71
|
-
|
|
72
|
-
If creating an API key for Seq, only permission that is required is `Ingest`.
|
|
73
|
-
|
|
74
|
-
## State management
|
|
75
|
-
Installations of your app and other state required for your app to function is stored in Redis. Another state provider can be swapped out for Redis, see `src/lib/state/seeka/installations.ts` for the file that manages the state of the installations.
|
|
76
|
-
|
|
77
|
-
### Upstash (optional)
|
|
78
|
-
If you dont want to use Upstash for Redis then the connection strings in `.env` can be swapped with your Redis instance.
|
|
79
|
-
|
|
80
|
-
> If using Upstash then create a database before following the below guide to deploying your AWS lambda function.
|
|
81
|
-
|
|
82
|
-
> When choosing region - use a region that is closest to the Azure region that your function app is hosted in to reduce latency between the function and the Redis database.
|
|
83
|
-
|
|
84
|
-
## Deployment
|
|
85
|
-
This project comes ready to deploy for free to Azure functions with database backed by Redis hosted by Upstash and queues, blobs and tables backed by Azure Storage.
|
|
86
|
-
|
|
87
|
-
1. Create Azure function app via the portal with below settings
|
|
88
|
-
- Function app name: seeka-app-example-name
|
|
89
|
-
- Code or container image: Code
|
|
90
|
-
- Runtime stack: Node.js
|
|
91
|
-
- Version:
|
|
92
|
-
- Region: Closest region to where your upstash "master / write" database is located
|
|
93
|
-
- Operating system: linux
|
|
94
|
-
- Hosting: Consumption
|
|
95
|
-
- Enable public access: On
|
|
96
|
-
2. Set environment variables of the Azure web app - reference local.settings.json "Values"
|
|
97
|
-
3. If your app receives calls directly from the browser (eg. your browser app plugin) then CORS needs to be enabled for all origins from within the settings of the Function app in Azure portal.
|
|
98
|
-
3. `yarn deploy`
|
|
99
|
-
|
|
100
|
-
### Continuous delivery
|
|
101
|
-
This template includes a GitLab CD pipeline that can be used to trigger deployments of your app when changes are pushed to your Git repository.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
## References
|
|
107
|
-
- https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite
|
|
1
|
+
# Seeka app - Azure functions
|
|
2
|
+
|
|
3
|
+
## Development
|
|
4
|
+
|
|
5
|
+
- See [Configure your environment](https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-vs-code-typescript?pivots=nodejs-model-v4#configure-your-environment) for dependencies
|
|
6
|
+
- For emulating Azure storage queues, blobs and tables: `docker run --name azurite -p 10000:10000 -p 10001:10001 -p 10002:10002 --detach mcr.microsoft.com/azure-storage/azurite`
|
|
7
|
+
- Set `AzureWebJobsStorage` setting in local.settings.json to `UseDevelopmentStorage=true`
|
|
8
|
+
- If not using WSL:
|
|
9
|
+
`UseDevelopmentStorage=true`
|
|
10
|
+
- If using WSL, the following may be required to allow your app to reach Azure storage emulator:
|
|
11
|
+
|
|
12
|
+
Replace `MY-MACHINE-NAME` with your hostname. Below connection string allows running Azurite on your host machine and lets WSL connect to it
|
|
13
|
+
`DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://MY-MACHINE-NAME.local:10000/devstoreaccount1;QueueEndpoint=http://MY-MACHINE-NAME.local:10001/devstoreaccount1;TableEndpoint=http://MY-MACHINE-NAME.local:10002/devstoreaccount1;`
|
|
14
|
+
- Install Azure Storage explorer and create your queues (see `./src/lib/jobs/index.ts` for `queueNames`). Azure Storage explorer can be used to view your queue items.
|
|
15
|
+
- `yarn install`
|
|
16
|
+
- `yarn dev`
|
|
17
|
+
|
|
18
|
+
### Debugging
|
|
19
|
+
Supports VSCode debugging via the debugger and utilisation of breakpoints.
|
|
20
|
+
This is only tested on Linux but may work on Windows.
|
|
21
|
+
If using Windows then use WSL with an Ubuntu distro for support of attaching the VS code debugger
|
|
22
|
+
|
|
23
|
+
### Live urls
|
|
24
|
+
You can expose your app locally to the internet via Ngrok to test your app before deploying.
|
|
25
|
+
|
|
26
|
+
#### Setup
|
|
27
|
+
1. Sign up for a Ngrok account
|
|
28
|
+
2. Get your auth token
|
|
29
|
+
3. `yarn ngrok config add-authtoken [auth token here]` replacing `[auth token]` with the auth token retrieved from your Ngrok dashboard
|
|
30
|
+
|
|
31
|
+
#### Running
|
|
32
|
+
1. `yarn start` OR start debugging in VSCode
|
|
33
|
+
2. In separate terminal window run `yarn tunnel` and observe the log entry that starts with `Live url exposed`.
|
|
34
|
+
3. Input the URL into your Seeka app configuration as the "Webook URL" via the Seeka UI.
|
|
35
|
+
|
|
36
|
+
## Included sample functions
|
|
37
|
+
### Seeka app webhook
|
|
38
|
+
`src/functions/seekaAppWebhook.ts`
|
|
39
|
+
|
|
40
|
+
Handles inbound webhooks sent from Seeka to your app.
|
|
41
|
+
|
|
42
|
+
### Queue example
|
|
43
|
+
`src/functions/queueExample.ts`
|
|
44
|
+
|
|
45
|
+
Handles taking a message and placing it on an Azure storage queue for later processing. This concept can be used to offload long running operations based on data sent to your app from Seeka and can help to ensure Azure Function time execution limits are respected.
|
|
46
|
+
|
|
47
|
+
### Polling example
|
|
48
|
+
`src/functions/pollingExample.ts`
|
|
49
|
+
|
|
50
|
+
Handles scheduled invoking of a function. This concept can be used to "fan out" long running operations based on data sent to your app from Seeka and can help to ensure Azure Function time execution limits are respected by splitting long running operations into smaller, less time consuming parts.
|
|
51
|
+
|
|
52
|
+
## Invoking functions
|
|
53
|
+
### Development environment
|
|
54
|
+
Scheduled / timer function: `curl -i -d '{"input": null}' -H "Content-Type: application/json" -X POST http://localhost:7072/admin/functions/pollingExample`
|
|
55
|
+
|
|
56
|
+
### Azure cloud
|
|
57
|
+
Scheduled / timer function: `curl -i -d '{"input": null}' -H "Content-Type: application/json" -H "x-functions-key: <key from azure portal>" -X POST https://seeka-app-example-name.azurewebsites.net/admin/functions/pollingExample`
|
|
58
|
+
|
|
59
|
+
See [this doc](https://learn.microsoft.com/en-us/azure/azure-functions/functions-manually-run-non-http?tabs=azure-portal#get-the-master-key) on how to get the functions (master) key
|
|
60
|
+
|
|
61
|
+
## Logging
|
|
62
|
+
Centralised logging handled by [Winston](https://www.npmjs.com/package/winston). Winston is installed in this template and is also used in the Seeka SDK NPM packages.
|
|
63
|
+
|
|
64
|
+
[Seq](https://datalust.co/seq) Winston transport is installed in this template (optional).
|
|
65
|
+
|
|
66
|
+
To configure Seq options, see `_SEQ_` environment variables.
|
|
67
|
+
|
|
68
|
+
To install Seq on your development machine
|
|
69
|
+
1. Run `docker run --name seq -d --restart=always -e ACCEPT_EULA=Y -p 5341:80 datalust/seq:2024.2`
|
|
70
|
+
2. Update your `LOGGING_SEQ_SERVERURL` environment variable to `http://localhost:5341` or `http://[YOUR MACHINE NAME].local:5341` if using WSL.
|
|
71
|
+
|
|
72
|
+
If creating an API key for Seq, only permission that is required is `Ingest`.
|
|
73
|
+
|
|
74
|
+
## State management
|
|
75
|
+
Installations of your app and other state required for your app to function is stored in Redis. Another state provider can be swapped out for Redis, see `src/lib/state/seeka/installations.ts` for the file that manages the state of the installations.
|
|
76
|
+
|
|
77
|
+
### Upstash (optional)
|
|
78
|
+
If you dont want to use Upstash for Redis then the connection strings in `.env` can be swapped with your Redis instance.
|
|
79
|
+
|
|
80
|
+
> If using Upstash then create a database before following the below guide to deploying your AWS lambda function.
|
|
81
|
+
|
|
82
|
+
> When choosing region - use a region that is closest to the Azure region that your function app is hosted in to reduce latency between the function and the Redis database.
|
|
83
|
+
|
|
84
|
+
## Deployment
|
|
85
|
+
This project comes ready to deploy for free to Azure functions with database backed by Redis hosted by Upstash and queues, blobs and tables backed by Azure Storage.
|
|
86
|
+
|
|
87
|
+
1. Create Azure function app via the portal with below settings
|
|
88
|
+
- Function app name: seeka-app-example-name
|
|
89
|
+
- Code or container image: Code
|
|
90
|
+
- Runtime stack: Node.js
|
|
91
|
+
- Version: 18 LTS
|
|
92
|
+
- Region: Closest region to where your upstash "master / write" database is located
|
|
93
|
+
- Operating system: linux
|
|
94
|
+
- Hosting: Consumption
|
|
95
|
+
- Enable public access: On
|
|
96
|
+
2. Set environment variables of the Azure web app - reference local.settings.json "Values"
|
|
97
|
+
3. If your app receives calls directly from the browser (eg. your browser app plugin) then CORS needs to be enabled for all origins from within the settings of the Function app in Azure portal.
|
|
98
|
+
3. `yarn deploy`
|
|
99
|
+
|
|
100
|
+
### Continuous delivery
|
|
101
|
+
This template includes a GitLab CD pipeline that can be used to trigger deployments of your app when changes are pushed to your Git repository.
|
|
102
|
+
|
|
103
|
+
## References
|
|
104
|
+
- https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite
|
|
108
105
|
- https://learn.microsoft.com/en-us/azure/storage/queues/storage-quickstart-queues-nodejs?tabs=connection-string%2Croles-azure-portal%2Cenvironment-variable-windows%2Csign-in-azure-cli
|
package/dist/{init-templates/azure-function → init-template/app/server-azure-function}/host.json
RENAMED
|
@@ -14,16 +14,7 @@
|
|
|
14
14
|
"version": "[4.*, 5.0.0)"
|
|
15
15
|
},
|
|
16
16
|
"concurrency": {
|
|
17
|
-
"dynamicConcurrencyEnabled":
|
|
17
|
+
"dynamicConcurrencyEnabled": true,
|
|
18
18
|
"snapshotPersistenceEnabled": true
|
|
19
|
-
},
|
|
20
|
-
"extensions": {
|
|
21
|
-
"queues": {
|
|
22
|
-
"maxPollingInterval": "00:00:15",
|
|
23
|
-
"visibilityTimeout": "00:01:00",
|
|
24
|
-
"batchSize": 32,
|
|
25
|
-
"maxDequeueCount": 2,
|
|
26
|
-
"messageEncoding": "base64"
|
|
27
|
-
}
|
|
28
19
|
}
|
|
29
20
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@seeka-app-example-name/server-azure-function",
|
|
3
|
+
"version": "2.0.7-rc.1",
|
|
4
|
+
"description": "Seeka example app with hosting on Azure serverless functions",
|
|
5
|
+
"author": "Seeka <platform@seeka.co>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "dist/src/functions/*.js",
|
|
8
|
+
"private": true,
|
|
9
|
+
"engines": {
|
|
10
|
+
"node": ">=20"
|
|
11
|
+
},
|
|
12
|
+
"scripts": {
|
|
13
|
+
"lint": "eslint",
|
|
14
|
+
"build": "tsc",
|
|
15
|
+
"watch": "tsc -w",
|
|
16
|
+
"clean": "rimraf dist",
|
|
17
|
+
"prestart": "<packageManagerRunPrefix> clean && yarn build",
|
|
18
|
+
"dev": "func start --port 7072",
|
|
19
|
+
"tunnel": "node scripts/ngrok.js seeka-app-example-name-localdev",
|
|
20
|
+
"deploy": "yarn func azure functionapp publish seeka-app-example-name --no-build --javascript",
|
|
21
|
+
"dev:queue:create": "node scripts/dev-queue-setup.js sample-queue-name"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@azure/functions": "^4.7.2",
|
|
25
|
+
"@azure/storage-queue": "^12.26.0",
|
|
26
|
+
"@datalust/winston-seq": "^2.0.0",
|
|
27
|
+
"@redis/client": "^5.1.0",
|
|
28
|
+
"@redis/json": "^5.1.0",
|
|
29
|
+
"@seeka-labs/sdk-apps-server": "2.0.7-rc.1",
|
|
30
|
+
"axios": "^1.9.0",
|
|
31
|
+
"lodash": "^4.17.21",
|
|
32
|
+
"redis": "^5.1.0",
|
|
33
|
+
"winston": "^3.17.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@jest/globals": "^29.7.0",
|
|
37
|
+
"@types/jest": "^29.5.14",
|
|
38
|
+
"@types/lodash": "^4.17.17",
|
|
39
|
+
"@types/lodash-es": "^4.17.12",
|
|
40
|
+
"@types/node": "^20",
|
|
41
|
+
"@typescript-eslint/eslint-plugin": "^8.32.1",
|
|
42
|
+
"@typescript-eslint/parser": "^8.32.1",
|
|
43
|
+
"azure-functions-core-tools": "*",
|
|
44
|
+
"eslint": "^9",
|
|
45
|
+
"jest": "^29.7.0",
|
|
46
|
+
"ngrok": "^5.0.0-beta.2",
|
|
47
|
+
"rimraf": "^6.0.1",
|
|
48
|
+
"ts-jest": "^29.3.4",
|
|
49
|
+
"typescript": "^5.8.3"
|
|
50
|
+
},
|
|
51
|
+
"stableVersion": "2.0.6"
|
|
52
|
+
}
|