Skip to content

Commit

Permalink
chore: k8s locally
Browse files Browse the repository at this point in the history
  • Loading branch information
radoslavirha committed Dec 12, 2023
1 parent 0703e54 commit 6bb010f
Show file tree
Hide file tree
Showing 8 changed files with 185 additions and 14 deletions.
5 changes: 2 additions & 3 deletions infra/k8s/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/cont

Just append to `/etc/hosts`

```
```sh
127.0.0.1 hikers-book.dev.info
127.0.0.1 api.hikers-book.dev.info
```
Expand Down Expand Up @@ -65,8 +65,7 @@ Set permissions on folder!
skaffold dev
```

3. [Visit hikers-book.dev](hikers-book.dev)

3. [Visit hikers-book.dev.info](hikers-book.dev.info)

## TODO

Expand Down
130 changes: 130 additions & 0 deletions infra/k8s/api-authentication.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@ spec:
- name: api-authentication-configmap-volume
configMap:
name: api-authentication-configmap
- name: api-authentication-configmap-keys-volume
configMap:
name: api-authentication-configmap-keys
containers:
- name: api-authentication
image: radoslavirha/hikers-book-api-authentication
imagePullPolicy: IfNotPresent
volumeMounts:
- mountPath: /app/api/authentication/config
name: api-authentication-configmap-volume
- mountPath: /app/api/authentication/keys
name: api-authentication-configmap-keys-volume
---
apiVersion: v1
kind: ConfigMap
Expand All @@ -31,13 +36,138 @@ metadata:
data:
production.json: |
{
"frontend": {
"url": "http://hikers-book.dev.info"
},
"auth": {
"facebook": {
"clientID": "your-app-id",
"clientSecret": "your-client-secret",
"callbackURL": "http://api.hikers-book.dev.info/auth/auth/provider/facebook/callback"
},
"github": {
"clientID": "your-app-id",
"clientSecret": "your-client-secret",
"callbackURL": "http://api.hikers-book.dev.info/auth/auth/provider/github/callback"
},
"google": {
"clientID": "your-app-id",
"clientSecret": "your-client-secret",
"callbackURL": "http://api.hikers-book.dev.info/auth/auth/provider/google/callback"
}
},
"jwt": {
"expiresIn": "1m",
"expiresInRefresh": "1w"
},
"mongodb": {
"url": "mongodb://mongodb-authentication-srv:27017/auth",
"connectionOptions": {}
},
"nodemailer": {
"service": "iCloud",
"from": "email@icloud.com",
"auth": {
"user": "email@icloud.com",
"pass": "pass"
}
},
"redis": {
"default": {
"host": "redis-srv",
"port": 6379,
"username": "",
"password": ""
}
}
}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: api-authentication-configmap-keys
data:
access.pem: |
-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCpfzYwM1E9dOBo
id0PUsqSpI7cUpEnAoFUgGV+zbtC85PySNrlarLJRc09Pb0++NFhspDwJLLm3Akn
QQzrpwIL92R1EkdpIpuAqj7Y5lCdKWtysVp3OPvTaKhab8IYqVDyvG/MRc+/eQ7+
5KpDEmM5GCxTe1S+RV1oc6ZiQ74yOOQZXQOPo0v9CJtbdP/+DBOEk+3CZF7fYnOE
V0us5MVPbCG11X22c/j7xvfBgTbZ5d2LgebYPz840/p+6fjMtg/ZZLT95Ympogkd
7r4Xkd80MIb8K76AAA3e5tE4+HE04AQ5U6mI1yvbIhgosuthPJcQDGdt3XyrqL95
qW0TmgtdAgMBAAECggEADQvJ66CCN/JqChcqblvXVGguyCM2zEOIxCyfI0kfM8Jf
IylGZ/LJe20lpKQUOpJDk3sqEBcoX1U/rcd3q3UPAZrIyate1xHJ2aJrn0hC8Nss
9lv+SZTs6n3GD4fwmZ4BVAhQVpm8/tDePZzzb0wtWkn+XMKZEuLF6MdAtD7glymN
FNyjmNZSNn93kQPmhmdqmB097bDCzNrkkeLY1AexgCSXd44PV+Cns+EFVzP/BWsc
MD8/N5unTGjukRvJKSc5oy6ZKB3iJ9yw8S4iWxpEFfcX237ArM0utXSt11SAAJoB
vfXOCL7xJrB7bEXbV66ApJ5PhFWnNSOfXHwr/CTKwQKBgQDZIPNrz/CftCc5e9xF
z6QHFB9s83VN2QIj4taaMpkIgqvX4Q11Q6nHa7f+OdsxfHK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wm2jq0E7/izcW0qFLLPxbJN+7ioyNpl/OKi+WV912ls0
WceQxHFzH6IrzscQZl4rslk8PyE3bjpOsga52Vlwg1Bf8Q8hJnAHvMUS6bw828bW
jSP6Tfb9jjuNszUZt/TPuGqhBj73cMUily5xBqji3fP1dE80u9wpMLYV6cTBME2D
BwIDAQAB
-----END PUBLIC KEY-----
---
apiVersion: v1
kind: Service
metadata:
name: authentication-srv
Expand Down
15 changes: 15 additions & 0 deletions infra/k8s/api-graphql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,24 @@ metadata:
data:
production.json: |
{
"apis": {
"hikersBook": {
"authenticationAPI": "http://authentication-srv:4000",
"stagesAPI": "http://stages-srv:4000",
"tripsAPI": "http://trips-srv:4000"
}
},
"mongodb": {
"url": "mongodb://mongodb-graphql-srv:27017/graphql",
"connectionOptions": {}
},
"redis": {
"default": {
"host": "redis-srv",
"port": 6379,
"username": "",
"password": ""
}
}
}
---
Expand Down
13 changes: 13 additions & 0 deletions infra/k8s/api-stages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,22 @@ metadata:
data:
production.json: |
{
"apis": {
"hikersBook": {
"authenticationAPI": "http://authentication-srv:4000"
}
},
"mongodb": {
"url": "mongodb://mongodb-stages-srv:27017/stages",
"connectionOptions": {}
},
"redis": {
"default": {
"host": "redis-srv",
"port": 6379,
"username": "",
"password": ""
}
}
}
---
Expand Down
13 changes: 13 additions & 0 deletions infra/k8s/api-trips.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,22 @@ metadata:
data:
production.json: |
{
"apis": {
"hikersBook": {
"authenticationAPI": "http://authentication-srv:4000"
}
},
"mongodb": {
"url": "mongodb://mongodb-trips-srv:27017/trips",
"connectionOptions": {}
},
"redis": {
"default": {
"host": "redis-srv",
"port": 6379,
"username": "",
"password": ""
}
}
}
---
Expand Down
3 changes: 2 additions & 1 deletion infra/k8s/mongodb-authentication.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ kind: Service
metadata:
name: mongodb-authentication-srv
spec:
type: ClusterIP
selector:
app: mongodb-authentication
ports:
- name: db
- name: client
protocol: TCP
port: 27017
targetPort: 27017
18 changes: 9 additions & 9 deletions infra/k8s/mongodb-graphql.yaml → infra/k8s/redis.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: mongodb-graphql-deployment
name: redis-deployment
spec:
replicas: 1
selector:
matchLabels:
app: mongodb-graphql
app: redis
template:
metadata:
labels:
app: mongodb-graphql
app: redis
spec:
containers:
- name: mongodb-graphql
image: mongo
- name: redis
image: redis
---
apiVersion: v1
kind: Service
metadata:
name: mongodb-graphql-srv
name: redis-srv
spec:
selector:
app: mongodb-graphql
app: redis
ports:
- name: db
protocol: TCP
port: 27017
targetPort: 27017
port: 6379
targetPort: 6379
2 changes: 1 addition & 1 deletion infra/k8s/ui-hikers-book.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ data:
config.json: |
{
"api": {
"authentication": "http://api.hikers-book.dev.info/auth/v1",
"authentication": "http://api.hikers-book.dev.info/auth",
"graphql": "http://api.hikers-book.dev.info/graphql/v1/graphql",
"stages": "http://api.hikers-book.dev.info/stages/v1",
"trips": "http://api.hikers-book.dev.info/trips/v1"
Expand Down

0 comments on commit 6bb010f

Please sign in to comment.