From 8e55310aef152d92842567a7f39610849cf3eab5 Mon Sep 17 00:00:00 2001 From: yusuf karatoprak Date: Sat, 24 Apr 2021 11:19:17 +0300 Subject: [PATCH 1/8] added dockerfiles --- .vscode/launch.json | 40 ++++++++++++++ .vscode/tasks.json | 99 +++++++++++++++++++++++++++++++++++ src/.dockerignore | 25 +++++++++ src/Dockerfile.HttpApi.Host | 16 ++++++ src/Dockerfile.IdentityServer | 16 ++++++ src/Dockerfile.Web | 16 ++++++ src/common.props | 8 +++ 7 files changed, 220 insertions(+) create mode 100644 .vscode/launch.json create mode 100644 .vscode/tasks.json create mode 100644 src/.dockerignore create mode 100644 src/Dockerfile.HttpApi.Host create mode 100644 src/Dockerfile.IdentityServer create mode 100644 src/Dockerfile.Web create mode 100644 src/common.props diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..0cad4fb --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,40 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": ".NET Core Launch (web)", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + "program": "${workspaceFolder}/src/EventHub.Web/bin/Debug/net5.0/EventHub.Web.dll", + "args": [], + "cwd": "${workspaceFolder}/src/EventHub.Web", + "stopAtEntry": false, + "serverReadyAction": { + "action": "openExternally", + "pattern": "\\bNow listening on:\\s+(https?://\\S+)" + }, + "env": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "sourceFileMap": { + "/Views": "${workspaceFolder}/Views" + } + }, + { + "name": ".NET Core Attach", + "type": "coreclr", + "request": "attach", + "processId": "${command:pickProcess}" + }, + { + "name": "Docker .NET Core Launch", + "type": "docker", + "request": "launch", + "preLaunchTask": "docker-run: debug", + "netCore": { + "appProject": "${workspaceFolder}/src/EventHub.Web/EventHub.Web.csproj" + } + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..7f054e8 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,99 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/src/EventHub.Web/EventHub.Web.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "publish", + "command": "dotnet", + "type": "process", + "args": [ + "publish", + "${workspaceFolder}/src/EventHub.Web/EventHub.Web.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "watch", + "command": "dotnet", + "type": "process", + "args": [ + "watch", + "run", + "${workspaceFolder}/src/EventHub.Web/EventHub.Web.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "type": "docker-build", + "label": "docker-build: debug", + "dependsOn": [ + "build" + ], + "dockerBuild": { + "tag": "eventhub:dev", + "target": "base", + "dockerfile": "${workspaceFolder}/src/EventHub.Web/Dockerfile", + "context": "${workspaceFolder}", + "pull": true + }, + "netCore": { + "appProject": "${workspaceFolder}/src/EventHub.Web/EventHub.Web.csproj" + } + }, + { + "type": "docker-build", + "label": "docker-build: release", + "dependsOn": [ + "build" + ], + "dockerBuild": { + "tag": "eventhub:latest", + "dockerfile": "${workspaceFolder}/src/EventHub.Web/Dockerfile", + "context": "${workspaceFolder}", + "pull": true + }, + "netCore": { + "appProject": "${workspaceFolder}/src/EventHub.Web/EventHub.Web.csproj" + } + }, + { + "type": "docker-run", + "label": "docker-run: debug", + "dependsOn": [ + "docker-build: debug" + ], + "dockerRun": {}, + "netCore": { + "appProject": "${workspaceFolder}/src/EventHub.Web/EventHub.Web.csproj", + "enableDebugging": true, + "configureSsl": false + } + }, + { + "type": "docker-run", + "label": "docker-run: release", + "dependsOn": [ + "docker-build: release" + ], + "dockerRun": {}, + "netCore": { + "appProject": "${workspaceFolder}/src/EventHub.Web/EventHub.Web.csproj" + } + } + ] +} \ No newline at end of file diff --git a/src/.dockerignore b/src/.dockerignore new file mode 100644 index 0000000..0426a8a --- /dev/null +++ b/src/.dockerignore @@ -0,0 +1,25 @@ +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +README.md diff --git a/src/Dockerfile.HttpApi.Host b/src/Dockerfile.HttpApi.Host new file mode 100644 index 0000000..03a1edb --- /dev/null +++ b/src/Dockerfile.HttpApi.Host @@ -0,0 +1,16 @@ +FROM mcr.microsoft.com/dotnet/sdk:5.0 as build-image + +WORKDIR /. +COPY ./*/*.csproj ./ +RUN for file in $(ls *.csproj); do mkdir -p ./${file%.*}/ && mv $file ./${file%.*}/; done +RUN dotnet restore "EventHub.HttpApi.Host/EventHub.HttpApi.Host.csproj" --verbosity detailed +COPY . . +RUN dotnet publish ./EventHub.HttpApi.Host/EventHub.HttpApi.Host.csproj -o /publish/ +FROM mcr.microsoft.com/dotnet/aspnet:5.0 +WORKDIR /publish +COPY --from=build-image /publish . +ENV ASPNETCORE_URLS="http://0.0.0.0:5002" +ENTRYPOINT ["dotnet", "EventHub.HttpApi.Host.dll"] + + + diff --git a/src/Dockerfile.IdentityServer b/src/Dockerfile.IdentityServer new file mode 100644 index 0000000..b1498c5 --- /dev/null +++ b/src/Dockerfile.IdentityServer @@ -0,0 +1,16 @@ +FROM mcr.microsoft.com/dotnet/sdk:5.0 as build-image + +WORKDIR /. +COPY ./*/*.csproj ./ +RUN for file in $(ls *.csproj); do mkdir -p ./${file%.*}/ && mv $file ./${file%.*}/; done +RUN dotnet restore "EventHub.IdentityServer/EventHub.IdentityServer.csproj" --verbosity detailed +COPY . . +RUN dotnet publish ./EventHub.IdentityServer/EventHub.IdentityServer.csproj -o /publish/ +FROM mcr.microsoft.com/dotnet/aspnet:5.0 +WORKDIR /publish +COPY --from=build-image /publish . +ENV ASPNETCORE_URLS="http://0.0.0.0:5001" +ENTRYPOINT ["dotnet", "EventHub.IdentityServer.dll"] + + + diff --git a/src/Dockerfile.Web b/src/Dockerfile.Web new file mode 100644 index 0000000..87f88e5 --- /dev/null +++ b/src/Dockerfile.Web @@ -0,0 +1,16 @@ +FROM mcr.microsoft.com/dotnet/sdk:5.0 as build-image + +WORKDIR /. +COPY ./*/*.csproj ./ +RUN for file in $(ls *.csproj); do mkdir -p ./${file%.*}/ && mv $file ./${file%.*}/; done +RUN dotnet restore "EventHub.Web/EventHub.Web.csproj" --verbosity detailed +COPY . . +RUN dotnet publish ./EventHub.Web/EventHub.Web.csproj -o /publish/ +FROM mcr.microsoft.com/dotnet/aspnet:5.0 +WORKDIR /publish +COPY --from=build-image /publish . +ENV ASPNETCORE_URLS="http://0.0.0.0:80" +ENTRYPOINT ["dotnet", "EventHub.Web.dll"] + + + diff --git a/src/common.props b/src/common.props new file mode 100644 index 0000000..fbef883 --- /dev/null +++ b/src/common.props @@ -0,0 +1,8 @@ + + + latest + 1.0.0 + $(NoWarn);CS1591;CS0436 + app + + \ No newline at end of file From 770bbdad73903b4c852feb8cb5f1788bb5823310 Mon Sep 17 00:00:00 2001 From: yusuf karatoprak Date: Sat, 24 Apr 2021 14:56:35 +0300 Subject: [PATCH 2/8] update for docker file httpapi.host,identity server and Web --- .dockerignore | 25 +++++++++++++++++++++++ src/Dockerfile.HttpApi.Host | 16 --------------- src/Dockerfile.IdentityServer | 16 --------------- src/Dockerfile.Web | 16 --------------- src/EventHub.HttpApi.Host/.dockerignore | 15 ++++++++++++++ src/EventHub.HttpApi.Host/Dockerfile | 19 +++++++++++++++++ src/EventHub.IdentityServer/.dockerignore | 15 ++++++++++++++ src/EventHub.IdentityServer/Dockerfile | 19 +++++++++++++++++ src/EventHub.Web/.dockerignore | 15 ++++++++++++++ src/EventHub.Web/Dockerfile | 19 +++++++++++++++++ 10 files changed, 127 insertions(+), 48 deletions(-) create mode 100644 .dockerignore delete mode 100644 src/Dockerfile.HttpApi.Host delete mode 100644 src/Dockerfile.IdentityServer delete mode 100644 src/Dockerfile.Web create mode 100644 src/EventHub.HttpApi.Host/.dockerignore create mode 100644 src/EventHub.HttpApi.Host/Dockerfile create mode 100644 src/EventHub.IdentityServer/.dockerignore create mode 100644 src/EventHub.IdentityServer/Dockerfile create mode 100644 src/EventHub.Web/.dockerignore create mode 100644 src/EventHub.Web/Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..0426a8a --- /dev/null +++ b/.dockerignore @@ -0,0 +1,25 @@ +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +README.md diff --git a/src/Dockerfile.HttpApi.Host b/src/Dockerfile.HttpApi.Host deleted file mode 100644 index 03a1edb..0000000 --- a/src/Dockerfile.HttpApi.Host +++ /dev/null @@ -1,16 +0,0 @@ -FROM mcr.microsoft.com/dotnet/sdk:5.0 as build-image - -WORKDIR /. -COPY ./*/*.csproj ./ -RUN for file in $(ls *.csproj); do mkdir -p ./${file%.*}/ && mv $file ./${file%.*}/; done -RUN dotnet restore "EventHub.HttpApi.Host/EventHub.HttpApi.Host.csproj" --verbosity detailed -COPY . . -RUN dotnet publish ./EventHub.HttpApi.Host/EventHub.HttpApi.Host.csproj -o /publish/ -FROM mcr.microsoft.com/dotnet/aspnet:5.0 -WORKDIR /publish -COPY --from=build-image /publish . -ENV ASPNETCORE_URLS="http://0.0.0.0:5002" -ENTRYPOINT ["dotnet", "EventHub.HttpApi.Host.dll"] - - - diff --git a/src/Dockerfile.IdentityServer b/src/Dockerfile.IdentityServer deleted file mode 100644 index b1498c5..0000000 --- a/src/Dockerfile.IdentityServer +++ /dev/null @@ -1,16 +0,0 @@ -FROM mcr.microsoft.com/dotnet/sdk:5.0 as build-image - -WORKDIR /. -COPY ./*/*.csproj ./ -RUN for file in $(ls *.csproj); do mkdir -p ./${file%.*}/ && mv $file ./${file%.*}/; done -RUN dotnet restore "EventHub.IdentityServer/EventHub.IdentityServer.csproj" --verbosity detailed -COPY . . -RUN dotnet publish ./EventHub.IdentityServer/EventHub.IdentityServer.csproj -o /publish/ -FROM mcr.microsoft.com/dotnet/aspnet:5.0 -WORKDIR /publish -COPY --from=build-image /publish . -ENV ASPNETCORE_URLS="http://0.0.0.0:5001" -ENTRYPOINT ["dotnet", "EventHub.IdentityServer.dll"] - - - diff --git a/src/Dockerfile.Web b/src/Dockerfile.Web deleted file mode 100644 index 87f88e5..0000000 --- a/src/Dockerfile.Web +++ /dev/null @@ -1,16 +0,0 @@ -FROM mcr.microsoft.com/dotnet/sdk:5.0 as build-image - -WORKDIR /. -COPY ./*/*.csproj ./ -RUN for file in $(ls *.csproj); do mkdir -p ./${file%.*}/ && mv $file ./${file%.*}/; done -RUN dotnet restore "EventHub.Web/EventHub.Web.csproj" --verbosity detailed -COPY . . -RUN dotnet publish ./EventHub.Web/EventHub.Web.csproj -o /publish/ -FROM mcr.microsoft.com/dotnet/aspnet:5.0 -WORKDIR /publish -COPY --from=build-image /publish . -ENV ASPNETCORE_URLS="http://0.0.0.0:80" -ENTRYPOINT ["dotnet", "EventHub.Web.dll"] - - - diff --git a/src/EventHub.HttpApi.Host/.dockerignore b/src/EventHub.HttpApi.Host/.dockerignore new file mode 100644 index 0000000..dbb5e63 --- /dev/null +++ b/src/EventHub.HttpApi.Host/.dockerignore @@ -0,0 +1,15 @@ +node_modules +npm-debug.log +Dockerfile* +docker-compose* +.dockerignore +.git +.gitignore +.env +*/bin +*/obj +bin +obj +README.md +LICENSE +.vscode \ No newline at end of file diff --git a/src/EventHub.HttpApi.Host/Dockerfile b/src/EventHub.HttpApi.Host/Dockerfile new file mode 100644 index 0000000..c0e1620 --- /dev/null +++ b/src/EventHub.HttpApi.Host/Dockerfile @@ -0,0 +1,19 @@ +FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base +WORKDIR /app +EXPOSE 5002 + +FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build +WORKDIR /src +COPY ["src/EventHub.HttpApi.Host/EventHub.HttpApi.Host.csproj", "src/EventHub.HttpApi.Host/"] +RUN dotnet restore "src/EventHub.HttpApi.Host/EventHub.HttpApi.Host.csproj" +COPY . . +WORKDIR "/src/src/EventHub.HttpApi.Host" +RUN dotnet build "EventHub.HttpApi.Host.csproj" -c Release -o /app + +FROM build AS publish +RUN dotnet publish "EventHub.HttpApi.Host.csproj" -c Release -o /app + +FROM base AS final +WORKDIR /app +COPY --from=publish /app . +ENTRYPOINT ["dotnet", "EventHub.HttpApi.Host.dll"] \ No newline at end of file diff --git a/src/EventHub.IdentityServer/.dockerignore b/src/EventHub.IdentityServer/.dockerignore new file mode 100644 index 0000000..dbb5e63 --- /dev/null +++ b/src/EventHub.IdentityServer/.dockerignore @@ -0,0 +1,15 @@ +node_modules +npm-debug.log +Dockerfile* +docker-compose* +.dockerignore +.git +.gitignore +.env +*/bin +*/obj +bin +obj +README.md +LICENSE +.vscode \ No newline at end of file diff --git a/src/EventHub.IdentityServer/Dockerfile b/src/EventHub.IdentityServer/Dockerfile new file mode 100644 index 0000000..d9f8fd5 --- /dev/null +++ b/src/EventHub.IdentityServer/Dockerfile @@ -0,0 +1,19 @@ +FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base +WORKDIR /app +EXPOSE 5001 + +FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build +WORKDIR /src +COPY ["src/EventHub.IdentityServer/EventHub.IdentityServer.csproj", "src/EventHub.IdentityServer/"] +RUN dotnet restore "src/EventHub.IdentityServer/EventHub.IdentityServer.csproj" +COPY . . +WORKDIR "/src/src/EventHub.IdentityServer" +RUN dotnet build "EventHub.IdentityServer.csproj" -c Release -o /app + +FROM build AS publish +RUN dotnet publish "EventHub.IdentityServer.csproj" -c Release -o /app + +FROM base AS final +WORKDIR /app +COPY --from=publish /app . +ENTRYPOINT ["dotnet", "EventHub.IdentityServer.dll"] \ No newline at end of file diff --git a/src/EventHub.Web/.dockerignore b/src/EventHub.Web/.dockerignore new file mode 100644 index 0000000..dbb5e63 --- /dev/null +++ b/src/EventHub.Web/.dockerignore @@ -0,0 +1,15 @@ +node_modules +npm-debug.log +Dockerfile* +docker-compose* +.dockerignore +.git +.gitignore +.env +*/bin +*/obj +bin +obj +README.md +LICENSE +.vscode \ No newline at end of file diff --git a/src/EventHub.Web/Dockerfile b/src/EventHub.Web/Dockerfile new file mode 100644 index 0000000..8a0a056 --- /dev/null +++ b/src/EventHub.Web/Dockerfile @@ -0,0 +1,19 @@ +FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base +WORKDIR /app +EXPOSE 80 + +FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build +WORKDIR /src +COPY ["src/EventHub.Web/EventHub.Web.csproj", "src/EventHub.Web/"] +RUN dotnet restore "src/EventHub.Web/EventHub.Web.csproj" +COPY . . +WORKDIR "/src/src/EventHub.Web" +RUN dotnet build "EventHub.Web.csproj" -c Release -o /app + +FROM build AS publish +RUN dotnet publish "EventHub.Web.csproj" -c Release -o /app + +FROM base AS final +WORKDIR /app +COPY --from=publish /app . +ENTRYPOINT ["dotnet", "EventHub.Web.dll"] \ No newline at end of file From a7d5705f0d63845de85750bafb93f2d2306d9488 Mon Sep 17 00:00:00 2001 From: yusuf karatoprak Date: Sat, 24 Apr 2021 21:13:36 +0300 Subject: [PATCH 3/8] redis connection string added --- src/EventHub.BackgroundServices/appsettings.json | 2 +- src/EventHub.HttpApi.Host/appsettings.json | 2 +- src/EventHub.IdentityServer/appsettings.json | 2 +- src/EventHub.Web/appsettings.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/EventHub.BackgroundServices/appsettings.json b/src/EventHub.BackgroundServices/appsettings.json index cebcafb..12b01cf 100644 --- a/src/EventHub.BackgroundServices/appsettings.json +++ b/src/EventHub.BackgroundServices/appsettings.json @@ -3,7 +3,7 @@ "Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=EventHub;Trusted_Connection=True" }, "Redis": { - "Configuration": "127.0.0.1" + "Configuration": "volosofteventhub.redis.cache.windows.net:6380,password=9Kc6E1lbwy5c+RHR1KZS26JPydYR5SeR8UixdECQWv4=,ssl=True,abortConnect=False" }, "StringEncryption": { "DefaultPassPhrase": "TxVIZFPxK33czbbv" diff --git a/src/EventHub.HttpApi.Host/appsettings.json b/src/EventHub.HttpApi.Host/appsettings.json index 0317bb3..1e46248 100644 --- a/src/EventHub.HttpApi.Host/appsettings.json +++ b/src/EventHub.HttpApi.Host/appsettings.json @@ -6,7 +6,7 @@ "Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=EventHub;Trusted_Connection=True" }, "Redis": { - "Configuration": "127.0.0.1" + "Configuration": "volosofteventhub.redis.cache.windows.net:6380,password=9Kc6E1lbwy5c+RHR1KZS26JPydYR5SeR8UixdECQWv4=,ssl=True,abortConnect=False" }, "AuthServer": { "Authority": "https://localhost:44313", diff --git a/src/EventHub.IdentityServer/appsettings.json b/src/EventHub.IdentityServer/appsettings.json index 76a5bfe..44c3245 100644 --- a/src/EventHub.IdentityServer/appsettings.json +++ b/src/EventHub.IdentityServer/appsettings.json @@ -8,7 +8,7 @@ "Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=EventHub;Trusted_Connection=True" }, "Redis": { - "Configuration": "127.0.0.1" + "Configuration": "volosofteventhub.redis.cache.windows.net:6380,password=9Kc6E1lbwy5c+RHR1KZS26JPydYR5SeR8UixdECQWv4=,ssl=True,abortConnect=False" }, "StringEncryption": { "DefaultPassPhrase": "TxVIZFPxK33czbbv" diff --git a/src/EventHub.Web/appsettings.json b/src/EventHub.Web/appsettings.json index 2d20ae9..870d464 100644 --- a/src/EventHub.Web/appsettings.json +++ b/src/EventHub.Web/appsettings.json @@ -8,7 +8,7 @@ } }, "Redis": { - "Configuration": "127.0.0.1" + "Configuration": "volosofteventhub.redis.cache.windows.net:6380,password=9Kc6E1lbwy5c+RHR1KZS26JPydYR5SeR8UixdECQWv4=,ssl=True,abortConnect=False" }, "AuthServer": { "Authority": "https://localhost:44313", From 5b682b8c155facba8408ceec73a458bf924818cf Mon Sep 17 00:00:00 2001 From: yusuf karatoprak Date: Sat, 24 Apr 2021 22:16:23 +0300 Subject: [PATCH 4/8] sql connection string added --- src/EventHub.BackgroundServices/appsettings.json | 2 +- src/EventHub.HttpApi.Host/appsettings.json | 2 +- src/EventHub.IdentityServer/appsettings.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/EventHub.BackgroundServices/appsettings.json b/src/EventHub.BackgroundServices/appsettings.json index 12b01cf..422f048 100644 --- a/src/EventHub.BackgroundServices/appsettings.json +++ b/src/EventHub.BackgroundServices/appsettings.json @@ -3,7 +3,7 @@ "Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=EventHub;Trusted_Connection=True" }, "Redis": { - "Configuration": "volosofteventhub.redis.cache.windows.net:6380,password=9Kc6E1lbwy5c+RHR1KZS26JPydYR5SeR8UixdECQWv4=,ssl=True,abortConnect=False" + "Configuration": "Server=tcp:volosofteventhub.database.windows.net,1433;Initial Catalog=volosofteventhub;Persist Security Info=False;User ID=volosoft;Password={your_password};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" }, "StringEncryption": { "DefaultPassPhrase": "TxVIZFPxK33czbbv" diff --git a/src/EventHub.HttpApi.Host/appsettings.json b/src/EventHub.HttpApi.Host/appsettings.json index 1e46248..46c028c 100644 --- a/src/EventHub.HttpApi.Host/appsettings.json +++ b/src/EventHub.HttpApi.Host/appsettings.json @@ -3,7 +3,7 @@ "CorsOrigins": "https://*.EventHub.com,https://localhost:44307,https://localhost:44308" }, "ConnectionStrings": { - "Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=EventHub;Trusted_Connection=True" + "Default": "Server=tcp:volosofteventhub.database.windows.net,1433;Initial Catalog=volosofteventhub;Persist Security Info=False;User ID=volosoft;Password={your_password};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" }, "Redis": { "Configuration": "volosofteventhub.redis.cache.windows.net:6380,password=9Kc6E1lbwy5c+RHR1KZS26JPydYR5SeR8UixdECQWv4=,ssl=True,abortConnect=False" diff --git a/src/EventHub.IdentityServer/appsettings.json b/src/EventHub.IdentityServer/appsettings.json index 44c3245..7ce49b3 100644 --- a/src/EventHub.IdentityServer/appsettings.json +++ b/src/EventHub.IdentityServer/appsettings.json @@ -5,7 +5,7 @@ "RedirectAllowedUrls": "http://localhost:4200,https://localhost:44307" }, "ConnectionStrings": { - "Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=EventHub;Trusted_Connection=True" + "Default": "Server=tcp:volosofteventhub.database.windows.net,1433;Initial Catalog=volosofteventhub;Persist Security Info=False;User ID=volosoft;Password={your_password};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" }, "Redis": { "Configuration": "volosofteventhub.redis.cache.windows.net:6380,password=9Kc6E1lbwy5c+RHR1KZS26JPydYR5SeR8UixdECQWv4=,ssl=True,abortConnect=False" From b2e1df8046d6470670d1643aadbb93e1f480afc9 Mon Sep 17 00:00:00 2001 From: yusuf karatoprak Date: Sat, 24 Apr 2021 22:18:39 +0300 Subject: [PATCH 5/8] sql connection string added --- src/EventHub.BackgroundServices/appsettings.json | 2 +- src/EventHub.HttpApi.Host/appsettings.json | 2 +- src/EventHub.IdentityServer/appsettings.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/EventHub.BackgroundServices/appsettings.json b/src/EventHub.BackgroundServices/appsettings.json index 422f048..c8e17e6 100644 --- a/src/EventHub.BackgroundServices/appsettings.json +++ b/src/EventHub.BackgroundServices/appsettings.json @@ -3,7 +3,7 @@ "Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=EventHub;Trusted_Connection=True" }, "Redis": { - "Configuration": "Server=tcp:volosofteventhub.database.windows.net,1433;Initial Catalog=volosofteventhub;Persist Security Info=False;User ID=volosoft;Password={your_password};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" + "Configuration": "Server=tcp:volosofteventhub.database.windows.net,1433;Initial Catalog=volosofteventhub;Persist Security Info=False;User ID=volosoft;Password=@Palandoken2021;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" }, "StringEncryption": { "DefaultPassPhrase": "TxVIZFPxK33czbbv" diff --git a/src/EventHub.HttpApi.Host/appsettings.json b/src/EventHub.HttpApi.Host/appsettings.json index 46c028c..91cd66b 100644 --- a/src/EventHub.HttpApi.Host/appsettings.json +++ b/src/EventHub.HttpApi.Host/appsettings.json @@ -3,7 +3,7 @@ "CorsOrigins": "https://*.EventHub.com,https://localhost:44307,https://localhost:44308" }, "ConnectionStrings": { - "Default": "Server=tcp:volosofteventhub.database.windows.net,1433;Initial Catalog=volosofteventhub;Persist Security Info=False;User ID=volosoft;Password={your_password};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" + "Default": "Server=tcp:volosofteventhub.database.windows.net,1433;Initial Catalog=volosofteventhub;Persist Security Info=False;User ID=volosoft;Password=@Palandoken2021;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" }, "Redis": { "Configuration": "volosofteventhub.redis.cache.windows.net:6380,password=9Kc6E1lbwy5c+RHR1KZS26JPydYR5SeR8UixdECQWv4=,ssl=True,abortConnect=False" diff --git a/src/EventHub.IdentityServer/appsettings.json b/src/EventHub.IdentityServer/appsettings.json index 7ce49b3..870fad6 100644 --- a/src/EventHub.IdentityServer/appsettings.json +++ b/src/EventHub.IdentityServer/appsettings.json @@ -5,7 +5,7 @@ "RedirectAllowedUrls": "http://localhost:4200,https://localhost:44307" }, "ConnectionStrings": { - "Default": "Server=tcp:volosofteventhub.database.windows.net,1433;Initial Catalog=volosofteventhub;Persist Security Info=False;User ID=volosoft;Password={your_password};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" + "Default": "Server=tcp:volosofteventhub.database.windows.net,1433;Initial Catalog=volosofteventhub;Persist Security Info=False;User ID=volosoft;Password=@Palandoken2021;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" }, "Redis": { "Configuration": "volosofteventhub.redis.cache.windows.net:6380,password=9Kc6E1lbwy5c+RHR1KZS26JPydYR5SeR8UixdECQWv4=,ssl=True,abortConnect=False" From 607cbfde60dfe290b579965e9a21cb6f8b4bcf8a Mon Sep 17 00:00:00 2001 From: yusuf karatoprak Date: Mon, 26 Apr 2021 14:47:09 +0300 Subject: [PATCH 6/8] update for devops added dockers and azure pipeline manifests --- .../manifests/deployment.yml | 23 +++++++++++++++++++ .../manifests/service.yml | 11 +++++++++ .../manifests/deployment.yml | 22 ++++++++++++++++++ .../manifests/service.yml | 11 +++++++++ src/EventHub.Web/manifests/deployment.yml | 22 ++++++++++++++++++ src/EventHub.Web/manifests/service.yml | 11 +++++++++ 6 files changed, 100 insertions(+) create mode 100644 src/EventHub.HttpApi.Host/manifests/deployment.yml create mode 100644 src/EventHub.HttpApi.Host/manifests/service.yml create mode 100644 src/EventHub.IdentityServer/manifests/deployment.yml create mode 100644 src/EventHub.IdentityServer/manifests/service.yml create mode 100644 src/EventHub.Web/manifests/deployment.yml create mode 100644 src/EventHub.Web/manifests/service.yml diff --git a/src/EventHub.HttpApi.Host/manifests/deployment.yml b/src/EventHub.HttpApi.Host/manifests/deployment.yml new file mode 100644 index 0000000..051f3b2 --- /dev/null +++ b/src/EventHub.HttpApi.Host/manifests/deployment.yml @@ -0,0 +1,23 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: volosoft-eventhub-httpapi-host-deployment +spec: + selector: + matchLabels: + app: volosoft-eventhub-httpapi-host-pod + replicas: 2 + template: + metadata: + labels: + app: volosoft-eventhub-httpapi-host-pod + spec: + containers: + - name: volosoft-eventhub-httpapi-host-container + image: voloeventhubhttpapihost.azurecr.io/voloeventhubhttpapihost:v1 + resources: + limits: + memory: "128Mi" + cpu: "500m" + ports: + - containerPort: 5002 \ No newline at end of file diff --git a/src/EventHub.HttpApi.Host/manifests/service.yml b/src/EventHub.HttpApi.Host/manifests/service.yml new file mode 100644 index 0000000..df7aba8 --- /dev/null +++ b/src/EventHub.HttpApi.Host/manifests/service.yml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Service +metadata: + name: volosoft-eventhub-httpapi-host-service +spec: + selector: + app: volosoft-eventhub-httpapi-host-pod + ports: + - port: 80 + targetPort: 80 + type: LoadBalancer diff --git a/src/EventHub.IdentityServer/manifests/deployment.yml b/src/EventHub.IdentityServer/manifests/deployment.yml new file mode 100644 index 0000000..b5301e5 --- /dev/null +++ b/src/EventHub.IdentityServer/manifests/deployment.yml @@ -0,0 +1,22 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: volosoft-eventhub-identityserver-deployment +spec: + selector: + matchLabels: + app: volosoft-eventhub-identityserver-pod + template: + metadata: + labels: + app: volosoft-eventhub-identityserver-pod + spec: + containers: + - name: volosoft-eventhub-identityserver-container + image: voloeventhubidentityserver.azurecr.io/voloeventhubidentityserver:v1 + resources: + limits: + memory: "128Mi" + cpu: "500m" + ports: + - containerPort: 5001 \ No newline at end of file diff --git a/src/EventHub.IdentityServer/manifests/service.yml b/src/EventHub.IdentityServer/manifests/service.yml new file mode 100644 index 0000000..30efb7d --- /dev/null +++ b/src/EventHub.IdentityServer/manifests/service.yml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Service +metadata: + name: volosoft-eventhub-identityserver-service +spec: + selector: + app: volosoft-eventhub-identityserver-pod + ports: + - port: 80 + targetPort: 80 + type: LoadBalancer \ No newline at end of file diff --git a/src/EventHub.Web/manifests/deployment.yml b/src/EventHub.Web/manifests/deployment.yml new file mode 100644 index 0000000..37bca0f --- /dev/null +++ b/src/EventHub.Web/manifests/deployment.yml @@ -0,0 +1,22 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: volosoft-eventhub-web-deployment +spec: + selector: + matchLabels: + app: volosoft-eventhub-web-pod + template: + metadata: + labels: + app: volosoft-eventhub-web-pod + spec: + containers: + - name: volosoft-eventhub-web-container + image: voloeventhub.azurecr.io/voloeventhub:v1 + resources: + limits: + memory: "128Mi" + cpu: "500m" + ports: + - containerPort: 80 diff --git a/src/EventHub.Web/manifests/service.yml b/src/EventHub.Web/manifests/service.yml new file mode 100644 index 0000000..a470dfd --- /dev/null +++ b/src/EventHub.Web/manifests/service.yml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Service +metadata: + name: volosoft-eventhub-web-service +spec: + selector: + app: volosoft-eventhub-web-pod + ports: + - port: 8080 + targetPort: 80 + type: ClusterIP \ No newline at end of file From b4847249acfa3a3df5fb1da0dcda4a375a98a782 Mon Sep 17 00:00:00 2001 From: yusuf karatoprak Date: Mon, 26 Apr 2021 21:01:23 +0300 Subject: [PATCH 7/8] update --- src/EventHub.BackgroundServices/appsettings.json | 2 +- src/EventHub.DbMigrator/appsettings.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/EventHub.BackgroundServices/appsettings.json b/src/EventHub.BackgroundServices/appsettings.json index c8e17e6..f297125 100644 --- a/src/EventHub.BackgroundServices/appsettings.json +++ b/src/EventHub.BackgroundServices/appsettings.json @@ -1,6 +1,6 @@ { "ConnectionStrings": { - "Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=EventHub;Trusted_Connection=True" + "Default": "Server=tcp:volosofteventhub.database.windows.net,1433;Initial Catalog=volosofteventhub;Persist Security Info=False;User ID=volosoft;Password=@Palandoken2021;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" }, "Redis": { "Configuration": "Server=tcp:volosofteventhub.database.windows.net,1433;Initial Catalog=volosofteventhub;Persist Security Info=False;User ID=volosoft;Password=@Palandoken2021;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" diff --git a/src/EventHub.DbMigrator/appsettings.json b/src/EventHub.DbMigrator/appsettings.json index 1520392..f9d16ff 100644 --- a/src/EventHub.DbMigrator/appsettings.json +++ b/src/EventHub.DbMigrator/appsettings.json @@ -1,6 +1,6 @@ { "ConnectionStrings": { - "Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=EventHub;Trusted_Connection=True" + "Default": "Server=tcp:volosofteventhub.database.windows.net,1433;Initial Catalog=volosofteventhub;Persist Security Info=False;User ID=volosoft;Password=@Palandoken2021;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" }, "IdentityServer": { "Clients": { From 37fa527dc9276614ce7e472526f9d14f9fd8dfa1 Mon Sep 17 00:00:00 2001 From: yusuf karatoprak Date: Mon, 26 Apr 2021 21:12:10 +0300 Subject: [PATCH 8/8] update for azure pipeline --- azure-pipelines.yml | 65 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..e80f41b --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,65 @@ +# Deploy to Azure Kubernetes Service +# Build and push image to Azure Container Registry; Deploy to Azure Kubernetes Service +# https://docs.microsoft.com/azure/devops/pipelines/languages/docker + +trigger: +- dev + +variables: + + # Container registry service connection established during pipeline creation + dockerRegistryServiceConnection: '0648130a-0d3e-41f3-b92e-fc7f620264e8' + imageRepository: 'voloeventhub' + containerRegistry: 'voloeventhub.azurecr.io' + dockerfilePath: '**/Dockerfile' + tag: '$(Build.BuildName)' + + # Agent VM image name + vmImageName: 'ubuntu-latest' + +stages: +- stage: Build + displayName: Build stage + jobs: + - job: Build + displayName: Build + pool: + vmImage: $(vmImageName) + steps: + - task: Docker@2 + displayName: Build and push an image to container registry + inputs: + command: buildAndPush + repository: $(imageRepository) + dockerfile: $(dockerfilePath) + containerRegistry: $(dockerRegistryServiceConnection) + tags: | + $(tag) + + - publish: manifests + artifact: manifests + +- stage: Deploy + displayName: Deploy stage + dependsOn: Build + + jobs: + - deployment: Deploy + displayName: Deploy + pool: + vmImage: $(vmImageName) + environment: 'volosofteventhub.default' + strategy: + runOnce: + deploy: + steps: + - task: KubernetesManifest@0 + displayName: Deploy to Kubernetes cluster + inputs: + action: deploy + manifests: | + $(Pipeline.Workspace)/manifests/deployment.yml + $(Pipeline.Workspace)/manifests/service.yml + containers: | + $(containerRegistry)/$(imageRepository):$(tag) +