Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kubernetes deployment bugfix #315

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions deployment/kubernetes/config.json.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"system": {
"host": "${DOMAIN_NAME}",
"port": "443",
"protocol": "https",
"logger" : {
"dir": "./logs",
"maxFiles" : "7d",
"level" : "debug",
"morganOption" : null
},
"subDomainCookies": false,
"muteNotifications": false
},
"express":{
"key" : "${EXPRESS_KEY}"
},
"apn" : {
"gateway": "gateway.push.apple.com",
"cert": "certs/aps/aps_production_cert.pem",
"key": "certs/aps/aps_production_key.pem",
"passphrase": "passphrase"
},
"gcm" : {
"jid": "[email protected]",
"password": "password"
},
"ifttt" : {
"iftttChannelKey" : "key",
"iftttTestToken" : "token"
},
"mail": {
"host" : "smtp",
"port" : 465,
"user" : "${SMTP_USER}",
"pass" : "${SMTP_PASSWORD}"
},
"mongodb": {
"hosts": ["mongodb"],
"db": "openhab",
"user": "${MONGO_USER}",
"password": "${MONGO_PASSWORD}"
},
"redis": {
"host": "redis",
"port": "6379",
"password": "123_openHAB"
},
"mailer": {
"host" : "smtp",
"port": 465,
"secureConnection": true,
"user": "${SMTP_USER}",
"password": "${SMTP_PASSWORD}",
"from": "openHAB Cloud <[email protected]>"
},
"legal": {
"terms" : "",
"policy": ""
},
"registration_enabled": false
}
5 changes: 5 additions & 0 deletions deployment/kubernetes/kubernetes-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ kubectl create namespace $KUBERNETES_NAMESPACE

kubectl create serviceaccount $KUBERNETES_ACCOUNT --namespace $KUBERNETES_NAMESPACE

# Creating configMap volumes

kubectl create configmap openhab-config --from-file=./config.json.template --namespace $KUBERNETES_NAMESPACE
kubectl create -f openhabcloud_env_k8.yml --namespace $KUBERNETES_NAMESPACE
kubectl create -f openhabcloud_secrets_k8.yml --namespace $KUBERNETES_NAMESPACE

### Create openHAB-cloud from template

Expand Down
8 changes: 8 additions & 0 deletions deployment/kubernetes/openhabcloud_env_k8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: openhab-env
data:
COMPOSE_PROJECT_NAME: "openhab-cloud"
DOMAIN_NAME: "<your_domain_name>"
EMAIL: "<your_email>"
71 changes: 58 additions & 13 deletions deployment/kubernetes/openhabcloud_ephemeral_k8_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,17 @@ items:
org.openhab.cloud.service: redis
status:
loadBalancer: {}
- apiVersion: extensions/v1beta1
- apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: storageclass-mongo
provisioner: kubernetes.io/gce-pd
parameters:
type: pd-standard
fstype: ext4
replication-type: none
reclaimPolicy: Retain
- apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
Expand All @@ -89,26 +99,42 @@ items:
org.openhab.cloud.service: app-1
spec:
containers:
- image: docker.io/openhab/openhabcloud-app
- image: docker.io/mariomastrorilli/openhabcloud-app:latest
name: app-1
ports:
- containerPort: 3000
resources: {}
envFrom:
- configMapRef:
name: openhab-env
- secretRef:
name: openhab-secrets
workingDir: /opt/openhabcloud
command: ["./run-app.sh"]
volumeMounts:
- name: config-storage
mountPath: /opt/openhabcloud/config.json.template
subPath: config.json.template
restartPolicy: Always
volumes:
- name: config-storage
configMap:
name: openhab-config
selector:
matchLabels:
org.openhab.cloud.service: app-1
status: {}
- apiVersion: extensions/v1beta1
kind: Deployment
- apiVersion: apps/v1
kind: StatefulSet
metadata:
annotations:
creationTimestamp: null
labels:
org.openhab.cloud.service: mongodb
name: mongodb
spec:
serviceName: "mongodb"
replicas: 1
strategy:
type: Recreate
template:
metadata:
creationTimestamp: null
Expand All @@ -118,7 +144,6 @@ items:
containers:
- args:
- mongod
- --smallfiles
- --bind_ip_all
image: bitnami/mongodb:latest
name: mongodb
Expand All @@ -127,17 +152,31 @@ items:
resources: {}
volumeMounts:
- mountPath: /data/db
name: mongodb-empty0
name: mongodb-vc
- mountPath: /data/configdb
name: mongodb-empty1
restartPolicy: Always
volumes:
- emptyDir: {}
name: mongodb-empty0
- emptyDir: {}
name: mongodb-empty1
status: {}
- apiVersion: extensions/v1beta1
securityContext:
fsGroup: 2000
volumeClaimTemplates:
- metadata:
name: mongodb-vc
spec:
storageClassName: storageclass-mongo
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
selector:
matchLabels:
org.openhab.cloud.service: mongodb
status:
replicas: 1
- apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
Expand Down Expand Up @@ -169,8 +208,11 @@ items:
volumes:
- emptyDir: {}
name: app-1
selector:
matchLabels:
org.openhab.cloud.service: nginx
status: {}
- apiVersion: extensions/v1beta1
- apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
Expand All @@ -197,6 +239,9 @@ items:
- containerPort: 6379
resources: {}
restartPolicy: Always
selector:
matchLabels:
org.openhab.cloud.service: redis
status: {}
kind: List
metadata: {}
Expand Down
11 changes: 11 additions & 0 deletions deployment/kubernetes/openhabcloud_secrets_k8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Secret
metadata:
name: openhab-secrets
type: Opaque
stringData:
EXPRESS_KEY: "<random_secret_string>"
SMTP_USER: "<your smtp username>"
SMTP_PASSWORD: "<your smtp password>"
MONGO_USER: "<your mongo username>"
MONGO_PASSWORD: "<your mongo password>"