Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

middleware: add wasm #2519

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,13 +1,13 @@
name: Azure Static Web App v1.7
name: Azure Static Web App v1.8

on:
push:
branches:
- v1.7
- v1.8
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- v1.7
- v1.8

jobs:
build_and_deploy_job:
Expand All @@ -27,7 +27,7 @@ jobs:
HUGO_ENV: production
HUGO_VERSION: "0.74.3"
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_V1_7 }}
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_V1_8 }}
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
skip_deploy_on_missing_secrets: true
action: "upload"
Expand All @@ -48,6 +48,6 @@ jobs:
id: closepullrequest
uses: Azure/static-web-apps-deploy@v0.0.1-preview
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_V1_7 }}
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_V1_8 }}
skip_deploy_on_missing_secrets: true
action: "close"
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -5,4 +5,5 @@ node_modules/
daprdocs/public
daprdocs/resources/_gen
.venv/
.hugo_build.lock
.hugo_build.lock
.dccache
1 change: 1 addition & 0 deletions daprdocs/.gitignore
@@ -1 +1,2 @@
node_modules/
.dccache
8 changes: 4 additions & 4 deletions daprdocs/config.toml
Expand Up @@ -163,17 +163,17 @@ github_subdir = "daprdocs"
github_branch = "v1.7"

# Versioning
version_menu = "v1.7 (latest)"
version = "v1.7"
version_menu = "v1.8 (preview)"
version = "v1.8"
archived_version = false
url_latest_version = "https://docs.dapr.io"

[[params.versions]]
version = "v1.8 (preview)"
url = "https://v1-8.docs.dapr.io"
url = "#"
[[params.versions]]
version = "v1.7 (latest)"
url = "#"
url = "https://v1-7.docs.dapr.io"
[[params.versions]]
version = "v1.6"
url = "https://v1-6.docs.dapr.io"
Expand Down
4 changes: 2 additions & 2 deletions daprdocs/content/en/concepts/configuration-concept.md
Expand Up @@ -25,14 +25,14 @@ spec:

This configuration configures tracing for metrics recording. It can be loaded in local self-hosted mode by editing the default configuration file called `config.yaml` file in your `.dapr` directory, or by applying it to your Kubernetes cluster with kubectl/helm.

Here is an example of the Dapr control plane configuration in the `daprsystem` namespace.
Here is an example of the Dapr control plane configuration called `daprsystem` in the `dapr-system` namespace.

```yaml
apiVersion: dapr.io/v1alpha1
kind: Configuration
metadata:
name: daprsystem
namespace: default
namespace: dapr-system
spec:
mtls:
enabled: true
Expand Down
7 changes: 5 additions & 2 deletions daprdocs/content/en/concepts/dapr-services/sentry.md
Expand Up @@ -9,7 +9,10 @@ The Dapr Sentry service manages mTLS between services and acts as a certificate

## Self-hosted mode

The sentry service Docker container is started automatically as part of [`dapr init`]({{< ref self-hosted-with-docker.md >}}). It can also be run manually as a process if you are running in [slim-init mode]({{< ref self-hosted-no-docker.md >}}).
The Sentry service Docker container is not started automatically as part of [`dapr init`]({{< ref self-hosted-with-docker.md >}}). However it can be executed manually by following the instructions for setting up [mutual TLS]({{< ref "mtls.md#self-hosted" >}}).


It can also be run manually as a process if you are running in [slim-init mode]({{< ref self-hosted-no-docker.md >}}).

<img src="/images/security-mTLS-sentry-selfhosted.png" width=1000>

Expand All @@ -23,4 +26,4 @@ The sentry service is deployed as part of `dapr init -k`, or via the Dapr Helm c

- [Security overview]({{< ref security-concept.md >}})
- [Self-hosted mode]({{< ref self-hosted-with-docker.md >}})
- [Kubernetes mode]({{< ref kubernetes >}})
- [Kubernetes mode]({{< ref kubernetes >}})
2 changes: 1 addition & 1 deletion daprdocs/content/en/concepts/security-concept.md
Expand Up @@ -138,7 +138,7 @@ By default Dapr doesn't transform the state data from applications. This means D

However application state often needs to get encrypted at rest to provide stronger security in enterprise workloads or regulated environments and Dapr does provide automatic client side state encryption based on AES256. Read [How-To: Encrypt application state]({{< ref howto-encrypt-state.md >}}) for more details.

## Dapr Runtrime state
## Dapr Runtime state
Importantly the Dapr runtime does not store any data at rest, meaning that Dapr runtime has no dependency on any state stores for its operation and can be considered stateless.

# Using security capabilies in an example application
Expand Down
4 changes: 3 additions & 1 deletion daprdocs/content/en/contributing/codespaces.md
Expand Up @@ -46,4 +46,6 @@ git reset --hard
```

## Related links
- [GitHub documentation](https://docs.github.com/en/github/developing-online-with-codespaces/about-codespaces)
<!-- IGNORE_LINKS -->
- [GitHub documentation](https://docs.github.com/github/developing-online-with-codespaces/about-codespaces)
<!-- END_IGNORE -->
2 changes: 1 addition & 1 deletion daprdocs/content/en/contributing/contributing-docs.md
Expand Up @@ -42,7 +42,7 @@ Diagrams should be;
- Named using the convention of a concept or building block so that they are grouped. For example `service-invocation-overview.png`. Also see Images guidance section below.
- Added to the correct section in the `Dapr-Diagrams.pptx` deck so that they can be amended and updated.

{{< button text="Download the Dapr Diagrams Deck" link="/presentations/Dapr-Diagrams.zip" >}}
{{< button text="Download the Dapr Diagrams Deck" link="/presentations/Dapr-Diagrams.pptx.zip" >}}


## Contributing a new docs page
Expand Down
4 changes: 2 additions & 2 deletions daprdocs/content/en/contributing/presentations.md
Expand Up @@ -8,11 +8,11 @@ description: How to give a presentation on Dapr and examples

We welcome community members giving presentations on Dapr and spreading the word about all the awesome Dapr features! We offer a template PowerPoint file to get started.

{{< button text="Download the Dapr Presentation Deck" link="/presentations/dapr-slidedeck.zip" >}}
{{< button text="Download the Dapr Presentation Deck" link="/presentations/dapr-slidedeck.pptx.zip" >}}

## Giving a Dapr presentation

- Begin by downloading the [Dapr Presentation Deck](/presentations/dapr-slidedeck.zip). This contains slides and diagrams needed to give a Dapr presentation.
- Begin by downloading the [Dapr Presentation Deck](/presentations/dapr-slidedeck.pptx.zip). This contains slides and diagrams needed to give a Dapr presentation.
- Next, review the docs to make sure you understand the [concepts]({{< ref concepts >}}).
- Use the Dapr [quickstarts](https://github.com/dapr/quickstarts) repo and [samples](https://github.com/dapr/samples) repo to show demos of how to use Dapr.

Expand Down
Expand Up @@ -95,7 +95,7 @@ spec:

Below are code examples that leverage Dapr SDKs to interact with an output binding.

{{< tabs Dotnet Java Python Go Javascript>}}
{{< tabs Dotnet Java Python Go JavaScript>}}

{{% codetab %}}

Expand All @@ -117,17 +117,18 @@ namespace EventService
{
static async Task Main(string[] args)
{
string BINDING_NAME = "checkout";
string BINDING_OPERATION = "create";
while(true) {
string BINDING_NAME = "checkout";
string BINDING_OPERATION = "create";
while(true)
{
System.Threading.Thread.Sleep(5000);
Random random = new Random();
int orderId = random.Next(1,1000);
using var client = new DaprClientBuilder().Build();
//Using Dapr SDK to invoke output binding
await client.InvokeBindingAsync(BINDING_NAME, BINDING_OPERATION, orderId);
Console.WriteLine("Sending message: " + orderId);
}
}
}
}
}
Expand Down Expand Up @@ -268,38 +269,36 @@ dapr run --app-id orderprocessing --app-port 6001 --dapr-http-port 3601 --dapr-g

```javascript
//dependencies

import { DaprServer, DaprClient, CommunicationProtocolEnum } from 'dapr-client';
import { DaprClient, CommunicationProtocolEnum } from "dapr-client";

//code
const daprHost = "127.0.0.1";

var main = function() {
for(var i=0;i<10;i++) {
sleep(5000);
var orderId = Math.floor(Math.random() * (1000 - 1) + 1);
start(orderId).catch((e) => {
const daprHost = "127.0.0.1";

(async function () {
for (var i = 0; i < 10; i++) {
await sleep(2000);
const orderId = Math.floor(Math.random() * (1000 - 1) + 1);
try {
await sendOrder(orderId)
} catch (err) {
console.error(e);
process.exit(1);
});
}
}
}
})();

async function start(orderId) {
async function sendOrder(orderId) {
const BINDING_NAME = "checkout";
const BINDING_OPERATION = "create";
const client = new DaprClient(daprHost, process.env.DAPR_HTTP_PORT, CommunicationProtocolEnum.HTTP);
//Using Dapr SDK to invoke output binding
const result = await client.binding.send(BINDING_NAME, BINDING_OPERATION, { orderId: orderId });
const result = await client.binding.send(BINDING_NAME, BINDING_OPERATION, orderId);
console.log("Sending message: " + orderId);
}

function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}

main();

```

Navigate to the directory containing the above code, then run the following command to launch a Dapr sidecar and run the application:
Expand All @@ -317,7 +316,7 @@ All that's left now is to invoke the output bindings endpoint on a running Dapr
You can also invoke the output bindings endpoint using HTTP:

```bash
curl -X POST -H 'Content-Type: application/json' http://localhost:3601/v1.0/bindings/checkout -d '{ "data": { "orderId": "100" }, "operation": "create" }'
curl -X POST -H 'Content-Type: application/json' http://localhost:3601/v1.0/bindings/checkout -d '{ "data": 100, "operation": "create" }'
```

As seen above, you invoked the `/binding` endpoint with the name of the binding to invoke, in our case its `checkout`.
Expand Down
Expand Up @@ -106,7 +106,7 @@ Now configure your application to receive incoming events. If using HTTP, you ne

Below are code examples that leverage Dapr SDKs to demonstrate an output binding.

{{< tabs Dotnet Java Python Go Javascript>}}
{{< tabs Dotnet Java Python Go JavaScript>}}

{{% codetab %}}

Expand Down
Expand Up @@ -48,7 +48,7 @@ with DaprClient() as d:
# Create a typed message with content type and body
resp = d.publish_event(
pubsub_name='pubsub',
topic='TOPIC_A',
topic_name='TOPIC_A',
data=json.dumps(req_data),
publish_metadata={'rawPayload': 'true'}
)
Expand Down
Expand Up @@ -16,6 +16,8 @@ To enable state sharing, Dapr supports the following key prefixes strategies:

* **`appid`** - This is the default strategy. the `appid` prefix allows state to be managed only by the app with the specified `appid`. All state keys will be prefixed with the `appid`, and are scoped for the application.

* **`namespace`** - If set, this setting prefixes the `appid` key with the configured namespace, resulting in a key that is scoped to a given namespace. This allows apps in different namespace with the same `appid` to reuse the same state store. If a namespace is not configured, the setting fallbacks to the `appid` strategy. For more information on namespaces in Dapr see [How-To: Scope components to one or more applications]({{< ref component-scopes.md >}})

* **`name`** - This setting uses the name of the state store component as the prefix. Multiple applications can share the same state for a given state store.

* **`none`** - This setting uses no prefixing. Multiple applications share state across different state stores.
Expand Down Expand Up @@ -59,6 +61,23 @@ curl -X POST http://localhost:3500/v1.0/state/redis \

The key will be saved as `myApp||darth`.

### `namespace`

A Dapr application running in namespace `production` with app id `myApp` is saving state into a state store named `redis`:

```shell
curl -X POST http://localhost:3500/v1.0/state/redis \
-H "Content-Type: application/json"
-d '[
{
"key": "darth",
"value": "nihilus"
}
]'
```

The key will be saved as `production.myApp||darth`.

### `name`

A Dapr application with app id `myApp` is saving state into a state store named `redis`:
Expand Down
Expand Up @@ -66,11 +66,17 @@ With the HTTP API, you can set content type via URL query parameter `metadata.co

With the gRPC API, you can set content type by adding key/value pair `"contentType" : <content type>` to the request metadata.

### Bulk operations
### Multiple operations

Dapr supports two types of bulk operations: **bulk** or **multi**. You can group several requests of the same type into a bulk (or a batch). Dapr submits requests in bulk operations as individual requests to the underlying data store. In other words, bulk operations are not transactional. On the other hand, you can group requests of different types into a multi-operation, which is then handled as an atomic transaction.
Dapr supports two types of multi-read or multi-write operations: **bulk** or **transactional**. Read the [API reference]({{< ref state_api.md >}}) to learn how use bulk and multi options.

Read the [API reference]({{< ref state_api.md >}}) to learn how use bulk and multi options.
#### Bulk read operations

You can group multiple read requests into a bulk (or batch) operation. In the bulk operation, Dapr submits the read requests as individual requests to the underlying data store, and returns them as a single result.

#### Transactional operations

You can group write, update and delete operations into a request, which are then handled as an atomic transaction. The request will succeed or fail as a transactional set of operations.

### State encryption
Dapr supports automatic client encryption of application state with support for key rotations. This is supported on all Dapr state stores. For more info, read the [How-To: Encrypt application state]({{< ref howto-encrypt-state.md >}}) topic.
Expand Down
Expand Up @@ -45,9 +45,9 @@ from dapr.clients import DaprClient
DAPR_STORE_NAME = "statestore"

with DaprClient() as client:
client.save_state(DAPR_STORE_NAME, "order_1", str(orderId), metadata=(
('ttlInSeconds', '120')
))
client.save_state(DAPR_STORE_NAME, "order_1", str(orderId), state_metadata={
'ttlInSeconds': '120'
})

```

Expand Down Expand Up @@ -83,4 +83,4 @@ See [this guide]({{< ref state_api.md >}}) for a reference on the state API.

- Learn [how to use key value pairs to persist a state]({{< ref howto-get-save-state.md >}})
- List of [state store components]({{< ref supported-state-stores >}})
- Read the [API reference]({{< ref state_api.md >}})
- Read the [API reference]({{< ref state_api.md >}})
Expand Up @@ -48,15 +48,15 @@ In the case of the hello world quickstart, two applications are launched, each w
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/app.js",
"program": "${workspaceFolder}/node/app.js",
"preLaunchTask": "daprd-debug-node",
"postDebugTask": "daprd-down-node"
},
{
"type": "python",
"request": "launch",
"name": "Pythonapp with Dapr",
"program": "${workspaceFolder}/app.py",
"program": "${workspaceFolder}/python/app.py",
"console": "integratedTerminal",
"preLaunchTask": "daprd-debug-python",
"postDebugTask": "daprd-down-python"
Expand Down Expand Up @@ -123,7 +123,7 @@ For this example the compound configuration is:
```json
{
"version": "2.0.0",
"tasks": [...],
"configurations": [...],
"compounds": [
{
"name": "Node/Python Dapr",
Expand Down