mirror of https://github.com/abpframework/eventhub
164 changed files with 5779 additions and 746 deletions
@ -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"] |
|||
@ -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"] |
|||
@ -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"] |
|||
@ -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) |
|||
|
|||
@ -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) |
|||
|
|||
@ -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) |
|||
|
|||
@ -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) |
|||
|
|||
@ -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) |
|||
|
|||
@ -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' |
|||
@ -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 |
|||
@ -0,0 +1,2 @@ |
|||
kubectl apply -f .\corednsms.yaml |
|||
kubectl delete pod --namespace kube-system -l k8s-app=kube-dns |
|||
@ -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 |
|||
@ -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} |
|||
@ -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 |
|||
Binary file not shown.
@ -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*`. |
|||
@ -0,0 +1 @@ |
|||
helm upgrade --install eh-az eventhub -f .\eventhub\values.azure.yaml --namespace eventhub --create-namespace |
|||
@ -0,0 +1,6 @@ |
|||
apiVersion: v2 |
|||
name: eventhub |
|||
appVersion: "1.0" |
|||
description: EventHub solution |
|||
version: 1.0.0 |
|||
type: application |
|||
@ -0,0 +1,6 @@ |
|||
apiVersion: v2 |
|||
name: account |
|||
appVersion: "1.0" |
|||
description: EventHub Account Application |
|||
version: 1.0.0 |
|||
type: application |
|||
@ -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 |
|||
@ -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 }} |
|||
@ -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,0 +1,6 @@ |
|||
apiVersion: v2 |
|||
name: admin-api |
|||
appVersion: "1.0" |
|||
description: EventHub Admin API Application |
|||
version: 1.0.0 |
|||
type: application |
|||
@ -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 |
|||
@ -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 }} |
|||
@ -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,0 +1,6 @@ |
|||
apiVersion: v2 |
|||
name: admin |
|||
appVersion: "1.0" |
|||
description: EventHub Admin Application |
|||
version: 1.0.0 |
|||
type: application |
|||
@ -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 |
|||
@ -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 }} |
|||
@ -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,0 +1,6 @@ |
|||
apiVersion: v2 |
|||
name: api |
|||
appVersion: "1.0" |
|||
description: EventHub API Application |
|||
version: 1.0.0 |
|||
type: application |
|||
@ -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 |
|||
@ -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 }} |
|||
@ -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,0 +1,6 @@ |
|||
apiVersion: v2 |
|||
name: background-services |
|||
appVersion: "1.0" |
|||
description: EventHub Background Services Application |
|||
version: 1.0.0 |
|||
type: application |
|||
@ -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,0 +1,6 @@ |
|||
apiVersion: v2 |
|||
name: dbmigrator |
|||
appVersion: "1.0" |
|||
description: EventHub Migrator Application |
|||
version: 1.0.0 |
|||
type: application |
|||
@ -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,0 +1,6 @@ |
|||
apiVersion: v2 |
|||
name: postgresql |
|||
appVersion: "1.0" |
|||
description: Runs PostgreSQL Instance |
|||
version: 1.0.0 |
|||
type: application |
|||
@ -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 }} |
|||
|
|||
@ -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,0 +1,6 @@ |
|||
apiVersion: v2 |
|||
name: redis |
|||
appVersion: "1.0" |
|||
description: Runs Redis instance |
|||
version: 1.0.0 |
|||
type: application |
|||
@ -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 }} |
|||
@ -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,0 +1,6 @@ |
|||
apiVersion: v2 |
|||
name: www |
|||
appVersion: "1.0" |
|||
description: EventHub WWW Application |
|||
version: 1.0.0 |
|||
type: application |
|||
@ -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 |
|||
@ -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 }} |
|||
@ -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,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 }} |
|||
@ -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 }} |
|||
@ -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" |
|||
@ -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" |
|||
@ -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 |
|||
@ -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 |
|||
@ -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) |
|||
@ -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 |
|||
@ -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 |
|||
@ -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 |
|||
@ -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 |
|||
@ -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 |
|||
@ -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 |
|||
@ -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 |
|||
@ -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 |
|||
@ -1,10 +0,0 @@ |
|||
apiVersion: v1 |
|||
kind: Service |
|||
metadata: |
|||
name: eventhubhttpapihost |
|||
spec: |
|||
type: LoadBalancer |
|||
ports: |
|||
- port: 80 |
|||
selector: |
|||
app: eventhubhttpapihost |
|||
@ -0,0 +1,7 @@ |
|||
namespace EventHub.Admin |
|||
{ |
|||
public static class EventHubAdminRemoteServiceConsts |
|||
{ |
|||
public const string RemoteServiceName = "EventHubAdmin"; |
|||
} |
|||
} |
|||
@ -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); |
|||
} |
|||
} |
|||
@ -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); |
|||
} |
|||
} |
|||
@ -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; } |
|||
} |
|||
} |
|||
@ -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; } |
|||
} |
|||
} |
|||
@ -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; } |
|||
} |
|||
} |
|||
@ -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; } |
|||
} |
|||
} |
|||
@ -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; } |
|||
} |
|||
} |
|||
@ -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; } |
|||
} |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
using EventHub.Localization; |
|||
using Volo.Abp.Application.Services; |
|||
|
|||
namespace EventHub.Admin |
|||
{ |
|||
public class EventHubAdminAppService : ApplicationService |
|||
{ |
|||
protected EventHubAdminAppService() |
|||
{ |
|||
LocalizationResource = typeof(EventHubResource); |
|||
} |
|||
} |
|||
} |
|||
@ -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>(); |
|||
} |
|||
} |
|||
} |
|||
@ -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) |
|||
); |
|||
} |
|||
} |
|||
} |
|||
@ -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); |
|||
} |
|||
} |
|||
} |
|||
@ -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); |
|||
} |
|||
} |
|||
} |
|||
@ -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); |
|||
} |
|||
} |
|||
} |
|||
@ -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"] |
|||
@ -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; |
|||
} |
|||
} |
|||
} |
|||
@ -1,2 +0,0 @@ |
|||
{ |
|||
} |
|||
@ -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" |
|||
} |
|||
} |
|||
|
|||
@ -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 |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue