Skip to content
This repository was archived by the owner on Jul 9, 2023. It is now read-only.

Commit 280c792

Browse files
Major revamp (#39)
* Major revamp * Fix action name * Use CMD instead of the action * fix path * Remove tty * Disabled tests * SPROCs removed from Reminders package. * SPROCs removed from persistence provider * Final tweaks * Update readme with migration paths.
1 parent 303c0f9 commit 280c792

38 files changed

+1684
-1608
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build:
10+
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v1
15+
- name: Setup .NET Core
16+
uses: actions/setup-dotnet@v1
17+
with:
18+
dotnet-version: 3.0.100
19+
# - name: Azure Cosmos Emulator
20+
# uses: galvesribeiro/AzureCosmosAction@v1.0.0
21+
# - name: Start CosmosDB Emulator
22+
# run: .\StartEmulator.cmd
23+
- name: Build
24+
run: dotnet build --configuration Release
25+
# - name: Test
26+
# run: dotnet test --configuration Release --no-build

.github/workflows/publish.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
build:
10+
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v1
15+
- name: Setup .NET Core
16+
uses: actions/setup-dotnet@v1
17+
with:
18+
dotnet-version: 3.0.100
19+
- name: Pack
20+
working-directory: src/Orleans.Clustering.CosmosDB
21+
run: dotnet pack --configuration Release -p:Version=${GITHUB_REF##*/v}
22+
- name: Pack
23+
working-directory: src/Orleans.Persistence.CosmosDB
24+
run: dotnet pack --configuration Release -p:Version=${GITHUB_REF##*/v}
25+
- name: Pack
26+
working-directory: src/Orleans.Reminders.CosmosDB
27+
run: dotnet pack --configuration Release -p:Version=${GITHUB_REF##*/v}
28+
- name: Pack
29+
working-directory: src/Orleans.Streaming.CosmosDB
30+
run: dotnet pack --configuration Release -p:Version=${GITHUB_REF##*/v}
31+
- name: Push
32+
working-directory: src/Orleans.Clustering.CosmosDB/bin/Release
33+
run: |
34+
dotnet nuget push Orleans.Clustering.CosmosDB.*.nupkg -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json
35+
- name: Push
36+
working-directory: src/Orleans.Persistence.CosmosDB/bin/Release
37+
run: |
38+
dotnet nuget push Orleans.Persistence.CosmosDB.*.nupkg -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json
39+
- name: Push
40+
working-directory: src/Orleans.Reminders.CosmosDB/bin/Release
41+
run: |
42+
dotnet nuget push Orleans.Reminders.CosmosDB.*.nupkg -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json
43+
- name: Push
44+
working-directory: src/Orleans.Streaming.CosmosDB/bin/Release
45+
run: |
46+
dotnet nuget push Orleans.Streaming.CosmosDB.*.nupkg -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json
47+
- name: Create Release
48+
uses: actions/create-release@master
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
with:
52+
tag_name: ${{ github.ref }}
53+
release_name: Release ${{ github.ref }}
54+
draft: false
55+
prerelease: false

.vscode/launch.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
// Use IntelliSense to find out which attributes exist for C# debugging
3+
// Use hover for the description of the existing attributes
4+
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": ".NET Core Launch (console)",
9+
"type": "coreclr",
10+
"request": "launch",
11+
"preLaunchTask": "build",
12+
// If you have changed target frameworks, make sure to update the program path.
13+
"program": "${workspaceFolder}/test/Orleans.CosmosDB.Tests/bin/Debug/netcoreapp3.0/Orleans.CosmosDB.Tests.dll",
14+
"args": [],
15+
"cwd": "${workspaceFolder}/test/Orleans.CosmosDB.Tests",
16+
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
17+
"console": "internalConsole",
18+
"stopAtEntry": false
19+
},
20+
{
21+
"name": ".NET Core Attach",
22+
"type": "coreclr",
23+
"request": "attach",
24+
"processId": "${command:pickProcess}"
25+
}
26+
]
27+
}

.vscode/tasks.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "build",
6+
"command": "dotnet",
7+
"type": "process",
8+
"args": [
9+
"build",
10+
"${workspaceFolder}/Orleans.CosmosDB.sln",
11+
"/property:GenerateFullPaths=true",
12+
"/consoleloggerparameters:NoSummary"
13+
],
14+
"problemMatcher": "$msCompile"
15+
},
16+
{
17+
"label": "publish",
18+
"command": "dotnet",
19+
"type": "process",
20+
"args": [
21+
"publish",
22+
"${workspaceFolder}/Orleans.CosmosDB.sln",
23+
"/property:GenerateFullPaths=true",
24+
"/consoleloggerparameters:NoSummary"
25+
],
26+
"problemMatcher": "$msCompile"
27+
},
28+
{
29+
"label": "watch",
30+
"command": "dotnet",
31+
"type": "process",
32+
"args": [
33+
"watch",
34+
"run",
35+
"${workspaceFolder}/Orleans.CosmosDB.sln",
36+
"/property:GenerateFullPaths=true",
37+
"/consoleloggerparameters:NoSummary"
38+
],
39+
"problemMatcher": "$msCompile"
40+
}
41+
]
42+
}

.vsts-ci.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.vsts-release.yml

Lines changed: 0 additions & 67 deletions
This file was deleted.

README.md

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
<h1>Orleans CosmosDB Providers</h1>
44
</p>
55

6-
[![CircleCI](https://circleci.com/gh/OrleansContrib/Orleans.CosmosDB.svg?style=svg)](https://circleci.com/gh/OrleansContrib/Orleans.CosmosDB)
6+
[![CI](https://github.com/OrleansContrib/Orleans.CosmosDB/workflows/CI/badge.svg)](https://github.com/OrleansContrib/Orleans.CosmosDB/actions)
77
[![NuGet](https://img.shields.io/nuget/v/Orleans.Clustering.CosmosDB.svg?style=flat)](http://www.nuget.org/packages/Orleans.Clustering.CosmosDB)
88
[![NuGet](https://img.shields.io/nuget/v/Orleans.Persistence.CosmosDB.svg?style=flat)](http://www.nuget.org/packages/Orleans.Persistence.CosmosDB)
9-
[![NuGet](https://img.shields.io/nuget/v/Orleans.Reminders.CosmosDB.svg?style=flat)](http://www.nuget.org/packages/Orleans.Clustering.CosmosDB)
9+
[![NuGet](https://img.shields.io/nuget/v/Orleans.Reminders.CosmosDB.svg?style=flat)](http://www.nuget.org/packages/Orleans.Reminders.CosmosDB)
10+
[![NuGet](https://img.shields.io/nuget/v/Orleans.Streaming.CosmosDB.svg?style=flat)](http://www.nuget.org/packages/Orleans.Streaming.CosmosDB)
1011
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/dotnet/orleans?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
1112

1213
[Orleans](https://github.com/dotnet/orleans) is a framework that provides a straight-forward approach to building distributed high-scale computing applications, without the need to learn and apply complex concurrency or other scaling patterns.
@@ -22,33 +23,33 @@ Installation is performed via [NuGet](https://www.nuget.org/packages?q=Orleans+C
2223

2324
From Package Manager:
2425

25-
> PS> Install-Package Orleans.Clustering.CosmosDB -prerelease
26+
> PS> Install-Package Orleans.Clustering.CosmosDB
2627
27-
> PS> Install-Package Orleans.Persistence.CosmosDB -prerelease
28+
> PS> Install-Package Orleans.Persistence.CosmosDB
2829
29-
> PS> Install-Package Orleans.Reminders.CosmosDB -prerelease
30+
> PS> Install-Package Orleans.Reminders.CosmosDB
3031
31-
> PS> Install-Package Orleans.Streaming.CosmosDB -prerelease
32+
> PS> Install-Package Orleans.Streaming.CosmosDB
3233
3334
.Net CLI:
3435

35-
> \# dotnet add package Orleans.Clustering.CosmosDB -prerelease
36+
> \# dotnet add package Orleans.Clustering.CosmosDB
3637
37-
> \# dotnet add package Orleans.Persistence.CosmosDB -prerelease
38+
> \# dotnet add package Orleans.Persistence.CosmosDB
3839
39-
> \# dotnet add package Orleans.Reminders.CosmosDB -prerelease
40+
> \# dotnet add package Orleans.Reminders.CosmosDB
4041
41-
> \# dotnet add package Orleans.Streaming.CosmosDB -prerelease
42+
> \# dotnet add package Orleans.Streaming.CosmosDB
4243
4344
Paket:
4445

45-
> \# paket add Orleans.Clustering.CosmosDB -prerelease
46+
> \# paket add Orleans.Clustering.CosmosDB
4647
47-
> \# paket add Orleans.Persistence.CosmosDB -prerelease
48+
> \# paket add Orleans.Persistence.CosmosDB
4849
49-
> \# paket add Orleans.Reminders.CosmosDB -prerelease
50+
> \# paket add Orleans.Reminders.CosmosDB
5051
51-
> \# paket add Orleans.Streaming.CosmosDB -prerelease
52+
> \# paket add Orleans.Streaming.CosmosDB
5253
5354
# Configuration
5455

@@ -130,6 +131,26 @@ For further details on partitioning in CosmosDB see https://docs.microsoft.com/e
130131
### Backwards compatibility
131132
The change will not affect existing systems. Configuring a custom `IPartitionKeyProvider` for an existing system will throw a BadGrainStorageConfigException stating incompatibility. To start using a custom partition key provider the old documents must be updated with a `/PartitionKey` property where the value is set using the same functionality as in the `GetPartitionKey` implementation in the custom `IPartitionKeyProvider`. Once all documents are updated, the data must be migrated to a new CosmosDB collection using Azure Data Factory, CosmosDB Migration tool or custom code with colletions PartitionKey set to `PartitionKey`
132133

134+
### Migration from 1.3.0 to 3.0.0
135+
136+
With the 3.0.0 release, two breaking changes requires manual changes if you have pre-existent data:
137+
138+
#### Remove stored procedures
139+
140+
Reminders, Streaming and Persistence providers doesn't rely on Stored Procedures anymore. You can safely remove them from your databases once you migrate to 3.0.0. The only stored procedures that are still used, are the ones from the Clustering packages since Orleans membership protocol requires some atomic operations that are only possible on CosmosDB by using stored procedures. All the rest can be killed.
141+
142+
#### Reminders collection
143+
144+
Before 3.0.0, the reminders provider used to use a non-partitioned collection. Recently Microsoft requires that everyone using CosmosDB to migrate to partitioned collections. If you have data on your old collection, you need to migrate this data to a new one.
145+
146+
The new structure is defined as follow:
147+
148+
- `id` field: `$"{grainRef.ToKeyString()}-{reminderName}"`
149+
- `PartitionKey` field: `$"{serviceId}_{grainRef.GetUniformHashCode():X8}"`
150+
- Other fields remain the same.
151+
152+
This data migration can be performed whatever the way you prefer, as long as the `id` and `PartitionKey` fields are formated the way described here. The partition key path of the new collection must be `/PartitionKey`.
153+
133154
### Indexing
134155
The current indexing fork relies on CosmosDB stored procedures for lookup. As stored procedures must be executed against a specific partition, the use of custom partition key builders is not compatible with the Orleans indexing fork.
135156

StartEmulator.cmd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@echo OFF
2+
set containerName=azure-cosmosdb-emulator
3+
set hostDirectory=%LOCALAPPDATA%\azure-cosmosdb-emulator.hostd
4+
md %hostDirectory% 2>nul
5+
REM docker run --name %containerName% --memory 2GB --mount "type=bind,source=%hostDirectory%,destination=C:\CosmosDB.Emulator\bind-mount" -P --interactive --tty microsoft/azure-cosmosdb-emulator
6+
docker run --name %containerName% --memory 2GB --mount "type=bind,source=%hostDirectory%,destination=C:\CosmosDB.Emulator\bind-mount" -p 8081:8081 -p 8900:8900 -p 8901:8901 -p 8979:8979 -p 10250:10250 -p 10251:10251 -p 10252:10252 -p 10253:10253 -p 10254:10254 -p 10255:10255 -p 10256:10256 -p 10350:10350 microsoft/azure-cosmosdb-emulator

0 commit comments

Comments
 (0)