diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml new file mode 100644 index 0000000..005fbe6 --- /dev/null +++ b/azure-pipelines-1.yml @@ -0,0 +1,72 @@ +# Deploy to Azure Kubernetes Service +# Build and push image to Azure Container Registry; Deploy to Azure Kubernetes Service +# https://docs.microsoft.com/azure/devops/pipelines/languages/docker + +trigger: +- main + + +variables: + + # Container registry service connection established during pipeline creation + dockerRegistryServiceConnection: 'be4690ca-0fbe-4473-a10e-c45c2a32a3c1' + 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) + + - publish: manifests + artifact: manifests + +- stage: Deploy + displayName: Deploy stage + dependsOn: Build + + jobs: + - deployment: Deploy + displayName: Deploy-HttpApi.Host + timeoutInMinutes: 60 # how long to run the job before automatically cancelling + cancelTimeoutInMinutes: 30 # how much time to give 'run always even if cancelled tasks' before stopping them + pool: + vmImage: $(vmImageName) + environment: 'voloeventhubhttpapihost.default' + strategy: + runOnce: + deploy: + steps: + + + - task: KubernetesManifest@0 + displayName: Deploy to Kubernetes cluster + inputs: + action: deploy + namespace: default + manifests: | + $(Pipeline.Workspace)/manifests/deployment.eventhub.httpapi.host.yml + $(Pipeline.Workspace)/manifests/service.eventhub.httpapi.host.yml + containers: | + $(containerRegistry)/$(imageRepository):$(tag) + diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..3e52e35 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,71 @@ +# Deploy to Azure Kubernetes Service +# Build and push image to Azure Container Registry; Deploy to Azure Kubernetes Service +# https://docs.microsoft.com/azure/devops/pipelines/languages/docker + +trigger: +- main + + +variables: + + # Container registry service connection established during pipeline creation + dockerRegistryServiceConnection: '1ae4ab3c-b39a-4860-b6dc-683cc524d1e4' + imageRepository: 'volosofteventhub' + 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) + + - publish: manifests + artifact: manifests + +- stage: Deploy + displayName: Deploy stage + dependsOn: Build + + jobs: + - deployment: Deploy + displayName: Deploy-EventHub.Web + timeoutInMinutes: 60 # how long to run the job before automatically cancelling + cancelTimeoutInMinutes: 30 # how much time to give 'run always even if cancelled tasks' before stopping them + pool: + vmImage: $(vmImageName) + environment: 'voloeventhub.default' + strategy: + runOnce: + deploy: + steps: + + + - task: KubernetesManifest@0 + displayName: Deploy to Kubernetes cluster + inputs: + action: deploy + manifests: | + $(Pipeline.Workspace)/manifests/deployment.eventhub.web.yml + $(Pipeline.Workspace)/manifests/service.eventhub.web.yml + containers: | + $(containerRegistry)/$(imageRepository):$(tag) + diff --git a/manifests/deployment.yml b/manifests/deployment.yml new file mode 100644 index 0000000..fe913f5 --- /dev/null +++ b/manifests/deployment.yml @@ -0,0 +1,19 @@ +apiVersion : apps/v1 +kind: Deployment +metadata: + name: volosofteventhub +spec: + replicas: 1 + selector: + matchLabels: + app: volosofteventhub + template: + metadata: + labels: + app: volosofteventhub + spec: + containers: + - name: volosofteventhub + image: voloeventhub.azurecr.io/volosofteventhub + ports: + - containerPort: 8080 \ No newline at end of file diff --git a/manifests/service.yml b/manifests/service.yml new file mode 100644 index 0000000..669ae56 --- /dev/null +++ b/manifests/service.yml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: Service +metadata: + name: volosofteventhub +spec: + type: LoadBalancer + ports: + - port: 8080 + selector: + app: volosofteventhub \ No newline at end of file