diff --git a/Dockerfile.EventHub.Admin b/Dockerfile.EventHub.Admin new file mode 100644 index 0000000..dc72cd8 --- /dev/null +++ b/Dockerfile.EventHub.Admin @@ -0,0 +1,21 @@ +FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base +WORKDIR /app +EXPOSE 80 +EXPOSE 443 + +FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build +WORKDIR /src +COPY ["src/EventHub.Admin.Web/EventHub.Admin.Web.csproj", "src/EventHub.Admin.Web/"] +RUN dotnet restore "src/EventHub.Admin.Web/EventHub.Admin.Web.csproj" +COPY . . +WORKDIR "/src/src/EventHub.Admin.Web" + +RUN dotnet build "EventHub.Admin.Web.csproj" -c Release -o /app + +FROM build AS publish +RUN dotnet publish "EventHub.Admin.Web.csproj" -c Release -o /app + +FROM base AS final +WORKDIR /app +COPY --from=publish /app . +ENTRYPOINT ["dotnet", "EventHub.Admin.Web.dll"] \ No newline at end of file diff --git a/Dockerfile.EventHub.HttpApi.Host b/Dockerfile.EventHub.HttpApi.Host index 0c354d8..e805f3c 100644 --- a/Dockerfile.EventHub.HttpApi.Host +++ b/Dockerfile.EventHub.HttpApi.Host @@ -10,8 +10,6 @@ RUN dotnet restore "src/EventHub.HttpApi.Host/EventHub.HttpApi.Host.csproj" COPY . . WORKDIR "/src/src/EventHub.HttpApi.Host" -RUN dotnet dev-certs https -v -ep localhost.pfx -p e8202f07-66e5-4619-be07-72ba76fde97f - RUN dotnet build "EventHub.HttpApi.Host.csproj" -c Release -o /app FROM build AS publish diff --git a/Dockerfile.EventHub.IdentityServer b/Dockerfile.EventHub.IdentityServer index ecde15b..b421bc1 100644 --- a/Dockerfile.EventHub.IdentityServer +++ b/Dockerfile.EventHub.IdentityServer @@ -10,10 +10,6 @@ RUN dotnet restore "src/EventHub.IdentityServer/EventHub.IdentityServer.csproj" COPY . . WORKDIR "/src/src/EventHub.IdentityServer" -RUN dotnet dev-certs https -ep aspnetapp.pfx -p mypassword123 -RUN dotnet dev-certs https --trust -RUN dotnet dev-certs https -ep $env:USERPROFILE\.aspnet\https\aspnetapp.pfx -p mypassword123 -RUN dotnet dev-certs https -ep %USERPROFILE%\.aspnet\https\aspnetapp.pfx -p mypassword123 RUN dotnet build "EventHub.IdentityServer.csproj" -c Release -o /app diff --git a/Dockerfile.EventHub.Web b/Dockerfile.EventHub.Web index 48f8448..123b023 100644 --- a/Dockerfile.EventHub.Web +++ b/Dockerfile.EventHub.Web @@ -10,8 +10,6 @@ RUN dotnet restore "src/EventHub.Web/EventHub.Web.csproj" COPY . . WORKDIR "/src/src/EventHub.Web" -RUN dotnet dev-certs https -v -ep localhost.pfx -p e8202f07-66e5-4619-be07-72ba76fde97f - RUN dotnet build "EventHub.Web.csproj" -c Release -o /app FROM build AS publish diff --git a/azure-pipelines.eventhub.admin.yml b/azure-pipelines.eventhub.admin.yml new file mode 100644 index 0000000..3bf77dc --- /dev/null +++ b/azure-pipelines.eventhub.admin.yml @@ -0,0 +1,67 @@ +trigger: +- dev + + +variables: + + # Container registry service connection established during pipeline creation + dockerRegistryServiceConnection: '855289e7-1034-4e42-90b4-38c072ecefcb' + imageRepository: 'voloeventhub' + containerRegistry: 'voloeventhub.azurecr.io' + dockerfilePath: '**/Dockerfile.EventHub.Web' + tag: '$(Build.BuildNumber)' + + + # 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) + + - upload: manifests + artifact: manifests + +- stage: Deploy + displayName: Deploy stage + dependsOn: Build + + jobs: + - deployment: Deploy + displayName: Deploy-EventHub-Web + pool: + vmImage: $(vmImageName) + environment: 'volosofteventhub-3839.default' + strategy: + runOnce: + deploy: + steps: + + + - task: KubernetesManifest@0 + displayName: Deploy to Kubernetes cluster + inputs: + action: deploy + manifests: | + $(Pipeline.Workspace)/manifests/deployment.eventhub.web.yml + $(Pipeline.Workspace)/manifests/service.eventhub.web.yml + + containers: | + $(containerRegistry)/$(imageRepository):$(tag) + diff --git a/manifests/deployment.eventhub.admin.yml b/manifests/deployment.eventhub.admin.yml new file mode 100644 index 0000000..e88d76a --- /dev/null +++ b/manifests/deployment.eventhub.admin.yml @@ -0,0 +1,23 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: admin +spec: + selector: + matchLabels: + app: admin + template: + metadata: + labels: + app: admin + spec: + containers: + - name: admin + image: eventhubregistry.azurecr.io/eventhubadmin:v2 + imagePullPolicy: Always + resources: + requests: + memory: "128Mi" + cpu: "500m" + ports: + - containerPort: 80 diff --git a/manifests/deployment.eventhub.identityserver.yml b/manifests/deployment.eventhub.identityserver.yml index 30302ca..6beca2b 100644 --- a/manifests/deployment.eventhub.identityserver.yml +++ b/manifests/deployment.eventhub.identityserver.yml @@ -13,7 +13,7 @@ spec: spec: containers: - name: identityserver - image: eventhubregistry.azurecr.io/eventhubidentityserver:v1 + image: eventhubregistry.azurecr.io/eventhubidentityserver:v2 imagePullPolicy: Always resources: requests: diff --git a/manifests/deployment.eventhub.web.yml b/manifests/deployment.eventhub.web.yml index 450572d..1d0e3c5 100644 --- a/manifests/deployment.eventhub.web.yml +++ b/manifests/deployment.eventhub.web.yml @@ -13,7 +13,7 @@ spec: spec: containers: - name: web - image: eventhubregistry.azurecr.io/eventhubweb:v4 + image: eventhubregistry.azurecr.io/eventhubweb:v5 imagePullPolicy: Always resources: requests: diff --git a/manifests/eventhub.admin.ingress.yaml b/manifests/eventhub.admin.ingress.yaml new file mode 100644 index 0000000..2af133a --- /dev/null +++ b/manifests/eventhub.admin.ingress.yaml @@ -0,0 +1,25 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: admin + annotations: + kubernetes.io/ingress.class: nginx + nginx.ingress.kubernetes.io/ssl-redirect: "true" + cert-manager.io/issuer: letsencrypt-prod +spec: + tls: + - hosts: + - admin.openeventhub.com + secretName: admin-tls + rules: + - host: admin.openeventhub.com + http: + paths: + - backend: + service: + name: admin + port: + number: 80 + path: / + pathType: Prefix + diff --git a/manifests/eventhub.httpapi.host.ingress.yaml b/manifests/eventhub.httpapi.host.ingress.yaml index 8484cca..c89edd2 100644 --- a/manifests/eventhub.httpapi.host.ingress.yaml +++ b/manifests/eventhub.httpapi.host.ingress.yaml @@ -9,10 +9,10 @@ metadata: spec: tls: - hosts: - - api.eventhub.gokhansengun.com + - api.openeventhub.com secretName: httpapi-host-tls rules: - - host: api.eventhub.gokhansengun.com + - host: api.openeventhub.com http: paths: - backend: diff --git a/manifests/eventhub.identityserver.ingress.yaml b/manifests/eventhub.identityserver.ingress.yaml index 7a81cc7..619d558 100644 --- a/manifests/eventhub.identityserver.ingress.yaml +++ b/manifests/eventhub.identityserver.ingress.yaml @@ -9,10 +9,10 @@ metadata: spec: tls: - hosts: - - identityserver.eventhub.gokhansengun.com + - identityserver.openeventhub.com secretName: identityserver-tls rules: - - host: identityserver.eventhub.gokhansengun.com + - host: identityserver.openeventhub.com http: paths: - backend: diff --git a/manifests/eventhub.ingress.yaml b/manifests/eventhub.web.ingress.yaml similarity index 84% rename from manifests/eventhub.ingress.yaml rename to manifests/eventhub.web.ingress.yaml index 2529910..ca0c721 100644 --- a/manifests/eventhub.ingress.yaml +++ b/manifests/eventhub.web.ingress.yaml @@ -9,10 +9,10 @@ metadata: spec: tls: - hosts: - - api.eventhub.gokhansengun.com + - web.openeventhub.com secretName: web-tls rules: - - host: web.eventhub.gokhansengun.com + - host: web.openeventhub.com http: paths: - backend: diff --git a/manifests/service.eventhub.admin.yml b/manifests/service.eventhub.admin.yml new file mode 100644 index 0000000..61b1dfd --- /dev/null +++ b/manifests/service.eventhub.admin.yml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Service +metadata: + name: admin +spec: + selector: + app: admin + ports: + - port: 80 + targetPort: 80 + type: ClusterIP \ No newline at end of file diff --git a/src/EventHub.Admin.Web/Properties/launchSettings.json b/src/EventHub.Admin.Web/Properties/launchSettings.json index a7de74a..cd7b143 100644 --- a/src/EventHub.Admin.Web/Properties/launchSettings.json +++ b/src/EventHub.Admin.Web/Properties/launchSettings.json @@ -3,8 +3,8 @@ "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { - "applicationUrl": "https://localhost:44307", - "sslPort": 44307 + "applicationUrl": "https://admin.openeventhub.com/", + "sslPort": 80 } }, "profiles": { @@ -20,7 +20,7 @@ "commandName": "Project", "launchBrowser": true, "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", - "applicationUrl": "https://localhost:44307", + "applicationUrl": "https://admin.openeventhub.com/", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/src/EventHub.Admin.Web/wwwroot/appsettings.json b/src/EventHub.Admin.Web/wwwroot/appsettings.json index 539c001..a5d2a38 100644 --- a/src/EventHub.Admin.Web/wwwroot/appsettings.json +++ b/src/EventHub.Admin.Web/wwwroot/appsettings.json @@ -1,20 +1,20 @@ { "App": { - "SelfUrl": "https://localhost:44307" + "SelfUrl": "https://admin.openeventhub.com/" }, "AuthServer": { - "Authority": "https://localhost:44313", + "Authority": "https://identityserver.openeventhub.com", "ClientId": "EventHub_Blazor", "ResponseType": "code" }, "RemoteServices": { "Default": { - "BaseUrl": "https://localhost:44362" + "BaseUrl": "https://api.openeventhub.com" } }, "AbpCli": { "Bundle": { - "Mode": "BundleAndMinify", /* Options: None, Bundle, BundleAndMinify */ + "Mode": "BundleAndMinify", "Name": "global", "Parameters": { diff --git a/src/EventHub.Web/Properties/launchSettings.json b/src/EventHub.Web/Properties/launchSettings.json index 69ea0d8..673ab7c 100644 --- a/src/EventHub.Web/Properties/launchSettings.json +++ b/src/EventHub.Web/Properties/launchSettings.json @@ -3,7 +3,7 @@ "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { - "applicationUrl": "https://web.eventhub.gokhansengun.com/", + "applicationUrl": "https://web.openeventhub.com/", "sslPort": 80 } }, @@ -18,7 +18,7 @@ "EventHub.Web": { "commandName": "Project", "launchBrowser": true, - "applicationUrl": "https://web.eventhub.gokhansengun.com/", + "applicationUrl": "https://web.openeventhub.com/", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/src/EventHub.Web/appsettings.json b/src/EventHub.Web/appsettings.json index 1091de3..34e07b8 100644 --- a/src/EventHub.Web/appsettings.json +++ b/src/EventHub.Web/appsettings.json @@ -1,17 +1,17 @@ { "App": { - "SelfUrl": "https://web.eventhub.gokhansengun.com/" + "SelfUrl": "https://web.openeventhub.com/" }, "RemoteServices": { "Default": { - "BaseUrl": "https://api.eventhub.gokhansengun.com" + "BaseUrl": "https://api.openeventhub.com" } }, "Redis": { "Configuration": "volosofteventhub.redis.cache.windows.net:6380,password=9Kc6E1lbwy5c+RHR1KZS26JPydYR5SeR8UixdECQWv4=,ssl=True,abortConnect=False" }, "AuthServer": { - "Authority": "https://identityserver.eventhub.gokhansengun.com", + "Authority": "https://identityserver.openeventhub.com", "RequireHttpsMetadata": "true", "ClientId": "EventHub_Web", "ClientSecret": "1q2w3e*"