Skip to content

Commit 15b493b

Browse files
committed
Added local cluster deployment (CD)
1 parent 0ca3f2c commit 15b493b

File tree

4 files changed

+68
-37
lines changed

4 files changed

+68
-37
lines changed

.github/workflows/dotnet.yml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979
fail_ci_if_error: true
8080
verbose: true
8181

82-
deploy:
82+
build and push to DockerHub:
8383
needs: [build, test]
8484
runs-on: ubuntu-latest
8585
steps:
@@ -98,4 +98,31 @@ jobs:
9898
context: .
9999
file: ./Forums/Dockerfile
100100
push: true
101-
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/forums:latest
101+
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/forums:latest
102+
103+
deploy to minikube:
104+
needs: [build and test to DockerHub]
105+
runs-on: ubuntu-latest
106+
name: build example and deploy to minikube
107+
steps:
108+
- uses: actions/checkout@v2
109+
- name: Start minikube
110+
uses: medyagh/setup-minikube@master
111+
- name: Try the cluster !
112+
run: kubectl get pods -A
113+
- name: Build image
114+
run: |
115+
export SHELL=/bin/bash
116+
eval $(minikube -p minikube docker-env)
117+
docker build -f ./Forums/Dockerfile -t markgoertz/forums .
118+
echo -n "verifying images:"
119+
docker images
120+
- name: Deploy to minikube
121+
run:
122+
kubectl apply -f deploy-to-minikube.yaml
123+
- name: Test service URLs
124+
run: |
125+
minikube service list
126+
minikube service example --url
127+
echo "------------------opening the service------------------"
128+
curl $(minikube service example --url)

Forums/Program.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,8 @@
55
using Microsoft.EntityFrameworkCore;
66
using CommandsMediatR = ForumsService.Application.Command;
77
using QueriesMediatR = ForumsService.Application.Query;
8-
using ForumsService.Application.Consumer;
9-
using ForumsService.Application.Worker;
108
using MassTransit;
11-
using Microsoft.Extensions.Configuration;
129
using Forums.Models;
13-
using System.Diagnostics;
1410
using FeedMessages.Application.Notifications;
1511

1612
var builder = WebApplication.CreateBuilder(args);

ForumsService.API/Worker/WorkerBus.cs

Lines changed: 0 additions & 31 deletions
This file was deleted.

k8s/deploy-to-minikube.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: forums
5+
spec:
6+
selector:
7+
matchLabels:
8+
app: forums
9+
replicas: 2
10+
template:
11+
metadata:
12+
labels:
13+
app: forums
14+
spec:
15+
containers:
16+
- name: forums-api
17+
imagePullPolicy: Never
18+
image: local/forums:latest
19+
resources:
20+
limits:
21+
cpu: 50m
22+
memory: 100Mi
23+
requests:
24+
cpu: 25m
25+
memory: 10Mi
26+
ports:
27+
- containerPort: 7070
28+
---
29+
apiVersion: v1
30+
kind: Service
31+
metadata:
32+
name: forums
33+
spec:
34+
type: NodePort
35+
selector:
36+
app: forums
37+
ports:
38+
- port: 7070
39+
targetPort: 7070

0 commit comments

Comments
 (0)