cluster

Infrastructure files for Nordgedanken and Midnightthoughts.
git clone git://archive.git.mtrnord.blog/MTRNord/cluster.git
Log | Files | Refs | README

mailman.yaml (11930B)


      1 apiVersion: v1
      2 kind: PersistentVolumeClaim
      3 metadata:
      4   labels:
      5     app: mailman
      6   name: mailman-opt-mailman-0
      7   namespace: mailserver
      8 spec:
      9   accessModes:
     10     - ReadWriteMany
     11   resources:
     12     requests:
     13       storage: 10Gi
     14   storageClassName: longhorn
     15 ---
     16 apiVersion: v1
     17 kind: PersistentVolumeClaim
     18 metadata:
     19   labels:
     20     app: mailman
     21   name: mailman-web-mailman-0
     22   namespace: mailserver
     23 spec:
     24   accessModes:
     25     - ReadWriteMany
     26   resources:
     27     requests:
     28       storage: 10Gi
     29   storageClassName: longhorn
     30 ---
     31 # https://github.com/maxking/docker-mailman
     32 apiVersion: apps/v1
     33 kind: Deployment
     34 metadata:
     35   name: mailman
     36   namespace: mailserver
     37 spec:
     38   replicas: 1
     39   selector:
     40     matchLabels:
     41       app: mailman
     42   template:
     43     metadata:
     44       labels:
     45         app: mailman
     46     spec:
     47       hostAliases:
     48         - ip: 0.0.0.0
     49           hostnames:
     50             - mailman.mailserver.svc.cluster.local
     51         - ip: 127.0.0.1
     52           hostnames:
     53             - mailman-web
     54       containers:
     55         - name: core
     56           image: ghcr.io/mtrnord/mailman-core:rolling
     57           imagePullPolicy: Always
     58           ports:
     59             - name: api
     60               containerPort: 8001
     61             - name: lmtp
     62               containerPort: 8024
     63           resources:
     64             requests:
     65               memory: "512Mi"
     66               cpu: "100m"
     67             limits:
     68               memory: "1Gi"
     69               cpu: "500m"
     70           env:
     71             - name: DATABASE_URL
     72               valueFrom:
     73                 secretKeyRef:
     74                   name: mailmancore
     75                   key: url
     76             - name: DATABASE_TYPE
     77               value: postgres
     78             - name: DATABASE_CLASS
     79               value: mailman.database.postgresql.PostgreSQLDatabase
     80             - name: HYPERKITTY_API_KEY
     81               valueFrom:
     82                 secretKeyRef:
     83                   name: mailman-passwords
     84                   key: apikey
     85             - name: MAILMAN_REST_USER
     86               value: restadm
     87             - name: MAILMAN_REST_PASSWORD
     88               valueFrom:
     89                 secretKeyRef:
     90                   name: mailman-passwords
     91                   key: restpassword
     92             - name: SMTP_HOST
     93               value: mail.midnightthoughts.space
     94             - name: SMTP_PORT
     95               value: "465"
     96             - name: SMTP_USE_SSL
     97               value: "true"
     98             - name: SMTP_SECURE_MODE
     99               value: "smtps"
    100             - name: SMTP_HOST_USER
    101               valueFrom:
    102                 secretKeyRef:
    103                   name: mailman-passwords
    104                   key: smtp_user
    105             - name: SMTP_HOST_PASSWORD
    106               valueFrom:
    107                 secretKeyRef:
    108                   name: mailman-passwords
    109                   key: smtp_password
    110             - name: MTA
    111               value: smtp
    112             - name: MM_HOSTNAME
    113               value: mailman.mailserver.svc.cluster.local
    114             - name: HYPERKITTY_URL
    115               value: http://localhost:8000/hyperkitty
    116           volumeMounts:
    117             - name: mailman-opt
    118               mountPath: /opt/mailman
    119             - name: mailman-extra
    120               mountPath: /opt/mailman/mailman-extra.cfg
    121               subPath: mailman-extra.cfg
    122             - name: mailman-extra
    123               mountPath: /usr/bin/chown
    124               subPath: chown
    125             - name: mailman-uwsgi
    126               mountPath: /opt/mailman-web/uwsgi.ini
    127               subPath: uwsgi.ini
    128         - name: web
    129           image: ghcr.io/mtrnord/mailman-web:rolling
    130           imagePullPolicy: Always
    131           ports:
    132             - name: http
    133               containerPort: 8000
    134             - name: uwsgi
    135               containerPort: 8080
    136           resources:
    137             requests:
    138               memory: "768Mi"
    139               cpu: "200m"
    140             limits:
    141               memory: "2Gi"
    142               cpu: "1000m"
    143           #command:
    144           #  - tail
    145           #args:
    146           #  - -f
    147           #  - /dev/null
    148           env:
    149             - name: DATABASE_URL
    150               valueFrom:
    151                 secretKeyRef:
    152                   name: mailmanweb
    153                   key: url
    154             - name: DATABASE_TYPE
    155               value: postgres
    156             - name: DATABASE_CLASS
    157               value: mailman.database.postgresql.PostgreSQLDatabase
    158             - name: HYPERKITTY_API_KEY
    159               valueFrom:
    160                 secretKeyRef:
    161                   name: mailman-passwords
    162                   key: apikey
    163             - name: MAILMAN_REST_USER
    164               value: restadm
    165             - name: MAILMAN_REST_PASSWORD
    166               valueFrom:
    167                 secretKeyRef:
    168                   name: mailman-passwords
    169                   key: restpassword
    170             - name: SECRET_KEY
    171               valueFrom:
    172                 secretKeyRef:
    173                   name: mailman-passwords
    174                   key: websecretkey
    175             - name: POSTORIUS_TEMPLATE_BASE_URL
    176               value: http://localhost:8000/
    177             # serving static files by uwsgi
    178             - name: UWSGI_STATIC_MAP
    179               value: /static=/opt/mailman-web-data/static
    180             - name: MAILMAN_ADMIN_USER
    181               value: admin
    182             - name: MAILMAN_ADMIN_EMAIL
    183               value: mtrnord@nordgedanken.dev
    184             - name: MAILMAN_HOST_IP
    185               value: 127.0.0.1
    186             - name: MAILMAN_HOSTNAME
    187               value: localhost
    188             - name: SERVE_FROM_DOMAIN
    189               value: lists.midnightthoughts.space
    190             - name: MAILMAN_REST_URL # MAILMAN_REST_API_URL is set from this variable in settings.
    191               value: http://127.0.0.1:8001
    192             - name: MAILMAN_REST_API_USER
    193               value: restadm
    194             - name: MAILMAN_REST_API_PASS
    195               valueFrom:
    196                 secretKeyRef:
    197                   name: mailman-passwords
    198                   key: restpassword
    199             - name: SMTP_HOST
    200               value: mail.midnightthoughts.space
    201             - name: SMTP_PORT
    202               value: "465"
    203             - name: SMTP_USE_SSL
    204               value: "true"
    205             - name: SMTP_HOST_USER
    206               valueFrom:
    207                 secretKeyRef:
    208                   name: mailman-passwords
    209                   key: smtp_user
    210             - name: SMTP_HOST_PASSWORD
    211               valueFrom:
    212                 secretKeyRef:
    213                   name: mailman-passwords
    214                   key: smtp_password
    215           # otherwise django cannot find the mysql driver.
    216           #- name: DYLD_LIBRARY_PATH
    217           #  value: /usr/local/mysql/lib/
    218 
    219           volumeMounts:
    220             - name: mailman-web
    221               mountPath: /opt/mailman-web-data
    222             - name: mailman-extra
    223               mountPath: /opt/mailman-web-data/settings_local.py
    224               subPath: settings_local.py
    225             - name: mailman-extra
    226               mountPath: /usr/bin/chown
    227               subPath: chown
    228             - name: django-cache
    229               mountPath: /opt/mailman-web-data/diskcache
    230             - name: static-cache
    231               mountPath: /opt/mailman-web-data/static/CACHE
    232         - name: redis
    233           image: redis:7-alpine
    234           imagePullPolicy: IfNotPresent
    235           ports:
    236             - name: redis
    237               containerPort: 6379
    238           command:
    239             - redis-server
    240             - --appendonly
    241             - "yes"
    242             - --maxmemory
    243             - "256mb"
    244             - --maxmemory-policy
    245             - "allkeys-lru"
    246           resources:
    247             requests:
    248               memory: "128Mi"
    249               cpu: "50m"
    250             limits:
    251               memory: "512Mi"
    252               cpu: "200m"
    253           livenessProbe:
    254             tcpSocket:
    255               port: 6379
    256             initialDelaySeconds: 30
    257             periodSeconds: 10
    258           readinessProbe:
    259             tcpSocket:
    260               port: 6379
    261             initialDelaySeconds: 5
    262             periodSeconds: 5
    263           volumeMounts:
    264             - name: redis-data
    265               mountPath: /data
    266         - name: nginx
    267           image: ghcr.io/nginx/nginx-unprivileged:stable-alpine
    268           imagePullPolicy: IfNotPresent
    269           ports:
    270             - name: http
    271               containerPort: 9090
    272           resources:
    273             requests:
    274               memory: "128Mi"
    275               cpu: "50m"
    276             limits:
    277               memory: "512Mi"
    278               cpu: "200m"
    279           startupProbe:
    280             httpGet:
    281               path: /mailman3/lists/
    282               port: 9090
    283               httpHeaders:
    284                 - name: Host
    285                   value: lists.midnightthoughts.space
    286             initialDelaySeconds: 30
    287             periodSeconds: 10
    288             timeoutSeconds: 5
    289             failureThreshold: 24
    290           livenessProbe:
    291             httpGet:
    292               path: /mailman3/lists/
    293               port: 9090
    294               httpHeaders:
    295                 - name: Host
    296                   value: lists.midnightthoughts.space
    297             periodSeconds: 30
    298             timeoutSeconds: 5
    299             failureThreshold: 3
    300           readinessProbe:
    301             httpGet:
    302               path: /mailman3/lists/
    303               port: 9090
    304               httpHeaders:
    305                 - name: Host
    306                   value: lists.midnightthoughts.space
    307             periodSeconds: 10
    308             timeoutSeconds: 3
    309             failureThreshold: 3
    310           volumeMounts:
    311             - name: mailman-web
    312               mountPath: /opt/mailman-web-data
    313               readOnly: true
    314             - name: static-cache
    315               mountPath: /opt/mailman-web-data/static/CACHE
    316               readOnly: true
    317             - name: nginx-config
    318               mountPath: /etc/nginx/nginx.conf
    319               subPath: nginx.conf
    320               readOnly: true
    321             - name: tmp
    322               mountPath: /tmp
    323               readOnly: false
    324             - name: tmp-client-body
    325               mountPath: /tmp/nginx/client_body
    326               readOnly: false
    327             - name: tmp-cgi
    328               mountPath: /tmp/nginx/fastcgi
    329               readOnly: false
    330             - name: tmp-cgi
    331               mountPath: /tmp/nginx/uwsgi
    332               readOnly: false
    333             - name: tmp-cgi
    334               mountPath: /tmp/nginx/scgi
    335               readOnly: false
    336             - name: tmp-proxy
    337               mountPath: /tmp/nginx/proxy
    338               readOnly: false
    339       volumes:
    340         - name: mailman-extra
    341           secret:
    342             secretName: mailman-extra
    343             defaultMode: 0555
    344         - name: nginx-config
    345           configMap:
    346             name: mailman-nginx
    347         - name: mailman-uwsgi
    348           configMap:
    349             name: mailman-uwsgi
    350         - name: tmp
    351           emptyDir: {}
    352         - name: tmp-client-body
    353           emptyDir: {}
    354         - name: tmp-cgi
    355           emptyDir: {}
    356         - name: tmp-proxy
    357           emptyDir: {}
    358         - name: redis-data
    359           emptyDir: {}
    360         - name: django-cache
    361           emptyDir: {}
    362         - name: static-cache
    363           emptyDir: {}
    364         - name: mailman-opt
    365           persistentVolumeClaim:
    366             claimName: mailman-opt-mailman-0 # Existing PVC from StatefulSet
    367         - name: mailman-web
    368           persistentVolumeClaim:
    369             claimName: mailman-web-mailman-0 # Existing PVC from StatefulSet
    370 ---
    371 apiVersion: v1
    372 kind: Service
    373 metadata:
    374   name: mailman
    375   namespace: mailserver
    376 spec:
    377   type: ClusterIP
    378   selector:
    379     app: mailman
    380   ports:
    381     - name: api
    382       port: 8001
    383     - name: lmtp
    384       port: 8024
    385     - name: http
    386       port: 8000
    387     - name: uwsgi
    388       port: 8080
    389     - name: nginx
    390       port: 9090
    391     - name: redis
    392       port: 6379
    393 ---
    394 apiVersion: gateway.networking.k8s.io/v1
    395 kind: HTTPRoute
    396 metadata:
    397   name: mailman
    398   namespace: mailserver
    399 spec:
    400   parentRefs:
    401     - name: envoy-gateway
    402       namespace: envoy-gateway
    403   hostnames:
    404     - lists.midnightthoughts.space
    405   rules:
    406     - backendRefs:
    407         - name: mailman
    408           port: 9090
    409       timeouts:
    410         request: 240s
    411         backendRequest: 0s