2019-03-05 13:41:45 +02:00
|
|
|
#
|
2020-01-06 16:52:41 +02:00
|
|
|
# Copyright © 2016-2020 The Thingsboard Authors
|
2019-03-05 13:41:45 +02:00
|
|
|
#
|
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
|
#
|
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
#
|
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
|
# limitations under the License.
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
apiVersion: v1
|
|
|
|
|
kind: PersistentVolumeClaim
|
|
|
|
|
metadata:
|
|
|
|
|
name: postgres-pv-claim
|
|
|
|
|
namespace: thingsboard
|
|
|
|
|
labels:
|
|
|
|
|
app: postgres
|
|
|
|
|
spec:
|
|
|
|
|
accessModes:
|
|
|
|
|
- ReadWriteOnce
|
|
|
|
|
resources:
|
|
|
|
|
requests:
|
|
|
|
|
storage: 5Gi
|
|
|
|
|
---
|
2020-01-10 13:15:09 +02:00
|
|
|
apiVersion: apps/v1
|
2019-03-05 13:41:45 +02:00
|
|
|
kind: Deployment
|
|
|
|
|
metadata:
|
|
|
|
|
name: postgres
|
|
|
|
|
namespace: thingsboard
|
|
|
|
|
labels:
|
|
|
|
|
app: postgres
|
|
|
|
|
spec:
|
2020-01-10 13:15:09 +02:00
|
|
|
selector:
|
|
|
|
|
matchLabels:
|
|
|
|
|
app: postgres
|
2019-03-05 13:41:45 +02:00
|
|
|
template:
|
|
|
|
|
metadata:
|
|
|
|
|
labels:
|
|
|
|
|
app: postgres
|
|
|
|
|
spec:
|
|
|
|
|
volumes:
|
|
|
|
|
- name: postgres-data
|
|
|
|
|
persistentVolumeClaim:
|
|
|
|
|
claimName: postgres-pv-claim
|
|
|
|
|
containers:
|
|
|
|
|
- name: postgres
|
|
|
|
|
imagePullPolicy: Always
|
|
|
|
|
image: postgres:9.6
|
|
|
|
|
ports:
|
|
|
|
|
- containerPort: 5432
|
|
|
|
|
name: postgres
|
|
|
|
|
env:
|
|
|
|
|
- name: POSTGRES_DB
|
|
|
|
|
value: "thingsboard"
|
2019-03-27 13:22:19 +00:00
|
|
|
- name: PGDATA
|
|
|
|
|
value: /var/lib/postgresql/data/pgdata
|
2019-03-05 13:41:45 +02:00
|
|
|
volumeMounts:
|
|
|
|
|
- mountPath: /var/lib/postgresql/data
|
|
|
|
|
name: postgres-data
|
|
|
|
|
livenessProbe:
|
|
|
|
|
exec:
|
|
|
|
|
command:
|
|
|
|
|
- pg_isready
|
|
|
|
|
- -h
|
|
|
|
|
- localhost
|
|
|
|
|
- -U
|
|
|
|
|
- postgres
|
|
|
|
|
initialDelaySeconds: 60
|
|
|
|
|
timeoutSeconds: 30
|
|
|
|
|
readinessProbe:
|
|
|
|
|
exec:
|
|
|
|
|
command:
|
|
|
|
|
- pg_isready
|
|
|
|
|
- -h
|
|
|
|
|
- localhost
|
|
|
|
|
- -U
|
|
|
|
|
- postgres
|
|
|
|
|
initialDelaySeconds: 5
|
|
|
|
|
timeoutSeconds: 1
|
|
|
|
|
restartPolicy: Always
|
|
|
|
|
---
|
|
|
|
|
apiVersion: v1
|
|
|
|
|
kind: Service
|
|
|
|
|
metadata:
|
|
|
|
|
name: tb-database
|
|
|
|
|
namespace: thingsboard
|
|
|
|
|
spec:
|
|
|
|
|
type: ClusterIP
|
|
|
|
|
selector:
|
|
|
|
|
app: postgres
|
|
|
|
|
ports:
|
|
|
|
|
- port: 5432
|
|
|
|
|
name: postgres
|
|
|
|
|
---
|