mirror of https://github.com/dapr/docs.git
Merge branch 'v1.0-rc3' into helm-updates
This commit is contained in:
commit
2a3473df8e
|
@ -1,5 +1,6 @@
|
|||
# Visual Studio 2015/2017/2019 cache/options directory
|
||||
.vs/
|
||||
.idea/
|
||||
node_modules/
|
||||
daprdocs/public
|
||||
daprdocs/resources/_gen
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Site Configuration
|
||||
baseURL = "https://v1-rc2.docs.dapr.io/"
|
||||
baseURL = "https://v1-rc3.docs.dapr.io/"
|
||||
title = "Dapr Docs"
|
||||
theme = "docsy"
|
||||
disableFastRender = true
|
||||
|
@ -84,15 +84,15 @@ offlineSearch = false
|
|||
github_repo = "https://github.com/dapr/docs"
|
||||
github_project_repo = "https://github.com/dapr/dapr"
|
||||
github_subdir = "daprdocs"
|
||||
github_branch = "v1.0-rc2"
|
||||
github_branch = "v1.0-rc3"
|
||||
|
||||
# Versioning
|
||||
version_menu = "v1.0-rc.2 (preview)"
|
||||
version = "v1.0-rc.2"
|
||||
version_menu = "v1.0-rc.3 (preview)"
|
||||
version = "v1.0-rc.3"
|
||||
archived_version = false
|
||||
|
||||
[[params.versions]]
|
||||
version = "v1.0-rc.2 (preview)"
|
||||
version = "v1.0-rc.3 (preview)"
|
||||
url = "#"
|
||||
[[params.versions]]
|
||||
version = "v0.11 (latest)"
|
||||
|
|
|
@ -29,14 +29,14 @@ Dapr produces logs based on the following schema.
|
|||
|
||||
* Plain text log examples
|
||||
```bash
|
||||
time="2020-03-11T17:08:48.303776-07:00" level=info msg="starting Dapr Runtime -- version 0.5.0-rc.2 -- commit v0.3.0-rc.0-155-g5dfcf2e" instance=dapr-pod-xxxx scope=dapr.runtime type=log ver=0.5.0-rc.2
|
||||
time="2020-03-11T17:08:48.303913-07:00" level=info msg="log level set to: info" instance=dapr-pod-xxxx scope=dapr.runtime type=log ver=0.5.0-rc.2
|
||||
time="2020-03-11T17:08:48.303776-07:00" level=info msg="starting Dapr Runtime -- version 0.5.0-rc.3 -- commit v0.3.0-rc.0-155-g5dfcf2e" instance=dapr-pod-xxxx scope=dapr.runtime type=log ver=0.5.0-rc.3
|
||||
time="2020-03-11T17:08:48.303913-07:00" level=info msg="log level set to: info" instance=dapr-pod-xxxx scope=dapr.runtime type=log ver=0.5.0-rc.3
|
||||
```
|
||||
|
||||
* JSON formatted log examples
|
||||
```json
|
||||
{"instance":"dapr-pod-xxxx","level":"info","msg":"starting Dapr Runtime -- version 0.5.0-rc.2 -- commit v0.3.0-rc.0-155-g5dfcf2e","scope":"dapr.runtime","time":"2020-03-11T17:09:45.788005Z","type":"log","ver":"0.5.0-rc.2"}
|
||||
{"instance":"dapr-pod-xxxx","level":"info","msg":"log level set to: info","scope":"dapr.runtime","time":"2020-03-11T17:09:45.788075Z","type":"log","ver":"0.5.0-rc.2"}
|
||||
{"instance":"dapr-pod-xxxx","level":"info","msg":"starting Dapr Runtime -- version 0.5.0-rc.3 -- commit v0.3.0-rc.0-155-g5dfcf2e","scope":"dapr.runtime","time":"2020-03-11T17:09:45.788005Z","type":"log","ver":"0.5.0-rc.3"}
|
||||
{"instance":"dapr-pod-xxxx","level":"info","msg":"log level set to: info","scope":"dapr.runtime","time":"2020-03-11T17:09:45.788075Z","type":"log","ver":"0.5.0-rc.3"}
|
||||
```
|
||||
|
||||
## Configurating plain text or JSON formatted logs
|
||||
|
|
|
@ -5,7 +5,7 @@ linkTitle: "Define a component"
|
|||
weight: 40
|
||||
---
|
||||
|
||||
In the [previous step]({{<ref get-started-api.d>}}) you called the Dapr HTTP API to store and retrieve a state from a Redis backed state store. Dapr knew to use the Redis instance that was configured locally on your machine through default component definition files that were created when Dapr was initialized.
|
||||
In the [previous step]({{<ref get-started-api.md>}}) you called the Dapr HTTP API to store and retrieve a state from a Redis backed state store. Dapr knew to use the Redis instance that was configured locally on your machine through default component definition files that were created when Dapr was initialized.
|
||||
|
||||
When building an app, you most likely would create your own component file definitions depending on the building block and specific component that you'd like to use.
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ The Dapr CLI is the main tool you'll be using for various Dapr related tasks. Yo
|
|||
Begin by downloading and installing the Dapr CLI for v1.0.0-rc.3. This is used to initialize your environment on your desired platform.
|
||||
|
||||
{{% alert title="Note" color="warning" %}}
|
||||
This command downloads and install Dapr CLI v1.0-rc.3. To install v0.11, the latest release prior to the release candidates for the [upcoming v1.0 release](https://blog.dapr.io/posts/2020/10/20/the-path-to-v.1.0-production-ready-dapr/), please visit the [v0.11 docs](https://docs.dapr.io).
|
||||
This command downloads and install Dapr CLI v1.0-rc.4. To install v0.11, the latest release prior to the release candidates for the [upcoming v1.0 release](https://blog.dapr.io/posts/2020/10/20/the-path-to-v.1.0-production-ready-dapr/), please visit the [v0.11 docs](https://docs.dapr.io).
|
||||
{{% /alert %}}
|
||||
|
||||
{{< tabs Linux Windows MacOS Binaries>}}
|
||||
|
@ -18,26 +18,26 @@ This command downloads and install Dapr CLI v1.0-rc.3. To install v0.11, the lat
|
|||
{{% codetab %}}
|
||||
This command installs the latest linux Dapr CLI to `/usr/local/bin`:
|
||||
```bash
|
||||
wget -q https://raw.githubusercontent.com/dapr/cli/master/install/install.sh -O - | /bin/bash -s 1.0.0-rc.3
|
||||
wget -q https://raw.githubusercontent.com/dapr/cli/master/install/install.sh -O - | /bin/bash -s 1.0.0-rc.4
|
||||
```
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
This Command Prompt command installs the latest windows Dapr cli to `C:\dapr` and adds this directory to User PATH environment variable.
|
||||
```powershell
|
||||
powershell -Command "$script=iwr -useb https://raw.githubusercontent.com/dapr/cli/master/install/install.ps1; $block=[ScriptBlock]::Create($script); invoke-command -ScriptBlock $block -ArgumentList 1.0.0-rc.3"
|
||||
powershell -Command "$script=iwr -useb https://raw.githubusercontent.com/dapr/cli/master/install/install.ps1; $block=[ScriptBlock]::Create($script); invoke-command -ScriptBlock $block -ArgumentList 1.0.0-rc.4"
|
||||
```
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
This command installs the latest darwin Dapr CLI to `/usr/local/bin`:
|
||||
```bash
|
||||
curl -fsSL https://raw.githubusercontent.com/dapr/cli/master/install/install.sh | /bin/bash -s 1.0.0-rc.3
|
||||
curl -fsSL https://raw.githubusercontent.com/dapr/cli/master/install/install.sh | /bin/bash -s 1.0.0-rc.4
|
||||
```
|
||||
|
||||
Or you can install via [Homebrew](https://brew.sh):
|
||||
```bash
|
||||
brew install dapr/tap/dapr-cli@1.0.0-rc.3
|
||||
brew install dapr/tap/dapr-cli@1.0.0-rc.4
|
||||
```
|
||||
|
||||
{{% alert title="Note for M1 Macs" color="primary" %}}
|
||||
|
|
|
@ -40,7 +40,7 @@ Both the Dapr CLI and the Dapr Helm chart automatically deploy with affinity for
|
|||
You can install Dapr to a Kubernetes cluster using the [Dapr CLI]({{< ref install-dapr-cli.md >}}).
|
||||
|
||||
{{% alert title="Release candidate" color="warning" %}}
|
||||
This command downloads and install Dapr runtime v1.0-rc.2. To install v0.11, the latest release prior to the release candidates for the [upcoming v1.0 release](https://blog.dapr.io/posts/2020/10/20/the-path-to-v.1.0-production-ready-dapr/), please visit the [v0.11 docs](https://docs.dapr.io).
|
||||
This command downloads and install Dapr runtime v1.0-rc.3. To install v0.11, the latest release prior to the release candidates for the [upcoming v1.0 release](https://blog.dapr.io/posts/2020/10/20/the-path-to-v.1.0-production-ready-dapr/), please visit the [v0.11 docs](https://docs.dapr.io).
|
||||
{{% /alert %}}
|
||||
|
||||
### Install Dapr
|
||||
|
@ -51,10 +51,10 @@ The `-k` flag initializes Dapr on the Kubernetes cluster in your current context
|
|||
Make sure the correct "target" cluster is set. Check `kubectl context (kubectl config kubectl config get-contexts)` to verify. You can set a different context using `kubectl config use-context <CONTEXT>`.
|
||||
{{% /alert %}}
|
||||
|
||||
Run `dapr init -k --runtime-version 1.0.0-rc.2` on your local machine:
|
||||
Run `dapr init -k --runtime-version 1.0.0-rc.3` on your local machine:
|
||||
|
||||
```bash
|
||||
$ dapr init -k --runtime-version 1.0.0-rc.2
|
||||
$ dapr init -k --runtime-version 1.0.0-rc.3
|
||||
|
||||
```
|
||||
⌛ Making the jump to hyperspace...
|
||||
|
@ -69,7 +69,7 @@ $ dapr init -k --runtime-version 1.0.0-rc.2
|
|||
The default namespace when initializing Dapr is `dapr-system`. You can override this with the `-n` flag.
|
||||
|
||||
```
|
||||
dapr init -k -n mynamespace --runtime-version 1.0.0-rc.2
|
||||
dapr init -k -n mynamespace --runtime-version 1.0.0-rc.3
|
||||
```
|
||||
|
||||
|
||||
|
@ -78,7 +78,7 @@ dapr init -k -n mynamespace --runtime-version 1.0.0-rc.2
|
|||
You can run Dapr with 3 replicas of each control plane pod with the exception of the Placement pod in the dapr-system namespace for [production scenarios]({{< ref kubernetes-production.md >}}).
|
||||
|
||||
```
|
||||
dapr init -k --enable-ha=true --runtime-version 1.0.0-rc.2
|
||||
dapr init -k --enable-ha=true --runtime-version 1.0.0-rc.3
|
||||
```
|
||||
|
||||
### Disable mTLS
|
||||
|
@ -86,7 +86,7 @@ dapr init -k --enable-ha=true --runtime-version 1.0.0-rc.2
|
|||
Dapr is initialized by default with [mTLS]({{< ref "security-concept.md#sidecar-to-sidecar-communication" >}}). You can disable it with:
|
||||
|
||||
```
|
||||
dapr init -k --enable-mtls=false --runtime-version 1.0.0-rc.2
|
||||
dapr init -k --enable-mtls=false --runtime-version 1.0.0-rc.3
|
||||
```
|
||||
|
||||
### Uninstall Dapr on Kubernetes with CLI
|
||||
|
|
|
@ -20,7 +20,7 @@ In addition, the default initialization process also creates a development envir
|
|||
|
||||
|
||||
{{% alert title="Note" color="warning" %}}
|
||||
This command downloads and installs Dapr runtime v1.0-rc.2. To install v0.11, the latest release prior to the release candidates for the [upcoming v1.0 release](https://blog.dapr.io/posts/2020/10/20/the-path-to-v.1.0-production-ready-dapr/), please visit the [v0.11 docs](https://docs.dapr.io).
|
||||
This command downloads and installs Dapr runtime v1.0-rc.3. To install v0.11, the latest release prior to the release candidates for the [upcoming v1.0 release](https://blog.dapr.io/posts/2020/10/20/the-path-to-v.1.0-production-ready-dapr/), please visit the [v0.11 docs](https://docs.dapr.io).
|
||||
{{% /alert %}}
|
||||
|
||||
{{% alert title="Docker" color="primary" %}}
|
||||
|
@ -46,7 +46,7 @@ This recommended development environment requires [Docker](https://docs.docker.c
|
|||
Install the latest Dapr runtime binaries:
|
||||
|
||||
```bash
|
||||
dapr init --runtime-version 1.0.0-rc.2
|
||||
dapr init --runtime-version 1.0.0-rc.3
|
||||
```
|
||||
|
||||
### Step 3: Verify Dapr version
|
||||
|
@ -57,8 +57,8 @@ dapr --version
|
|||
|
||||
Output should look like this:
|
||||
```
|
||||
CLI version: 1.0.0-rc.3
|
||||
Runtime version: 1.0.0-rc.2
|
||||
CLI version: 1.0.0-rc.4
|
||||
Runtime version: 1.0.0-rc.3
|
||||
```
|
||||
|
||||
### Step 4: Verify containers are running
|
||||
|
|
|
@ -6,7 +6,7 @@ weight: 60
|
|||
description: "Tutorials with code samples that are aimed to get you started quickly with Dapr"
|
||||
---
|
||||
|
||||
The [Dapr Quickstarts](https://github.com/dapr/quickstarts/tree/v1.0.0-rc.2) are a collection of tutorials with code samples that are aimed to get you started quickly with Dapr, each highlighting a different Dapr capability.
|
||||
The [Dapr Quickstarts](https://github.com/dapr/quickstarts/tree/v1.0.0-rc.3) are a collection of tutorials with code samples that are aimed to get you started quickly with Dapr, each highlighting a different Dapr capability.
|
||||
|
||||
- A good place to start is the hello-world quickstart, it demonstrates how to run Dapr in standalone mode locally on your machine and demonstrates state management and service invocation in a simple application.
|
||||
- Next, if you are familiar with Kubernetes and want to see how to run the same application in a Kubernetes environment, look for the hello-kubernetes quickstart. Other quickstarts such as pub-sub, bindings and the distributed-calculator quickstart explore different Dapr capabilities include instructions for running both locally and on Kubernetes and can be completed in any order. A full list of the quickstarts can be found below.
|
||||
|
@ -17,11 +17,11 @@ The [Dapr Quickstarts](https://github.com/dapr/quickstarts/tree/v1.0.0-rc.2) are
|
|||
|
||||
| Quickstart | Description |
|
||||
|--------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| [Hello World](https://github.com/dapr/quickstarts/tree/v1.0.0-rc.2/hello-world) | Demonstrates how to run Dapr locally. Highlights service invocation and state management. |
|
||||
| [Hello Kubernetes](https://github.com/dapr/quickstarts/tree/v1.0.0-rc.2/hello-kubernetes) | Demonstrates how to run Dapr in Kubernetes. Highlights service invocation and state management. |
|
||||
| [Distributed Calculator](https://github.com/dapr/quickstarts/tree/v1.0.0-rc.2/distributed-calculator) | Demonstrates a distributed calculator application that uses Dapr services to power a React web app. Highlights polyglot (multi-language) programming, service invocation and state management. |
|
||||
| [Pub/Sub](https://github.com/dapr/quickstarts/tree/v1.0.0-rc.2/pub-sub) | Demonstrates how to use Dapr to enable pub-sub applications. Uses Redis as a pub-sub component. |
|
||||
| [Bindings](https://github.com/dapr/quickstarts/tree/v1.0.0-rc.2/bindings) | Demonstrates how to use Dapr to create input and output bindings to other components. Uses bindings to Kafka. |
|
||||
| [Middleware](https://github.com/dapr/quickstarts/tree/v1.0.0-rc.2/middleware) | Demonstrates use of Dapr middleware to enable OAuth 2.0 authorization. |
|
||||
| [Observability](https://github.com/dapr/quickstarts/tree/v1.0.0-rc.2/observability) | Demonstrates Dapr tracing capabilities. Uses Zipkin as a tracing component. |
|
||||
| [Secret Store](https://github.com/dapr/quickstarts/tree/v1.0.0-rc.2/secretstore) | Demonstrates the use of Dapr Secrets API to access secret stores. |
|
||||
| [Hello World](https://github.com/dapr/quickstarts/tree/v1.0.0-rc.3/hello-world) | Demonstrates how to run Dapr locally. Highlights service invocation and state management. |
|
||||
| [Hello Kubernetes](https://github.com/dapr/quickstarts/tree/v1.0.0-rc.3/hello-kubernetes) | Demonstrates how to run Dapr in Kubernetes. Highlights service invocation and state management. |
|
||||
| [Distributed Calculator](https://github.com/dapr/quickstarts/tree/v1.0.0-rc.3/distributed-calculator) | Demonstrates a distributed calculator application that uses Dapr services to power a React web app. Highlights polyglot (multi-language) programming, service invocation and state management. |
|
||||
| [Pub/Sub](https://github.com/dapr/quickstarts/tree/v1.0.0-rc.3/pub-sub) | Demonstrates how to use Dapr to enable pub-sub applications. Uses Redis as a pub-sub component. |
|
||||
| [Bindings](https://github.com/dapr/quickstarts/tree/v1.0.0-rc.3/bindings) | Demonstrates how to use Dapr to create input and output bindings to other components. Uses bindings to Kafka. |
|
||||
| [Middleware](https://github.com/dapr/quickstarts/tree/v1.0.0-rc.3/middleware) | Demonstrates use of Dapr middleware to enable OAuth 2.0 authorization. |
|
||||
| [Observability](https://github.com/dapr/quickstarts/tree/v1.0.0-rc.3/observability) | Demonstrates Dapr tracing capabilities. Uses Zipkin as a tracing component. |
|
||||
| [Secret Store](https://github.com/dapr/quickstarts/tree/v1.0.0-rc.3/secretstore) | Demonstrates the use of Dapr Secrets API to access secret stores. |
|
||||
|
|
|
@ -19,6 +19,7 @@ Every binding has its own unique set of properties. Click the name link to see t
|
|||
| [Kafka]({{< ref kafka.md >}}) | ✅ | ✅ | Experimental |
|
||||
| [Kubernetes Events]({{< ref "kubernetes-binding.md" >}}) | ✅ | | Experimental |
|
||||
| [MQTT]({{< ref mqtt.md >}}) | ✅ | ✅ | Experimental |
|
||||
| [MySQL]({{< ref mysql.md >}}) | | ✅ | Experimental |
|
||||
| [PostgreSql]({{< ref postgres.md >}}) | | ✅ | Experimental |
|
||||
| [Postmark]({{< ref postmark.md >}}) | | ✅ | Experimental |
|
||||
| [RabbitMQ]({{< ref rabbitmq.md >}}) | ✅ | ✅ | Experimental |
|
||||
|
|
|
@ -0,0 +1,147 @@
|
|||
---
|
||||
type: docs
|
||||
title: "MySQL binding spec"
|
||||
linkTitle: "MySQL"
|
||||
description: "Detailed documentation on the MySQL binding component"
|
||||
---
|
||||
|
||||
## Setup Dapr component
|
||||
|
||||
```yaml
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: <NAME>
|
||||
namespace: <NAMESPACE>
|
||||
spec:
|
||||
type: bindings.mysql
|
||||
version: v1
|
||||
metadata:
|
||||
- name: url # Required, define DB connection in DSN format
|
||||
value: <CONNECTION_STRING>
|
||||
- name: pemPath # Optional
|
||||
value: <PEM PATH>
|
||||
- name: maxIdleConns
|
||||
value: <MAX_IDLE_CONNECTIONS>
|
||||
- name: maxOpenConns
|
||||
value: <MAX_OPEN_CONNECTIONS>
|
||||
- name: connMaxLifetime
|
||||
value: <CONNECTILN_MAX_LIFE_TIME>
|
||||
- name: connMaxIdleTime
|
||||
value: <CONNECTION_MAX_IDLE_TIME>
|
||||
```
|
||||
|
||||
The MySQL binding uses [Go-MySQL-Driver](https://github.com/go-sql-driver/mysql) internally so the `url` parameter should follow the `DSN` format shown below:
|
||||
|
||||
- `url`: Required, represent DB connection in Data Source Name (DNS) format.
|
||||
|
||||
**Example DSN**
|
||||
|
||||
```yaml
|
||||
- name: url
|
||||
value: user:password@tcp(localhost:3306)/dbname
|
||||
```
|
||||
|
||||
If your server requires SSL your connection string must end of `&tls=custom` for example, `"<user>:<password>@tcp(<server>:3306)/<database>?allowNativePasswords=true&tls=custom"`. You must replace the `<PEM PATH>` with a full path to the PEM file. If you are using [MySQL on Azure](http://bit.ly/AzureMySQLSSL) see the Azure [documentation on SSL database connections](http://bit.ly/MySQLSSL), for information on how to download the required certificate. The connection to MySQL will require a minimum TLS version of 1.2.
|
||||
|
||||
- `pemPath`: path to the PEM file
|
||||
|
||||
also support connection pool configuration variables:
|
||||
|
||||
- `maxIdleConns`: integer greater than 0
|
||||
- `maxOpenConns`: integer greater than 0
|
||||
- `connMaxLifetime`: duration string
|
||||
- `connMaxIdleTime`: duration string
|
||||
|
||||
{{% alert title="Warning" color="warning" %}} The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets as described [here]({{< ref component-secrets.md >}}). {{% /alert %}}
|
||||
|
||||
## Output Binding Supported Operations
|
||||
|
||||
- `exec`
|
||||
- `query`
|
||||
- `close`
|
||||
|
||||
### exec
|
||||
|
||||
The `exec` operation can be used for DDL operations (like table creation), as well as `INSERT`, `UPDATE`, `DELETE` operations which return only metadata (e.g. number of affected rows).
|
||||
|
||||
**Request**
|
||||
|
||||
```json
|
||||
{
|
||||
"operation": "exec",
|
||||
"metadata": {
|
||||
"sql": "INSERT INTO foo (id, c1, ts) VALUES (1, 'demo', '2020-09-24T11:45:05Z07:00')"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Response**
|
||||
|
||||
```json
|
||||
{
|
||||
"metadata": {
|
||||
"operation": "exec",
|
||||
"duration": "294µs",
|
||||
"start-time": "2020-09-24T11:13:46.405097Z",
|
||||
"end-time": "2020-09-24T11:13:46.414519Z",
|
||||
"rows-affected": "1",
|
||||
"sql": "INSERT INTO foo (id, c1, ts) VALUES (1, 'demo', '2020-09-24T11:45:05Z07:00')"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### query
|
||||
|
||||
The `query` operation is used for `SELECT` statements, which returns the metadata along with data in a form of an array of row values.
|
||||
|
||||
**Request**
|
||||
|
||||
```json
|
||||
{
|
||||
"operation": "query",
|
||||
"metadata": {
|
||||
"sql": "SELECT * FROM foo WHERE id < 3"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Response**
|
||||
|
||||
```json
|
||||
{
|
||||
"metadata": {
|
||||
"operation": "query",
|
||||
"duration": "432µs",
|
||||
"start-time": "2020-09-24T11:13:46.405097Z",
|
||||
"end-time": "2020-09-24T11:13:46.420566Z",
|
||||
"sql": "SELECT * FROM foo WHERE id < 3"
|
||||
},
|
||||
"data": "[
|
||||
[0,\"test-0\",\"2020-09-24T04:13:46Z\"],
|
||||
[1,\"test-1\",\"2020-09-24T04:13:46Z\"],
|
||||
[2,\"test-2\",\"2020-09-24T04:13:46Z\"]
|
||||
]"
|
||||
}
|
||||
```
|
||||
|
||||
### close
|
||||
|
||||
Finally, the `close` operation can be used to explicitly close the DB connection and return it to the pool. This operation doesn't have any response.
|
||||
|
||||
**Request**
|
||||
|
||||
```json
|
||||
{
|
||||
"operation": "close"
|
||||
}
|
||||
```
|
||||
|
||||
> Note, the MySQL binding itself doesn't prevent SQL injection, like with any database application, validate the input before executing query.
|
||||
|
||||
## Related links
|
||||
|
||||
- [Bindings building block]({{< ref bindings >}})
|
||||
- [How-To: Trigger application with input binding]({{< ref howto-triggers.md >}})
|
||||
- [How-To: Use bindings to interface with external resources]({{< ref howto-bindings.md >}})
|
||||
- [Bindings API reference]({{< ref bindings_api.md >}})
|
|
@ -31,6 +31,8 @@ spec:
|
|||
value: 0
|
||||
- name: exclusive
|
||||
value: false
|
||||
- name: maxPriority
|
||||
value: 5
|
||||
```
|
||||
|
||||
- `queueName` is the RabbitMQ queue name.
|
||||
|
@ -40,6 +42,7 @@ spec:
|
|||
- `ttlInSeconds` is an optional parameter to set the [default message time to live at RabbitMQ queue level](https://www.rabbitmq.com/ttl.html). If this parameter is omitted, messages won't expire, continuing to exist on the queue until processed.
|
||||
- `prefetchCount` is an optional parameter to set the [Channel Prefetch Setting (QoS)](https://www.rabbitmq.com/confirms.html#channel-qos-prefetch). If this parameter is omiited, QoS would set value to 0 as no limit.
|
||||
- `exclusive` determines whether the topic will be an exclusive topic or not
|
||||
- `maxPriority` is an optional parameter to set the [priority queue](https://www.rabbitmq.com/priority.html). If this parameter is omitted, queue will be created as a general queue instead of a priority queue.
|
||||
|
||||
{{% alert title="Warning" color="warning" %}}
|
||||
The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets as described [here]({{< ref component-secrets.md >}}).
|
||||
|
@ -69,6 +72,30 @@ curl -X POST http://localhost:3500/v1.0/bindings/myRabbitMQ \
|
|||
}'
|
||||
```
|
||||
|
||||
## Specifying a priority on message level
|
||||
|
||||
Priority can be defined at the message level. If `maxPriority` parameter is set, high priority messages will have priority over other low priority messages.
|
||||
|
||||
To set priority at message level use the `metadata` section in the request body during the binding invocation.
|
||||
|
||||
The field name is `priority`.
|
||||
|
||||
Example:
|
||||
|
||||
```shell
|
||||
curl -X POST http://localhost:3500/v1.0/bindings/myRabbitMQ \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"data": {
|
||||
"message": "Hi"
|
||||
},
|
||||
"metadata": {
|
||||
"priority": "5"
|
||||
},
|
||||
"operation": "create"
|
||||
}'
|
||||
```
|
||||
|
||||
## Output Binding Supported Operations
|
||||
|
||||
* create
|
||||
|
|
|
@ -20,6 +20,7 @@ The following stores are supported, at various levels, by the Dapr state managem
|
|||
| [Hazelcast]({{< ref setup-hazelcast.md >}}) | ✅ | ❌ |
|
||||
| [Memcached]({{< ref setup-memcached.md >}}) | ✅ | ❌ |
|
||||
| [MongoDB]({{< ref setup-mongodb.md >}}) | ✅ | ✅ |
|
||||
| [MySQL]({{< ref setup-mysql.md >}}) | ✅ | ✅ |
|
||||
| [PostgreSQL]({{< ref setup-postgresql.md >}}) | ✅ | ✅ |
|
||||
| [Redis]({{< ref setup-redis.md >}}) | ✅ | ✅ |
|
||||
| [Zookeeper]({{< ref setup-zookeeper.md >}}) | ✅ | ❌ |
|
||||
|
@ -28,4 +29,3 @@ The following stores are supported, at various levels, by the Dapr state managem
|
|||
| [Azure Table Storage]({{< ref setup-azure-tablestorage.md >}}) | ✅ | ❌ |
|
||||
| [Azure Blob Storage]({{< ref setup-azure-blobstorage.md >}}) | ✅ | ❌ |
|
||||
| [Google Cloud Firestore]({{< ref setup-firestore.md >}}) | ✅ | ❌ |
|
||||
|
||||
|
|
|
@ -0,0 +1,145 @@
|
|||
---
|
||||
type: docs
|
||||
title: "MySQL"
|
||||
linkTitle: "MySQL"
|
||||
description: Detailed information on the MySQL state store component
|
||||
---
|
||||
|
||||
## Create a MySQL Store
|
||||
|
||||
Dapr can use any MySQL instance - containerized, running on your local dev machine, or a managed cloud service. If you already have a MySQL store, move on to the [Create a Dapr component](#create-a-dapr-component) section.
|
||||
|
||||
{{< tabs "Self-Hosted" "Kubernetes" "Azure" "AWS" "GCP" >}}
|
||||
|
||||
{{% codetab %}}
|
||||
<!-- Self-Hosted -->
|
||||
|
||||
Run an instance of MySQL. You can run a local instance of MySQL in Docker CE with the following command:
|
||||
|
||||
This example does not describe a production configuration because it sets the password in plain text and the user name is left as the MySQL default of "root".
|
||||
|
||||
```bash
|
||||
docker run --name dapr_mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:latest
|
||||
```
|
||||
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
<!-- Kubernetes -->
|
||||
|
||||
We can use [Helm](https://helm.sh/) to quickly create a MySQL instance in our Kubernetes cluster. This approach requires [Installing Helm](https://github.com/helm/helm#install).
|
||||
|
||||
1. Install MySQL into your cluster.
|
||||
|
||||
```bash
|
||||
helm repo add bitnami https://charts.bitnami.com/bitnami
|
||||
helm install dapr_mysql bitnami/mysql
|
||||
```
|
||||
|
||||
1. Run `kubectl get pods` to see the MySQL containers now running in your cluster.
|
||||
|
||||
1. Next, we'll get our password, which is slightly different depending on the OS we're using:
|
||||
- **Windows**: Run `[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($(kubectl get secret --namespace default dapr-mysql -o jsonpath="{.data.mysql-root-password}")))` and copy the outputted password.
|
||||
|
||||
- **Linux/MacOS**: Run `kubectl get secret --namespace default dapr-mysql -o jsonpath="{.data.mysql-root-password}" | base64 --decode` and copy the outputted password.
|
||||
|
||||
1. With the password you can construct your connection string.
|
||||
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
<!-- Azure -->
|
||||
|
||||
[Azure MySQL](http://bit.ly/AzureMySQL)
|
||||
|
||||
If you are using [MySQL on Azure](http://bit.ly/AzureMySQLSSL) see the Azure [documentation on SSL database connections](http://bit.ly/MySQLSSL), for information on how to download the required certificate.
|
||||
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
<!-- AWS -->
|
||||
|
||||
[AWS MySQL](https://aws.amazon.com/rds/mysql/)
|
||||
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
<!-- GCP -->
|
||||
|
||||
[GCP MySQL](https://cloud.google.com/sql/docs/mysql/features)
|
||||
|
||||
{{% /codetab %}}
|
||||
|
||||
{{< /tabs >}}
|
||||
|
||||
## Create a Dapr component
|
||||
|
||||
### Non SSL connection
|
||||
|
||||
Create a file called `mysqlstate.yaml`, paste the following and replace the `<CONNECTION STRING>` value with your connection string. The connection string is a standard MySQL connection string. For example, `"<user>:<password>@tcp(<server>:3306)/?allowNativePasswords=true"`. Do not add the schema to the connection string. The component connects to the server first to check for the existence of the desired schema. If the schemaName is not provided the default value of **dapr_state_store** will be used. If the schema does not exist it will be created.
|
||||
|
||||
The tableName is also optional and if not provided will default to **state**. If the table does ont exist it will be created.
|
||||
|
||||
If you want to also configure MySQL to store actors, add the `actorStateStore` configuration element shown below.
|
||||
|
||||
```yaml
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: statestore
|
||||
spec:
|
||||
type: state.mysql
|
||||
version: v1
|
||||
metadata:
|
||||
- name: connectionString
|
||||
value: "<CONNECTION STRING>"
|
||||
- name: schemaName
|
||||
value: "<SCHEMA NAME>"
|
||||
- name: tableName
|
||||
value: "<TABLE NAME>"
|
||||
- name: actorStateStore
|
||||
value: "true"
|
||||
```
|
||||
|
||||
### Enforced SSL connection
|
||||
|
||||
If your server requires SSL your connection string must end with `&tls=custom` for example, `"<user>:<password>@tcp(<server>:3306)/?allowNativePasswords=true&tls=custom"`. You must replace the `<PEM PATH>` with a full path to the PEM file. The connection to MySQL will require a minimum TLS version of 1.2.
|
||||
|
||||
```yaml
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: statestore
|
||||
spec:
|
||||
type: state.mysql
|
||||
version: v1
|
||||
metadata:
|
||||
- name: connectionString
|
||||
value: "<CONNECTION STRING>"
|
||||
- name: schemaName
|
||||
value: "<SCHEMA NAME>"
|
||||
- name: tableName
|
||||
value: "<TABLE NAME>"
|
||||
- name: pemPath
|
||||
value: "<PEM PATH>"
|
||||
- name: actorStateStore
|
||||
value: "true"
|
||||
```
|
||||
|
||||
{{% alert title="Warning" color="warning" %}}
|
||||
The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets as described [here]({{< ref component-secrets.md >}}).
|
||||
{{% /alert %}}
|
||||
|
||||
## Apply the configuration
|
||||
|
||||
### In Kubernetes
|
||||
|
||||
To apply the MySQL state store to Kubernetes, use the `kubectl` CLI:
|
||||
|
||||
```yaml
|
||||
kubectl apply -f mysqlstate.yaml
|
||||
```
|
||||
|
||||
### Running locally
|
||||
|
||||
To run locally, create a `components` dir containing the YAML file and provide the path to the `dapr run` command with the flag `--components-path`.
|
|
@ -22,14 +22,14 @@ description: "Follow these steps to upgrade Dapr in self-hosted mode and ensure
|
|||
1. Initialize the Dapr runtime:
|
||||
|
||||
```bash
|
||||
dapr init --runtime-version=1.0.0-rc.2
|
||||
dapr init --runtime-version=1.0.0-rc.3
|
||||
```
|
||||
|
||||
1. Ensure you are using the latest version of Dapr (1.0.0-rc.2) with:
|
||||
1. Ensure you are using the latest version of Dapr (1.0.0-rc.3) with:
|
||||
|
||||
```bash
|
||||
$ dapr --version
|
||||
|
||||
CLI version: 1.0.0-rc.3
|
||||
Runtime version: 1.0.0-rc.2
|
||||
Runtime version: 1.0.0-rc.3
|
||||
```
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// Your apiKey and indexName will be given to you once
|
||||
// we create your config
|
||||
apiKey: '54ae43aa28ce8f00c54c8d5f544d29b9',
|
||||
indexName: 'crawler_dapr-rc2',
|
||||
indexName: 'crawler_dapr-rc3',
|
||||
appId: 'O0QLQGNF38',
|
||||
// Replace inputSelector with a CSS selector
|
||||
// matching your search input
|
||||
|
|
|
@ -10,9 +10,6 @@ data:
|
|||
receivers:
|
||||
zipkin:
|
||||
endpoint: 0.0.0.0:9411
|
||||
processors:
|
||||
queued_retry:
|
||||
batch:
|
||||
extensions:
|
||||
health_check:
|
||||
pprof:
|
||||
|
@ -37,7 +34,6 @@ data:
|
|||
traces:
|
||||
receivers: [zipkin]
|
||||
exporters: [azuremonitor,logging]
|
||||
processors: [batch, queued_retry]
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
|
|
Loading…
Reference in New Issue