nuget private repo & solutions separation

This commit is contained in:
Spyros Garyfallos 2018-05-21 13:37:11 -07:00
Родитель 779ce15a98
Коммит 2648b65fb0
62 изменённых файлов: 362 добавлений и 369 удалений

Просмотреть файл

@ -1,10 +0,0 @@
.dockerignore
.env
.git
.gitignore
.vs
.vscode
docker-compose.yml
docker-compose.*.yml
*/bin
*/obj

1
.env
Просмотреть файл

@ -1 +0,0 @@
DOCKER_REGISTRY=localhost

Двоичные данные
.nuget/nuget.exe

Двоичный файл не отображается.

1
Example/.env Normal file
Просмотреть файл

@ -0,0 +1 @@
DOCKER_REGISTRY=localhost:5000/

Просмотреть файл

@ -3,12 +3,12 @@ WORKDIR /app
FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY Example/Modules/NormalizeTemperatureModule/NormalizeTemperatureModule.csproj Example/Modules/NormalizeTemperatureModule/
COPY Microsoft.Azure.IoT.TypeEdge/Microsoft.Azure.IoT.TypeEdge.csproj Microsoft.Azure.IoT.TypeEdge/
COPY Example/Thermostat.Shared/Thermostat.Shared.csproj Example/Thermostat.Shared/
RUN dotnet restore Example/Modules/NormalizeTemperatureModule/NormalizeTemperatureModule.csproj
COPY build build
COPY Modules/NormalizeTemperatureModule/NormalizeTemperatureModule.csproj Modules/NormalizeTemperatureModule/
COPY Thermostat.Shared/Thermostat.Shared.csproj Thermostat.Shared/
RUN dotnet restore Modules/NormalizeTemperatureModule/NormalizeTemperatureModule.csproj -s /src/build -s https://api.nuget.org/v3/index.json
COPY . .
WORKDIR /src/Example/Modules/NormalizeTemperatureModule
WORKDIR /src/Modules/NormalizeTemperatureModule
RUN dotnet build NormalizeTemperatureModule.csproj -c Release -o /app
FROM build AS publish

Просмотреть файл

@ -50,7 +50,6 @@ namespace Modules
await Twin.ReportAsync(twin);
return TwinResult.OK;
});
}
}
}

Просмотреть файл

@ -1,14 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<ApplicationIcon />
<OutputType>Exe</OutputType>
<LangVersion>latest</LangVersion>
<Configurations>Debug;Release;TemplateDevelopment</Configurations>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>TRACE;DEBUG</DefineConstants>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Microsoft.Azure.IoT.TypeEdge\Microsoft.Azure.IoT.TypeEdge.csproj" />
<PackageReference Include="Microsoft.Azure.IoT.TypeEdge" Version="0.0.2" Condition="'$(Configuration)|$(Platform)'!='TemplateDevelopment|AnyCPU'" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Microsoft.Azure.IoT.TypeEdge\Microsoft.Azure.IoT.TypeEdge.csproj" Condition="'$(Configuration)|$(Platform)'=='TemplateDevelopment|AnyCPU'" />
<ProjectReference Include="..\..\Thermostat.Shared\Thermostat.Shared.csproj" />
</ItemGroup>

Просмотреть файл

@ -3,12 +3,12 @@ WORKDIR /app
FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY Example/Modules/TemperatureModule/TemperatureModule.csproj Example/Modules/TemperatureModule/
COPY Microsoft.Azure.IoT.TypeEdge/Microsoft.Azure.IoT.TypeEdge.csproj Microsoft.Azure.IoT.TypeEdge/
COPY Example/Thermostat.Shared/Thermostat.Shared.csproj Example/Thermostat.Shared/
RUN dotnet restore Example/Modules/TemperatureModule/TemperatureModule.csproj
COPY build build
COPY Modules/TemperatureModule/TemperatureModule.csproj Modules/TemperatureModule/
COPY Thermostat.Shared/Thermostat.Shared.csproj Thermostat.Shared/
RUN dotnet restore Modules/TemperatureModule/TemperatureModule.csproj -s /src/build -s https://api.nuget.org/v3/index.json
COPY . .
WORKDIR /src/Example/Modules/TemperatureModule
WORKDIR /src/Modules/TemperatureModule
RUN dotnet build TemperatureModule.csproj -c Release -o /app
FROM build AS publish

Просмотреть файл

@ -1,14 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<ApplicationIcon />
<OutputType>Exe</OutputType>
<LangVersion>latest</LangVersion>
<Configurations>Debug;Release;TemplateDevelopment</Configurations>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>TRACE;DEBUG</DefineConstants>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Microsoft.Azure.IoT.TypeEdge\Microsoft.Azure.IoT.TypeEdge.csproj" />
<PackageReference Include="Microsoft.Azure.IoT.TypeEdge" Version="0.0.2" Condition="'$(Configuration)|$(Platform)'!='TemplateDevelopment|AnyCPU'" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Microsoft.Azure.IoT.TypeEdge\Microsoft.Azure.IoT.TypeEdge.csproj" Condition="'$(Configuration)|$(Platform)'=='TemplateDevelopment|AnyCPU'" />
<ProjectReference Include="..\..\Thermostat.Shared\Thermostat.Shared.csproj" />
</ItemGroup>

6
Example/NuGet.Config Normal file
Просмотреть файл

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="internal" value="build" />
</packageSources>
</configuration>

Просмотреть файл

@ -1,51 +0,0 @@
FROM microsoft/dotnet:2.1-runtime AS base
# Add an unprivileged user account for running Edge Hub
RUN useradd -ms /bin/bash edgehubuser
ENV EdgeHubUser=edgehubuser
ARG EXE_DIR=.
ENV SSL_CERTIFICATE_PATH=/app/certs
ENV SSL_CERTIFICATE_NAME=mqtt-server.pfx
# Install snappy and set up symlinks that are absent from the base image
# Required by RocksDb
RUN apt-get update && \
apt-get install -y libsnappy1v5 libcap2-bin && \
ln -s /lib/x86_64-linux-gnu/libdl.so.2 /usr/lib/x86_64-linux-gnu/libdl.so && \
ln -s /lib/x86_64-linux-gnu/libc.so.6 /usr/lib/x86_64-linux-gnu/libc.so && \
rm -rf /var/lib/apt/lists/*
# add the CAP_NET_BIND_SERVICE capability to the dotnet binary because
# we are starting edge hub as a non-root user
RUN setcap 'cap_net_bind_service=+ep' /usr/share/dotnet/dotnet
WORKDIR /app
COPY $EXE_DIR/ ./
# Expose MQTT and HTTPS ports
EXPOSE 8883/tcp
EXPOSE 443/tcp
FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY Example/Thermostat.Emulator/Thermostat.Emulator.csproj Example/Thermostat.Emulator/
COPY Example/Thermostat.Shared/Thermostat.Shared.csproj Example/Thermostat.Shared/
COPY Microsoft.Azure.IoT.TypeEdge/Microsoft.Azure.IoT.TypeEdge.csproj Microsoft.Azure.IoT.TypeEdge/
COPY Microsoft.Azure.IoT.TypeEdge.Host/Microsoft.Azure.IoT.TypeEdge.Host.csproj Microsoft.Azure.IoT.TypeEdge.Host/
COPY Example/Modules/NormalizeTemperatureModule/NormalizeTemperatureModule.csproj Example/Modules/NormalizeTemperatureModule/
COPY Example/Modules/TemperatureModule/TemperatureModule.csproj Example/Modules/TemperatureModule/
RUN dotnet restore Example/Thermostat.Emulator/Thermostat.Emulator.csproj
COPY . .
WORKDIR /src/Example/Thermostat.Emulator
RUN dotnet build Thermostat.Emulator.csproj -c Release -o /app
FROM build AS publish
RUN dotnet publish Thermostat.Emulator.csproj -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "Thermostat.Emulator.dll"]

Просмотреть файл

@ -19,7 +19,6 @@ namespace ThermostatApplication
.Build();
var host = new TypeEdgeHost(configuration);
host.RegisterModule<ITemperatureModule, TemperatureModule>();
host.RegisterModule<INormalizeTemperatureModule, NormalizeTemperatureModule>();

Просмотреть файл

@ -1,18 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<LangVersion>latest</LangVersion>
<Configurations>Debug;Release;TemplateDevelopment</Configurations>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>TRACE;DEBUG</DefineConstants>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Microsoft.Azure.IoT.TypeEdge.Host\Microsoft.Azure.IoT.TypeEdge.Host.csproj" />
<PackageReference Include="Microsoft.Azure.IoT.TypeEdge.Host" Version="0.0.2" />
<PackageReference Include="rocksdb-native-arm" Version="5.4.6" />
<PackageReference Include="RocksDbNative" Version="5.4.6.10" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Microsoft.Azure.IoT.TypeEdge.Host\Microsoft.Azure.IoT.TypeEdge.Host.csproj" Condition="'$(Configuration)|$(Platform)'=='TemplateDevelopment|AnyCPU'" />
<ProjectReference Include="..\Modules\NormalizeTemperatureModule\NormalizeTemperatureModule.csproj" />
<ProjectReference Include="..\Modules\TemperatureModule\TemperatureModule.csproj" />
<ProjectReference Include="..\Thermostat.Shared\Thermostat.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="appsettings_thermostat.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>

Просмотреть файл

@ -1,8 +1,6 @@
{
"TypeEdgeHost": {
"IotHubConnectionString": "HostName=iotedgedev-iothub-7389d7.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=68K3zvI8CKbN7NM5s46N9rlP+zvPHPJKg7shy1rwMRU=",
"DeviceId": "type-edge-dev",
"Environment": "InMemory",
"DockerFileTemplate": "Dockerfile"
"DeviceId": "type-edge-dev"
}
}

Просмотреть файл

@ -1,13 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<LangVersion>latest</LangVersion>
<OutputType>Exe</OutputType>
<Configurations>Debug;Release;TemplateDevelopment</Configurations>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>TRACE;DEBUG</DefineConstants>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Microsoft.Azure.IoT.TypeEdge.Proxy\Microsoft.Azure.IoT.TypeEdge.Proxy.csproj" />
<PackageReference Include="Microsoft.Azure.IoT.TypeEdge.Proxy" Version="0.0.2" Condition="'$(Configuration)|$(Platform)'!='TemplateDevelopment|AnyCPU'" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Microsoft.Azure.IoT.TypeEdge.Proxy\Microsoft.Azure.IoT.TypeEdge.Proxy.csproj" Condition="'$(Configuration)|$(Platform)'=='TemplateDevelopment|AnyCPU'" />
<ProjectReference Include="..\Thermostat.Shared\Thermostat.Shared.csproj" />
</ItemGroup>

Просмотреть файл

@ -1,11 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<Configurations>Debug;Release;TemplateDevelopment</Configurations>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>TRACE;DEBUG</DefineConstants>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Microsoft.Azure.IoT.TypeEdge\Microsoft.Azure.IoT.TypeEdge.csproj" />
<PackageReference Include="Microsoft.Azure.IoT.TypeEdge" Version="0.0.2" Condition="'$(Configuration)|$(Platform)'!='TemplateDevelopment|AnyCPU'" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Microsoft.Azure.IoT.TypeEdge\Microsoft.Azure.IoT.TypeEdge.csproj" Condition="'$(Configuration)|$(Platform)'=='TemplateDevelopment|AnyCPU'" />
</ItemGroup>
</Project>

Просмотреть файл

@ -3,51 +3,57 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27703.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ThermostatApplication.Shared", "ThermostatApplication.Shared\ThermostatApplication.Shared.csproj", "{DD7A29AD-0125-4335-BDA1-41DD7586BD6D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ThermostatApplication", "ThermostatApplication\ThermostatApplication.csproj", "{8CAC237D-EE55-481F-B08A-5B3F9DE2F43A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Modules", "Modules", "{8D822B22-E5A9-4165-B27B-458A70D2B44F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TemperatureModule", "TemperatureModule\TemperatureModule.csproj", "{D24DFF2A-1783-45EC-B4D0-DB4C48864E01}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NormalizeTemperatureModule", "NormalizeTemperatureModule\NormalizeTemperatureModule.csproj", "{5EF59CBB-28AB-42CB-B7EC-528D20F5CDAC}"
EndProject
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{1373DBDC-DC13-429E-8C17-2E4D85CF42BA}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NormalizeTemperatureModule", "Modules\NormalizeTemperatureModule\NormalizeTemperatureModule.csproj", "{97D246B7-A79E-49A1-A9BA-2D1B8A6C26BF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TemperatureModule", "Modules\TemperatureModule\TemperatureModule.csproj", "{73158509-5709-40DF-A5A9-89661B3000A7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Thermostat.Emulator", "Thermostat.Emulator\Thermostat.Emulator.csproj", "{1A622C23-B9BD-4903-A28D-28B446BB358E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Thermostat.Shared", "Thermostat.Shared\Thermostat.Shared.csproj", "{7DB0AED8-EA6D-466E-B173-6C6BA4A692CF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Thermostat.ServiceApp", "Thermostat.ServiceApp\Thermostat.ServiceApp.csproj", "{258D1CCE-A112-46A2-88F1-D9BA50450C7B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DD7A29AD-0125-4335-BDA1-41DD7586BD6D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DD7A29AD-0125-4335-BDA1-41DD7586BD6D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DD7A29AD-0125-4335-BDA1-41DD7586BD6D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DD7A29AD-0125-4335-BDA1-41DD7586BD6D}.Release|Any CPU.Build.0 = Release|Any CPU
{8CAC237D-EE55-481F-B08A-5B3F9DE2F43A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8CAC237D-EE55-481F-B08A-5B3F9DE2F43A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8CAC237D-EE55-481F-B08A-5B3F9DE2F43A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8CAC237D-EE55-481F-B08A-5B3F9DE2F43A}.Release|Any CPU.Build.0 = Release|Any CPU
{D24DFF2A-1783-45EC-B4D0-DB4C48864E01}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D24DFF2A-1783-45EC-B4D0-DB4C48864E01}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D24DFF2A-1783-45EC-B4D0-DB4C48864E01}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D24DFF2A-1783-45EC-B4D0-DB4C48864E01}.Release|Any CPU.Build.0 = Release|Any CPU
{5EF59CBB-28AB-42CB-B7EC-528D20F5CDAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5EF59CBB-28AB-42CB-B7EC-528D20F5CDAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5EF59CBB-28AB-42CB-B7EC-528D20F5CDAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5EF59CBB-28AB-42CB-B7EC-528D20F5CDAC}.Release|Any CPU.Build.0 = Release|Any CPU
{1373DBDC-DC13-429E-8C17-2E4D85CF42BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1373DBDC-DC13-429E-8C17-2E4D85CF42BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1373DBDC-DC13-429E-8C17-2E4D85CF42BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1373DBDC-DC13-429E-8C17-2E4D85CF42BA}.Release|Any CPU.Build.0 = Release|Any CPU
{97D246B7-A79E-49A1-A9BA-2D1B8A6C26BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{97D246B7-A79E-49A1-A9BA-2D1B8A6C26BF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{97D246B7-A79E-49A1-A9BA-2D1B8A6C26BF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{97D246B7-A79E-49A1-A9BA-2D1B8A6C26BF}.Release|Any CPU.Build.0 = Release|Any CPU
{73158509-5709-40DF-A5A9-89661B3000A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{73158509-5709-40DF-A5A9-89661B3000A7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{73158509-5709-40DF-A5A9-89661B3000A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{73158509-5709-40DF-A5A9-89661B3000A7}.Release|Any CPU.Build.0 = Release|Any CPU
{1A622C23-B9BD-4903-A28D-28B446BB358E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1A622C23-B9BD-4903-A28D-28B446BB358E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1A622C23-B9BD-4903-A28D-28B446BB358E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1A622C23-B9BD-4903-A28D-28B446BB358E}.Release|Any CPU.Build.0 = Release|Any CPU
{7DB0AED8-EA6D-466E-B173-6C6BA4A692CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7DB0AED8-EA6D-466E-B173-6C6BA4A692CF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7DB0AED8-EA6D-466E-B173-6C6BA4A692CF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7DB0AED8-EA6D-466E-B173-6C6BA4A692CF}.Release|Any CPU.Build.0 = Release|Any CPU
{258D1CCE-A112-46A2-88F1-D9BA50450C7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{258D1CCE-A112-46A2-88F1-D9BA50450C7B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{258D1CCE-A112-46A2-88F1-D9BA50450C7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{258D1CCE-A112-46A2-88F1-D9BA50450C7B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{D24DFF2A-1783-45EC-B4D0-DB4C48864E01} = {8D822B22-E5A9-4165-B27B-458A70D2B44F}
{5EF59CBB-28AB-42CB-B7EC-528D20F5CDAC} = {8D822B22-E5A9-4165-B27B-458A70D2B44F}
{97D246B7-A79E-49A1-A9BA-2D1B8A6C26BF} = {8D822B22-E5A9-4165-B27B-458A70D2B44F}
{73158509-5709-40DF-A5A9-89661B3000A7} = {8D822B22-E5A9-4165-B27B-458A70D2B44F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E7BE10A1-BBA6-43BB-BC65-A9D38A168E00}

Двоичные данные
Example/build/Microsoft.Azure.Devices.Edge.Agent.Core.1.0.0.nupkg Normal file

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичные данные
Example/build/Microsoft.Azure.IoT.TypeEdge.0.0.1.nupkg Normal file

Двоичный файл не отображается.

Двоичные данные
Example/build/Microsoft.Azure.IoT.TypeEdge.0.0.2.nupkg Normal file

Двоичный файл не отображается.

Двоичные данные
Example/build/Microsoft.Azure.IoT.TypeEdge.Host.0.0.1.nupkg Normal file

Двоичный файл не отображается.

Двоичные данные
Example/build/Microsoft.Azure.IoT.TypeEdge.Host.0.0.2.nupkg Normal file

Двоичный файл не отображается.

Двоичные данные
Example/build/Microsoft.Azure.IoT.TypeEdge.Proxy.0.0.2.nupkg Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -1,8 +1,23 @@
version: '3.4'
services:
thermostatapplication:
image: ${DOCKER_REGISTRY}thermostatapplication
normalizetemperaturemodule:
image: ${DOCKER_REGISTRY}normalizetemperaturemodule
build:
context: .
dockerfile: ThermostatApplication/Dockerfile
dockerfile: Modules/NormalizeTemperatureModule/Dockerfile
temperaturemodule:
image: ${DOCKER_REGISTRY}temperaturemodule
build:
context: .
dockerfile: Modules/TemperatureModule/Dockerfile
thermostat.emulator:
image: ${DOCKER_REGISTRY}thermostatemulator
build:
context: .
dockerfile: Thermostat.Emulator/Dockerfile

Просмотреть файл

@ -11,8 +11,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Example", "Example", "{C865
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Modules", "Modules", "{F2FF1756-9AAF-411B-8B54-3829EAC21515}"
EndProject
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{8275D850-82CD-4204-A4BE-C8EC3095E703}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TemperatureModule", "Example\Modules\TemperatureModule\TemperatureModule.csproj", "{48302C68-971D-414F-A29D-742F79415D74}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NormalizeTemperatureModule", "Example\Modules\NormalizeTemperatureModule\NormalizeTemperatureModule.csproj", "{30A335A6-47C9-435A-BA23-50988EAF2C33}"
@ -30,6 +28,7 @@ Global
CodeCoverage|Any CPU = CodeCoverage|Any CPU
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
TemplateDevelopment|Any CPU = TemplateDevelopment|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{54587D56-7C22-4084-9321-84D57C2F6ECB}.CodeCoverage|Any CPU.ActiveCfg = Debug|Any CPU
@ -38,61 +37,70 @@ Global
{54587D56-7C22-4084-9321-84D57C2F6ECB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{54587D56-7C22-4084-9321-84D57C2F6ECB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{54587D56-7C22-4084-9321-84D57C2F6ECB}.Release|Any CPU.Build.0 = Release|Any CPU
{54587D56-7C22-4084-9321-84D57C2F6ECB}.TemplateDevelopment|Any CPU.ActiveCfg = TemplateDevelopment|Any CPU
{54587D56-7C22-4084-9321-84D57C2F6ECB}.TemplateDevelopment|Any CPU.Build.0 = TemplateDevelopment|Any CPU
{6F13F88C-B271-4DA6-9A35-5FD7FEADD3A3}.CodeCoverage|Any CPU.ActiveCfg = Debug|Any CPU
{6F13F88C-B271-4DA6-9A35-5FD7FEADD3A3}.CodeCoverage|Any CPU.Build.0 = Debug|Any CPU
{6F13F88C-B271-4DA6-9A35-5FD7FEADD3A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6F13F88C-B271-4DA6-9A35-5FD7FEADD3A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6F13F88C-B271-4DA6-9A35-5FD7FEADD3A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6F13F88C-B271-4DA6-9A35-5FD7FEADD3A3}.Release|Any CPU.Build.0 = Release|Any CPU
{8275D850-82CD-4204-A4BE-C8EC3095E703}.CodeCoverage|Any CPU.ActiveCfg = Debug|Any CPU
{8275D850-82CD-4204-A4BE-C8EC3095E703}.CodeCoverage|Any CPU.Build.0 = Debug|Any CPU
{8275D850-82CD-4204-A4BE-C8EC3095E703}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8275D850-82CD-4204-A4BE-C8EC3095E703}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8275D850-82CD-4204-A4BE-C8EC3095E703}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8275D850-82CD-4204-A4BE-C8EC3095E703}.Release|Any CPU.Build.0 = Release|Any CPU
{6F13F88C-B271-4DA6-9A35-5FD7FEADD3A3}.TemplateDevelopment|Any CPU.ActiveCfg = TemplateDevelopment|Any CPU
{6F13F88C-B271-4DA6-9A35-5FD7FEADD3A3}.TemplateDevelopment|Any CPU.Build.0 = TemplateDevelopment|Any CPU
{48302C68-971D-414F-A29D-742F79415D74}.CodeCoverage|Any CPU.ActiveCfg = Debug|Any CPU
{48302C68-971D-414F-A29D-742F79415D74}.CodeCoverage|Any CPU.Build.0 = Debug|Any CPU
{48302C68-971D-414F-A29D-742F79415D74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{48302C68-971D-414F-A29D-742F79415D74}.Debug|Any CPU.Build.0 = Debug|Any CPU
{48302C68-971D-414F-A29D-742F79415D74}.Release|Any CPU.ActiveCfg = Release|Any CPU
{48302C68-971D-414F-A29D-742F79415D74}.Release|Any CPU.Build.0 = Release|Any CPU
{48302C68-971D-414F-A29D-742F79415D74}.TemplateDevelopment|Any CPU.ActiveCfg = TemplateDevelopment|Any CPU
{48302C68-971D-414F-A29D-742F79415D74}.TemplateDevelopment|Any CPU.Build.0 = TemplateDevelopment|Any CPU
{30A335A6-47C9-435A-BA23-50988EAF2C33}.CodeCoverage|Any CPU.ActiveCfg = Debug|Any CPU
{30A335A6-47C9-435A-BA23-50988EAF2C33}.CodeCoverage|Any CPU.Build.0 = Debug|Any CPU
{30A335A6-47C9-435A-BA23-50988EAF2C33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{30A335A6-47C9-435A-BA23-50988EAF2C33}.Debug|Any CPU.Build.0 = Debug|Any CPU
{30A335A6-47C9-435A-BA23-50988EAF2C33}.Release|Any CPU.ActiveCfg = Release|Any CPU
{30A335A6-47C9-435A-BA23-50988EAF2C33}.Release|Any CPU.Build.0 = Release|Any CPU
{30A335A6-47C9-435A-BA23-50988EAF2C33}.TemplateDevelopment|Any CPU.ActiveCfg = TemplateDevelopment|Any CPU
{30A335A6-47C9-435A-BA23-50988EAF2C33}.TemplateDevelopment|Any CPU.Build.0 = TemplateDevelopment|Any CPU
{45F97F43-7C75-49B8-8525-7F0E9C7B9FB7}.CodeCoverage|Any CPU.ActiveCfg = Debug|Any CPU
{45F97F43-7C75-49B8-8525-7F0E9C7B9FB7}.CodeCoverage|Any CPU.Build.0 = Debug|Any CPU
{45F97F43-7C75-49B8-8525-7F0E9C7B9FB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{45F97F43-7C75-49B8-8525-7F0E9C7B9FB7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{45F97F43-7C75-49B8-8525-7F0E9C7B9FB7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{45F97F43-7C75-49B8-8525-7F0E9C7B9FB7}.Release|Any CPU.Build.0 = Release|Any CPU
{45F97F43-7C75-49B8-8525-7F0E9C7B9FB7}.TemplateDevelopment|Any CPU.ActiveCfg = TemplateDevelopment|Any CPU
{45F97F43-7C75-49B8-8525-7F0E9C7B9FB7}.TemplateDevelopment|Any CPU.Build.0 = TemplateDevelopment|Any CPU
{2076DDEF-8EE3-4BC1-BF79-1C1F62A8719D}.CodeCoverage|Any CPU.ActiveCfg = Debug|Any CPU
{2076DDEF-8EE3-4BC1-BF79-1C1F62A8719D}.CodeCoverage|Any CPU.Build.0 = Debug|Any CPU
{2076DDEF-8EE3-4BC1-BF79-1C1F62A8719D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2076DDEF-8EE3-4BC1-BF79-1C1F62A8719D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2076DDEF-8EE3-4BC1-BF79-1C1F62A8719D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2076DDEF-8EE3-4BC1-BF79-1C1F62A8719D}.Release|Any CPU.Build.0 = Release|Any CPU
{2076DDEF-8EE3-4BC1-BF79-1C1F62A8719D}.TemplateDevelopment|Any CPU.ActiveCfg = TemplateDevelopment|Any CPU
{2076DDEF-8EE3-4BC1-BF79-1C1F62A8719D}.TemplateDevelopment|Any CPU.Build.0 = TemplateDevelopment|Any CPU
{286CDAA1-5410-4322-AC1C-F35A83CDA63D}.CodeCoverage|Any CPU.ActiveCfg = Debug|Any CPU
{286CDAA1-5410-4322-AC1C-F35A83CDA63D}.CodeCoverage|Any CPU.Build.0 = Debug|Any CPU
{286CDAA1-5410-4322-AC1C-F35A83CDA63D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{286CDAA1-5410-4322-AC1C-F35A83CDA63D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{286CDAA1-5410-4322-AC1C-F35A83CDA63D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{286CDAA1-5410-4322-AC1C-F35A83CDA63D}.Release|Any CPU.Build.0 = Release|Any CPU
{286CDAA1-5410-4322-AC1C-F35A83CDA63D}.TemplateDevelopment|Any CPU.ActiveCfg = TemplateDevelopment|Any CPU
{286CDAA1-5410-4322-AC1C-F35A83CDA63D}.TemplateDevelopment|Any CPU.Build.0 = TemplateDevelopment|Any CPU
{E738845B-4D98-4CB9-BDA4-F83193FE81B5}.CodeCoverage|Any CPU.ActiveCfg = Debug|Any CPU
{E738845B-4D98-4CB9-BDA4-F83193FE81B5}.CodeCoverage|Any CPU.Build.0 = Debug|Any CPU
{E738845B-4D98-4CB9-BDA4-F83193FE81B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E738845B-4D98-4CB9-BDA4-F83193FE81B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E738845B-4D98-4CB9-BDA4-F83193FE81B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E738845B-4D98-4CB9-BDA4-F83193FE81B5}.Release|Any CPU.Build.0 = Release|Any CPU
{E738845B-4D98-4CB9-BDA4-F83193FE81B5}.TemplateDevelopment|Any CPU.ActiveCfg = TemplateDevelopment|Any CPU
{E738845B-4D98-4CB9-BDA4-F83193FE81B5}.TemplateDevelopment|Any CPU.Build.0 = TemplateDevelopment|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{F2FF1756-9AAF-411B-8B54-3829EAC21515} = {C865B730-A5A7-4738-9F6E-CBC7AA306467}
{8275D850-82CD-4204-A4BE-C8EC3095E703} = {C865B730-A5A7-4738-9F6E-CBC7AA306467}
{48302C68-971D-414F-A29D-742F79415D74} = {F2FF1756-9AAF-411B-8B54-3829EAC21515}
{30A335A6-47C9-435A-BA23-50988EAF2C33} = {F2FF1756-9AAF-411B-8B54-3829EAC21515}
{45F97F43-7C75-49B8-8525-7F0E9C7B9FB7} = {C865B730-A5A7-4738-9F6E-CBC7AA306467}

Просмотреть файл

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>Microsoft.Azure.IoT.TypeEdge.Host</id>
<version>0.0.2</version>
<authors>paloukari</authors>
<owners>paloukari</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Package Description</description>
<dependencies>
<group targetFramework=".NETCoreApp2.1">
<dependency id="Microsoft.Azure.IoT.TypeEdge" version="0.0.1" exclude="Build,Analyzers" />
<dependency id="Microsoft.Azure.Devices.Edge.Agent.Core" version="1.0.0" exclude="Build,Analyzers" />
<dependency id="Microsoft.Azure.Devices.Edge.Hub.Service" version="1.0.0" exclude="Build,Analyzers" />
</group>
</dependencies>
<contentFiles>
<files include="build/Config/appsettings_hub.json" buildAction="None" copyToOutput="true"/>
<files include="build/Docker/Dockerfile" buildAction="None" />
<files include="build/Certificates/edge-chain-ca/cert/edge-chain-ca.cert.pem" buildAction="None" copyToOutput="true" />
<files include="build/Certificates/edge-device-ca/cert/edge-device-ca-root.cert.pem" buildAction="None" copyToOutput="true" />
<files include="build/Certificates/edge-hub-server/cert/edge-hub-server.cert.pfx" buildAction="None" copyToOutput="true" />
</contentFiles>
</metadata>
<files>
<file src="bin\Debug\netcoreapp2.1\Microsoft.Azure.IoT.TypeEdge.Host.dll" target="lib\netcoreapp2.1\Microsoft.Azure.IoT.TypeEdge.Host.dll" />
<file src="Microsoft.Azure.IoT.TypeEdge.Host.targets" target="build\Microsoft.Azure.IoT.TypeEdge.Host.targets" />
<file src="Certificates\edge-chain-ca\cert\edge-chain-ca.cert.pem" target="build\Certificates\edge-chain-ca\cert\edge-chain-ca.cert.pem" />
<file src="Certificates\edge-device-ca\cert\edge-device-ca-root.cert.pem" target="build\Certificates\edge-device-ca\cert\edge-device-ca-root.cert.pem" />
<file src="Certificates\edge-hub-server\cert\edge-hub-server.cert.pfx" target="build\Certificates\edge-hub-server\cert\edge-hub-server.cert.pfx" />
<file src="appsettings_hub.json" target="build\Config\appsettings_hub.json" />
<file src="Dockerfile" target="build\Docker\Dockerfile" />
</files>
</package>

Просмотреть файл

@ -2,7 +2,7 @@
{
internal class Constants
{
public const string ConfigFileName = "appsettings_compose.json";
}
}
}

Просмотреть файл

@ -0,0 +1,32 @@
ARG base_tag=2.1-runtime-stretch-slim
FROM microsoft/dotnet:${base_tag}
# Add an unprivileged user account for running Edge Hub
RUN useradd -ms /bin/bash edgehubuser
ENV EdgeHubUser=edgehubuser
ARG EXE_DIR=.
ENV SSL_CERTIFICATE_PATH=/app/certs
ENV SSL_CERTIFICATE_NAME=mqtt-server.pfx
# Install snappy and set up symlinks that are absent from the base image
# Required by RocksDb
RUN apt-get update && \
apt-get install -y libsnappy1v5 libcap2-bin && \
ln -s /lib/x86_64-linux-gnu/libdl.so.2 /usr/lib/x86_64-linux-gnu/libdl.so && \
ln -s /lib/x86_64-linux-gnu/libc.so.6 /usr/lib/x86_64-linux-gnu/libc.so && \
rm -rf /var/lib/apt/lists/*
# add the CAP_NET_BIND_SERVICE capability to the dotnet binary because
# we are starting edge hub as a non-root user
RUN setcap 'cap_net_bind_service=+ep' /usr/share/dotnet/dotnet
WORKDIR /app
COPY $EXE_DIR/ ./
# Expose MQTT and HTTPS ports
EXPOSE 8883/tcp
EXPOSE 443/tcp
CMD ["scripts/linux/start.sh"]

Просмотреть файл

@ -16,7 +16,6 @@ namespace Microsoft.Azure.IoT.TypeEdge.Host.Hub
public override CreationResult Configure(IConfigurationRoot configuration)
{
HubServiceConfiguration = new ConfigurationBuilder()
.AddJsonFile(Constants.ConfigFileName)
.AddEnvironmentVariables()
.Build();

Просмотреть файл

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<PackageId>Microsoft.Azure.IoT.TypeEdge.Host</PackageId>
@ -7,71 +7,43 @@
<Company>Microsoft</Company>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageOutputPath>../build</PackageOutputPath>
<PackageOutputPath>../Example/build</PackageOutputPath>
<TargetFramework>netcoreapp2.1</TargetFramework>
<Configurations>Debug;Release;TemplateDevelopment</Configurations>
<NuspecFile>.nuspec</NuspecFile>
</PropertyGroup>
<ItemGroup>
<None Remove="deviceconfig.json" />
</ItemGroup>
<ItemGroup>
<Content Include="..\..\..\..\internal\Azure-IoT-Edge-Core\edge-hub\src\Microsoft.Azure.Devices.Edge.Hub.Service\appsettings_hub.json" Link="appsettings_hub.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="deviceconfig.json">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Devices.Edge.Agent.Core" Version="1.0.0" />
<PackageReference Include="Microsoft.Azure.Devices.Edge.Hub.Service" Version="1.0.0" />
<PackageReference Include="RocksDbNative" Version="5.4.6.10" />
<PackageReference Include="Microsoft.Azure.Devices.Edge.Hub.Service" Version="1.0.0">
<ExcludeAssets>contentFiles</ExcludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Microsoft.Azure.IoT.TypeEdge\Microsoft.Azure.IoT.TypeEdge.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="Certificates\edge-agent-ca\cert\edge-agent-ca.cert.pem">
<Content Include="appsettings_hub.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Certificates\edge-agent-ca\private\edge-agent-ca.key.pem">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Certificates\edge-chain-ca\cert\edge-chain-ca.cert.pem">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Certificates\edge-device-ca\cert\edge-device-ca-root.cert.pem">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Certificates\edge-device-ca\cert\edge-device-ca.cert.pem">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Certificates\edge-device-ca\private\edge-device-ca.key.pem">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Certificates\edge-hub-server\cert\edge-hub-server.cert.pem">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Certificates\edge-hub-server\cert\edge-hub-server.cert.pfx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Certificates\edge-hub-server\private\edge-hub-server.key.pem">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Scripts\linux\generate-cert.sh">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Content Include="Dockerfile">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
</Target>
<ItemGroup>
<EmbeddedResource Include="deviceconfig.json" />
</ItemGroup>
</Project>

Просмотреть файл

@ -0,0 +1,23 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)Certificates\edge-chain-ca\cert\edge-chain-ca.cert.pem">
<Link>Certificates\edge-chain-ca\cert\edge-chain-ca.cert.pem</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="$(MSBuildThisFileDirectory)Certificates\edge-device-ca\cert\edge-device-ca-root.cert.pem">
<Link>Certificates\edge-device-ca\cert\edge-device-ca-root.cert.pem</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="$(MSBuildThisFileDirectory)Certificates\edge-hub-server\cert\edge-hub-server.cert.pfx">
<Link>Certificates\edge-hub-server\cert\edge-hub-server.cert.pfx</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="$(MSBuildThisFileDirectory)Docker\Dockerfile">
<Link>Dockerfile</Link>
</None>
<None Include="$(MSBuildThisFileDirectory)Config\appsettings_hub.json">
<Link>appsettings_hub.json</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

Просмотреть файл

@ -8,4 +8,4 @@
LocalDevice,
RemoteDevice
}
}
}

Просмотреть файл

@ -1,114 +0,0 @@
#!/bin/bash
###############################################################################
# This Script uses openssl to generate a self signed certificate
###############################################################################
###############################################################################
# Define Environment Variables
###############################################################################
SCRIPT_NAME=$(basename $0)
SSL_CERTIFICATE_COMMON_NAME=${SSL_CERTIFICATE_COMMON_NAME:="$HOSTNAME"}
###############################################################################
# Print usage information pertaining to this script and exit
###############################################################################
usage()
{
echo "$SCRIPT_NAME"
echo "Note: Depending on the options you might have to run this as root or sudo."
echo ""
echo "options"
echo " -p, --ssl_cert_path SSL Certificate Path"
echo " -f, --ssl_cert_file SSL Certificate File"
echo " -cn, --ssl_cert_cn SSL Certificate Common Name. Optional, if none provided, $HOSTNAME will be used"
exit 1;
}
print_help_and_exit()
{
echo "Run $SCRIPT_NAME --help for more information."
exit 1
}
###############################################################################
# Obtain and validate the options supported by this script
###############################################################################
process_args()
{
save_next_arg=0
for arg in $@
do
if [ $save_next_arg -eq 1 ]; then
SSL_CERTIFICATE_PATH="$arg"
save_next_arg=0
elif [ $save_next_arg -eq 2 ]; then
SSL_CERTIFICATE_NAME="$arg"
save_next_arg=0
elif [ $save_next_arg -eq 3 ]; then
SSL_CERTIFICATE_COMMON_NAME="$arg"
save_next_arg=0
else
case "$arg" in
"-h" | "--help" ) usage;;
"-p" | "--ssl_cert_path" ) save_next_arg=1;;
"-f" | "--ssl_cert_file" ) save_next_arg=2;;
"-cn" | "--ssl_cert_cn" ) save_next_arg=3;;
* ) usage;;
esac
fi
done
if [[ ! -d $SSL_CERTIFICATE_PATH ]]; then
echo "Invalid SSL Certificate Path Provided"
print_help_and_exit
fi
if [[ -z $SSL_CERTIFICATE_NAME ]]; then
echo "Invalid SSL Certificate Name Provided"
print_help_and_exit
fi
if [[ -z $SSL_CERTIFICATE_COMMON_NAME ]]; then
echo "Invalid SSL Certificate Path Provided"
print_help_and_exit
fi
}
###############################################################################
# Function to generate a cert
###############################################################################
generate_cert()
{
#command="openssl req -nodes -new -x509 -keyout /etc/ssl/private/mqtt-server.key -out $SSL_CERTIFICATE_PATH/mqtt-server.crt -subj /CN=$SSL_CERTIFICATE_COMMON_NAME"
mkdir -p $SSL_CERTIFICATE_PATH
mkdir -p $SSL_CERTIFICATE_PATH/private
command="openssl req -nodes -new -x509 -keyout $SSL_CERTIFICATE_PATH/private/mqtt-server.key -out $SSL_CERTIFICATE_PATH/mqtt-server.crt -subj /CN=$SSL_CERTIFICATE_COMMON_NAME"
$command
if [ $? -ne 0 ]; then
echo "Failed to generate certificate."
exit 1
fi
command="openssl pkcs12 -export -out $SSL_CERTIFICATE_PATH/$SSL_CERTIFICATE_NAME -inkey $SSL_CERTIFICATE_PATH/private/mqtt-server.key -in $SSL_CERTIFICATE_PATH/mqtt-server.crt -passout pass:"
$command
if [ $? -ne 0 ]; then
echo "Failed to generate certificate."
exit 1
fi
echo "Certificate generated successfully!"
}
###############################################################################
# Main Script Execution
###############################################################################
process_args $@
generate_cert
[ $? -eq 0 ] || exit $?

Просмотреть файл

@ -10,21 +10,21 @@ using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using ILogger = Microsoft.Extensions.Logging.ILogger;
using HubService = Microsoft.Azure.Devices.Edge.Hub.Service;
using HubService = Microsoft.Azure.Devices.Edge.Hub.Service;
using System.Reflection;
using Microsoft.Azure.Devices;
using Microsoft.Azure.Devices;
using Microsoft.Azure.Devices.Common.Exceptions;
using Newtonsoft.Json;
using Microsoft.Azure.Devices.Shared;
using Newtonsoft.Json.Linq;
using System.Linq;
using Microsoft.Azure.IoT.TypeEdge.Host.Hub;
using Microsoft.Azure.Devices.Edge.Agent.Core;
using Microsoft.Azure.Devices.Edge.Agent.Core;
using Core = Microsoft.Azure.Devices.Edge.Agent.Core;
using Castle.DynamicProxy;
namespace Microsoft.Azure.IoT.TypeEdge.Host
{
{
public class TypeEdgeHost
{
public Upstream<JsonMessage> Upstream { get; set; }
@ -85,7 +85,7 @@ namespace Microsoft.Azure.IoT.TypeEdge.Host
private void BuildHub(string deviceSasKey)
{
//Calculate the Hub Enviroment Varialbes
var currentLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
var currentLocation = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
Environment.SetEnvironmentVariable(HubService.Constants.SslCertEnvName,
"edge-hub-server.cert.pfx");
@ -122,7 +122,7 @@ namespace Microsoft.Azure.IoT.TypeEdge.Host
private void ConfigureModules()
{
var currentLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
var currentLocation = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
foreach (var module in this.modules)
{
var moduleConnectionString = GetModuleConnectionStringAsync(options.IotHubConnectionString, options.DeviceId, module.Name).Result;
@ -167,23 +167,23 @@ namespace Microsoft.Azure.IoT.TypeEdge.Host
sasKey = device.Authentication.SymmetricKey.PrimaryKey;
}
catch (DeviceAlreadyExistsException)
{
{
var device = await registryManager.GetDeviceAsync(options.DeviceId);
sasKey = device.Authentication.SymmetricKey.PrimaryKey;
}
try
}
try
{
ConfigurationContent configurationContent;
ConfigurationContent configurationContent;
using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Microsoft.Azure.IoT.TypeEdge.Host.deviceconfig.json"))
using (StreamReader reader = new StreamReader(stream))
using (StreamReader reader = new StreamReader(stream))
{
var deviceconfig = reader.ReadToEnd();
configurationContent = JsonConvert.DeserializeObject<ConfigurationContent>(deviceconfig);
}
var modulesConfig = configurationContent.ModuleContent["$edgeAgent"].TargetContent["modules"] as JObject;
foreach (var module in modules)
{
{
modulesConfig.Add(module.Name, JObject.FromObject(new
{
version = "1.0",
@ -192,8 +192,8 @@ namespace Microsoft.Azure.IoT.TypeEdge.Host
restartPolicy = "on-failure",
settings = new
{
image = "devimage",
createOptions = $" -e {Microsoft.Azure.IoT.TypeEdge.Constants.ModuleNameConfigName}='{module.Name}' "
image = module.Name.ToLower(),
createOptions = "{\"Env\":[\"" + Microsoft.Azure.IoT.TypeEdge.Constants.ModuleNameConfigName + "=" + module.Name + "\"]}"
}
}));

Просмотреть файл

@ -9,8 +9,7 @@ namespace Microsoft.Azure.IoT.TypeEdge.Host
{
public string IotHubConnectionString { get; set; }
public string DeviceId { get; set; }
public RunningEnvironment Environment { get; set; }
public LogEventLevel RuntimeLogLevel { get; set; }
public string DockerFileTemplate { get; set; }
}
}

Просмотреть файл

@ -0,0 +1,57 @@
{
"appSettings": {
"MaxPendingInboundAcknowledgements": 16,
"DeviceReceiveAckTimeout": "00:00:00",
"MaxInboundMessageSize": "262144",
"ConnectArrivalTimeout": "00:01:00",
"MaxKeepAliveTimeout": "00:10:00",
"RetainPropertyName": "mqtt-retain",
"DupPropertyName": "mqtt-dup",
"QoSPropertyName": "mqtt-qos",
"IotHubClient.MaxPendingInboundMessages": 10,
"IotHubClient.MaxPendingOutboundMessages": 10,
"IotHubClient.DefaultPublishToClientQoS": 1,
"IotHubClient.MaxOutboundRetransmissionCount": 2,
"IotHubClient.ConnectionPoolSize": 400,
"IotHubClient.ConnectionIdleTimeout": "00:03:30",
"BlobSessionStatePersistenceProvider.StorageConnectionString": "UseDevelopmentStorage=true",
"BlobSessionStatePersistenceProvider.StorageContainerName": "mqtt-sessions",
"TableQos2StatePersistenceProvider.StorageConnectionString": "UseDevelopmentStorage=true",
"TableQos2StatePersistenceProvider.StorageTableName": "mqttqos2"
},
"amqp": {
"scheme": "amqps",
"port": 5671
},
"IotHubConnectionPoolSize": 1,
"IotHubConnectionString": "",
"mqttTopicNameConversion": {
"InboundTemplates": [
"devices/{deviceId}/messages/events/{params}/",
"devices/{deviceId}/messages/events/",
"devices/{deviceId}/modules/{moduleId}/messages/events/{params}/",
"devices/{deviceId}/modules/{moduleId}/messages/events/",
"$iothub/methods/res/{statusCode}/?$rid={correlationId}",
"$iothub/methods/res/{statusCode}/?$rid={correlationId}&foo={bar}"
],
"OutboundTemplates": {
"C2D": "devices/{deviceId}/messages/devicebound",
"TwinEndpoint": "$iothub/twin/res/{statusCode}/?$rid={correlationId}",
"TwinDesiredPropertyUpdate": "$iothub/twin/PATCH/properties/desired/?$version={version}",
"ModuleEndpoint": "devices/{deviceId}/modules/{moduleId}/inputs/{inputName}"
}
},
"routes": {
"r1": "FROM /* INTO $upstream"
},
"storageFolder": "",
"storeAndForwardEnabled": true,
"usePersistentStorage": true,
"configSource": "twin",
"storeAndForward": {
"timeToLiveSecs": "-1"
},
"RuntimeLogLevel": "info",
"ClientCertAuthEnabled": false,
"OptimizeForPerformance": true
}

Просмотреть файл

@ -1,15 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<PackageId>Microsoft.Azure.IoT.TypeEdge.Proxy</PackageId>
<Version>0.0.1</Version>
<Version>0.0.2</Version>
<Authors>paloukari</Authors>
<Company>Microsoft</Company>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageOutputPath>../build</PackageOutputPath>
<PackageOutputPath>../Example/build</PackageOutputPath>
<TargetFramework>netcoreapp2.1</TargetFramework>
<Configurations>Debug;Release;TemplateDevelopment</Configurations>
</PropertyGroup>
<ItemGroup>

Просмотреть файл

@ -7,11 +7,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.IoT.TypeEdg
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.IoT.TypeEdge.Host", "Microsoft.Azure.IoT.TypeEdge.Host\Microsoft.Azure.IoT.TypeEdge.Host.csproj", "{6F13F88C-B271-4DA6-9A35-5FD7FEADD3A3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.IoT.TypeEdge.Proxy", "Microsoft.Azure.IoT.TypeEdge.Proxy\Microsoft.Azure.IoT.TypeEdge.Proxy.csproj", "{5FC1E03A-7CD6-40AC-A893-2691DA8C9B5C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
CodeCoverage|Any CPU = CodeCoverage|Any CPU
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
TemplateDevelopment|Any CPU = TemplateDevelopment|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{54587D56-7C22-4084-9321-84D57C2F6ECB}.CodeCoverage|Any CPU.ActiveCfg = Debug|Any CPU
@ -20,12 +23,24 @@ Global
{54587D56-7C22-4084-9321-84D57C2F6ECB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{54587D56-7C22-4084-9321-84D57C2F6ECB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{54587D56-7C22-4084-9321-84D57C2F6ECB}.Release|Any CPU.Build.0 = Release|Any CPU
{54587D56-7C22-4084-9321-84D57C2F6ECB}.TemplateDevelopment|Any CPU.ActiveCfg = TemplateDevelopment|Any CPU
{54587D56-7C22-4084-9321-84D57C2F6ECB}.TemplateDevelopment|Any CPU.Build.0 = TemplateDevelopment|Any CPU
{6F13F88C-B271-4DA6-9A35-5FD7FEADD3A3}.CodeCoverage|Any CPU.ActiveCfg = Debug|Any CPU
{6F13F88C-B271-4DA6-9A35-5FD7FEADD3A3}.CodeCoverage|Any CPU.Build.0 = Debug|Any CPU
{6F13F88C-B271-4DA6-9A35-5FD7FEADD3A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6F13F88C-B271-4DA6-9A35-5FD7FEADD3A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6F13F88C-B271-4DA6-9A35-5FD7FEADD3A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6F13F88C-B271-4DA6-9A35-5FD7FEADD3A3}.Release|Any CPU.Build.0 = Release|Any CPU
{6F13F88C-B271-4DA6-9A35-5FD7FEADD3A3}.TemplateDevelopment|Any CPU.ActiveCfg = TemplateDevelopment|Any CPU
{6F13F88C-B271-4DA6-9A35-5FD7FEADD3A3}.TemplateDevelopment|Any CPU.Build.0 = TemplateDevelopment|Any CPU
{5FC1E03A-7CD6-40AC-A893-2691DA8C9B5C}.CodeCoverage|Any CPU.ActiveCfg = TemplateDevelopment|Any CPU
{5FC1E03A-7CD6-40AC-A893-2691DA8C9B5C}.CodeCoverage|Any CPU.Build.0 = TemplateDevelopment|Any CPU
{5FC1E03A-7CD6-40AC-A893-2691DA8C9B5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5FC1E03A-7CD6-40AC-A893-2691DA8C9B5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5FC1E03A-7CD6-40AC-A893-2691DA8C9B5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5FC1E03A-7CD6-40AC-A893-2691DA8C9B5C}.Release|Any CPU.Build.0 = Release|Any CPU
{5FC1E03A-7CD6-40AC-A893-2691DA8C9B5C}.TemplateDevelopment|Any CPU.ActiveCfg = TemplateDevelopment|Any CPU
{5FC1E03A-7CD6-40AC-A893-2691DA8C9B5C}.TemplateDevelopment|Any CPU.Build.0 = TemplateDevelopment|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Просмотреть файл

@ -1,16 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<PackageId>Microsoft.Azure.IoT.TypeEdge</PackageId>
<Version>0.0.1</Version>
<Version>0.0.2</Version>
<Authors>paloukari</Authors>
<Company>Microsoft</Company>
<PackageOutputPath>../build</PackageOutputPath>
<PackageOutputPath>../Example/build</PackageOutputPath>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<TargetFramework>netcoreapp2.1</TargetFramework>
<AssemblyName>Microsoft.Azure.IoT.TypeEdge</AssemblyName>
<RootNamespace>Microsoft.Azure.IoT.TypeEdge</RootNamespace>
<Configurations>Debug;Release;TemplateDevelopment</Configurations>
</PropertyGroup>
<ItemGroup>
@ -29,10 +30,4 @@
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.0.1" />
</ItemGroup>
<ItemGroup>
<None Update="appsettings_compose.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

Просмотреть файл

@ -169,7 +169,7 @@ namespace Microsoft.Azure.IoT.TypeEdge.Modules
{
edgeMessage.Properties.Add(prop.Key, prop.Value);
}
await ioTHubModuleClient.SendEventAsync(outputName, edgeMessage);
string messageString = Encoding.UTF8.GetString(message.GetBytes());

Просмотреть файл

@ -35,7 +35,9 @@ namespace Microsoft.Azure.IoT.TypeEdge.Host
|| genericDef.IsAssignableFrom(typeof(Output<>))
|| genericDef.IsAssignableFrom(typeof(ModuleTwin<>)))
{
var value = Activator.CreateInstance(genericDef.MakeGenericType(invocation.Method.ReturnType.GenericTypeArguments), invocation.Method.Name.Replace("get_", ""), this);
var value = Activator.CreateInstance(
genericDef.MakeGenericType(invocation.Method.ReturnType.GenericTypeArguments),
invocation.Method.Name.Replace("get_", ""), this);
invocation.ReturnValue = value;
}
}

Просмотреть файл

@ -16,7 +16,7 @@ using System.Threading.Tasks;
namespace Microsoft.Azure.IoT.TypeEdge
{
public static class Startup
{
{
public static async Task DockerEntryPoint(string[] args)
{
var services = new ServiceCollection().AddLogging();

Просмотреть файл

@ -1,6 +0,0 @@
{
"appSettings": {
},
"RuntimeLogLevel": "info"
}

3
NuGet.Config Normal file
Просмотреть файл

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
</configuration>

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичные данные
build/Microsoft.Azure.IoT.TypeEdge.0.0.1.nupkg

Двоичный файл не отображается.

Двоичный файл не отображается.

Просмотреть файл

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" Sdk="Microsoft.Docker.Sdk">
<PropertyGroup Label="Globals">
<ProjectVersion>2.1</ProjectVersion>
<DockerTargetOS>Linux</DockerTargetOS>
<ProjectGuid>8275d850-82cd-4204-a4be-c8ec3095e703</ProjectGuid>
</PropertyGroup>
<ItemGroup>
<None Include=".env" />
<None Include="docker-compose.override.yml">
<DependentUpon>docker-compose.yml</DependentUpon>
</None>
<None Include="docker-compose.yml" />
<None Include=".dockerignore" />
</ItemGroup>
</Project>

Просмотреть файл

@ -1 +0,0 @@
version: '3.4'

Просмотреть файл

@ -1,24 +0,0 @@
version: '3.4'
services:
normalizetemperaturemodule:
image: ${DOCKER_REGISTRY}normalizetemperaturemodule
build:
context: .
dockerfile: Example/Modules/NormalizeTemperatureModule/Dockerfile
temperaturemodule:
image: ${DOCKER_REGISTRY}temperaturemodule
build:
context: .
dockerfile: Example/Modules/TemperatureModule/Dockerfile
thermostat.emulator:
image: ${DOCKER_REGISTRY}thermostatemulator
build:
context: .
dockerfile: Example/Thermostat.Emulator/Dockerfile