You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Use Nimbella Projects with Netlify Sites](#use-nimbella-projects-with-netlify-sites)
27
-
-[Deploy Netlify Functions on Nimbella Cloud](#deploy-netlify-functions-on-nimbella-cloud)
28
27
-[Examples](#examples)
29
28
-[Support](#support)
30
29
-[License](#license)
@@ -42,7 +41,7 @@ To do that, run the following command from the base of your local project direct
42
41
netlify addons:create nimbella
43
42
```
44
43
45
-
The add-on will create a Nimbella namespace where your resources are allocated. Your Nimbella namespace includes your serverless functions, a dedicated key-value store, and access to an integrated object store.
44
+
The add-on will create a Nimbella namespace where your resources are allocated. Your Nimbella namespace includes your serverless APIs, a dedicated key-value store, and access to an integrated object store.
46
45
47
46
<!--TODO: add steps to claim the namespace and configure `nim` CLI when the flow is enabled. -->
48
47
<!--You may claim the namespace and login to your Nimbella account by running `netlify addons:auth nimbella`.-->
@@ -68,29 +67,22 @@ Once your add-on is configured, you need to add the Nimbella Build Plugin to You
68
67
package = "netlify-plugin-nimbella"
69
68
```
70
69
71
-
You may provide additional configuration in the `netlify.toml` file to configure the resources available to your serverless functions, or to configure the API path for your functions. Here is an example.
70
+
You may provide additional configuration in the `netlify.toml` file. The plugin input configuration is optional, however you will want to at least set the API `path` to avoid CORS issues between your frontend and backend components of your cloud application.
72
71
73
72
```toml
74
73
[[plugins]]
75
74
package = "netlify-plugin-nimbella"
75
+
76
76
[plugins.inputs]
77
-
functions = "functions"# Functions source directory. Use this if you would like to use Nimbella to deploy your functions.
78
-
memory = 256# Function memory limit in MB.
79
-
path = "/api/"# The prefix path to access your deployed packages.
80
-
timeout = 6000# Function timeout limit in milliseconds.
77
+
path = "/api"# The prefix path to access your deployed packages.
78
+
env = [] # Environment variables to export to serverless APIs.
81
79
```
82
80
83
-
## Usage
84
-
85
-
In this section, you will learn how to structure your repository and `netlify.toml` for this plugin to deploy your functions on Nimbella Cloud.
86
-
87
-
**Note:** Deployment of packages/functions to Nimbella is skipped when the build context is not "production". We're working on an enhancement that will allow you to deploy preview builds to staging namespaces on Nimbella.
88
-
89
-
#### Use Nimbella Projects with Netlify Sites
81
+
## Understanding your Nimbella Project
90
82
91
83
The Nimbella add-on for Netlify allows you to use [Nimbella projects](https://nimbella.io/downloads/nim/nim.html#overview-of-nimbella-projects-actions-and-deployment) to automate packaging and deployment. We suggest reading the documentation about [Nimbella projects](https://nimbella.io/downloads/nim/nim.html#overview-of-nimbella-projects-actions-and-deployment) at some point. We provide a quick introduction here.
92
84
93
-
Nimbella projects inspect a directory named `packages` at the base of your repository. The contents of this directory dictate the serverless functions that are deployed. The plugin will automatically deploy the functions inside `packages`and all of the functions (also called actions) can accessed using the following pattern: `https://your-site.com/<path(default="api")>/<packageName>/<actionName>`.
85
+
Nimbella projects inspect a directory named `packages` at the base of your repository. The contents of this directory dictate the serverless APIs that are deployed. The plugin will automatically deploy each API inside the `packages`directory. We use the term `action` to be synonymous with serverless API (or serverless function). Each API can accessed using the following pattern: `https://your-site.com/<path(default="api")>/<packageName>/<actionName>`.
94
86
95
87
For example, for the following project structure:
96
88
@@ -99,47 +91,31 @@ site
99
91
├── netlify.toml
100
92
├── packages
101
93
│ ├── auth
102
-
│ │ ├── login.js
94
+
│ │ ├── login
95
+
│ │ │ └── index.js
103
96
│ │ └── logout.js
104
97
│ └── todos
105
-
│ ├── create.js
106
-
│ ├── delete.js
107
-
│ ├── list.js
108
-
│ └── update.js
109
-
└── public
98
+
│ ├── create.py
99
+
│ ├── delete.php
100
+
│ ├── list.go
101
+
│ └── update.swift
102
+
└── web
110
103
└── index.html
111
104
```
112
105
113
-
You will invoke the function `auth/login.js`via the API end point `https://your-site.com/api/auth/login`.
106
+
The APIs are `auth/login`, `auth/logout`, `todos/create`, and so on. An API may be a single file, or built from a set of files within an enclosing directory. You may mix languages, and deploy functions as source, without even building languages that require compilation. To API end point for any of the actions is constructed in the same way. For example the serverless API implemented by `auth/login/index.js`is invoked with the REST end point `https://your-site.com/api/auth/login`.
114
107
115
-
#### Deploy Netlify Functions on Nimbella Cloud
108
+
##Exporting Environment Variables to Serverless APIs
116
109
117
-
You can deploy your existing Netlify Functions to Nimbella Cloud with very minimal changes.
118
-
119
-
Specify the `functions` input value under `[plugins.inputs]` inside `netlify.toml`.
120
-
121
-
```diff
122
-
[[plugins]]
123
-
package = "netlify-plugin-nimbella"
124
-
+ [plugins.inputs]
125
-
+ functions = "functions" # Functions source directory. Use this if you would like to use Nimbella to deploy your functions.
126
-
```
127
-
128
-
To be able to pass **environment variables** to functions, you should first set them as Netlify build environment variables and use the below plugin input to selectively forward the variables to functions deployed on Nimbella.
110
+
If your serverless APIs require environment variables, you have to export the variables explicitly in the `plugins.input` section of the `netlify.toml` file. This is to avoid exporting the entire environment to your APIs, and instead selecting exporting only the variables the actions need access to.
129
111
130
112
```toml
131
113
[plugins.inputs]
132
-
envs = ['ENV_ONE', 'ENV_TWO']
114
+
# Export specified environment variables to the serverless APIs
115
+
env = ['ENV_ONE', 'ENV_TWO']
133
116
```
134
117
135
-
This plugin builds your functions using a modified version of [netlify-lambda](https://github.com/netlify/netlify-lambda). You can get rid of any build steps you're performing on functions since the plugin handles it for you.
136
-
137
-
**Notes:**
138
-
139
-
- Replace occurrences of `/.netlify/functions` in your API calls with `/.netlify/nimbella`, or use `/api`, as your API path instead.
140
-
- All Netlify functions are deployed to a "default" package in your Nimbella namespace. The package name is required in the API path. For Netlify functions, the path will be `/.netlify/nimbella/default/` or `/api/default`. For named packages, replace `default` with your package name instead.
141
-
142
-
## Examples
118
+
## Example Projects
143
119
144
120
These are few sites that use `netlify-plugin-nimbella` to deploy frontend content to Netlify and functions on Nimbella.
145
121
@@ -150,7 +126,7 @@ Look at `netlify.toml` of these repositories to get an idea on how the plugin is
150
126
151
127
## Support
152
128
153
-
We're always happy to help you with any issues you encounter. You may want to [join our Slack community](https://nimbella-community.slack.com) to engage with us for a more rapid response. Otherwise, open an issue and provide us with details about your situation so we can respond adequately.
129
+
We welcome your feedback, and we are happy to help you with any issues you encounter. You may want to [join our Slack community](https://nimbella-community.slack.com) to engage with us for a more rapid response. Otherwise, open an issue and provide us with details about your situation so we can respond adequately.
description: The source directory of the functions.
5
-
- name: timeout
6
-
description: Timeout LIMIT in milliseconds after which the function is terminated (functions input value is required to utilize this option).
7
-
default: 6000
8
-
- name: memory
9
-
description: Maximum memory LIMIT in MB for the function (functions input value is required to utilize this option).
10
-
default: 256
11
-
- name: envs
12
-
description: Specify the names of the environment variables that need to be forwarded from Netlify CI to Nimbella Functions (functions input value is required to utilize this option).
13
-
default: []
14
3
- name: path
15
-
description: The API prefix path you would like to use to access your functions.
16
-
default: '/api/'
4
+
description: The API prefix path for your serverless APIs for single origin.
5
+
default: '/api'
6
+
7
+
- name: web
8
+
description: Deploy entire project include web frontend. Proxy domain to Nimbella.
9
+
default: false
10
+
11
+
- name: env
12
+
description: Environment variables to forward from Netlify CI to Nimbella Projects.
0 commit comments