Compare commits

...

2 commits

12 changed files with 233 additions and 20 deletions

View file

@ -1,19 +0,0 @@
name: Deploy with Docker Compose
on: [push]
jobs:
deploy:
runs-on: docker
container:
image: forgejo-actions-base:latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Deploy using Docker Compose (Down and Up)
run: |
project_name=$(basename "$PWD")
echo "Deploying project: $project_name"
docker compose -p "$project_name" down
docker compose -p "$project_name" up -d --remove-orphans

View file

@ -2,7 +2,7 @@ version: '2'
services:
nextcloud:
image: nextcloud
image: nextcloud:28
container_name: nextcloud
restart: unless-stopped
volumes:

27
deployment/ingress.yaml Normal file
View file

@ -0,0 +1,27 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nextcloud
namespace: nextcloud
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
nginx.ingress.kubernetes.io/proxy-body-size: "0"
nginx.ingress.kubernetes.io/proxy-read-timeout: "600"
nginx.ingress.kubernetes.io/proxy-send-timeout: "600"
spec:
ingressClassName: nginx
tls:
- hosts:
- nextcloud.szymi.ddns.net
secretName: nextcloud-tls
rules:
- host: nextcloud.szymi.ddns.net
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: nextcloud
port:
number: 80

View file

@ -0,0 +1,13 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: nextcloud
resources:
- namespace.yaml
- secret.yaml
- mariadb-pv.yaml
- nextcloud-pv.yaml
- mariadb-deployment.yaml
- mariadb-service.yaml
- nextcloud-deployment.yaml
- nextcloud-service.yaml
- ingress.yaml

View file

@ -0,0 +1,46 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: mariadb
namespace: nextcloud
spec:
replicas: 1
selector:
matchLabels:
app: mariadb
template:
metadata:
labels:
app: mariadb
spec:
containers:
- name: mariadb
image: mariadb:11.1
args:
- --transaction-isolation=READ-COMMITTED
- --log-bin=binlog
- --binlog-format=ROW
env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: nextcloud-db-secret
key: MYSQL_ROOT_PASSWORD
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: nextcloud-db-secret
key: MYSQL_PASSWORD
- name: MYSQL_DATABASE
value: nextcloud
- name: MYSQL_USER
value: szymi
ports:
- containerPort: 3306
volumeMounts:
- name: mariadb-data
mountPath: /var/lib/mysql
volumes:
- name: mariadb-data
persistentVolumeClaim:
claimName: mariadb-pvc

View file

@ -0,0 +1,35 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: mariadb-pv
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
storageClassName: local-storage
local:
path: /media/ssd/mariadb
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- szymicluster-control-plane
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mariadb-pvc
namespace: nextcloud
spec:
accessModes:
- ReadWriteOnce
storageClassName: local-storage
resources:
requests:
storage: 10Gi
volumeName: mariadb-pv

View file

@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: mariadb
namespace: nextcloud
spec:
selector:
app: mariadb
ports:
- port: 3306
targetPort: 3306

View file

@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: nextcloud

View file

@ -0,0 +1,41 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nextcloud
namespace: nextcloud
spec:
replicas: 1
selector:
matchLabels:
app: nextcloud
template:
metadata:
labels:
app: nextcloud
spec:
containers:
- name: nextcloud
image: nextcloud:28
env:
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: nextcloud-db-secret
key: MYSQL_PASSWORD
- name: MYSQL_DATABASE
value: nextcloud
- name: MYSQL_USER
value: szymi
- name: MYSQL_HOST
value: mariadb
- name: OVERWRITEPROTOCOL
value: https
ports:
- containerPort: 80
volumeMounts:
- name: nextcloud-data
mountPath: /var/www/html
volumes:
- name: nextcloud-data
persistentVolumeClaim:
claimName: nextcloud-pvc

View file

@ -0,0 +1,35 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: nextcloud-pv
spec:
capacity:
storage: 50Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
storageClassName: local-storage
local:
path: /media/ssd/nextcloud
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- szymicluster-control-plane
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: nextcloud-pvc
namespace: nextcloud
spec:
accessModes:
- ReadWriteOnce
storageClassName: local-storage
resources:
requests:
storage: 50Gi
volumeName: nextcloud-pv

View file

@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: nextcloud
namespace: nextcloud
spec:
selector:
app: nextcloud
ports:
- port: 80
targetPort: 80

9
deployment/secret.yaml Normal file
View file

@ -0,0 +1,9 @@
apiVersion: v1
kind: Secret
metadata:
name: nextcloud-db-secret
namespace: nextcloud
type: Opaque
stringData:
MYSQL_ROOT_PASSWORD: "2a!qd*6s"
MYSQL_PASSWORD: "2a!qd*6s"