From 6baed168b29661f413a721ca42c2d55e6a4053f4 Mon Sep 17 00:00:00 2001 From: Michael Thomson Date: Wed, 10 Jul 2024 00:19:26 -0400 Subject: [PATCH] roundcube nginx --- roundcube/roundcubemail-service.yaml | 1 + roundcube/roundcubenginx-config.yaml | 33 ++++++++++++++ roundcube/roundcubenginx-deployment.yaml | 45 +++++++++++++++++++ ...gress.yaml => roundcubenginx-ingress.yaml} | 6 +-- roundcube/roundcubenginx-service.yaml | 14 ++++++ 5 files changed, 96 insertions(+), 3 deletions(-) create mode 100644 roundcube/roundcubenginx-config.yaml create mode 100644 roundcube/roundcubenginx-deployment.yaml rename roundcube/{roundcubemail-ingress.yaml => roundcubenginx-ingress.yaml} (87%) create mode 100644 roundcube/roundcubenginx-service.yaml diff --git a/roundcube/roundcubemail-service.yaml b/roundcube/roundcubemail-service.yaml index 61eee4f..73690c7 100644 --- a/roundcube/roundcubemail-service.yaml +++ b/roundcube/roundcubemail-service.yaml @@ -6,6 +6,7 @@ metadata: labels: service: roundcubemail spec: + type: NodePort ports: - port: 9000 protocol: TCP diff --git a/roundcube/roundcubenginx-config.yaml b/roundcube/roundcubenginx-config.yaml new file mode 100644 index 0000000..8c3dd20 --- /dev/null +++ b/roundcube/roundcubenginx-config.yaml @@ -0,0 +1,33 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: roundcubenginx-config + namespace: roundcube +data: + default.conf: | + server { + listen 80 default_server; + server_name _; + root /var/www/html; + + location / { + try_files $uri /index.php$is_args$args; + } + + location ~ \.php(/|$) { + try_files $uri =404; + fastcgi_pass roundcubemail:9000; + fastcgi_read_timeout 300; + proxy_read_timeout 300; + fastcgi_split_path_info ^(.+\.php)(/.*)$; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; + fastcgi_param DOCUMENT_ROOT $realpath_root; + internal; + } + + client_max_body_size 6m; + + error_log /var/log/nginx/error.log; + access_log /var/log/nginx/access.log; + } diff --git a/roundcube/roundcubenginx-deployment.yaml b/roundcube/roundcubenginx-deployment.yaml new file mode 100644 index 0000000..8f2c7c8 --- /dev/null +++ b/roundcube/roundcubenginx-deployment.yaml @@ -0,0 +1,45 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: roundcubenginx + namespace: roundcube + labels: + service: roundcubenginx +spec: + replicas: 1 + selector: + matchLabels: + service: roundcubenginx + strategy: + type: Recreate + template: + metadata: + labels: + service: roundcubenginx + spec: + containers: + - name: roundcubenginx + image: nginx:alpine + imagePullPolicy: "" + env: + - name: NGINX_HOST + value: localhost + - name: NGINX_PHP_CGI + value: roundcubemail:9000 + ports: + - containerPort: 80 + volumeMounts: + - name: www-data + mountPath: /var/www/html + - name: nginx-config + mountPath: /etc/nginx/conf.d/default.conf + subPath: default.conf + restartPolicy: Always + serviceAccountName: "" + volumes: + - name: www-data + persistentVolumeClaim: + claimName: roundcubemail-www-pvc + - name: nginx-config + configMap: + name: roundcubenginx-config diff --git a/roundcube/roundcubemail-ingress.yaml b/roundcube/roundcubenginx-ingress.yaml similarity index 87% rename from roundcube/roundcubemail-ingress.yaml rename to roundcube/roundcubenginx-ingress.yaml index 8016baa..e170791 100644 --- a/roundcube/roundcubemail-ingress.yaml +++ b/roundcube/roundcubenginx-ingress.yaml @@ -1,14 +1,14 @@ apiVersion: networking.k8s.io/v1 kind: Ingress metadata: - name: roundcubemail-ingress + name: roundcubenginx-ingress namespace: roundcube annotations: traefik.ingress.kubernetes.io/router.entrypoints: websecure # traefik.ingress.kubernetes.io/router.middlewares: traefik-authentik@kubernetescrd traefik.ingress.kubernetes.io/router.tls: "true" labels: - service: roundcubemail + service: roundcubenginx spec: rules: - host: roundcube.michaelthomson.dev @@ -18,7 +18,7 @@ spec: path: / backend: service: - name: roundcubemail + name: roundcubenginx port: name: http tls: diff --git a/roundcube/roundcubenginx-service.yaml b/roundcube/roundcubenginx-service.yaml new file mode 100644 index 0000000..3c81ffe --- /dev/null +++ b/roundcube/roundcubenginx-service.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: roundcubenginx + namespace: roundcube + labels: + service: roundcubenginx +spec: + ports: + - name: http + port: 8080 + targetPort: 80 + selector: + service: roundcubenginx