Skip to content

Commit c003d45

Browse files
authored
Feature/tye kubernetes (#26)
* Tye: add sqlserver; add ingress - Use sqlserver as a service - Refactor by using - configuration.GetConnectionString of Tye * Deploy on Kubernetes - Enabled ingress with NGINX-Ingress Controller - Don't use password for Redis - Install Redis, Seq, Zipkin, SqlServer via Helm * Update README * Update github workflow
1 parent b425352 commit c003d45

File tree

28 files changed

+489
-158
lines changed

28 files changed

+489
-158
lines changed

.github/workflows/ci-simple-microservices.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ on:
55
push:
66
branches:
77
- master
8-
paths-ignore:
9-
- README.md
10-
- assets/**
11-
- Helm/**
8+
paths:
9+
- 'src/**'
1210
pull_request:
1311
branches:
1412
- master
13+
paths:
14+
- 'src/**'
1515

1616
jobs:
1717
build:

.helm/README.md

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
2+
# How to install to Kubernetes
3+
4+
## Prerequisites
5+
6+
1. Docker for Desktop with ready Kubernetes
7+
2. Helm 3
8+
9+
## Getting Started
10+
11+
### Add repositories for Helm
12+
13+
```powershell
14+
helm repo add bitnami https://charts.bitnami.com/bitnami
15+
```
16+
17+
```powershell
18+
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
19+
```
20+
21+
```powershell
22+
helm repo add stable https://kubernetes-charts.storage.googleapis.com/
23+
```
24+
25+
```powershell
26+
helm repo add carlosjgp https://carlosjgp.github.io/open-charts/
27+
```
28+
29+
```powershell
30+
helm repo add dapr https://daprio.azurecr.io/helm/v1/repo
31+
```
32+
33+
```powershell
34+
helm repo update
35+
```
36+
37+
### Install Helm's charts
38+
39+
Open PowerShell at `D:\forks-netcore\tye\samples\dapr\helm\`
40+
41+
1. Install MS SqlServer
42+
43+
```powershell
44+
helm install sqlserver stable/mssql-linux --version 0.11.2 -f .\sqlserver.dev.yaml
45+
```
46+
47+
1. Install Redis
48+
49+
```powershell
50+
helm install redis bitnami/redis -f .\redis.dev.yaml
51+
```
52+
53+
1. Install NGINX Ingress Controller
54+
55+
```powershell
56+
helm install nginx ingress-nginx/ingress-nginx
57+
```
58+
59+
1. Install Seq
60+
61+
```powershell
62+
helm install seq stable/seq --version 2.2.0 -f .\seq.dev.yaml
63+
```
64+
65+
1. Install Zipkin
66+
67+
```powershell
68+
helm install zipkin carlosjgp/zipkin --version 0.2.0 -f .\zipkin.dev.yaml
69+
```
70+
71+
### Install Dapr and its components
72+
73+
1. Install Dapr on Kubernetes
74+
75+
```powershell
76+
helm install dapr dapr/dapr
77+
```
78+
79+
1. Install Dapr's components
80+
81+
```poweshell
82+
kubectl apply -f .\components
83+
```
84+
85+
### Deploy our services via Tye
86+
87+
1. Tye deploy
88+
89+
```powershell
90+
tye deploy ..\tye-k8s.yaml --interactive
91+
```
92+
93+
1. **Notes:** We'll be asked to input the following
94+
95+
- Enter the connection string to use for service 'sqlserver':
96+
> Data Source=sqlserver,1433;User Id=sa;Password=P@ssword;MultipleActiveResultSets=True
97+
98+
- Enter the URI to use for service 'zipkin':
99+
> http://zipkin-collector:9411/api/v2/spans
100+
101+
- Enter the URI to use for service 'seq':
102+
> http://seq:5341
103+
104+
1. Deploy Ingress
105+
106+
```powershell
107+
kubectl apply -f .\k8s
108+
```
109+
110+
1. Add hosts
111+
112+
```text
113+
127.0.0.1 seq.mydomain.com
114+
127.0.0.1 ingestion.seq.mydomain.com
115+
116+
127.0.0.1 zipkin.mydomain.com
117+
127.0.0.1 collector.zipkin.mydomain.com
118+
119+
127.0.0.1 simplestore-graphql-api.local
120+
```
121+
122+
## How to use
123+
124+
1. Open browser with the following addresses
125+
126+
- Logging: `http://seq.mydomain.com`
127+
- Tracing: `http://zipkin.mydomain.com`
128+
- Store Application: `http://simplestore-graphql-api.local`
129+
130+
2. To access sqlserver
131+
132+
- Forward port **1433**
133+
```powershell
134+
kubectl port-forward service/sqlserver 1433:1433
135+
```
136+
- Use the following information to access
137+
- Server Name: **127.0.0.1,1433**
138+
- Login: **sa**
139+
- Password: **P@ssword**
140+
141+
## Cleanup
142+
143+
```powershell
144+
tye undeploy ..\tye-k8s.yaml
145+
146+
helm uninstall sqlserver redis seq zipkin nginx dapr
147+
148+
kubectl delete -f .\components
149+
150+
kubectl delete -f .\k8s
151+
```

.helm/components/pubsub.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: dapr.io/v1alpha1
2+
kind: Component
3+
metadata:
4+
name: messagebus
5+
spec:
6+
type: pubsub.redis
7+
metadata:
8+
- name: redisHost
9+
value: redis-master:6379
10+
- name: redisPassword
11+
value: ""
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: dapr.io/v1alpha1
22
kind: Configuration
33
metadata:
4-
name: simplestore-config
4+
name: simplestore-dapr-config
55
spec:
66
tracing:
77
samplingRate: "1"

.helm/components/statestore.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: dapr.io/v1alpha1
2+
kind: Component
3+
metadata:
4+
name: default
5+
spec:
6+
type: state.redis
7+
metadata:
8+
- name: redisHost
9+
value: redis-master:6379
10+
- name: redisPassword
11+
value: ""
12+
- name: actorStateStore
13+
value: "true"

.helm/components/zipkin.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: dapr.io/v1alpha1
2+
kind: Component
3+
metadata:
4+
name: zipkin
5+
namespace: default
6+
spec:
7+
type: exporters.zipkin
8+
metadata:
9+
- name: enabled
10+
value: "true"
11+
- name: exporterAddress
12+
value: "http://zipkin-collector:9411/api/v2/spans"

.helm/k8s/ingress.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: extensions/v1beta1
2+
kind: Ingress
3+
metadata:
4+
name: ingress-basic
5+
namespace: default
6+
annotations:
7+
kubernetes.io/ingress.class: nginx
8+
nginx.ingress.kubernetes.io/ssl-redirect: "false"
9+
nginx.ingress.kubernetes.io/rewrite-target: /
10+
spec:
11+
rules:
12+
- host: simplestore-graphql-api.local
13+
http:
14+
paths:
15+
- backend:
16+
serviceName: graphql-api
17+
servicePort: 80
18+
path: /

.helm/redis.dev.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## https://github.com/helm/charts/blob/master/stable/redis/values.yaml
2+
3+
image:
4+
repository: bitnami/redis
5+
tag: latest
6+
pullPolicy: IfNotPresent
7+
8+
cluster:
9+
enabled: true
10+
slaveCount: 1
11+
12+
usePassword: false
13+
14+
# Redis port
15+
redisPort: 6379
16+
17+
master:
18+
service:
19+
## Redis Master Service type
20+
type: ClusterIP
21+
port: 6379

.helm/seq.dev.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
## https://github.com/helm/charts/blob/master/stable/seq/values.yaml
2+
3+
4+
fullnameOverride: seq
5+
6+
image:
7+
repository: datalust/seq
8+
tag: latest
9+
10+
persistence:
11+
enabled: false
12+
auth:
13+
enabled: false
14+
15+
acceptEULA: "Y"
16+
17+
ingress:
18+
annotations:
19+
kubernetes.io/ingress.class: nginx
20+
21+
ui:
22+
ingress:
23+
enabled: true
24+
path: /
25+
hosts:
26+
- seq.mydomain.com
27+
ingestion:
28+
ingress:
29+
enabled: true
30+
path: /
31+
hosts:
32+
- ingestion.seq.mydomain.com
33+
34+

.helm/sqlserver.dev.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## https://github.com/helm/charts/blob/master/stable/mssql-linux/values.yaml
2+
3+
fullnameOverride: sqlserver
4+
image:
5+
repository: mcr.microsoft.com/mssql/server
6+
tag: 2017-latest
7+
pullPolicy: IfNotPresent
8+
9+
service:
10+
port: 1433
11+
12+
acceptEula:
13+
value: "Y"
14+
edition:
15+
value: "Developer"
16+
persistence:
17+
enabled: false
18+
resources:
19+
limits:
20+
cpu: 1
21+
memory: 1Gi
22+
requests:
23+
cpu: 0.5
24+
memory: 1Gi
25+
sapassword: "P@ssword"

0 commit comments

Comments
 (0)