Browse Source

Merge branch 'main' into tracks-and-sessions

pull/79/head
Halil İbrahim Kalkan 5 years ago
parent
commit
19a53a5fd4
  1. 1
      .gitignore
  2. 23
      Dockerfile.EventHub.HttpApi.Host
  3. 26
      Dockerfile.EventHub.IdentityServer
  4. 23
      Dockerfile.EventHub.Web
  5. 62
      azure-pipelines.eventhub.httpapi.host.yml
  6. 61
      azure-pipelines.eventhub.httpapi.host2.yml
  7. 62
      azure-pipelines.eventhub.identityserver.yml
  8. 67
      azure-pipelines.eventhub.web.yml
  9. 61
      azure-pipelines.yml
  10. 25
      etc/azure/deploy-to-k8s.yml
  11. 18
      etc/azure/scripts/cluster-issuer.yaml
  12. 2
      etc/azure/scripts/configure-dns.ps1
  13. 8
      etc/azure/scripts/corednsms.yaml
  14. 69
      etc/azure/scripts/install-ingress.ps1
  15. 22
      etc/azure/scripts/push-images.ps1
  16. BIN
      etc/dev-cert/localhost.pfx
  17. 21
      etc/k8s/README.md
  18. 1
      etc/k8s/helm-chart/deploy-azure.ps1
  19. 6
      etc/k8s/helm-chart/eventhub/Chart.yaml
  20. 6
      etc/k8s/helm-chart/eventhub/charts/account/Chart.yaml
  21. 28
      etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml
  22. 14
      etc/k8s/helm-chart/eventhub/charts/account/templates/account-service.yaml
  23. 27
      etc/k8s/helm-chart/eventhub/charts/account/templates/account.yaml
  24. 0
      etc/k8s/helm-chart/eventhub/charts/account/values.yaml
  25. 6
      etc/k8s/helm-chart/eventhub/charts/admin-api/Chart.yaml
  26. 26
      etc/k8s/helm-chart/eventhub/charts/admin-api/templates/admin-api-ingress.yaml
  27. 14
      etc/k8s/helm-chart/eventhub/charts/admin-api/templates/admin-api-service.yaml
  28. 27
      etc/k8s/helm-chart/eventhub/charts/admin-api/templates/admin-api.yaml
  29. 0
      etc/k8s/helm-chart/eventhub/charts/admin-api/values.yaml
  30. 6
      etc/k8s/helm-chart/eventhub/charts/admin/Chart.yaml
  31. 28
      etc/k8s/helm-chart/eventhub/charts/admin/templates/admin-ingress.yaml
  32. 14
      etc/k8s/helm-chart/eventhub/charts/admin/templates/admin-service.yaml
  33. 24
      etc/k8s/helm-chart/eventhub/charts/admin/templates/admin.yaml
  34. 0
      etc/k8s/helm-chart/eventhub/charts/admin/values.yaml
  35. 6
      etc/k8s/helm-chart/eventhub/charts/api/Chart.yaml
  36. 26
      etc/k8s/helm-chart/eventhub/charts/api/templates/api-ingress.yaml
  37. 14
      etc/k8s/helm-chart/eventhub/charts/api/templates/api-service.yaml
  38. 27
      etc/k8s/helm-chart/eventhub/charts/api/templates/api.yaml
  39. 0
      etc/k8s/helm-chart/eventhub/charts/api/values.yaml
  40. 6
      etc/k8s/helm-chart/eventhub/charts/background-services/Chart.yaml
  41. 18
      etc/k8s/helm-chart/eventhub/charts/background-services/templates/background-services.yaml
  42. 0
      etc/k8s/helm-chart/eventhub/charts/background-services/values.yaml
  43. 6
      etc/k8s/helm-chart/eventhub/charts/dbmigrator/Chart.yaml
  44. 24
      etc/k8s/helm-chart/eventhub/charts/dbmigrator/templates/migrator.yaml
  45. 0
      etc/k8s/helm-chart/eventhub/charts/dbmigrator/values.yaml
  46. 6
      etc/k8s/helm-chart/eventhub/charts/postgresql/Chart.yaml
  47. 14
      etc/k8s/helm-chart/eventhub/charts/postgresql/templates/postgresql-service.yaml
  48. 43
      etc/k8s/helm-chart/eventhub/charts/postgresql/templates/postgresql.yaml
  49. 0
      etc/k8s/helm-chart/eventhub/charts/postgresql/values.yaml
  50. 6
      etc/k8s/helm-chart/eventhub/charts/redis/Chart.yaml
  51. 13
      etc/k8s/helm-chart/eventhub/charts/redis/templates/redis-service.yaml
  52. 20
      etc/k8s/helm-chart/eventhub/charts/redis/templates/redis.yaml
  53. 0
      etc/k8s/helm-chart/eventhub/charts/redis/values.yaml
  54. 6
      etc/k8s/helm-chart/eventhub/charts/www/Chart.yaml
  55. 36
      etc/k8s/helm-chart/eventhub/charts/www/templates/www-ingress.yaml
  56. 14
      etc/k8s/helm-chart/eventhub/charts/www/templates/www-service.yaml
  57. 24
      etc/k8s/helm-chart/eventhub/charts/www/templates/www.yaml
  58. 0
      etc/k8s/helm-chart/eventhub/charts/www/values.yaml
  59. 24
      etc/k8s/helm-chart/eventhub/templates/_helpers.tpl
  60. 11
      etc/k8s/helm-chart/eventhub/templates/managed-premium-retain.yaml
  61. 35
      etc/k8s/helm-chart/eventhub/values.azure.yaml
  62. 35
      etc/k8s/helm-chart/eventhub/values.yaml
  63. 63
      etc/k8s/scripts/build-images.ps1
  64. 7
      etc/k8s/scripts/minikube-load-images.ps1
  65. 32
      etc/notes/ui-design.md
  66. 23
      localhost.conf
  67. 23
      manifests/deployment.eventhub.httpapi.host.yml
  68. 23
      manifests/deployment.eventhub.identityserver.yml
  69. 23
      manifests/deployment.eventhub.web.yml
  70. 19
      manifests/deployment.yml
  71. 11
      manifests/service.eventhub.httpapi.host.yml
  72. 17
      manifests/service.eventhub.identityserver.yml
  73. 11
      manifests/service.eventhub.web.yml
  74. 10
      manifests/service.yml
  75. 7
      src/EventHub.Admin.Application.Contracts/EventHubAdminRemoteServiceConsts.cs
  76. 20
      src/EventHub.Admin.Application.Contracts/Organizations/IOrganizationAppService.cs
  77. 11
      src/EventHub.Admin.Application.Contracts/Organizations/Memberships/IOrganizationMembershipAppService.cs
  78. 18
      src/EventHub.Admin.Application.Contracts/Organizations/Memberships/OrganizationMemberDto.cs
  79. 12
      src/EventHub.Admin.Application.Contracts/Organizations/Memberships/OrganizationMemberListFilterDto.cs
  80. 14
      src/EventHub.Admin.Application.Contracts/Organizations/OrganizationInListDto.cs
  81. 15
      src/EventHub.Admin.Application.Contracts/Organizations/OrganizationListFilterDto.cs
  82. 32
      src/EventHub.Admin.Application.Contracts/Organizations/OrganizationProfileDto.cs
  83. 44
      src/EventHub.Admin.Application.Contracts/Organizations/UpdateOrganizationDto.cs
  84. 9
      src/EventHub.Admin.Application.Contracts/Permissions/EventHubPermissionDefinitionProvider.cs
  85. 14
      src/EventHub.Admin.Application.Contracts/Permissions/EventHubPermissions.cs
  86. 13
      src/EventHub.Admin.Application/EventHubAdminAppService.cs
  87. 11
      src/EventHub.Admin.Application/EventHubAdminApplicationModule.cs
  88. 24
      src/EventHub.Admin.Application/EventHubApplicationAutoMapperProfile.cs
  89. 53
      src/EventHub.Admin.Application/Organizations/Memberships/OrganizationMembershipAppService.cs
  90. 161
      src/EventHub.Admin.Application/Organizations/OrganizationAppService.cs
  91. 30
      src/EventHub.Admin.HttpApi.Host/Controllers/Organizations/Memberships/OrganizationMembershipController.cs
  92. 58
      src/EventHub.Admin.HttpApi.Host/Controllers/Organizations/OrganizationController.cs
  93. 4
      src/EventHub.Admin.HttpApi.Host/Dockerfile
  94. 18
      src/EventHub.Admin.HttpApi.Host/EventHubAdminHttpApiHostModule.cs
  95. 2
      src/EventHub.Admin.HttpApi.Host/Program.cs
  96. 71
      src/EventHub.Admin.HttpApi.Host/Utils/SameSiteCookiesServiceCollectionExtensions.cs
  97. 2
      src/EventHub.Admin.HttpApi.Host/appsettings.Development.json
  98. 8
      src/EventHub.Admin.HttpApi.Host/appsettings.json
  99. 3
      src/EventHub.Admin.Web/Dockerfile
  100. 4
      src/EventHub.Admin.Web/EventHub.Admin.Web.csproj

1
.gitignore

@ -226,7 +226,6 @@ ClientBin/
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs

23
Dockerfile.EventHub.HttpApi.Host

@ -1,23 +0,0 @@
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.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 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
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"]

26
Dockerfile.EventHub.IdentityServer

@ -1,26 +0,0 @@
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.IdentityServer/EventHub.IdentityServer.csproj", "src/EventHub.IdentityServer/"]
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
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"]

23
Dockerfile.EventHub.Web

@ -1,23 +0,0 @@
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.Web/EventHub.Web.csproj", "src/EventHub.Web/"]
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
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"]

62
azure-pipelines.eventhub.httpapi.host.yml

@ -1,62 +0,0 @@
trigger:
- dev
variables:
dockerRegistryServiceConnection: 'b46a670b-6940-4de5-b6b1-b06f9dd1c849'
imageRepository: 'voloeventhubhttpapihost'
containerRegistry: 'voloeventhubhttpapihost.azurecr.io'
dockerfilePath: '**/Dockerfile.EventHub.HttpApi.Host'
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-HttpApi-Host
pool:
vmImage: $(vmImageName)
environment: 'volosofteventhub-6504.default'
strategy:
runOnce:
deploy:
steps:
- task: KubernetesManifest@0
displayName: Deploy to Kubernetes cluster
inputs:
action: deploy
manifests: |
$(Pipeline.Workspace)/manifests/deployment.eventhub.httpapi.host.yml
$(Pipeline.Workspace)/manifests/service.eventhub.httpapi.host.yml
containers: |
$(containerRegistry)/$(imageRepository):$(tag)

61
azure-pipelines.eventhub.httpapi.host2.yml

@ -1,61 +0,0 @@
trigger:
- dev
variables:
dockerRegistryServiceConnection: '8a2bf690-716a-490c-8a88-d93fab12cf9d'
imageRepository: 'eventhubhttpapihost'
containerRegistry: 'eventhubregistry.azurecr.io'
dockerfilePath: '**/Dockerfile.EventHub.HttpApi.Host'
tag: '$(Build.BuildNumber)'
# Agent VM image namedocker images
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-HttpApi-Host
pool:
vmImage: $(vmImageName)
environment: 'volosofteventhub-6504.default'
strategy:
runOnce:
deploy:
steps:
- task: KubernetesManifest@0
displayName: Deploy to Kubernetes cluster
inputs:
action: deploy
manifests: |
$(Pipeline.Workspace)/manifests/deployment.eventhub.httpapi.host.yml
$(Pipeline.Workspace)/manifests/service.eventhub.httpapi.host.yml
containers: |
$(containerRegistry)/$(imageRepository):$(tag)

62
azure-pipelines.eventhub.identityserver.yml

@ -1,62 +0,0 @@
trigger:
- dev
variables:
# Container registry service connection established during pipeline creation
dockerRegistryServiceConnection: '18b12bb9-87a3-4539-a769-7a1e371886cf'
imageRepository: 'voloeventhubidentityserver'
containerRegistry: 'voloeventhubidentityserver.azurecr.io'
dockerfilePath: '**/Dockerfile.EventHub.IdentityServer'
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)
- publish: manifests
artifact: manifests
- stage: Deploy
displayName: Deploy stage
dependsOn: Build
jobs:
- deployment: Deploy
displayName: Deploy
pool:
vmImage: $(vmImageName)
environment: 'volosofteventhub-1359.default'
strategy:
runOnce:
deploy:
steps:
- task: KubernetesManifest@0
displayName: Deploy to Kubernetes cluster
inputs:
action: deploy
manifests: |
$(Pipeline.Workspace)/manifests/deployment.eventhub.identityserver.yml
$(Pipeline.Workspace)/manifests/service.eventhub.identityserver.yml
containers: |
$(containerRegistry)/$(imageRepository):$(tag)

67
azure-pipelines.eventhub.web.yml

@ -1,67 +0,0 @@
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)

61
azure-pipelines.yml

@ -1,61 +0,0 @@
trigger:
- dev
variables:
dockerRegistryServiceConnection: 'efbb038e-4f76-4833-a538-fbd8ecb7c545'
imageRepository: 'eventhubhttpapihost'
containerRegistry: 'eventhubregistry.azurecr.io'
dockerfilePath: '**/Dockerfile.EventHub.HttpApi.Host'
tag: '$(Build.BuildNumber)'
# Agent VM image namedocker images
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-HttpApi-Host
pool:
vmImage: $(vmImageName)
environment: 'volosofteventhub-2042'
strategy:
runOnce:
deploy:
steps:
- task: KubernetesManifest@0
displayName: Deploy to Kubernetes cluster
inputs:
action: deploy
manifests: |
$(Pipeline.Workspace)/manifests/deployment.eventhub.httpapi.host.yml
$(Pipeline.Workspace)/manifests/service.eventhub.httpapi.host.yml
containers: |
$(containerRegistry)/$(imageRepository):$(tag)

25
etc/azure/deploy-to-k8s.yml

@ -0,0 +1,25 @@
pool:
vmImage: 'windows-latest'
steps:
- task: PowerShell@2
inputs:
filePath: 'etc/k8s/scripts/build-images.ps1'
- task: PowerShell@2
inputs:
filePath: 'etc/azure/scripts/push-images.ps1'
- task: HelmDeploy@0
inputs:
connectionType: 'Azure Resource Manager'
azureSubscription: 'volosoft(fe02ef9f-9e1c-4e40-b924-505981688dd8)'
azureResourceGroup: 'volo'
kubernetesCluster: 'volo'
useClusterAdmin: true
namespace: 'eventhub'
command: 'upgrade'
chartType: 'Name'
chartName: 'eventhub'
releaseName: 'eh-az'
valueFile: 'etc/k8s/helm-chart/eventhub/values.azure.yaml'
arguments: '--namespace eventhub --create-namespace'

18
etc/azure/scripts/cluster-issuer.yaml

@ -0,0 +1,18 @@
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: letsencrypt
spec:
acme:
server: https://acme-v02.api.letsencrypt.org/directory
email: info@volosoft.com
privateKeySecretRef:
name: letsencrypt
solvers:
- http01:
ingress:
class: nginx
podTemplate:
spec:
nodeSelector:
"kubernetes.io/os": linux

2
etc/azure/scripts/configure-dns.ps1

@ -0,0 +1,2 @@
kubectl apply -f .\corednsms.yaml
kubectl delete pod --namespace kube-system -l k8s-app=kube-dns

8
etc/azure/scripts/corednsms.yaml

@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: coredns-custom
namespace: kube-system
data:
Corefile.override: |
rewrite name substring account.openeventhub.com eh-az-account

69
etc/azure/scripts/install-ingress.ps1

@ -0,0 +1,69 @@
$REGISTRY_NAME="volocr.azurecr.io"
$ACR_URL="volocr.azurecr.io"
$CONTROLLER_REGISTRY="k8s.gcr.io"
$CONTROLLER_IMAGE="ingress-nginx/controller"
$CONTROLLER_TAG="v0.48.1"
$PATCH_REGISTRY="docker.io"
$PATCH_IMAGE="jettech/kube-webhook-certgen"
$PATCH_TAG="v1.5.1"
$DEFAULTBACKEND_REGISTRY="k8s.gcr.io"
$DEFAULTBACKEND_IMAGE="defaultbackend-amd64"
$DEFAULTBACKEND_TAG="1.5"
$CERT_MANAGER_REGISTRY="quay.io"
$CERT_MANAGER_TAG="v1.3.1"
$CERT_MANAGER_IMAGE_CONTROLLER="jetstack/cert-manager-controller"
$CERT_MANAGER_IMAGE_WEBHOOK="jetstack/cert-manager-webhook"
$CERT_MANAGER_IMAGE_CAINJECTOR="jetstack/cert-manager-cainjector"
az acr import --name $REGISTRY_NAME --source ${CONTROLLER_REGISTRY}/${CONTROLLER_IMAGE}:${CONTROLLER_TAG} --image ${CONTROLLER_IMAGE}:${CONTROLLER_TAG}
az acr import --name $REGISTRY_NAME --source ${PATCH_REGISTRY}/${PATCH_IMAGE}:${PATCH_TAG} --image ${PATCH_IMAGE}:${PATCH_TAG}
az acr import --name $REGISTRY_NAME --source ${DEFAULTBACKEND_REGISTRY}/${DEFAULTBACKEND_IMAGE}:${DEFAULTBACKEND_TAG} --image ${DEFAULTBACKEND_IMAGE}:${DEFAULTBACKEND_TAG}
az acr import --name $REGISTRY_NAME --source ${CERT_MANAGER_REGISTRY}/${CERT_MANAGER_IMAGE_CONTROLLER}:${CERT_MANAGER_TAG} --image ${CERT_MANAGER_IMAGE_CONTROLLER}:${CERT_MANAGER_TAG}
az acr import --name $REGISTRY_NAME --source ${CERT_MANAGER_REGISTRY}/${CERT_MANAGER_IMAGE_WEBHOOK}:${CERT_MANAGER_TAG} --image ${CERT_MANAGER_IMAGE_WEBHOOK}:${CERT_MANAGER_TAG}
az acr import --name $REGISTRY_NAME --source ${CERT_MANAGER_REGISTRY}/${CERT_MANAGER_IMAGE_CAINJECTOR}:${CERT_MANAGER_TAG} --image ${CERT_MANAGER_IMAGE_CAINJECTOR}:${CERT_MANAGER_TAG}
# Create a namespace for your ingress resources
kubectl create namespace ingress-basic
# Add the ingress-nginx repository
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
# Use Helm to deploy an NGINX ingress controller
helm install nginx-ingress ingress-nginx/ingress-nginx `
--namespace ingress-basic `
--set controller.replicaCount=1 `
--set controller.nodeSelector."kubernetes\.io/os"=linux `
--set controller.image.registry=$ACR_URL `
--set controller.image.image=$CONTROLLER_IMAGE `
--set controller.image.tag=$CONTROLLER_TAG `
--set controller.image.digest="" `
--set controller.admissionWebhooks.patch.nodeSelector."kubernetes\.io/os"=linux `
--set controller.admissionWebhooks.patch.image.registry=$ACR_URL `
--set controller.admissionWebhooks.patch.image.image=$PATCH_IMAGE `
--set controller.admissionWebhooks.patch.image.tag=$PATCH_TAG `
--set defaultBackend.nodeSelector."kubernetes\.io/os"=linux `
--set defaultBackend.image.registry=$ACR_URL `
--set defaultBackend.image.image=$DEFAULTBACKEND_IMAGE `
--set defaultBackend.image.tag=$DEFAULTBACKEND_TAG
# Label the ingress-basic namespace to disable resource validation
kubectl label namespace ingress-basic cert-manager.io/disable-validation=true
# Add the Jetstack Helm repository
helm repo add jetstack https://charts.jetstack.io
# Update your local Helm chart repository cache
helm repo update
# Install the cert-manager Helm chart
helm install cert-manager jetstack/cert-manager `
--namespace ingress-basic `
--version ${CERT_MANAGER_TAG} `
--set installCRDs=true `
--set nodeSelector."kubernetes\.io/os"=linux `
--set image.repository=${ACR_URL}/${CERT_MANAGER_IMAGE_CONTROLLER} `
--set image.tag=${CERT_MANAGER_TAG} `
--set webhook.image.repository=${ACR_URL}/${CERT_MANAGER_IMAGE_WEBHOOK} `
--set webhook.image.tag=${CERT_MANAGER_TAG} `
--set cainjector.image.repository=${ACR_URL}/${CERT_MANAGER_IMAGE_CAINJECTOR} `
--set cainjector.image.tag=${CERT_MANAGER_TAG}

22
etc/azure/scripts/push-images.ps1

@ -0,0 +1,22 @@
az acr login --name volocr
docker tag eventhub.dbmigrator:latest volocr.azurecr.io/eventhub.dbmigrator:latest
docker push volocr.azurecr.io/eventhub.dbmigrator:latest
docker tag eventhub.www:latest volocr.azurecr.io/eventhub.www:latest
docker push volocr.azurecr.io/eventhub.www:latest
docker tag eventhub.api:latest volocr.azurecr.io/eventhub.api:latest
docker push volocr.azurecr.io/eventhub.api:latest
docker tag eventhub.admin:latest volocr.azurecr.io/eventhub.admin:latest
docker push volocr.azurecr.io/eventhub.admin:latest
docker tag eventhub.admin-api:latest volocr.azurecr.io/eventhub.admin-api:latest
docker push volocr.azurecr.io/eventhub.admin-api:latest
docker tag eventhub.account:latest volocr.azurecr.io/eventhub.account:latest
docker push volocr.azurecr.io/eventhub.account:latest
docker tag eventhub.background-services:latest volocr.azurecr.io/eventhub.background-services:latest
docker push volocr.azurecr.io/eventhub.background-services:latest

BIN
etc/dev-cert/localhost.pfx

Binary file not shown.

21
etc/k8s/README.md

@ -0,0 +1,21 @@
### Pre-requirements
* Docker Desktop with Kubernetes enabled
* Install [NGINX ingress](https://kubernetes.github.io/ingress-nginx/deploy/) for k8s
### How to run?
* Add entries to the hosts file (in Windows: `C:\Windows\System32\drivers\etc\hosts`):
````
127.0.0.1 eh-st-account
127.0.0.1 eh-st-www
127.0.0.1 eh-st-api
127.0.0.1 eh-st-admin
127.0.0.1 eh-st-admin-api
````
* Run `build-images.ps1` in the `scripts` directory.
* Run `helm install eh-st eventhub` in the `helm-chart` directory.
* Browse https://eh-st-www and https://eh-st-admin
* Username: `admin`, password: `1q2w3E*`.

1
etc/k8s/helm-chart/deploy-azure.ps1

@ -0,0 +1 @@
helm upgrade --install eh-az eventhub -f .\eventhub\values.azure.yaml --namespace eventhub --create-namespace

6
etc/k8s/helm-chart/eventhub/Chart.yaml

@ -0,0 +1,6 @@
apiVersion: v2
name: eventhub
appVersion: "1.0"
description: EventHub solution
version: 1.0.0
type: application

6
etc/k8s/helm-chart/eventhub/charts/account/Chart.yaml

@ -0,0 +1,6 @@
apiVersion: v2
name: account
appVersion: "1.0"
description: EventHub Account Application
version: 1.0.0
type: application

28
etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml

@ -0,0 +1,28 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Release.Name }}-{{ .Chart.Name }}-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
nginx.ingress.kubernetes.io/proxy-buffer-size: "{{ .Values.global.nginxProxyBufferSize }}"
nginx.ingress.kubernetes.io/proxy-buffers-number: "{{ .Values.global.nginxProxyBuffersNumber }}"
cert-manager.io/cluster-issuer: letsencrypt
nginx.ingress.kubernetes.io/configuration-snippet: |
more_set_input_headers "from-ingress: true";
spec:
tls:
- hosts:
- {{ .Values.global.accountDomain }}
secretName: {{ .Release.Name }}-{{ .Chart.Name }}-tls
rules:
- host: "{{ .Values.global.accountDomain }}"
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ .Release.Name }}-{{ .Chart.Name }}
port:
number: 80

14
etc/k8s/helm-chart/eventhub/charts/account/templates/account-service.yaml

@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
labels:
name: {{ .Release.Name }}-{{ .Chart.Name }}
name: {{ .Release.Name }}-{{ .Chart.Name }}
spec:
ports:
- name: "80"
port: 80
- name: "443"
port: 443
selector:
app: {{ .Release.Name }}-{{ .Chart.Name }}

27
etc/k8s/helm-chart/eventhub/charts/account/templates/account.yaml

@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-{{ .Chart.Name }}
spec:
selector:
matchLabels:
app: {{ .Release.Name }}-{{ .Chart.Name }}
template:
metadata:
labels:
app: {{ .Release.Name }}-{{ .Chart.Name }}
spec:
containers:
- image: {{ .Values.containerImage }}
imagePullPolicy: {{ .Values.global.imagePullPolicy }}
name: {{ .Release.Name }}-{{ .Chart.Name }}
ports:
- name: http
containerPort: 80
- name: https
containerPort: 443
env:
{{ include "eventhub.global.env" . | indent 8 }}
- name: "ConnectionStrings__Default"
value: {{ .Values.global.defaultConnString }}

0
etc/k8s/helm-chart/eventhub/charts/account/values.yaml

6
etc/k8s/helm-chart/eventhub/charts/admin-api/Chart.yaml

@ -0,0 +1,6 @@
apiVersion: v2
name: admin-api
appVersion: "1.0"
description: EventHub Admin API Application
version: 1.0.0
type: application

26
etc/k8s/helm-chart/eventhub/charts/admin-api/templates/admin-api-ingress.yaml

@ -0,0 +1,26 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Release.Name }}-{{ .Chart.Name }}-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
nginx.ingress.kubernetes.io/proxy-buffer-size: "{{ .Values.global.nginxProxyBufferSize }}"
nginx.ingress.kubernetes.io/proxy-buffers-number: "{{ .Values.global.nginxProxyBuffersNumber }}"
cert-manager.io/cluster-issuer: letsencrypt
spec:
tls:
- hosts:
- {{ .Values.global.adminApiDomain }}
secretName: {{ .Release.Name }}-{{ .Chart.Name }}-tls
rules:
- host: "{{ .Values.global.adminApiDomain }}"
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ .Release.Name }}-{{ .Chart.Name }}
port:
number: 80

14
etc/k8s/helm-chart/eventhub/charts/admin-api/templates/admin-api-service.yaml

@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
labels:
name: {{ .Release.Name }}-{{ .Chart.Name }}
name: {{ .Release.Name }}-{{ .Chart.Name }}
spec:
ports:
- name: "80"
port: 80
- name: "443"
port: 443
selector:
app: {{ .Release.Name }}-{{ .Chart.Name }}

27
etc/k8s/helm-chart/eventhub/charts/admin-api/templates/admin-api.yaml

@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-{{ .Chart.Name }}
spec:
selector:
matchLabels:
app: {{ .Release.Name }}-{{ .Chart.Name }}
template:
metadata:
labels:
app: {{ .Release.Name }}-{{ .Chart.Name }}
spec:
containers:
- image: {{ .Values.containerImage }}
imagePullPolicy: {{ .Values.global.imagePullPolicy }}
name: {{ .Release.Name }}-{{ .Chart.Name }}
ports:
- name: http
containerPort: 80
- name: https
containerPort: 443
env:
{{ include "eventhub.global.env" . | indent 8 }}
- name: "ConnectionStrings__Default"
value: {{ .Values.global.defaultConnString }}

0
etc/k8s/helm-chart/eventhub/charts/admin-api/values.yaml

6
etc/k8s/helm-chart/eventhub/charts/admin/Chart.yaml

@ -0,0 +1,6 @@
apiVersion: v2
name: admin
appVersion: "1.0"
description: EventHub Admin Application
version: 1.0.0
type: application

28
etc/k8s/helm-chart/eventhub/charts/admin/templates/admin-ingress.yaml

@ -0,0 +1,28 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Release.Name }}-{{ .Chart.Name }}-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
nginx.ingress.kubernetes.io/proxy-buffer-size: "{{ .Values.global.nginxProxyBufferSize }}"
nginx.ingress.kubernetes.io/proxy-buffers-number: "{{ .Values.global.nginxProxyBuffersNumber }}"
cert-manager.io/cluster-issuer: letsencrypt
nginx.ingress.kubernetes.io/configuration-snippet: |
more_set_headers "blazor-environment: {{ .Values.global.dotnetEnvironment }}";
spec:
tls:
- hosts:
- {{ .Values.global.adminDomain }}
secretName: {{ .Release.Name }}-{{ .Chart.Name }}-tls
rules:
- host: "{{ .Values.global.adminDomain }}"
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ .Release.Name }}-{{ .Chart.Name }}
port:
number: 80

14
etc/k8s/helm-chart/eventhub/charts/admin/templates/admin-service.yaml

@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
labels:
name: {{ .Release.Name }}-{{ .Chart.Name }}
name: {{ .Release.Name }}-{{ .Chart.Name }}
spec:
ports:
- name: "80"
port: 80
- name: "443"
port: 443
selector:
app: {{ .Release.Name }}-{{ .Chart.Name }}

24
etc/k8s/helm-chart/eventhub/charts/admin/templates/admin.yaml

@ -0,0 +1,24 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-{{ .Chart.Name }}
spec:
selector:
matchLabels:
app: {{ .Release.Name }}-{{ .Chart.Name }}
template:
metadata:
labels:
app: {{ .Release.Name }}-{{ .Chart.Name }}
spec:
containers:
- image: {{ .Values.containerImage }}
imagePullPolicy: {{ .Values.global.imagePullPolicy }}
name: {{ .Release.Name }}-{{ .Chart.Name }}
ports:
- name: http
containerPort: 80
- name: https
containerPort: 443
env:
{{ include "eventhub.global.env" . | indent 8 }}

0
etc/k8s/helm-chart/eventhub/charts/admin/values.yaml

6
etc/k8s/helm-chart/eventhub/charts/api/Chart.yaml

@ -0,0 +1,6 @@
apiVersion: v2
name: api
appVersion: "1.0"
description: EventHub API Application
version: 1.0.0
type: application

26
etc/k8s/helm-chart/eventhub/charts/api/templates/api-ingress.yaml

@ -0,0 +1,26 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Release.Name }}-{{ .Chart.Name }}-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
nginx.ingress.kubernetes.io/proxy-buffer-size: "{{ .Values.global.nginxProxyBufferSize }}"
nginx.ingress.kubernetes.io/proxy-buffers-number: "{{ .Values.global.nginxProxyBuffersNumber }}"
cert-manager.io/cluster-issuer: letsencrypt
spec:
tls:
- hosts:
- {{ .Values.global.apiDomain }}
secretName: {{ .Release.Name }}-{{ .Chart.Name }}-tls
rules:
- host: "{{ .Values.global.apiDomain }}"
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ .Release.Name }}-{{ .Chart.Name }}
port:
number: 80

14
etc/k8s/helm-chart/eventhub/charts/api/templates/api-service.yaml

@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
labels:
name: {{ .Release.Name }}-{{ .Chart.Name }}
name: {{ .Release.Name }}-{{ .Chart.Name }}
spec:
ports:
- name: "80"
port: 80
- name: "443"
port: 443
selector:
app: {{ .Release.Name }}-{{ .Chart.Name }}

27
etc/k8s/helm-chart/eventhub/charts/api/templates/api.yaml

@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-{{ .Chart.Name }}
spec:
selector:
matchLabels:
app: {{ .Release.Name }}-{{ .Chart.Name }}
template:
metadata:
labels:
app: {{ .Release.Name }}-{{ .Chart.Name }}
spec:
containers:
- image: {{ .Values.containerImage }}
imagePullPolicy: {{ .Values.global.imagePullPolicy }}
name: {{ .Release.Name }}-{{ .Chart.Name }}
ports:
- name: http
containerPort: 80
- name: https
containerPort: 443
env:
{{ include "eventhub.global.env" . | indent 8 }}
- name: "ConnectionStrings__Default"
value: {{ .Values.global.defaultConnString }}

0
etc/k8s/helm-chart/eventhub/charts/api/values.yaml

6
etc/k8s/helm-chart/eventhub/charts/background-services/Chart.yaml

@ -0,0 +1,6 @@
apiVersion: v2
name: background-services
appVersion: "1.0"
description: EventHub Background Services Application
version: 1.0.0
type: application

18
etc/k8s/helm-chart/eventhub/charts/background-services/templates/background-services.yaml

@ -0,0 +1,18 @@
apiVersion: batch/v1
kind: Job
metadata:
name: {{ .Release.Name }}-{{ .Chart.Name }}
spec:
activeDeadlineSeconds: 180
template:
spec:
containers:
- name: {{ .Release.Name }}-{{ .Chart.Name }}
image: {{ .Values.containerImage }}
imagePullPolicy: {{ .Values.global.imagePullPolicy }}
env:
{{ include "eventhub.global.env" . | indent 8 }}
- name: "ConnectionStrings__Default"
value: {{ .Values.global.defaultConnString }}
restartPolicy: Never
backoffLimit: 10

0
etc/k8s/helm-chart/eventhub/charts/background-services/values.yaml

6
etc/k8s/helm-chart/eventhub/charts/dbmigrator/Chart.yaml

@ -0,0 +1,6 @@
apiVersion: v2
name: dbmigrator
appVersion: "1.0"
description: EventHub Migrator Application
version: 1.0.0
type: application

24
etc/k8s/helm-chart/eventhub/charts/dbmigrator/templates/migrator.yaml

@ -0,0 +1,24 @@
apiVersion: batch/v1
kind: Job
metadata:
name: {{ .Release.Name }}-{{ .Chart.Name }}
spec:
activeDeadlineSeconds: 180
template:
spec:
containers:
- name: {{ .Release.Name }}-{{ .Chart.Name }}
image: {{ .Values.containerImage }}
imagePullPolicy: {{ .Values.global.imagePullPolicy }}
env:
{{ include "eventhub.global.env" . | indent 8 }}
- name: "ConnectionStrings__Default"
value: {{ .Values.global.defaultConnString }}
- name: "IdentityServer__Clients__EventHub_Web__RootUrl"
value: {{ .Values.global.wwwUrl }}
- name: "IdentityServer__Clients__EventHub_Blazor__RootUrl"
value: {{ .Values.global.adminUrl }}
- name: "IdentityServer__Clients__EventHub_Swagger__RootUrl"
value: {{ .Values.global.apiUrl }}
restartPolicy: Never
backoffLimit: 10

0
etc/k8s/helm-chart/eventhub/charts/dbmigrator/values.yaml

6
etc/k8s/helm-chart/eventhub/charts/postgresql/Chart.yaml

@ -0,0 +1,6 @@
apiVersion: v2
name: postgresql
appVersion: "1.0"
description: Runs PostgreSQL Instance
version: 1.0.0
type: application

14
etc/k8s/helm-chart/eventhub/charts/postgresql/templates/postgresql-service.yaml

@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
labels:
name: {{ .Release.Name }}-{{ .Chart.Name }}
name: {{ .Release.Name }}-{{ .Chart.Name }}
spec:
type: ClusterIP
ports:
- name: postgresql
port: 5432
selector:
app: {{ .Release.Name }}-{{ .Chart.Name }}

43
etc/k8s/helm-chart/eventhub/charts/postgresql/templates/postgresql.yaml

@ -0,0 +1,43 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ .Release.Name }}-{{ .Chart.Name }}
spec:
serviceName: {{ .Release.Name }}-{{ .Chart.Name }}
replicas: 1
selector:
matchLabels:
app: {{ .Release.Name }}-{{ .Chart.Name }}
template:
metadata:
labels:
app: {{ .Release.Name }}-{{ .Chart.Name }}
spec:
containers:
- image: postgres
name: {{ .Release.Name }}-{{ .Chart.Name }}
{{- if eq .Release.Name "eh-az" }}
volumeMounts:
- mountPath: "/var/lib/postgresql/data"
name: {{ .Release.Name }}-{{ .Chart.Name }}-database-volume
subPath: postgresql-data
{{- end }}
ports:
- name: postgresql
containerPort: 5432
env:
- name: POSTGRES_USER
value: "root"
- name: POSTGRES_PASSWORD
value: "root"
{{- if eq .Release.Name "eh-az" }}
volumeClaimTemplates:
- metadata:
name: {{ .Release.Name }}-{{ .Chart.Name }}-database-volume
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: "managed-premium-retain"
resources:
requests:
storage: 64Gi
{{- end }}

0
etc/k8s/helm-chart/eventhub/charts/postgresql/values.yaml

6
etc/k8s/helm-chart/eventhub/charts/redis/Chart.yaml

@ -0,0 +1,6 @@
apiVersion: v2
name: redis
appVersion: "1.0"
description: Runs Redis instance
version: 1.0.0
type: application

13
etc/k8s/helm-chart/eventhub/charts/redis/templates/redis-service.yaml

@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
labels:
name: {{ .Release.Name }}-{{ .Chart.Name }}
name: {{ .Release.Name }}-{{ .Chart.Name }}
spec:
type: ClusterIP
ports:
- name: redis
port: 6379
selector:
app: {{ .Release.Name }}-{{ .Chart.Name }}

20
etc/k8s/helm-chart/eventhub/charts/redis/templates/redis.yaml

@ -0,0 +1,20 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-{{ .Chart.Name }}
spec:
replicas: 1
selector:
matchLabels:
app: {{ .Release.Name }}-{{ .Chart.Name }}
template:
metadata:
labels:
app: {{ .Release.Name }}-{{ .Chart.Name }}
spec:
containers:
- image: redis:6.0.10-alpine
name: {{ .Release.Name }}-{{ .Chart.Name }}
ports:
- name: redis
containerPort: 6379

0
etc/k8s/helm-chart/eventhub/charts/redis/values.yaml

6
etc/k8s/helm-chart/eventhub/charts/www/Chart.yaml

@ -0,0 +1,6 @@
apiVersion: v2
name: www
appVersion: "1.0"
description: EventHub WWW Application
version: 1.0.0
type: application

36
etc/k8s/helm-chart/eventhub/charts/www/templates/www-ingress.yaml

@ -0,0 +1,36 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Release.Name }}-{{ .Chart.Name }}-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
nginx.ingress.kubernetes.io/proxy-buffer-size: "{{ .Values.global.nginxProxyBufferSize }}"
nginx.ingress.kubernetes.io/proxy-buffers-number: "{{ .Values.global.nginxProxyBuffersNumber }}"
{{- if eq .Release.Name "eh-az" }}
nginx.ingress.kubernetes.io/from-to-www-redirect: "true"
{{- end }}
cert-manager.io/cluster-issuer: letsencrypt
spec:
tls:
- hosts:
- {{ .Values.global.wwwDomain }}
{{- if eq .Release.Name "eh-az" }}
- {{ print "www." .Values.global.wwwDomain }}
{{- end }}
secretName: {{ .Release.Name }}-{{ .Chart.Name }}-tls
rules:
{{- if eq .Release.Name "eh-az" }}
- host: "{{ print "www." .Values.global.wwwDomain }}"
{{- else }}
- host: "{{ .Values.global.wwwDomain }}"
{{- end }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ .Release.Name }}-{{ .Chart.Name }}
port:
number: 80

14
etc/k8s/helm-chart/eventhub/charts/www/templates/www-service.yaml

@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
labels:
name: {{ .Release.Name }}-{{ .Chart.Name }}
name: {{ .Release.Name }}-{{ .Chart.Name }}
spec:
ports:
- name: "80"
port: 80
- name: "443"
port: 443
selector:
app: {{ .Release.Name }}-{{ .Chart.Name }}

24
etc/k8s/helm-chart/eventhub/charts/www/templates/www.yaml

@ -0,0 +1,24 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-{{ .Chart.Name }}
spec:
selector:
matchLabels:
app: {{ .Release.Name }}-{{ .Chart.Name }}
template:
metadata:
labels:
app: {{ .Release.Name }}-{{ .Chart.Name }}
spec:
containers:
- image: {{ .Values.containerImage }}
imagePullPolicy: {{ .Values.global.imagePullPolicy }}
name: {{ .Release.Name }}-{{ .Chart.Name }}
ports:
- name: http
containerPort: 80
- name: https
containerPort: 443
env:
{{ include "eventhub.global.env" . | indent 8 }}

0
etc/k8s/helm-chart/eventhub/charts/www/values.yaml

24
etc/k8s/helm-chart/eventhub/templates/_helpers.tpl

@ -0,0 +1,24 @@
{{- define "eventhub.global.env" -}}
- name: "DOTNET_ENVIRONMENT"
value: "{{ .Values.global.dotnetEnvironment }}"
- name: "AppUrls__Account"
value: "{{ .Values.global.accountUrl }}"
- name: "AppUrls__Www"
value: "{{ .Values.global.wwwUrl }}"
- name: "AppUrls__Api"
value: "{{ .Values.global.apiUrl }}"
- name: "AppUrls__ApiInternal"
value: "{{ .Values.global.apiUrlInternal }}"
- name: "AppUrls__Admin"
value: "{{ .Values.global.adminUrl }}"
- name: "AppUrls__AdminApi"
value: "{{ .Values.global.adminApiUrl }}"
- name: "Redis__Configuration"
value: "{{ .Values.global.redisConfiguration }}"
- name: "AuthServer__Authority"
value: "{{ .Values.global.internalAuthServerAuthority }}"
- name: "AuthServer__RequireHttpsMetadata"
value: "{{ .Values.global.internalAuthServerRequireHttpsMetadata }}"
- name: "StringEncryption__DefaultPassPhrase"
value: "{{ .Values.global.stringEncryptionDefaultPassPhrase }}"
{{- end }}

11
etc/k8s/helm-chart/eventhub/templates/managed-premium-retain.yaml

@ -0,0 +1,11 @@
{{- if eq .Release.Name "eh-az" }}
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: managed-premium-retain
provisioner: kubernetes.io/azure-disk
reclaimPolicy: Retain
parameters:
storageaccounttype: Premium_LRS
kind: Managed
{{- end }}

35
etc/k8s/helm-chart/eventhub/values.azure.yaml

@ -0,0 +1,35 @@
global:
dotnetEnvironment: 'Production'
accountDomain: account.openeventhub.com
accountUrl: https://account.openeventhub.com
apiDomain: api.openeventhub.com
apiUrl: https://api.openeventhub.com
apiUrlInternal: http://eh-az-api
wwwDomain: openeventhub.com
wwwUrl: "https://www.openeventhub.com"
adminDomain: admin.openeventhub.com
adminUrl: https://admin.openeventhub.com
adminApiDomain: admin-api.openeventhub.com
adminApiUrl: https://admin-api.openeventhub.com
nginxProxyBufferSize: "32k"
nginxProxyBuffersNumber: "8"
defaultConnString: "Host=eh-az-postgresql;Port=5432;Database=EventHub;Username=root;Password=root"
redisConfiguration: "eh-az-redis"
internalAuthServerAuthority: "http://account.openeventhub.com"
internalAuthServerRequireHttpsMetadata: "false"
stringEncryptionDefaultPassPhrase: "TxVIZFPxK33czbbv"
imagePullPolicy: Always
account:
containerImage: "volocr.azurecr.io/eventhub.account"
api:
containerImage: "volocr.azurecr.io/eventhub.api"
www:
containerImage: "volocr.azurecr.io/eventhub.www"
admin-api:
containerImage: "volocr.azurecr.io/eventhub.admin-api"
admin:
containerImage: "volocr.azurecr.io/eventhub.admin"
dbmigrator:
containerImage: "volocr.azurecr.io/eventhub.dbmigrator"
background-services:
containerImage: "volocr.azurecr.io/eventhub.background-services"

35
etc/k8s/helm-chart/eventhub/values.yaml

@ -0,0 +1,35 @@
global:
dotnetEnvironment: 'Staging'
accountDomain: eh-st-account
accountUrl: https://eh-st-account
apiDomain: eh-st-api
apiUrl: https://eh-st-api
apiUrlInternal: http://eh-st-api
wwwDomain: eh-st-www
wwwUrl: "https://eh-st-www"
adminDomain: eh-st-admin
adminUrl: https://eh-st-admin
adminApiDomain: eh-st-admin-api
adminApiUrl: https://eh-st-admin-api
nginxProxyBufferSize: "32k"
nginxProxyBuffersNumber: "8"
defaultConnString: "Host=eh-st-postgresql;Port=5432;Database=EventHub;Username=root;Password=root"
redisConfiguration: "eh-st-redis"
internalAuthServerAuthority: "http://eh-st-account"
internalAuthServerRequireHttpsMetadata: "false"
stringEncryptionDefaultPassPhrase: "TxVIZFPxK33czbbv"
imagePullPolicy: Never
account:
containerImage: "eventhub.account"
api:
containerImage: "eventhub.api"
www:
containerImage: "eventhub.www"
admin-api:
containerImage: "eventhub.admin-api"
admin:
containerImage: "eventhub.admin"
dbmigrator:
containerImage: "eventhub.dbmigrator"
background-services:
containerImage: "eventhub.background-services"

63
etc/k8s/scripts/build-images.ps1

@ -0,0 +1,63 @@
$currentFolder = $PSScriptRoot
$slnFolder = Join-Path $currentFolder "../../../"
$dbmigratorFolder = Join-Path $slnFolder "src/EventHub.DbMigrator"
$webFolder = Join-Path $slnFolder "src/EventHub.Web"
$apiFolder = Join-Path $slnFolder "src/EventHub.HttpApi.Host"
$adminFolder = Join-Path $slnFolder "src/EventHub.Admin.Web"
$adminApiFolder = Join-Path $slnFolder "src/EventHub.Admin.HttpApi.Host"
$identityServerFolder = Join-Path $slnFolder "src/EventHub.IdentityServer"
$backgroundServicesFolder = Join-Path $slnFolder "src/EventHub.BackgroundServices"
### DB MIGRATOR
Write-Host "*** BUILDING DB MIGRATOR ****************" -ForegroundColor Green
Set-Location $dbmigratorFolder
dotnet publish -c Release
docker build -t eventhub.dbmigrator .
### WEB (WWW)
Write-Host "*** BUILDING WEB (WWW) ****************" -ForegroundColor Green
Set-Location $webFolder
dotnet publish -c Release
docker build -t eventhub.www .
### API
Write-Host "*** BUILDING API ****************" -ForegroundColor Green
Set-Location $apiFolder
dotnet publish -c Release
docker build -t eventhub.api .
### ADMIN (BLAZOR)
Write-Host "*** BUILDING ADMIN (BLAZOR) ****************" -ForegroundColor Green
Set-Location $adminFolder
dotnet publish -c Release
docker build -t eventhub.admin .
### ADMIN API
Write-Host "*** BUILDING ADMIN API ****************" -ForegroundColor Green
Set-Location $adminApiFolder
dotnet publish -c Release
docker build -t eventhub.admin-api .
### IDENTITY SERVER (ACCOUNT)
Write-Host "*** BUILDING IDENTITY SERVER (ACCOUNT) ****************" -ForegroundColor Green
Set-Location $identityServerFolder
dotnet publish -c Release
docker build -t eventhub.account .
### BACKGROUND SERVICES
Write-Host "*** BUILDING BACKGROUND SERVICES ****************" -ForegroundColor Green
Set-Location $backgroundServicesFolder
dotnet publish -c Release
docker build -t eventhub.background-services .
### ALL COMPLETED
Write-Host "ALL COMPLETED" -ForegroundColor Green
Set-Location $currentFolder

7
etc/k8s/scripts/minikube-load-images.ps1

@ -0,0 +1,7 @@
minikube image load eventhub.dbmigrator:latest
minikube image load eventhub.www:latest
minikube image load eventhub.api:latest
minikube image load eventhub.admin:latest
minikube image load eventhub.admin-api:latest
minikube image load eventhub.account:latest
minikube image load eventhub.background-services:latest

32
etc/notes/ui-design.md

@ -1,32 +0,0 @@
# UI Design Notes
## Implementing the Design
### Overall / Layout
* Home & Events are separated, so we should create a separation in the solution
### Home Page
* Search area:
* Language selection
* Location (country / city) search / with online option
* When (date range selection)
### Events Page
* Search area:
* Language selection
* Location (country / city) search / with online option
* When (date range selection)
## Features
### Should Implement for the Design
* ...
### Plan for Future
* Event & Organization Categories
* Event & Organization Tags (use the tagging system of CMS Kit)

23
localhost.conf

@ -1,23 +0,0 @@
[req]
default_bits = 2048
default_keyfile = localhost.key
distinguished_name = req_distinguished_name
req_extensions = req_ext
x509_extensions = v3_ca
[req_distinguished_name]
commonName = Common Name (e.g. server FQDN or YOUR name)
commonName_default = localhost
commonName_max = 64
[req_ext]
subjectAltName = @alt_names
[v3_ca]
subjectAltName = @alt_names
basicConstraints = critical, CA:false
keyUsage = keyCertSign, cRLSign, digitalSignature,keyEncipherment
[alt_names]
DNS.1 = localhost
DNS.2 = 127.0.0.1

23
manifests/deployment.eventhub.httpapi.host.yml

@ -1,23 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: volosoft-eventhub-httpapi-host-deployment
spec:
selector:
matchLabels:
app: volosoft-eventhub-httpapi-host-pod
template:
metadata:
labels:
app: volosoft-eventhub-httpapi-host-pod
spec:
containers:
- name: volosoft-eventhub-httpapi-host-container
image: voloeventhubhttpapihost.azurecr.io/voloeventhubhttpapihost
imagePullPolicy: Always
resources:
limits:
memory: "128Mi"
cpu: "500m"
ports:
- containerPort: 80

23
manifests/deployment.eventhub.identityserver.yml

@ -1,23 +0,0 @@
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
imagePullPolicy: Always
resources:
limits:
memory: "128Mi"
cpu: "500m"
ports:
- containerPort: 80

23
manifests/deployment.eventhub.web.yml

@ -1,23 +0,0 @@
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
imagePullPolicy: Always
resources:
limits:
memory: "128Mi"
cpu: "500m"
ports:
- containerPort: 80

19
manifests/deployment.yml

@ -1,19 +0,0 @@
apiVersion : apps/v1
kind: Deployment
metadata:
name: eventhubhttpapihost
spec:
replicas: 1
selector:
matchLabels:
app: eventhubhttpapihost
template:
metadata:
labels:
app: eventhubhttpapihost
spec:
containers:
- name: eventhubhttpapihost
image: eventhubregistry.azurecr.io/eventhubhttpapihost
ports:
- containerPort: 80

11
manifests/service.eventhub.httpapi.host.yml

@ -1,11 +0,0 @@
apiVersion: v1
kind: Service
metadata:
name: volosoft-eventhub-httpapi-host-service
spec:
selector:
app: volosoft-eventhub-httpapi-host-pod
ports:
- port: 5002
targetPort: 80
type: LoadBalancer

17
manifests/service.eventhub.identityserver.yml

@ -1,17 +0,0 @@
apiVersion: v1
kind: Service
metadata:
name: volosoft-eventhub-identityserver-service
spec:
selector:
app: volosoft-eventhub-identityserver-pod
ports:
- name: http
port: 5001
protocol: TCP
targetPort: 80
- name: https
port: 5000
targetPort: 443
protocol: TCP
type: LoadBalancer

11
manifests/service.eventhub.web.yml

@ -1,11 +0,0 @@
apiVersion: v1
kind: Service
metadata:
name: volosoft-eventhub-web-service
spec:
selector:
app: volosoft-eventhub-web-pod
ports:
- port: 8080
targetPort: 80
type: LoadBalancer

10
manifests/service.yml

@ -1,10 +0,0 @@
apiVersion: v1
kind: Service
metadata:
name: eventhubhttpapihost
spec:
type: LoadBalancer
ports:
- port: 80
selector:
app: eventhubhttpapihost

7
src/EventHub.Admin.Application.Contracts/EventHubAdminRemoteServiceConsts.cs

@ -0,0 +1,7 @@
namespace EventHub.Admin
{
public static class EventHubAdminRemoteServiceConsts
{
public const string RemoteServiceName = "EventHubAdmin";
}
}

20
src/EventHub.Admin.Application.Contracts/Organizations/IOrganizationAppService.cs

@ -0,0 +1,20 @@
using System;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
namespace EventHub.Admin.Organizations
{
public interface IOrganizationAppService : IApplicationService
{
Task<PagedResultDto<OrganizationInListDto>> GetListAsync(OrganizationListFilterDto input);
Task<OrganizationProfileDto> GetAsync(Guid id);
Task<OrganizationProfileDto> GetByNameAsync(string name);
Task<OrganizationProfileDto> UpdateAsync(Guid id, UpdateOrganizationDto input);
Task DeleteAsync(Guid id);
}
}

11
src/EventHub.Admin.Application.Contracts/Organizations/Memberships/IOrganizationMembershipAppService.cs

@ -0,0 +1,11 @@
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
namespace EventHub.Admin.Organizations.Memberships
{
public interface IOrganizationMembershipAppService : IApplicationService
{
Task<PagedResultDto<OrganizationMemberDto>> GetListAsync(OrganizationMemberListFilterDto input);
}
}

18
src/EventHub.Admin.Application.Contracts/Organizations/Memberships/OrganizationMemberDto.cs

@ -0,0 +1,18 @@
using System;
using Volo.Abp.Application.Dtos;
namespace EventHub.Admin.Organizations.Memberships
{
public class OrganizationMemberDto : EntityDto<Guid>
{
public string OrganizationName { get; set; }
public string UserName { get; set; }
public string Email { get; set; }
public string Name { get; set; }
public string Surname { get; set; }
}
}

12
src/EventHub.Admin.Application.Contracts/Organizations/Memberships/OrganizationMemberListFilterDto.cs

@ -0,0 +1,12 @@
using System;
using Volo.Abp.Application.Dtos;
namespace EventHub.Admin.Organizations.Memberships
{
public class OrganizationMemberListFilterDto : PagedResultRequestDto
{
public Guid? OrganizationId { get; set; }
public string UserName { get; set; }
}
}

14
src/EventHub.Admin.Application.Contracts/Organizations/OrganizationInListDto.cs

@ -0,0 +1,14 @@
using System;
using Volo.Abp.Application.Dtos;
namespace EventHub.Admin.Organizations
{
public class OrganizationInListDto : EntityDto<Guid>
{
public string Name { get; set; }
public string DisplayName { get; set; }
public int MemberCount { get; set; }
}
}

15
src/EventHub.Admin.Application.Contracts/Organizations/OrganizationListFilterDto.cs

@ -0,0 +1,15 @@
using Volo.Abp.Application.Dtos;
namespace EventHub.Admin.Organizations
{
public class OrganizationListFilterDto : PagedAndSortedResultRequestDto
{
public string Name { get; set; }
public string DisplayName { get; set; }
public int? MinMemberCount { get; set; }
public int? MaxMemberCount { get; set; }
}
}

32
src/EventHub.Admin.Application.Contracts/Organizations/OrganizationProfileDto.cs

@ -0,0 +1,32 @@
using System;
using Volo.Abp.Application.Dtos;
namespace EventHub.Admin.Organizations
{
public class OrganizationProfileDto : EntityDto<Guid>
{
public string Name { get; set; }
public string DisplayName { get; set; }
public byte[] ProfilePictureContent { get; set; }
public string OwnerUserName { get; set; }
public string OwnerEmail { get; set; }
public string Description { get; set; }
public string Website { get; set; }
public string TwitterUsername { get; set; }
public string GitHubUsername { get; set; }
public string FacebookUsername { get; set; }
public string InstagramUsername { get; set; }
public string MediumUsername { get; set; }
}
}

44
src/EventHub.Admin.Application.Contracts/Organizations/UpdateOrganizationDto.cs

@ -0,0 +1,44 @@
using System.ComponentModel.DataAnnotations;
using EventHub.Organizations;
using JetBrains.Annotations;
namespace EventHub.Admin.Organizations
{
public class UpdateOrganizationDto
{
[Required]
[StringLength(OrganizationConsts.MaxDisplayNameLength, MinimumLength = OrganizationConsts.MinDisplayNameLength)]
public string DisplayName { get; set; }
[Required]
[StringLength(OrganizationConsts.MaxDescriptionNameLength, MinimumLength = OrganizationConsts.MinDescriptionNameLength)]
public string Description { get; set; }
[CanBeNull]
public byte[] ProfilePictureContent { get; set; }
[CanBeNull]
[StringLength(OrganizationConsts.MaxWebsiteLength)]
public string Website { get; set; }
[CanBeNull]
[StringLength(OrganizationConsts.MaxTwitterUsernameLength)]
public string TwitterUsername { get; set; }
[CanBeNull]
[StringLength(OrganizationConsts.MaxGitHubUsernameLength)]
public string GitHubUsername { get; set; }
[CanBeNull]
[StringLength(OrganizationConsts.MaxFacebookUsernameLength)]
public string FacebookUsername { get; set; }
[CanBeNull]
[StringLength(OrganizationConsts.MaxInstagramUsernameLength)]
public string InstagramUsername { get; set; }
[CanBeNull]
[StringLength(OrganizationConsts.MaxMediumUsernameLength)]
public string MediumUsername { get; set; }
}
}

9
src/EventHub.Admin.Application.Contracts/Permissions/EventHubPermissionDefinitionProvider.cs

@ -8,10 +8,13 @@ namespace EventHub.Admin.Permissions
{
public override void Define(IPermissionDefinitionContext context)
{
var myGroup = context.AddGroup(EventHubPermissions.GroupName);
var eventHubGroup = context.AddGroup(EventHubPermissions.GroupName);
//Define your own permissions here. Example:
//myGroup.AddPermission(EventHubPermissions.MyPermission1, L("Permission:MyPermission1"));
var organizationsPermission = eventHubGroup.AddPermission(EventHubPermissions.Organizations.Default, L("Permission:OrganizationManagement"));
organizationsPermission.AddChild(EventHubPermissions.Organizations.Create, L("Permission:Create"));
organizationsPermission.AddChild(EventHubPermissions.Organizations.Update, L("Permission:Edit"));
organizationsPermission.AddChild(EventHubPermissions.Organizations.Delete, L("Permission:Delete"));
organizationsPermission.AddChild(EventHubPermissions.Organizations.Memberships.Default, L("Permission:MembershipManagement"));
}
private static LocalizableString L(string name)

14
src/EventHub.Admin.Application.Contracts/Permissions/EventHubPermissions.cs

@ -4,7 +4,17 @@
{
public const string GroupName = "EventHub";
//Add your own permission names. Example:
//public const string MyPermission1 = GroupName + ".MyPermission1";
public static class Organizations
{
public const string Default = GroupName + ".Organizations";
public const string Create = Default + ".Create";
public const string Update = Default + ".Update";
public const string Delete = Default + ".Delete";
public static class Memberships
{
public const string Default = Organizations.Default + ".Memberships";
}
}
}
}

13
src/EventHub.Admin.Application/EventHubAdminAppService.cs

@ -0,0 +1,13 @@
using EventHub.Localization;
using Volo.Abp.Application.Services;
namespace EventHub.Admin
{
public class EventHubAdminAppService : ApplicationService
{
protected EventHubAdminAppService()
{
LocalizationResource = typeof(EventHubResource);
}
}
}

11
src/EventHub.Admin.Application/EventHubAdminApplicationModule.cs

@ -1,4 +1,5 @@
using Volo.Abp.Account;
using Volo.Abp.AutoMapper;
using Volo.Abp.Identity;
using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement;
@ -10,9 +11,17 @@ namespace EventHub.Admin
typeof(AbpAccountApplicationModule),
typeof(EventHubAdminApplicationContractsModule),
typeof(AbpIdentityApplicationModule),
typeof(AbpPermissionManagementApplicationModule)
typeof(AbpPermissionManagementApplicationModule),
typeof(AbpAutoMapperModule)
)]
public class EventHubAdminApplicationModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpAutoMapperOptions>(options =>
{
options.AddProfile<EventHubAdminApplicationAutoMapperProfile>(validate: true);
});
}
}
}

24
src/EventHub.Admin.Application/EventHubApplicationAutoMapperProfile.cs

@ -0,0 +1,24 @@
using AutoMapper;
using EventHub.Admin.Organizations;
using EventHub.Admin.Organizations.Memberships;
using EventHub.Organizations;
using EventHub.Organizations.Memberships;
using Volo.Abp.AutoMapper;
namespace EventHub.Admin
{
public class EventHubAdminApplicationAutoMapperProfile : Profile
{
public EventHubAdminApplicationAutoMapperProfile()
{
CreateMap<Organization, OrganizationInListDto>();
CreateMap<Organization, OrganizationProfileDto>()
.Ignore(x => x.OwnerUserName)
.Ignore(x => x.OwnerEmail)
.Ignore(x => x.ProfilePictureContent);
CreateMap<OrganizationMemberWithDetails, OrganizationMemberDto>();
}
}
}

53
src/EventHub.Admin.Application/Organizations/Memberships/OrganizationMembershipAppService.cs

@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using EventHub.Admin.Permissions;
using EventHub.Organizations.Memberships;
using Microsoft.AspNetCore.Authorization;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Identity;
namespace EventHub.Admin.Organizations.Memberships
{
[Authorize(EventHubPermissions.Organizations.Memberships.Default)]
public class OrganizationMembershipAppService : ApplicationService, IOrganizationMembershipAppService
{
private readonly IOrganizationMembershipRepository _organizationMembershipRepository;
private readonly IRepository<IdentityUser, Guid> _userRepository;
public OrganizationMembershipAppService(
IOrganizationMembershipRepository organizationMembershipRepository,
IRepository<IdentityUser, Guid> userRepository)
{
_organizationMembershipRepository = organizationMembershipRepository;
_userRepository = userRepository;
}
public async Task<PagedResultDto<OrganizationMemberDto>> GetListAsync(OrganizationMemberListFilterDto input)
{
IdentityUser user = null;
if (!input.UserName.IsNullOrWhiteSpace())
{
input.UserName = input.UserName.ToLower();
user = await _userRepository.SingleOrDefaultAsync(x => x.UserName.ToLower() == input.UserName);
if (user is null)
{
throw new BusinessException(EventHubErrorCodes.UserNotFound)
.WithData("UserName", input.UserName);
}
}
var members = await _organizationMembershipRepository.GetMemberListAsync(input.OrganizationId, user?.Id, input.SkipCount, input.MaxResultCount);
var totalCount = await _organizationMembershipRepository.GetCountAsync(input.OrganizationId, user?.Id);
return new PagedResultDto<OrganizationMemberDto>(
totalCount,
ObjectMapper.Map<List<OrganizationMemberWithDetails>, List<OrganizationMemberDto>>(members)
);
}
}
}

161
src/EventHub.Admin.Application/Organizations/OrganizationAppService.cs

@ -0,0 +1,161 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Threading.Tasks;
using EventHub.Admin.Permissions;
using EventHub.Organizations;
using Microsoft.AspNetCore.Authorization;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.BlobStoring;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Identity;
namespace EventHub.Admin.Organizations
{
[Authorize(EventHubPermissions.Organizations.Default)]
public class OrganizationAppService : EventHubAdminAppService, IOrganizationAppService
{
private readonly IRepository<Organization, Guid> _organizationRepository;
private readonly IRepository<IdentityUser, Guid> _identityUserRepository;
private readonly IBlobContainer<OrganizationProfilePictureContainer> _organizationBlobContainer;
public OrganizationAppService(
IRepository<Organization, Guid> organizationRepository,
IRepository<IdentityUser, Guid> identityUserRepository,
IBlobContainer<OrganizationProfilePictureContainer> organizationBlobContainer)
{
_organizationRepository = organizationRepository;
_identityUserRepository = identityUserRepository;
_organizationBlobContainer = organizationBlobContainer;
}
public async Task<PagedResultDto<OrganizationInListDto>> GetListAsync(OrganizationListFilterDto input)
{
var query = await _organizationRepository.GetQueryableAsync();
if (!input.Name.IsNullOrWhiteSpace())
{
input.Name = input.Name.ToLower();
query = query.Where(o => o.Name.ToLower().Contains(input.Name));
}
if (!input.DisplayName.IsNullOrWhiteSpace())
{
input.DisplayName = input.DisplayName.ToLower();
query = query.Where(o => o.DisplayName.ToLower().Contains(input.DisplayName));
}
if (input.MinMemberCount != null)
{
query = query.Where(o => o.MemberCount >= input.MinMemberCount);
}
if (input.MaxMemberCount != null)
{
query = query.Where(o => o.MemberCount <= input.MaxMemberCount);
}
var totalCount = await AsyncExecuter.CountAsync(query);
query = query.OrderBy(string.IsNullOrWhiteSpace(input.Sorting)
? OrganizationConsts.DefaultSorting
: input.Sorting);
query = query.PageBy(input);
var organizationListDto = ObjectMapper
.Map<List<Organization>, List<OrganizationInListDto>>(await AsyncExecuter.ToListAsync(query));
return new PagedResultDto<OrganizationInListDto>(totalCount, organizationListDto);
}
public async Task<OrganizationProfileDto> GetAsync(Guid id)
{
var organization = await _organizationRepository.GetAsync(id);
return await CreateOrganizationProfileDto(organization);
}
public async Task<OrganizationProfileDto> GetByNameAsync(string name)
{
var organization = await _organizationRepository.FindAsync(x => x.Name.ToLower() == name.ToLower());
if (organization is null)
{
throw new BusinessException(EventHubErrorCodes.OrganizationNotFound)
.WithData("OrganizationName", name);
}
return await CreateOrganizationProfileDto(organization);
}
[Authorize(EventHubPermissions.Organizations.Update)]
public async Task<OrganizationProfileDto> UpdateAsync(Guid id, UpdateOrganizationDto input)
{
var organization = await _organizationRepository.GetAsync(id);
organization.SetDisplayName(input.DisplayName);
organization.SetDescription(input.Description);
organization.Website = input.Website;
organization.TwitterUsername = input.TwitterUsername;
organization.GitHubUsername = input.GitHubUsername;
organization.FacebookUsername = input.FacebookUsername;
organization.InstagramUsername = input.InstagramUsername;
organization.MediumUsername = input.MediumUsername;
if (input.ProfilePictureContent?.Length > 0)
{
await SaveCoverImageAsync(organization.Id, input.ProfilePictureContent);
}
else
{
await DeleteCoverImageAsync(organization.Id);
}
await _organizationRepository.UpdateAsync(organization);
return ObjectMapper.Map<Organization, OrganizationProfileDto>(organization);
}
[Authorize(EventHubPermissions.Organizations.Delete)]
public async Task DeleteAsync(Guid id)
{
await _organizationRepository.DeleteAsync(id);
}
private async Task<OrganizationProfileDto> CreateOrganizationProfileDto(Organization organization)
{
var dto = ObjectMapper.Map<Organization, OrganizationProfileDto>(organization);
var user = await _identityUserRepository.GetAsync(organization.OwnerUserId);
dto.OwnerUserName = user.UserName;
dto.OwnerEmail = user.Email;
dto.ProfilePictureContent = await GetCoverImageAsync(organization.Id);
return dto;
}
private async Task<byte[]> GetCoverImageAsync(Guid id)
{
var blobName = id.ToString();
return await _organizationBlobContainer.GetAllBytesOrNullAsync(blobName);
}
private async Task SaveCoverImageAsync(Guid id, byte[] coverImageContent)
{
var blobName = id.ToString();
await _organizationBlobContainer.SaveAsync(blobName, coverImageContent, overrideExisting: true);
}
private async Task DeleteCoverImageAsync(Guid id)
{
var blobName = id.ToString();
await _organizationBlobContainer.DeleteAsync(blobName);
}
}
}

30
src/EventHub.Admin.HttpApi.Host/Controllers/Organizations/Memberships/OrganizationMembershipController.cs

@ -0,0 +1,30 @@
using System.Threading.Tasks;
using EventHub.Admin.Organizations.Memberships;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.AspNetCore.Mvc;
namespace EventHub.Admin.Controllers.Organizations.Memberships
{
[RemoteService(Name = EventHubAdminRemoteServiceConsts.RemoteServiceName)]
[Controller]
[Area("eventhub-admin")]
[ControllerName("OrganizationMembership")]
[Route("/api/eventhub/admin/organization-membership")]
public class OrganizationMembershipController : AbpController, IOrganizationMembershipAppService
{
private readonly IOrganizationMembershipAppService _organizationMembershipAppService;
public OrganizationMembershipController(IOrganizationMembershipAppService organizationMembershipAppService)
{
_organizationMembershipAppService = organizationMembershipAppService;
}
[HttpGet]
public async Task<PagedResultDto<OrganizationMemberDto>> GetListAsync(OrganizationMemberListFilterDto input)
{
return await _organizationMembershipAppService.GetListAsync(input);
}
}
}

58
src/EventHub.Admin.HttpApi.Host/Controllers/Organizations/OrganizationController.cs

@ -0,0 +1,58 @@
using System;
using System.Threading.Tasks;
using EventHub.Admin.Organizations;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.AspNetCore.Mvc;
namespace EventHub.Admin.Controllers.Organizations
{
[RemoteService(Name = EventHubAdminRemoteServiceConsts.RemoteServiceName)]
[Controller]
[Area("eventhub-admin")]
[ControllerName("Organization")]
[Route("/api/eventhub/admin/organization")]
public class OrganizationController : AbpController, IOrganizationAppService
{
private readonly IOrganizationAppService _organizationAppService;
public OrganizationController(IOrganizationAppService organizationAppService)
{
_organizationAppService = organizationAppService;
}
[HttpGet]
public Task<PagedResultDto<OrganizationInListDto>> GetListAsync(OrganizationListFilterDto input)
{
return _organizationAppService.GetListAsync(input);
}
[HttpGet]
[Route("{id}")]
public Task<OrganizationProfileDto> GetAsync(Guid id)
{
return _organizationAppService.GetAsync(id);
}
[HttpGet]
[Route("by-name/{name}")]
public Task<OrganizationProfileDto> GetByNameAsync(string name)
{
return _organizationAppService.GetByNameAsync(name);
}
[HttpPut]
public Task<OrganizationProfileDto> UpdateAsync(Guid id, UpdateOrganizationDto input)
{
return _organizationAppService.UpdateAsync(id, input);
}
[HttpDelete]
[Route("{id}")]
public Task DeleteAsync(Guid id)
{
return _organizationAppService.DeleteAsync(id);
}
}
}

4
src/EventHub.Admin.HttpApi.Host/Dockerfile

@ -0,0 +1,4 @@
FROM mcr.microsoft.com/dotnet/aspnet:5.0
COPY bin/Release/net5.0/publish/ app/
WORKDIR /app
ENTRYPOINT ["dotnet", "EventHub.Admin.HttpApi.Host.dll"]

18
src/EventHub.Admin.HttpApi.Host/EventHubAdminHttpApiHostModule.cs

@ -3,7 +3,9 @@ using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using EventHub.Admin.Utils;
using EventHub.EntityFrameworkCore;
using EventHub.Web;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Cors;
@ -54,6 +56,7 @@ namespace EventHub.Admin
ConfigureVirtualFileSystem(context);
ConfigureRedis(context, configuration);
ConfigureCors(context, configuration);
ConfigureCookies(context);
ConfigureSwaggerServices(context, configuration);
ConfigureBackgroundJobs();
}
@ -109,7 +112,7 @@ namespace EventHub.Admin
private static void ConfigureSwaggerServices(ServiceConfigurationContext context, IConfiguration configuration)
{
context.Services.AddAbpSwaggerGenWithOAuth(
configuration["AuthServer:Authority"],
configuration[EventHubUrlOptions.GetAccountConfigKey()],
new Dictionary<string, string>
{
{"EventHubAdmin", "EventHub Admin API"}
@ -148,10 +151,7 @@ namespace EventHub.Admin
{
builder
.WithOrigins(
configuration["App:CorsOrigins"]
.Split(",", StringSplitOptions.RemoveEmptyEntries)
.Select(o => o.RemovePostFix("/"))
.ToArray()
configuration[EventHubUrlOptions.GetAdminConfigKey()]
)
.WithAbpExposedHeaders()
.SetIsOriginAllowedToAllowWildcardSubdomains()
@ -162,6 +162,11 @@ namespace EventHub.Admin
});
}
private void ConfigureCookies(ServiceConfigurationContext context)
{
context.Services.AddSameSiteCookiePolicy();
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var app = context.GetApplicationBuilder();
@ -194,8 +199,9 @@ namespace EventHub.Admin
app.UseErrorPage();
}
app.UseCookiePolicy();
app.UseCorrelationId();
app.UseVirtualFiles();
app.UseStaticFiles();
app.UseRouting();
app.UseCors(DefaultCorsPolicyName);
app.UseAuthentication();

2
src/EventHub.Admin.HttpApi.Host/Program.cs

@ -20,9 +20,7 @@ namespace EventHub.Admin
.MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning)
.Enrich.FromLogContext()
.WriteTo.Async(c => c.File("Logs/logs.txt"))
#if DEBUG
.WriteTo.Async(c => c.Console())
#endif
.CreateLogger();
try

71
src/EventHub.Admin.HttpApi.Host/Utils/SameSiteCookiesServiceCollectionExtensions.cs

@ -0,0 +1,71 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
namespace EventHub.Admin.Utils
{
public static class SameSiteCookiesServiceCollectionExtensions
{
public static IServiceCollection AddSameSiteCookiePolicy(this IServiceCollection services)
{
services.Configure<CookiePolicyOptions>(options =>
{
options.MinimumSameSitePolicy = SameSiteMode.Unspecified;
options.OnAppendCookie = cookieContext =>
CheckSameSite(cookieContext.Context, cookieContext.CookieOptions);
options.OnDeleteCookie = cookieContext =>
CheckSameSite(cookieContext.Context, cookieContext.CookieOptions);
});
return services;
}
private static void CheckSameSite(HttpContext httpContext, CookieOptions options)
{
if (options.SameSite == SameSiteMode.None)
{
var userAgent = httpContext.Request.Headers["User-Agent"].ToString();
if (!httpContext.Request.IsHttps || DisallowsSameSiteNone(userAgent))
{
// For .NET Core < 3.1 set SameSite = (SameSiteMode)(-1)
options.SameSite = SameSiteMode.Unspecified;
}
}
}
private static bool DisallowsSameSiteNone(string userAgent)
{
// Cover all iOS based browsers here. This includes:
// - Safari on iOS 12 for iPhone, iPod Touch, iPad
// - WkWebview on iOS 12 for iPhone, iPod Touch, iPad
// - Chrome on iOS 12 for iPhone, iPod Touch, iPad
// All of which are broken by SameSite=None, because they use the iOS networking stack
if (userAgent.Contains("CPU iPhone OS 12") || userAgent.Contains("iPad; CPU OS 12"))
{
return true;
}
// Cover Mac OS X based browsers that use the Mac OS networking stack. This includes:
// - Safari on Mac OS X.
// This does not include:
// - Chrome on Mac OS X
// Because they do not use the Mac OS networking stack.
if (userAgent.Contains("Macintosh; Intel Mac OS X 10_14") &&
userAgent.Contains("Version/") && userAgent.Contains("Safari"))
{
return true;
}
// Cover Chrome 50-69, because some versions are broken by SameSite=None,
// and none in this range require it.
// Note: this covers some pre-Chromium Edge versions,
// but pre-Chromium Edge does not require SameSite=None.
if (userAgent.Contains("Chrome/5") || userAgent.Contains("Chrome/6"))
{
return true;
}
return false;
}
}
}

2
src/EventHub.Admin.HttpApi.Host/appsettings.Development.json

@ -1,2 +0,0 @@
{
}

8
src/EventHub.Admin.HttpApi.Host/appsettings.json

@ -1,20 +1,14 @@
{
"App": {
"CorsOrigins": "https://*.openeventhub.com,https://localhost:44307,https://localhost:44308"
},
"ConnectionStrings": {
"Default": "Host=localhost;Database=EventHub;Username=root;Password=root;Port=5432"
},
"Redis": {
"Configuration": "127.0.0.1"
"Configuration": "localhost"
},
"AuthServer": {
"Authority": "https://localhost:44313",
"RequireHttpsMetadata": "true",
"SwaggerClientId": "EventHub_Swagger",
"SwaggerClientSecret": "1q2w3e*"
},
"StringEncryption": {
"DefaultPassPhrase": "TxVIZFPxK33czbbv"
}
}

3
src/EventHub.Admin.Web/Dockerfile

@ -0,0 +1,3 @@
FROM nginx:latest
COPY ./bin/Release/net5.0/publish/wwwroot/ /usr/share/nginx/html/
COPY ./nginx.conf /etc/nginx/conf.d/default.conf

4
src/EventHub.Admin.Web/EventHub.Admin.Web.csproj

@ -11,8 +11,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Blazorise.Bootstrap" Version="0.9.3-preview6" />
<PackageReference Include="Blazorise.Icons.FontAwesome" Version="0.9.3-preview6" />
<PackageReference Include="Blazorise.Bootstrap" Version="0.9.3.5" />
<PackageReference Include="Blazorise.Icons.FontAwesome" Version="0.9.3.5" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.*" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="5.0.*" />
</ItemGroup>

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save