🚀 add files
This commit is contained in:
@@ -0,0 +1,89 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: nextcloud
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: nextcloud-db
|
||||||
|
namespace: nextcloud
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: nextcloud-db
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: nextcloud-db
|
||||||
|
spec:
|
||||||
|
# nodeName: kube-master
|
||||||
|
containers:
|
||||||
|
- name: db
|
||||||
|
image: docker.io/library/postgres:14
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
env:
|
||||||
|
- name: POSTGRES_DB
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: nextcloud-credentials
|
||||||
|
key: POSTGRES_DB
|
||||||
|
- name: POSTGRES_USER
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: nextcloud-credentials
|
||||||
|
key: POSTGRES_USER
|
||||||
|
- name: POSTGRES_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: nextcloud-credentials
|
||||||
|
key: POSTGRES_PASSWORD
|
||||||
|
|
||||||
|
volumeMounts:
|
||||||
|
# - name: pgdata
|
||||||
|
# mountPath: /var/lib/postgresql/data
|
||||||
|
- name: nextcloud-database-data
|
||||||
|
mountPath: /var/lib/postgresql/data
|
||||||
|
ports:
|
||||||
|
- name: postgres
|
||||||
|
containerPort: 5432
|
||||||
|
volumes:
|
||||||
|
- name: pgdata
|
||||||
|
hostPath:
|
||||||
|
path: /opt/kubernetes/Nextcloud_kube/data/pgdata
|
||||||
|
|
||||||
|
- name: nextcloud-database-data
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: nextcloud-database
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: db
|
||||||
|
namespace: nextcloud
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: nextcloud-db
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 5432
|
||||||
|
targetPort: postgres
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
# if remote access required
|
||||||
|
#apiVersion: v1
|
||||||
|
#kind: Service
|
||||||
|
#metadata:
|
||||||
|
# name: db-nodeport
|
||||||
|
# namespace: nextcloud
|
||||||
|
#spec:
|
||||||
|
# type: NodePort
|
||||||
|
# selector:
|
||||||
|
# app: nextcloud-db
|
||||||
|
# ports:
|
||||||
|
# - protocol: TCP
|
||||||
|
# port: 5432
|
||||||
|
# targetPort: postgres
|
||||||
|
# nodePort: 32366
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: nextcloud
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: nextcloud-redis
|
||||||
|
namespace: nextcloud
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: nextcloud-redis
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: nextcloud-redis
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: broker
|
||||||
|
image: docker.io/library/redis:7
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
volumeMounts:
|
||||||
|
- name: redisdata
|
||||||
|
mountPath: /data
|
||||||
|
ports:
|
||||||
|
- name: redis
|
||||||
|
containerPort: 6379
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: redisdata
|
||||||
|
hostPath:
|
||||||
|
path: /opt/kubernetes/Nextcloud_kube/data/redisdata
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: redis
|
||||||
|
namespace: nextcloud
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: nextcloud-redis
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 6379
|
||||||
|
targetPort: redis
|
||||||
|
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: nextcloud
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: nextcloud-webserver
|
||||||
|
namespace: nextcloud
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: nextcloud-webserver
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: nextcloud-webserver
|
||||||
|
spec:
|
||||||
|
nodeName: kube-master
|
||||||
|
containers:
|
||||||
|
- name: nextcloud-webserver
|
||||||
|
# image: nextcloud:apache
|
||||||
|
# image: nextcloud:28.0.5-apache
|
||||||
|
# image: nextcloud:28.0.6-apache
|
||||||
|
image: nextcloud:29.0.1-apache
|
||||||
|
imagePullPolicy: Always
|
||||||
|
ports:
|
||||||
|
- containerPort: 80
|
||||||
|
name: webserver-port
|
||||||
|
env:
|
||||||
|
#- name: REDIS_HOST
|
||||||
|
# value: "redis://redis:6379"
|
||||||
|
- name: POSTGRES_HOST
|
||||||
|
value: "db"
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /
|
||||||
|
port: 80
|
||||||
|
httpHeaders:
|
||||||
|
- name: host
|
||||||
|
value: nextcloud.tryton.geeraert.eu
|
||||||
|
initialDelaySeconds: 3
|
||||||
|
periodSeconds: 3
|
||||||
|
|
||||||
|
volumeMounts:
|
||||||
|
- name: nextcloud-webserver
|
||||||
|
mountPath: /var/www/html
|
||||||
|
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: nextcloud-webserver
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: nextcloud-webserver
|
||||||
|
securityContext:
|
||||||
|
fsGroup: 33
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: webserver
|
||||||
|
namespace: nextcloud
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
port: 80
|
||||||
|
# targetPort: webserver-port
|
||||||
|
protocol: TCP
|
||||||
|
# nodePort: 31236
|
||||||
|
# type: NodePort
|
||||||
|
selector:
|
||||||
|
app: nextcloud-webserver
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
$ cat docker-compose.yml
|
||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
image: postgres:alpine
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- db:/var/lib/postgresql/data:Z
|
||||||
|
env_file:
|
||||||
|
- db.env
|
||||||
|
|
||||||
|
redis:
|
||||||
|
image: redis:alpine
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
app:
|
||||||
|
image: nextcloud:apache
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- 6456:80
|
||||||
|
volumes:
|
||||||
|
- nextcloud:/var/www/html:z
|
||||||
|
environment:
|
||||||
|
- POSTGRES_HOST=db
|
||||||
|
- REDIS_HOST=redis
|
||||||
|
env_file:
|
||||||
|
- db.env
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
- redis
|
||||||
|
|
||||||
|
cron:
|
||||||
|
image: nextcloud:apache
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- nextcloud:/var/www/html:z
|
||||||
|
entrypoint: /cron.sh
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
- redis
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
db:
|
||||||
|
nextcloud:
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
data:
|
||||||
|
POSTGRES_DB: bmV4dGNsb3Vk
|
||||||
|
POSTGRES_PASSWORD: bmV4dGNsb3Vk
|
||||||
|
POSTGRES_USER: bmV4dGNsb3Vk
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: nextcloud-credentials
|
||||||
|
namespace: nextcloud
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
apiVersion: batch/v1
|
||||||
|
kind: CronJob
|
||||||
|
metadata:
|
||||||
|
name: purge-oc-authtoken
|
||||||
|
namespace: nextcloud
|
||||||
|
spec:
|
||||||
|
schedule: 0 0 */15 * *
|
||||||
|
jobTemplate:
|
||||||
|
spec:
|
||||||
|
ttlSecondsAfterFinished: 100
|
||||||
|
template:
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- image: alpine
|
||||||
|
imagePullPolicy: Always
|
||||||
|
name: purge-oc-authtoken
|
||||||
|
volumeMounts:
|
||||||
|
- name: nextcloud-purge-oc-authtoken-log
|
||||||
|
mountPath: /var/log/nextcloud-nextcloud-purge-oc-authtoken.log
|
||||||
|
command: [ "/bin/sh", "-c", "--" ]
|
||||||
|
args:
|
||||||
|
- apk -q update; apk -q add postgresql;clear;echo $(date) >> /var/log/nextcloud-nextcloud-purge-oc-authtoken.log 2>&1;echo "Number of row before the query" >> /var/log/nextcloud-nextcloud-purge-oc-authtoken.log;PGPASSWORD=$POSTGRES_PASSWORD psql -h db.nextcloud.svc -d $POSTGRES_DB -U $POSTGRES_USER -c "select * from oc_authtoken where uid='pi';" |tail -n 2 >> /var/log/nextcloud-nextcloud-purge-oc-authtoken.log; PGPASSWORD=$POSTGRES_PASSWORD psql -h db.nextcloud.svc -d $POSTGRES_DB -U $POSTGRES_USER -c "delete from oc_authtoken where uid='pi' >> /var/log/nextcloud-nextcloud-purge-oc-authtoken.log;";echo "Number of row after the query" >> /var/log/nextcloud-nextcloud-purge-oc-authtoken.log; PGPASSWORD=$POSTGRES_PASSWORD psql -h db.nextcloud.svc -d $POSTGRES_DB -U $POSTGRES_USER -c "select * from oc_authtoken where uid='pi';"|tail -n 2 >> /var/log/nextcloud-nextcloud-purge-oc-authtoken.log;sleep 3600
|
||||||
|
env:
|
||||||
|
- name: POSTGRES_DB
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: nextcloud-credentials
|
||||||
|
key: POSTGRES_DB
|
||||||
|
- name: POSTGRES_USER
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: nextcloud-credentials
|
||||||
|
key: POSTGRES_USER
|
||||||
|
- name: POSTGRES_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: nextcloud-credentials
|
||||||
|
key: POSTGRES_PASSWORD
|
||||||
|
restartPolicy: OnFailure
|
||||||
|
volumes:
|
||||||
|
- name: nextcloud-purge-oc-authtoken-log
|
||||||
|
hostPath:
|
||||||
|
path: /var/log/nextcloud-nextcloud-purge-oc-authtoken.log
|
||||||
|
type: File
|
||||||
|
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
kind: PersistentVolumeClaim
|
||||||
|
apiVersion: v1
|
||||||
|
metadata:
|
||||||
|
name: nextcloud-database
|
||||||
|
namespace: nextcloud
|
||||||
|
spec:
|
||||||
|
storageClassName: nfs-storage-intelligent
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteMany
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 2Gi
|
||||||
|
---
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
apiVersion: v1
|
||||||
|
metadata:
|
||||||
|
name: nextcloud-webserver
|
||||||
|
namespace: nextcloud
|
||||||
|
spec:
|
||||||
|
storageClassName: nfs-storage-intelligent
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteMany
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 2Gi
|
||||||
Reference in New Issue
Block a user