Merge branch 'v1.14' into issue_3915

Signed-off-by: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com>
This commit is contained in:
Hannah Hunter 2024-06-04 12:24:10 -04:00 committed by GitHub
commit ba5084af3f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
19 changed files with 461 additions and 2 deletions

28
.github/iac/swa/azure.yaml vendored Normal file
View File

@ -0,0 +1,28 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/Azure/azure-dev/main/schemas/v1.0/azure.yaml.json
name: swa-deploy-dapr-docs
metadata:
template: swa-deploy-dapr-docs@0.0.1-beta
#hooks:
# postprovision:
# windows:
# shell: pwsh
# run: ./scripts/deploy.ps1
# interactive: true
# continueOnError: false
# posix:
# shell: sh
# run: ./scripts/deploy.sh
# interactive: true
# continueOnError: false
# predeploy:
# windows:
# shell: pwsh
# run: cd ./app/frontend;npm install;npm run build
# interactive: true
# continueOnError: false
# posix:
# shell: sh
# run: cd ./app/frontend;npm install;npm run build
# interactive: true
# continueOnError: false

135
.github/iac/swa/infra/abbreviations.json vendored Normal file
View File

@ -0,0 +1,135 @@
{
"analysisServicesServers": "as",
"apiManagementService": "apim-",
"appConfigurationConfigurationStores": "appcs-",
"appManagedEnvironments": "cae-",
"appContainerApps": "ca-",
"authorizationPolicyDefinitions": "policy-",
"automationAutomationAccounts": "aa-",
"blueprintBlueprints": "bp-",
"blueprintBlueprintsArtifacts": "bpa-",
"cacheRedis": "redis-",
"cdnProfiles": "cdnp-",
"cdnProfilesEndpoints": "cdne-",
"cognitiveServicesAccounts": "cog-",
"cognitiveServicesFormRecognizer": "cog-fr-",
"cognitiveServicesTextAnalytics": "cog-ta-",
"computeAvailabilitySets": "avail-",
"computeCloudServices": "cld-",
"computeDiskEncryptionSets": "des",
"computeDisks": "disk",
"computeDisksOs": "osdisk",
"computeGalleries": "gal",
"computeSnapshots": "snap-",
"computeVirtualMachines": "vm",
"computeVirtualMachineScaleSets": "vmss-",
"containerInstanceContainerGroups": "ci",
"containerRegistryRegistries": "cr",
"containerServiceManagedClusters": "aks-",
"databricksWorkspaces": "dbw-",
"dataFactoryFactories": "adf-",
"dataLakeAnalyticsAccounts": "dla",
"dataLakeStoreAccounts": "dls",
"dataMigrationServices": "dms-",
"dBforMySQLServers": "mysql-",
"dBforPostgreSQLServers": "psql-",
"devicesIotHubs": "iot-",
"devicesProvisioningServices": "provs-",
"devicesProvisioningServicesCertificates": "pcert-",
"documentDBDatabaseAccounts": "cosmos-",
"eventGridDomains": "evgd-",
"eventGridDomainsTopics": "evgt-",
"eventGridEventSubscriptions": "evgs-",
"eventHubNamespaces": "evhns-",
"eventHubNamespacesEventHubs": "evh-",
"hdInsightClustersHadoop": "hadoop-",
"hdInsightClustersHbase": "hbase-",
"hdInsightClustersKafka": "kafka-",
"hdInsightClustersMl": "mls-",
"hdInsightClustersSpark": "spark-",
"hdInsightClustersStorm": "storm-",
"hybridComputeMachines": "arcs-",
"insightsActionGroups": "ag-",
"insightsComponents": "appi-",
"keyVaultVaults": "kv-",
"kubernetesConnectedClusters": "arck",
"kustoClusters": "dec",
"kustoClustersDatabases": "dedb",
"logicIntegrationAccounts": "ia-",
"logicWorkflows": "logic-",
"machineLearningServicesWorkspaces": "mlw-",
"managedIdentityUserAssignedIdentities": "id-",
"managementManagementGroups": "mg-",
"migrateAssessmentProjects": "migr-",
"networkApplicationGateways": "agw-",
"networkApplicationSecurityGroups": "asg-",
"networkAzureFirewalls": "afw-",
"networkBastionHosts": "bas-",
"networkConnections": "con-",
"networkDnsZones": "dnsz-",
"networkExpressRouteCircuits": "erc-",
"networkFirewallPolicies": "afwp-",
"networkFirewallPoliciesWebApplication": "waf",
"networkFirewallPoliciesRuleGroups": "wafrg",
"networkFrontDoors": "fd-",
"networkFrontdoorWebApplicationFirewallPolicies": "fdfp-",
"networkLoadBalancersExternal": "lbe-",
"networkLoadBalancersInternal": "lbi-",
"networkLoadBalancersInboundNatRules": "rule-",
"networkLocalNetworkGateways": "lgw-",
"networkNatGateways": "ng-",
"networkNetworkInterfaces": "nic-",
"networkNetworkSecurityGroups": "nsg-",
"networkNetworkSecurityGroupsSecurityRules": "nsgsr-",
"networkNetworkWatchers": "nw-",
"networkPrivateDnsZones": "pdnsz-",
"networkPrivateLinkServices": "pl-",
"networkPublicIPAddresses": "pip-",
"networkPublicIPPrefixes": "ippre-",
"networkRouteFilters": "rf-",
"networkRouteTables": "rt-",
"networkRouteTablesRoutes": "udr-",
"networkTrafficManagerProfiles": "traf-",
"networkVirtualNetworkGateways": "vgw-",
"networkVirtualNetworks": "vnet-",
"networkVirtualNetworksSubnets": "snet-",
"networkVirtualNetworksVirtualNetworkPeerings": "peer-",
"networkVirtualWans": "vwan-",
"networkVpnGateways": "vpng-",
"networkVpnGatewaysVpnConnections": "vcn-",
"networkVpnGatewaysVpnSites": "vst-",
"notificationHubsNamespaces": "ntfns-",
"notificationHubsNamespacesNotificationHubs": "ntf-",
"operationalInsightsWorkspaces": "log-",
"portalDashboards": "dash-",
"powerBIDedicatedCapacities": "pbi-",
"purviewAccounts": "pview-",
"recoveryServicesVaults": "rsv-",
"resourcesResourceGroups": "rg-",
"searchSearchServices": "srch-",
"serviceBusNamespaces": "sb-",
"serviceBusNamespacesQueues": "sbq-",
"serviceBusNamespacesTopics": "sbt-",
"serviceEndPointPolicies": "se-",
"serviceFabricClusters": "sf-",
"signalRServiceSignalR": "sigr",
"sqlManagedInstances": "sqlmi-",
"sqlServers": "sql-",
"sqlServersDataWarehouse": "sqldw-",
"sqlServersDatabases": "sqldb-",
"sqlServersDatabasesStretch": "sqlstrdb-",
"storageStorageAccounts": "st",
"storageStorageAccountsVm": "stvm",
"storSimpleManagers": "ssimp",
"streamAnalyticsCluster": "asa-",
"synapseWorkspaces": "syn",
"synapseWorkspacesAnalyticsWorkspaces": "synw",
"synapseWorkspacesSqlPoolsDedicated": "syndp",
"synapseWorkspacesSqlPoolsSpark": "synsp",
"timeSeriesInsightsEnvironments": "tsi-",
"webServerFarms": "plan-",
"webSitesAppService": "app-",
"webSitesAppServiceEnvironment": "ase-",
"webSitesFunctions": "func-",
"webStaticSites": "stapp-"
}

View File

@ -0,0 +1,33 @@
param name string
param location string = resourceGroup().location
param tags object = {}
param sku string = 'Standard'
@allowed([ 'None', 'SystemAssigned', 'UserAssigned' ])
param identityType string
@description('User assigned identity name')
param identityId string
resource frontend 'Microsoft.Web/staticSites@2022-09-01' = {
name: name
location: location
tags: tags
sku: {
name: sku
tier: sku
}
properties: {
allowConfigFileUpdates: true
enterpriseGradeCdnStatus: 'Disabled'
}
identity: {
type: identityType
userAssignedIdentities: { '${identityId}': {} }
}
}
output name string = frontend.name

63
.github/iac/swa/infra/main.bicep vendored Normal file
View File

@ -0,0 +1,63 @@
targetScope = 'subscription'
@minLength(1)
@maxLength(64)
@description('Name of the the environment which is used to generate a short unique hash used in all resources.')
param environmentName string
@minLength(1)
@description('Primary location for all resources')
@allowed([ 'eastus', 'eastus2', 'westus', 'westus2'])
param location string
param resourceGroupName string = ''
param staticWebsiteName string = ''
@description('Id of the user or app to assign application roles')
param principalId string = ''
param identityResourceGroupName string = 'dapr-identities'
var abbrs = loadJsonContent('abbreviations.json')
var resourceToken = toLower(uniqueString(subscription().id, environmentName, location))
var tags = { 'azd-env-name': environmentName }
// Organize resources in a resource group
resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = {
name: !empty(resourceGroupName) ? resourceGroupName : '${abbrs.resourcesResourceGroups}${environmentName}'
location: location
tags: tags
}
resource identityResourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' existing = {
name: identityResourceGroupName
}
// load existing user assigned identity
resource userAssignedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' existing = {
name: 'dapr-docs-swa-useridentity'
scope: identityResourceGroup
}
// Create the Static Web App
module staticwebsite 'core/host/staticwebsite.bicep' = {
scope: resourceGroup
name: 'website'
params: {
name: !empty(staticWebsiteName) ? staticWebsiteName : '${abbrs.webStaticSites}${resourceToken}'
location: location
sku: 'Standard'
identityType: 'UserAssigned'
identityId: userAssignedIdentity.id
}
}
output AZURE_LOCATION string = location
output AZURE_TENANT_ID string = tenant().tenantId
output AZURE_RESOURCE_GROUP string = resourceGroup.name
output AZURE_STATICWEBSITE_NAME string = staticwebsite.outputs.name
output IDENTITY_RESOURCE_ID string = userAssignedIdentity.id
output IDENTITY_RESOURCE_GROUP string = identityResourceGroup.name

View File

@ -0,0 +1,24 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"environmentName": {
"value": "${AZURE_ENV_NAME}"
},
"location": {
"value": "${AZURE_LOCATION}"
},
"principalId": {
"value": "${AZURE_PRINCIPAL_ID}"
},
"resourceGroupName": {
"value": "${AZURE_RESOURCE_GROUP}"
},
"identityResourceGroup": {
"value": "${IDENTITY_RESOURCE_GROUP}"
},
"staticWebsiteName": {
"value": "${AZURE_STATICWEBSITE_NAME}"
}
}
}

View File

@ -0,0 +1,7 @@
resource createRgLock 'Microsoft.Authorization/locks@2016-09-01' = {
name: 'rgLock'
properties: {
level: 'do-not-delete'
notes: 'Resource group and its resources should not be deleted because it contains live OSS website.'
}
}

View File

@ -0,0 +1,11 @@
param identityName string
param location string
resource userAssignedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = {
name: identityName
location: location
}
output identityId string = userAssignedIdentity.id
output identityName string = userAssignedIdentity.name
output identityPrincipalId string = userAssignedIdentity.properties.principalId

60
.github/iac/swa/readme.md vendored Normal file
View File

@ -0,0 +1,60 @@
# Dapr Static Web Apps
## dapr.docs.io
## Summary
This folder contains a template and infrastructure as code to recreate and reconfigure the static web app used to host docs.dapr.io.
## Prerequisites
1) Active Azure Subscription with `Contributor` or `Owner` access to create resources
2) [Azure Developer CLI](https://aka.ms/azd)
## Deploy Static Web App
1) Export any environment variables you want to override with your values using `./infra/main.parameters.json` as a reference for the variable names. e.g.
In a new terminal:
Bash/sh/zsh:
```bash
export AZURE_RESOURCE_GROUP=rg-dapr-docs-test
export IDENTITY_RESOURCE_GROUP=rg-my-identities
export AZURE_STATICWEBSITE_NAME=daprdocs-latest
```
PowerShell
```PowerShell
setx AZURE_RESOURCE_GROUP "rg-dapr-docs-test"
setx IDENTITY_RESOURCE_GROUP "rg-my-identities"
setx AZURE_STATICWEBSITE_NAME "daprdocs-latest"
```
This assumes you have an existing [user-assigned managed identity](https://learn.microsoft.com/entra/identity/managed-identities-azure-resources/how-manage-user-assigned-managed-identities?pivots=identity-mi-methods-azp) (see L39 in `./infra/main.bicep` to use or modify name) in a resource group that you can reference as the runtime identity of this static web app. We recommend storing this in a different resource group from your application, to keep the permissions and lifecycles separate of your identity and your web app. We also recommend narrowly limiting who has access to view, contribute or own this identity, and also only apply it to single resource scopes, not to entire resource groups or subscriptions, to avoid elevation of priviledges.
2) Deploy using the Azure Dev CLI
The first time, and any updates to this environment
```bash
azd up
```
For subsequent environments/sites, create a side-by-side environment like this:
```bash
azd env new
azd up
```
You will be prompted for the subscription and location (region) to use. The Resource Group and Static Web App will now be created and usable. Typical deployment times are only 20-60 seconds.
## Configure the Static Web App in portal.azure.com
1) (Optional) Grant correct minimal permissions for inbound publishing and outbound access to dependencies using the Static Web App -> Access control (IAM) blade of the portal
2) (Optional) Map your DNS CNAME using the Static Web App -> Custom Domain blade of the portal
## Configure your CI/CD pipeline
You will need a rotatable token or ideally a managed identity (coming soon) for your pipeline to have Web publishing access grants to the Static Web App. Get the token from the Overview blade -> Manage Access Token command of the SWA, and store it in the vault/secret for the repo matching your Github Action (or other CI/CD pipeline)'s workflow file. One example for the current/main release of Dapr docs is [here](https://github.com/dapr/docs/blob/v1.13/.github/workflows/website-root.yml#L57). This is an elevated operation that likely needs an admin or maintainer to perform.

32
.github/iac/swa/scripts/deploy.ps1 vendored Normal file
View File

@ -0,0 +1,32 @@
$output = azd env get-values
foreach ($line in $output) {
if (!($line)){
break
}
$name = $line.Split('=')[0]
$value = $line.Split('=')[1].Trim('"')
Set-Item -Path "env:\$name" -Value $value
}
Write-Host "Environment variables set."
$tools = @("az", "swa", "func")
foreach ($tool in $tools) {
if (!(Get-Command $tool -ErrorAction SilentlyContinue)) {
Write-Host "Error: $tool command line tool is not available, check pre-requisites in README.md"
exit 1
}
}
# az account set --subscription $env:AZURE_SUBSCRIPTION_ID
Write-Host $env:AZURE_SUBSCRIPTION_ID
cd $env:SWA_APP_PATH
$SWA_DEPLOYMENT_TOKEN = az staticwebapp secrets list --name $env:AZURE_STATICWEBSITE_NAME --query "properties.apiKey" --output tsv
if ($SWA_DEPLOYMENT_TOKEN -ne "") {
swa deploy --env production --deployment-token $SWA_DEPLOYMENT_TOKEN
} else {
Write-Host "SWA_DEPLOYMENT_TOKEN is empty, not deployoing froentend, check if the static website is created in Azure portal."
}

31
.github/iac/swa/scripts/deploy.sh vendored Executable file
View File

@ -0,0 +1,31 @@
#!/bin/bash
output=$(azd env get-values)
while IFS= read -r line; do
name=$(echo $line | cut -d'=' -f1)
value=$(echo $line | cut -d'=' -f2 | sed 's/^"\|"$//g')
export $name=$value
echo "$name=$value"
done <<<$output
echo "Environment variables set."
commands=("az" "swa" "func")
for cmd in "${commands[@]}"; do
if ! command -v "$cmd" &>/dev/null; then
echo "Error: $cmd command is not available, check pre-requisites in README.md"
exit 1
fi
done
# az account set --subscription $AZURE_SUBSCRIPTION_ID
cd $SWA_APP_PATH
SWA_DEPLOYMENT_TOKEN=$(az staticwebapp secrets list --name $AZURE_STATICWEBSITE_NAME --query "properties.apiKey" --output tsv)
if [[ -n $SWA_DEPLOYMENT_TOKEN ]]; then
swa deploy --env production --deployment-token $SWA_DEPLOYMENT_TOKEN
else
echo "SWA_DEPLOYMENT_TOKEN is empty, not deployoing froentend, check if the static website is created in Azure portal."
fi

View File

@ -1,6 +1,7 @@
name: Azure Static Web App v1.14
on:
workflow_dispatch:
push:
branches:
- v1.14

3
.gitmodules vendored
View File

@ -29,3 +29,6 @@
[submodule "sdkdocs/pluggable-components/go"]
path = sdkdocs/pluggable-components/go
url = https://github.com/dapr-sandbox/components-go-sdk
[submodule "sdkdocs/rust"]
path = sdkdocs/rust
url = https://github.com/dapr/rust-sdk.git

View File

@ -103,6 +103,14 @@ id = "G-60C6Q1ETC1"
source = "../sdkdocs/js/daprdocs/content/en/js-sdk-contributing"
target = "content/contributing/sdk-contrib/"
lang = "en"
[[module.mounts]]
source = "../sdkdocs/rust/daprdocs/content/en/rust-sdk-docs"
target = "content/developing-applications/sdks/rust"
lang = "en"
[[module.mounts]]
source = "../sdkdocs/rust/daprdocs/content/en/rust-sdk-contributing"
target = "content/contributing/sdks-contrib"
lang = "en"
[[module.mounts]]
source = "../translations/docs-zh/translated_content/zh_CN/docs"

View File

@ -184,6 +184,13 @@ The example above shows an event subscription to topic `orders`, for the pubsub
Place `subscription.yaml` in the same directory as your `pubsub.yaml` component. When Dapr starts up, it loads subscriptions along with the components.
{{% alert title="Note" color="primary" %}}
This feature is currently in preview.
Dapr can be made to "hot reload" declarative subscriptions, whereby updates are picked up automatically without needing a restart.
This is enabled by via the [`HotReload` feature gate]({{< ref "support-preview-features.md" >}}).
To prevent reprocessing or loss of unprocessed messages, in-flight messages between Dapr and your application are unaffected during hot reload events.
{{% /alert %}}
Below are code examples that leverage Dapr SDKs to subscribe to the topic you defined in `subscription.yaml`.
{{< tabs Dotnet Java Python Go JavaScript>}}

View File

@ -84,6 +84,13 @@ Dapr applications can subscribe to published topics via two methods that support
For more information, read [about the subscriptions in Subscription Methods]({{< ref subscription-methods.md >}}).
### Reloading topic subscriptions
To reload topic subscriptions that are defined programmatically or declaratively, the Dapr sidecar needs to be restarted.
The Dapr sidecar can be made to dynamically reload changed declarative topic subscriptions without restarting by enabling the [`HotReload` feature gate]({{< ref "support-preview-features.md" >}}).
Hot reloading of topic subscriptions is currently a preview feature.
In-flight messages are unaffected when reloading a subscription.
### Message routing
Dapr provides [content-based routing](https://www.enterpriseintegrationpatterns.com/ContentBasedRouter.html) pattern. [Pub/sub routing]({{< ref howto-route-messages.md >}}) is an implementation of this pattern that allows developers to use expressions to route [CloudEvents](https://cloudevents.io) based on their contents to different URIs/paths and event handlers in your application. If no route matches, an optional default route is used. This is useful as your applications expands to support multiple event versions or special cases.

View File

@ -19,6 +19,13 @@ The examples below demonstrate pub/sub messaging between a `checkout` app and an
### Declarative subscriptions
{{% alert title="Note" color="primary" %}}
This feature is currently in preview.
Dapr can be made to "hot reload" declarative subscriptions, whereby updates are picked up automatically without needing a restart.
This is enabled by via the [`HotReload` feature gate]({{< ref "support-preview-features.md" >}}).
To prevent reprocessing or loss of unprocessed messages, in-flight messages between Dapr and your application are unaffected during hot reload events.
{{% /alert %}}
You can subscribe declaratively to a topic using an external component file. This example uses a YAML component file named `subscription.yaml`:
```yaml

View File

@ -29,7 +29,7 @@ Select your [preferred language below]({{< ref "#sdk-languages" >}}) to learn mo
| [PHP]({{< ref php >}}) | Stable | ✔ | ✔ | ✔ | |
| [Javascript]({{< ref js >}}) | Stable| ✔ | | ✔ | ✔ |
| [C++](https://github.com/dapr/cpp-sdk) | In development | ✔ | | |
| [Rust](https://github.com/dapr/rust-sdk) | In development | ✔ | | ✔ | |
| [Rust]({{< ref rust >}}) | In development | ✔ | | ✔ | |
## Further reading

View File

@ -23,4 +23,5 @@ For CLI there is no explicit opt-in, just the version that this was first made a
| **Actor State TTL** | Allow actors to save records to state stores with Time To Live (TTL) set to automatically clean up old data. In its current implementation, actor state with TTL may not be reflected correctly by clients, read [Actor State Transactions]({{< ref actors_api.md >}}) for more information. | `ActorStateTTL` | [Actor State Transactions]({{< ref actors_api.md >}}) | v1.11 |
| **Transactional Outbox** | Allows state operations for inserts and updates to be published to a configured pub/sub topic using a single transaction across the state store and the pub/sub | N/A | [Transactional Outbox Feature]({{< ref howto-outbox.md >}}) | v1.12 |
| **Component Hot Reloading** | Allows for Dapr-loaded components to be "hot reloaded". A component spec is reloaded when it is created/updated/deleted in Kubernetes or on file when running in self-hosted mode. Ignores changes to actor state stores and workflow backends. | `HotReload`| [Hot Reloading]({{< ref components-concept.md >}}) | v1.13 |
| **Scheduler reminders** | While [Scheduler]({{< ref "concepts/dapr-services/scheduler.md" >}}) is deployed by default, scheduler reminders (used for scheduling actor reminders) are enabled through a preview feature and needs a feature flag. | `SchedulerReminders`| [Scheduler reminders]({{< ref "scheduler-overview.md#scheduler-reminders" >}}) | v1.14 |
| **Subscription Hot Reloading** | Allows for declarative subscriptions to be "hot reloaded". A subscription is reloaded either when it is created/updated/deleted in Kubernetes, or on file in self-hosted mode. In-flight messages are unaffected when reloading. | `HotReload`| [Hot Reloading]({{< ref "subscription-methods.md#declarative-subscriptions" >}}) | v1.14 |
| **Scheduler reminders** | While [Scheduler]({{< ref "concepts/dapr-services/scheduler.md" >}}) is deployed by default, scheduler reminders (used for scheduling actor reminders) are enabled through a preview feature and needs a feature flag. | `SchedulerReminders`| [Scheduler reminders]({{< ref "scheduler-overview.md#scheduler-reminders" >}}) | v1.14 |

1
sdkdocs/rust Submodule

@ -0,0 +1 @@
Subproject commit ed283c2e259c21cc77a24b3dbc03733103455f1b