Skip to content

Commit

Permalink
Update dependencies to latest version (aspnet#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
xscript authored May 14, 2018
1 parent 8fbc110 commit 20a9046
Show file tree
Hide file tree
Showing 31 changed files with 128 additions and 380 deletions.
38 changes: 4 additions & 34 deletions docs/azure-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Then copy the build output into `app` folder and set the entrypoint:

```docker
# build runtime image
FROM microsoft/aspnetcore:2.0
FROM microsoft/dotnet:2.1-aspnetcore-runtime
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "ChatRoom.dll"]
Expand All @@ -47,7 +47,7 @@ ENTRYPOINT ["dotnet", "ChatRoom.dll"]
Then you can test the image locally:

```
docker run -p 5000:80 -e Azure__SignalR__ConnectionString=<connection_string> chatroom
docker run -p 5000:80 -e Azure__SignalR__ConnectionString="<connection_string>" chatroom
```

> For more information about building Docker image for .NET Core, please refer to this [doc](https://docs.microsoft.com/en-us/dotnet/core/docker/building-net-docker-images).
Expand Down Expand Up @@ -86,39 +86,9 @@ az webapp config container set \
--docker-registry-server-url https://<acr_name>.azurecr.io \
--docker-registry-server-user <acr_name> \
--docker-registry-server-password <acr_password>
az webapp config appsettings set --resource-group <resource_group_name> --name <app_name> --setting PORT=5000
az webapp config appsettings set --resource-group <resource_group_name> --name <app_name> --setting PORT=80
az webapp config appsettings set --resource-group <resource_group_name> --name <app_name> \
--setting Azure__SignalR__ConnectionString=<connection_string>
--setting Azure__SignalR__ConnectionString="<connection_string>"
```

Now open `https://<app_name>.azurewebsites.net` and you will see your chat room running on Azure.

> Web App now supports .NET Core 2.0, so you can directly deploy to Web App without Docker:
> 1. Create a web app:
> ```
> az group create --name <resource_group_name> --location CentralUS
> az appservice plan create --name <plan_name> --resource-group <resource_group_name> --sku S1 --is-linux
> az webapp create \
> --resource-group <resource_group_name> --plan <plan_name> --name <app_name> \
> --runtime "DOTNETCORE|2.0"
> ```
>
> 2. Config deployment source and credential:
> ```
> az webapp deployment source config-local-git --resource-group <resource_group_name> --name <app_name>
> az webapp deployment user set --user-name <user_name> --password <password>
> ```
>
> 3. Deploy using git:
> ```
> git init
> git remote add origin <deploy_git_url>
> git add -A
> git commit -m "init commit"
> git push origin master
> ```
> 4. Update config
> ```
> az webapp config appsettings set --resource-group <resource_group_name> --name <app_name> \
> --setting Azure__SignalR__ConnectionString=<connection_string>
> ```
1 change: 0 additions & 1 deletion samples/ChatRoom/.npmrc

This file was deleted.

10 changes: 4 additions & 6 deletions samples/ChatRoom/ChatRoom.csproj
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
<UserSecretsId>chatroom</UserSecretsId>
<RootNamespace>Microsoft.Azure.SignalR.Samples.ChatRoom</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="2.1.0-rc1-30677" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.1.0-rc1-30677" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.1.0-rc1-30677" />
<PackageReference Include="Microsoft.Azure.SignalR" Version="1.0.0-preview-10008" />
<Folder Include="wwwroot\" />
</ItemGroup>

<ItemGroup>
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.0-rc1-final" />
<PackageReference Include="Microsoft.Azure.SignalR" Version="1.0.0-preview1-10009" />
</ItemGroup>
</Project>
7 changes: 5 additions & 2 deletions samples/ChatRoom/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM microsoft/aspnetcore-build:2.0 AS build-env
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.

FROM microsoft/dotnet:2.1-sdk-stretch AS build-env
WORKDIR /app

# copy csproj and restore as distinct layers
Expand All @@ -12,7 +15,7 @@ COPY ./ ./
RUN dotnet publish -c Release -o out

# build runtime image
FROM microsoft/aspnetcore:2.0
FROM microsoft/dotnet:2.1-aspnetcore-runtime
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "ChatRoom.dll"]
3 changes: 0 additions & 3 deletions samples/ChatRoom/NuGet.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="azure-signalr-dev" value="https://www.myget.org/F/azure-signalr-dev/api/v3/index.json" />
<add key="aspnetcore-dev" value="https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json" />
<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
</packageSources>
</configuration>
8 changes: 3 additions & 5 deletions samples/ChatRoom/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

In [ChatRoomLocal sample](../ChatRoomLocal) you have learned how to use SignalR to build a chat room application. In that example, the SignalR runtime (which manages the client connections and message routing) is running on your own server. As the number of the clients increases, you'll eventually hit a limit on your server and you'll need to scale your server to handle more clients. This is usually not an easy task. In this tutorial, you'll learn how to use Azure SignalR Service to offload the connection management part to the service so that you don't need to worry about the scaling problem.

## Create a SignalR Service
## Provision a SignalR Service

First let's create a SignalR service on Azure.
First let's provision a SignalR service on Azure.

1. Open Azure portal, click "Create a resource" and find "SignalR Service" in "Web + Mobile".

Expand All @@ -21,8 +21,6 @@ First let's create a SignalR service on Azure.
* Free: which can handle 100 connections at the same time and can send and receive one million messages in a month.
* Basic: which has 1000 concurrent connections and 75 millions message per month limit for *one unit*. You can scale up to 10 units for a single service instance and you'll be charged by the number of units you use.

> In private preview, only basic tier with one unit is supported.
3. Click "Create", your SignalR service will be created in a few minutes.

![signalr-3](../../docs/images/signalr-3.png)
Expand Down Expand Up @@ -64,7 +62,7 @@ Let's look at the key changes:
You also need to reference the service SDK before using these APIs:

```xml
<PackageReference Include="Microsoft.Azure.SignalR" Version="1.0.0-preview-10008" />
<PackageReference Include="Microsoft.Azure.SignalR" Version="1.0.0-preview1-10009" />
```

Other than these changes, everything else remains the same, you can still use the hub interface you're already familiar with to write business logic.
Expand Down
86 changes: 3 additions & 83 deletions samples/ChatRoom/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions samples/ChatRoom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "chatsample",
"private": true,
"dependencies": {
"@aspnet/signalr": "1.0.0-rc1-30656",
"@aspnet/signalr-protocol-msgpack": "1.0.0-rc1-30656"
"@aspnet/signalr": "^1.0.0-rc1-final"
}
}
1 change: 0 additions & 1 deletion samples/ChatRoomLocal/.npmrc

This file was deleted.

9 changes: 3 additions & 6 deletions samples/ChatRoomLocal/ChatRoomLocal.csproj
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
<UserSecretsId>chatroom</UserSecretsId>
<RootNamespace>Microsoft.Azure.SignalR.Samples.ChatRoom</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="2.1.0-rc1-30677" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.1.0-rc1-30677" />
<PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.0.0-rc1-30677" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.1.0-rc1-30677" />
<Folder Include="wwwroot\" />
</ItemGroup>

<ItemGroup>
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.0-rc1-final" />
</ItemGroup>
</Project>
3 changes: 0 additions & 3 deletions samples/ChatRoomLocal/NuGet.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="azure-signalr-dev" value="https://www.myget.org/F/azure-signalr-dev/api/v3/index.json" />
<add key="aspnetcore-dev" value="https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json" />
<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
</packageSources>
</configuration>
4 changes: 2 additions & 2 deletions samples/ChatRoomLocal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Let's do it step by step.
dotnet new web
```
> Before you start, make sure you installed [.NET Core SDK](https://www.microsoft.com/net/learn/get-started).
> Before you start, make sure you installed the latest [.NET Core 2.1 RC1 SDK](https://www.microsoft.com/net/download/dotnet-core/sdk-2.1.300-rc1).
2. Create a `Chat.cs` that defines a `Chat` hub class.
Expand All @@ -48,7 +48,7 @@ Let's do it step by step.
> You need to reference the SignalR SDK before using the APIs:
>
> ```xml
> <PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.0.0-rc1-30677" />
> <PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.0.0-rc1-final" />
> ```
Hub is the core concept in SignalR which exposes a set of methods that can be called from client. Here we define two methods: `Broadcast()` which broadcasts the message to all clients and `Echo()` which sends the message back to the caller.
Expand Down
86 changes: 3 additions & 83 deletions samples/ChatRoomLocal/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions samples/ChatRoomLocal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "chatsample",
"private": true,
"dependencies": {
"@aspnet/signalr": "1.0.0-rc1-30656",
"@aspnet/signalr-protocol-msgpack": "1.0.0-rc1-30656"
"@aspnet/signalr": "^1.0.0-rc1-final"
}
}
Loading

0 comments on commit 20a9046

Please sign in to comment.