diff --git a/apps/templates/sogo-folder.yaml b/apps/templates/sogo-folder.yaml new file mode 100644 index 0000000..01e2940 --- /dev/null +++ b/apps/templates/sogo-folder.yaml @@ -0,0 +1,22 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: sogo + namespace: argocd + finalizers: + - resources-finalizer.argocd.argoproj.io +spec: + project: default + source: + repoURL: https://github.com/rubenhensen/k8scd.git + targetRevision: HEAD + path: sogo + destination: + server: https://kubernetes.default.svc + namespace: sogo + syncPolicy: + syncOptions: + - CreateNamespace=true + automated: + selfHeal: true + prune: true diff --git a/sogo/configmap.yaml b/sogo/configmap.yaml new file mode 100644 index 0000000..efbe4a1 --- /dev/null +++ b/sogo/configmap.yaml @@ -0,0 +1,69 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: sogo-config + namespace: sogo +data: + sogo.conf: | + { + /* Mail Server Configuration */ + SOGoIMAPServer = "stalwart.stalwart.svc.cluster.local:143"; + SOGoSMTPServer = "stalwart.stalwart.svc.cluster.local:587"; + SOGoMailDomain = "hensen.io"; + SOGoForceIMAPLoginWithEmail = YES; + + /* Database Configuration */ + SOGoProfileURL = "postgresql://sogo:${POSTGRES_PASSWORD}@sogo-postgres-rw.sogo.svc.cluster.local:5432/sogo/sogo_user_profile"; + OCSFolderInfoURL = "postgresql://sogo:${POSTGRES_PASSWORD}@sogo-postgres-rw.sogo.svc.cluster.local:5432/sogo/sogo_folder_info"; + OCSSessionsFolderURL = "postgresql://sogo:${POSTGRES_PASSWORD}@sogo-postgres-rw.sogo.svc.cluster.local:5432/sogo/sogo_sessions_folder"; + + /* General Settings */ + SOGoTimeZone = "Europe/Amsterdam"; + SOGoLanguage = "English"; + SOGoSuperUsername = "admin@hensen.io"; + + /* Modules */ + SOGoModules = ( + "Mail", + "Calendar", + "Contacts", + "Tasks" + ); + + /* Calendar Settings */ + SOGoCalendarDefaultRoles = ( + "PublicViewer", + "ConfidentialDAndTViewer" + ); + SOGoFirstDayOfWeek = 1; + SOGoFirstWeekOfYear = "January1"; + SOGoDayStartTime = 8; + SOGoDayEndTime = 18; + + /* Authentication */ + SOGoAuthenticationType = "IMAP"; + + /* WebUI Settings */ + SOGoPageTitle = "SOGo @ hensen.io"; + SOGoLoginModule = "Mail"; + SOGoRefreshViewCheck = "every_5_minutes"; + SOGoMailMessageCheck = "every_5_minutes"; + + /* Mail Preferences */ + SOGoMailAuxiliaryUserAccountsEnabled = YES; + SOGoMailComposeMessageType = "html"; + SOGoMailReplyPlacement = "below"; + SOGoMailSignaturePlacement = "below"; + + /* Security */ + SOGoPasswordChangeEnabled = NO; + SOGoXSRFValidationEnabled = YES; + + /* Performance */ + SOGoMemcachedHost = ""; + WOWorkersCount = 3; + WOListenQueueSize = 5; + WONoDetach = YES; + WOLogFile = "-"; + WOPidFile = "/var/run/sogo/sogo.pid"; + } diff --git a/sogo/deployment.yaml b/sogo/deployment.yaml new file mode 100644 index 0000000..242793c --- /dev/null +++ b/sogo/deployment.yaml @@ -0,0 +1,66 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: sogo + namespace: sogo + labels: + app: sogo +spec: + replicas: 1 + strategy: + type: Recreate + selector: + matchLabels: + app: sogo + template: + metadata: + labels: + app: sogo + spec: + containers: + - name: sogo + image: sonroyaalmerol/docker-sogo:latest + ports: + - containerPort: 80 + name: http + env: + - name: POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + name: sogo-postgres-credentials + key: password + - name: TZ + value: "Europe/Amsterdam" + volumeMounts: + - name: config + mountPath: /etc/sogo/sogo.conf.d/ + - name: data + mountPath: /srv/lib/sogo + resources: + requests: + memory: "512Mi" + cpu: "200m" + limits: + memory: "1Gi" + cpu: "1000m" + livenessProbe: + httpGet: + path: /SOGo + port: 80 + initialDelaySeconds: 60 + periodSeconds: 30 + timeoutSeconds: 5 + readinessProbe: + httpGet: + path: /SOGo + port: 80 + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 5 + volumes: + - name: config + configMap: + name: sogo-config + - name: data + persistentVolumeClaim: + claimName: sogo-data diff --git a/sogo/external-secret.yaml b/sogo/external-secret.yaml new file mode 100644 index 0000000..569cf11 --- /dev/null +++ b/sogo/external-secret.yaml @@ -0,0 +1,18 @@ +apiVersion: external-secrets.io/v1beta1 +kind: ExternalSecret +metadata: + name: sogo-postgres-credentials + namespace: sogo +spec: + refreshInterval: 15m + secretStoreRef: + name: vault-backend + kind: ClusterSecretStore + target: + name: sogo-postgres-credentials + creationPolicy: Owner + data: + - secretKey: password + remoteRef: + key: kv/sogo + property: postgres_pw diff --git a/sogo/ingress.yaml b/sogo/ingress.yaml new file mode 100644 index 0000000..490bd4c --- /dev/null +++ b/sogo/ingress.yaml @@ -0,0 +1,26 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: sogo + namespace: sogo + annotations: + cert-manager.io/cluster-issuer: prod-cluster-issuer + nginx.ingress.kubernetes.io/backend-protocol: HTTP + nginx.ingress.kubernetes.io/proxy-body-size: "50m" +spec: + ingressClassName: nginx + tls: + - hosts: + - post.hensen.io + secretName: sogo-tls + rules: + - host: post.hensen.io + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: sogo + port: + number: 80 diff --git a/sogo/postgresql-cluster.yaml b/sogo/postgresql-cluster.yaml new file mode 100644 index 0000000..e2394e7 --- /dev/null +++ b/sogo/postgresql-cluster.yaml @@ -0,0 +1,25 @@ +apiVersion: postgresql.cnpg.io/v1 +kind: Cluster +metadata: + name: sogo-postgres + namespace: sogo +spec: + instances: 1 + + storage: + size: 10Gi + storageClass: longhorn + + bootstrap: + initdb: + database: sogo + owner: sogo + secret: + name: sogo-postgres-credentials + postInitSQL: + - CREATE EXTENSION IF NOT EXISTS pg_trgm; + + postgresql: + parameters: + max_connections: "100" + shared_buffers: "256MB" diff --git a/sogo/pvc.yaml b/sogo/pvc.yaml new file mode 100644 index 0000000..d1063a9 --- /dev/null +++ b/sogo/pvc.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: sogo-data + namespace: sogo +spec: + accessModes: + - ReadWriteOnce + storageClassName: longhorn + resources: + requests: + storage: 5Gi diff --git a/sogo/service.yaml b/sogo/service.yaml new file mode 100644 index 0000000..f21ee74 --- /dev/null +++ b/sogo/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: sogo + namespace: sogo + labels: + app: sogo +spec: + type: ClusterIP + ports: + - port: 80 + targetPort: 80 + protocol: TCP + name: http + selector: + app: sogo