cluster

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

deployment.yaml (32867B)


      1 # Persistent Volume Claim for BookWyrm static, exports and media files
      2 apiVersion: v1
      3 kind: PersistentVolumeClaim
      4 metadata:
      5   name: bookwyrm-pvc
      6   labels:
      7     app: bookwyrm
      8 spec:
      9   accessModes:
     10     - ReadWriteMany
     11   resources:
     12     requests:
     13       storage: 5Gi
     14   storageClassName: longhorn
     15 ---
     16 apiVersion: apps/v1
     17 kind: Deployment
     18 metadata:
     19   name: bookwyrm
     20   labels:
     21     app: bookwyrm
     22 spec:
     23   replicas: 1
     24   selector:
     25     matchLabels:
     26       app: bookwyrm
     27   strategy:
     28     type: "Recreate"
     29   template:
     30     metadata:
     31       labels:
     32         app: bookwyrm
     33     spec:
     34       automountServiceAccountToken: false
     35       securityContext:
     36         fsGroup: 1000
     37       volumes:
     38         - name: bookwyrm-script
     39           configMap:
     40             name: bookwyrm-script
     41         - name: bookwyrm-data
     42           persistentVolumeClaim:
     43             claimName: bookwyrm-pvc
     44         - name: nginx-config
     45           configMap:
     46             name: nginx
     47         - name: nginx-tmp
     48           emptyDir: {}
     49         - name: nginx-var-cache
     50           emptyDir: {}
     51         - name: nginx-var-run
     52           emptyDir: {}
     53       initContainers:
     54         - name: bookwyrm-update
     55           image: registry.midnightthoughts.space/mtrnord/bookwyrm:v0.8.5 # {"$imagepolicy": "flux-system:bookwyrm"}
     56           securityContext:
     57             allowPrivilegeEscalation: false
     58             capabilities:
     59               drop:
     60                 - ALL
     61               add:
     62                 - CHOWN
     63                 - FOWNER
     64                 - DAC_OVERRIDE
     65           imagePullPolicy: Always
     66           command: ["bash"]
     67           args:
     68             - /hl/bookwyrm.sh
     69             - update
     70           volumeMounts:
     71             - name: bookwyrm-script
     72               mountPath: /hl
     73               readOnly: true
     74             - name: bookwyrm-data
     75               mountPath: /app/static
     76               subPath: static
     77             - name: bookwyrm-data
     78               mountPath: /app/media
     79               subPath: media
     80             - name: bookwyrm-data
     81               mountPath: /app/exports
     82               subPath: exports
     83             - name: bookwyrm-data
     84               mountPath: /app/images
     85               subPath: images
     86           env:
     87             - name: POD_IP
     88               valueFrom:
     89                 fieldRef:
     90                   fieldPath: status.podIP
     91             - name: DEBUG
     92               value: "false"
     93             - name: ALLOWED_HOSTS
     94               value: "books.mtrnord.blog,localhost,$(POD_IP)"
     95             - name: SECRET_KEY
     96               valueFrom:
     97                 secretKeyRef:
     98                   name: bookwyrm-secrets
     99                   key: SECRET_KEY
    100             - name: DOMAIN
    101               value: "books.mtrnord.blog"
    102             - name: USE_HTTPS
    103               value: "true"
    104             - name: PGPORT
    105               value: "5432"
    106             - name: POSTGRES_PASSWORD
    107               valueFrom:
    108                 secretKeyRef:
    109                   name: bookwyrm-secrets
    110                   key: POSTGRES_PASSWORD
    111             - name: POSTGRES_USER
    112               value: "bookwyrm"
    113             - name: POSTGRES_DB
    114               value: "bookwyrm"
    115             - name: POSTGRES_HOST
    116               value: "pg-cluster-v2-rw.postgres-cluster.svc.cluster.local"
    117             # TODO: Setup Redis
    118             - name: REDIS_ACTIVITY_URL
    119               value: "redis://bookwyrm-keydb.bookwyrm.svc.cluster.local:6379/0"
    120             - name: REDIS_BROKER_URL
    121               value: "redis://bookwyrm-keydb.bookwyrm.svc.cluster.local:6379/1"
    122             - name: FLOWER_USER
    123               value: "bookwyrm"
    124             - name: FLOWER_PASSWORD
    125               valueFrom:
    126                 secretKeyRef:
    127                   name: bookwyrm-secrets
    128                   key: FLOWER_PASSWORD
    129             - name: FLOWER_BASIC_AUTH
    130               value: "$(FLOWER_USER):$(FLOWER_PASSWORD)"
    131             - name: FLOWER_PORT
    132               value: "5555"
    133             - name: EMAIL_HOST
    134               value: "mail.midnightthoughts.space"
    135             - name: EMAIL_PORT
    136               value: "465"
    137             - name: EMAIL_USE_TLS
    138               value: "false"
    139             - name: EMAIL_USE_SSL
    140               value: "true"
    141             - name: EMAIL_HOST_USER
    142               value: "support@midnightthoughts.space"
    143             - name: EMAIL_HOST_PASSWORD
    144               valueFrom:
    145                 secretKeyRef:
    146                   name: bookwyrm-secrets
    147                   key: EMAIL_HOST_PASSWORD
    148             - name: EMAIL_SENDER_NAME
    149               value: "support"
    150             - name: EMAIL_SENDER_DOMAIN
    151               value: "midnightthoughts.space"
    152             - name: USE_S3
    153               value: "false"
    154             - name: AWS_ACCESS_KEY_ID
    155               valueFrom:
    156                 secretKeyRef:
    157                   name: bookwyrm-secrets
    158                   key: AWS_ACCESS_KEY_ID
    159             - name: AWS_SECRET_ACCESS_KEY
    160               valueFrom:
    161                 secretKeyRef:
    162                   name: bookwyrm-secrets
    163                   key: AWS_SECRET_ACCESS_KEY
    164             - name: AWS_STORAGE_BUCKET_NAME
    165               valueFrom:
    166                 secretKeyRef:
    167                   name: bookwyrm-secrets
    168                   key: AWS_STORAGE_BUCKET_NAME
    169             - name: AWS_S3_CUSTOM_DOMAIN
    170               valueFrom:
    171                 secretKeyRef:
    172                   name: bookwyrm-secrets
    173                   key: AWS_S3_CUSTOM_DOMAIN
    174             - name: AWS_S3_ENDPOINT_URL
    175               valueFrom:
    176                 secretKeyRef:
    177                   name: bookwyrm-secrets
    178                   key: AWS_S3_ENDPOINT_URL
    179             - name: ENABLE_THUMBNAIL_GENERATION
    180               value: "true"
    181             - name: STATIC_ROOT
    182               value: "static/"
    183             - name: MEDIA_ROOT
    184               value: "images/"
    185             - name: MAX_UPLOAD_MiB
    186               value: "100"
    187             - name: DATA_UPLOAD_MAX_MEMORY_MiB
    188               value: "100"
    189       containers:
    190         - name: nginx
    191           image: nginxinc/nginx-unprivileged:1.27-alpine
    192           securityContext:
    193             allowPrivilegeEscalation: false
    194             readOnlyRootFilesystem: false # envsubst template processing writes to /etc/nginx/conf.d/
    195             runAsNonRoot: true
    196             runAsUser: 101
    197             runAsGroup: 101
    198             capabilities:
    199               drop:
    200                 - ALL
    201             seccompProfile:
    202               type: RuntimeDefault
    203           resources:
    204             limits:
    205               cpu: "200m"
    206               memory: "128Mi"
    207             requests:
    208               cpu: "50m"
    209               memory: "64Mi"
    210           volumeMounts:
    211             - name: bookwyrm-data
    212               mountPath: /app/static
    213               subPath: static
    214             - name: bookwyrm-data
    215               mountPath: /app/media
    216               subPath: media
    217             - name: bookwyrm-data
    218               mountPath: /app/exports
    219               subPath: exports
    220             - name: bookwyrm-data
    221               mountPath: /app/images
    222               subPath: images
    223             - name: nginx-config
    224               mountPath: /etc/nginx/templates/default.conf.template
    225               subPath: reverse_proxy.conf
    226               readOnly: true
    227             - name: nginx-config
    228               mountPath: /etc/nginx/templates/server_config.template
    229               subPath: server_config
    230               readOnly: true
    231             - name: nginx-config
    232               mountPath: /etc/nginx/conf.d/locations
    233               subPath: locations
    234               readOnly: true
    235             - name: nginx-config
    236               mountPath: /etc/nginx/conf.d/server_name
    237               subPath: server_name
    238               readOnly: true
    239             - name: nginx-tmp
    240               mountPath: /tmp
    241             - name: nginx-var-cache
    242               mountPath: /var/cache/nginx
    243             - name: nginx-var-run
    244               mountPath: /var/run
    245           env:
    246             - name: POD_IP
    247               valueFrom:
    248                 fieldRef:
    249                   fieldPath: status.podIP
    250             - name: DEBUG
    251               value: "false"
    252             - name: ALLOWED_HOSTS
    253               value: "books.mtrnord.blog,localhost,$(POD_IP)"
    254             - name: SECRET_KEY
    255               valueFrom:
    256                 secretKeyRef:
    257                   name: bookwyrm-secrets
    258                   key: SECRET_KEY
    259             - name: DOMAIN
    260               value: "books.mtrnord.blog"
    261             - name: USE_HTTPS
    262               value: "true"
    263             - name: PGPORT
    264               value: "5432"
    265             - name: POSTGRES_PASSWORD
    266               valueFrom:
    267                 secretKeyRef:
    268                   name: bookwyrm-secrets
    269                   key: POSTGRES_PASSWORD
    270             - name: POSTGRES_USER
    271               value: "bookwyrm"
    272             - name: POSTGRES_DB
    273               value: "bookwyrm"
    274             - name: POSTGRES_HOST
    275               value: "pg-cluster-v2-rw.postgres-cluster.svc.cluster.local"
    276             # TODO: Setup Redis
    277             - name: REDIS_ACTIVITY_URL
    278               value: "redis://bookwyrm-keydb.bookwyrm.svc.cluster.local:6379/0"
    279             - name: REDIS_BROKER_URL
    280               value: "redis://bookwyrm-keydb.bookwyrm.svc.cluster.local:6379/1"
    281             - name: FLOWER_USER
    282               value: "bookwyrm"
    283             - name: FLOWER_PASSWORD
    284               valueFrom:
    285                 secretKeyRef:
    286                   name: bookwyrm-secrets
    287                   key: FLOWER_PASSWORD
    288             - name: FLOWER_BASIC_AUTH
    289               value: "$(FLOWER_USER):$(FLOWER_PASSWORD)"
    290             - name: FLOWER_PORT
    291               value: "5555"
    292             - name: EMAIL_HOST
    293               value: "mail.midnightthoughts.space"
    294             - name: EMAIL_PORT
    295               value: "465"
    296             - name: EMAIL_USE_TLS
    297               value: "false"
    298             - name: EMAIL_USE_SSL
    299               value: "true"
    300             - name: EMAIL_HOST_USER
    301               value: "support@midnightthoughts.space"
    302             - name: EMAIL_HOST_PASSWORD
    303               valueFrom:
    304                 secretKeyRef:
    305                   name: bookwyrm-secrets
    306                   key: EMAIL_HOST_PASSWORD
    307             - name: EMAIL_SENDER_NAME
    308               value: "support"
    309             - name: EMAIL_SENDER_DOMAIN
    310               value: "midnightthoughts.space"
    311             - name: USE_S3
    312               value: "false"
    313             - name: AWS_ACCESS_KEY_ID
    314               valueFrom:
    315                 secretKeyRef:
    316                   name: bookwyrm-secrets
    317                   key: AWS_ACCESS_KEY_ID
    318             - name: AWS_SECRET_ACCESS_KEY
    319               valueFrom:
    320                 secretKeyRef:
    321                   name: bookwyrm-secrets
    322                   key: AWS_SECRET_ACCESS_KEY
    323             - name: AWS_STORAGE_BUCKET_NAME
    324               valueFrom:
    325                 secretKeyRef:
    326                   name: bookwyrm-secrets
    327                   key: AWS_STORAGE_BUCKET_NAME
    328             - name: AWS_S3_CUSTOM_DOMAIN
    329               valueFrom:
    330                 secretKeyRef:
    331                   name: bookwyrm-secrets
    332                   key: AWS_S3_CUSTOM_DOMAIN
    333             - name: AWS_S3_ENDPOINT_URL
    334               valueFrom:
    335                 secretKeyRef:
    336                   name: bookwyrm-secrets
    337                   key: AWS_S3_ENDPOINT_URL
    338             - name: ENABLE_THUMBNAIL_GENERATION
    339               value: "true"
    340             - name: STATIC_ROOT
    341               value: "static/"
    342             - name: MEDIA_ROOT
    343               value: "images/"
    344             - name: MAX_UPLOAD_MiB
    345               value: "100"
    346             - name: DATA_UPLOAD_MAX_MEMORY_MiB
    347               value: "100"
    348           livenessProbe:
    349             httpGet:
    350               port: 8080
    351               path: "/"
    352             initialDelaySeconds: 15
    353             periodSeconds: 30
    354           ports:
    355             - name: bookwyrm-nginx
    356               containerPort: 8080
    357               protocol: TCP
    358         - name: bookwyrm-web
    359           image: registry.midnightthoughts.space/mtrnord/bookwyrm:v0.8.5 # {"$imagepolicy": "flux-system:bookwyrm"}
    360           imagePullPolicy: Always
    361           command: ["gunicorn"]
    362           args:
    363             - "bookwyrm.wsgi:application"
    364           securityContext:
    365             allowPrivilegeEscalation: false
    366             readOnlyRootFilesystem: false
    367             runAsNonRoot: true
    368             runAsUser: 1000
    369             runAsGroup: 1000
    370             capabilities:
    371               drop:
    372                 - ALL
    373             seccompProfile:
    374               type: RuntimeDefault
    375           resources:
    376             limits:
    377               cpu: "500m"
    378               memory: "3Gi"
    379             requests:
    380               cpu: 200m
    381               memory: 500Mi
    382           volumeMounts:
    383             - name: bookwyrm-data
    384               mountPath: /app/static
    385               subPath: static
    386             - name: bookwyrm-data
    387               mountPath: /app/media
    388               subPath: media
    389             - name: bookwyrm-data
    390               mountPath: /app/exports
    391               subPath: exports
    392             - name: bookwyrm-data
    393               mountPath: /app/images
    394               subPath: images
    395           env:
    396             - name: POD_IP
    397               valueFrom:
    398                 fieldRef:
    399                   fieldPath: status.podIP
    400             - name: DEBUG
    401               value: "false"
    402             - name: ALLOWED_HOSTS
    403               value: "books.mtrnord.blog,localhost,$(POD_IP)"
    404             - name: SECRET_KEY
    405               valueFrom:
    406                 secretKeyRef:
    407                   name: bookwyrm-secrets
    408                   key: SECRET_KEY
    409             - name: DOMAIN
    410               value: "books.mtrnord.blog"
    411             - name: USE_HTTPS
    412               value: "true"
    413             - name: PGPORT
    414               value: "5432"
    415             - name: POSTGRES_PASSWORD
    416               valueFrom:
    417                 secretKeyRef:
    418                   name: bookwyrm-secrets
    419                   key: POSTGRES_PASSWORD
    420             - name: POSTGRES_USER
    421               value: "bookwyrm"
    422             - name: POSTGRES_DB
    423               value: "bookwyrm"
    424             - name: POSTGRES_HOST
    425               value: "pg-cluster-v2-rw.postgres-cluster.svc.cluster.local"
    426             # TODO: Setup Redis
    427             - name: REDIS_ACTIVITY_URL
    428               value: "redis://bookwyrm-keydb.bookwyrm.svc.cluster.local:6379/0"
    429             - name: REDIS_BROKER_URL
    430               value: "redis://bookwyrm-keydb.bookwyrm.svc.cluster.local:6379/1"
    431             - name: FLOWER_USER
    432               value: "bookwyrm"
    433             - name: FLOWER_PASSWORD
    434               valueFrom:
    435                 secretKeyRef:
    436                   name: bookwyrm-secrets
    437                   key: FLOWER_PASSWORD
    438             - name: FLOWER_BASIC_AUTH
    439               value: "$(FLOWER_USER):$(FLOWER_PASSWORD)"
    440             - name: FLOWER_PORT
    441               value: "5555"
    442             - name: EMAIL_HOST
    443               value: "mail.midnightthoughts.space"
    444             - name: EMAIL_PORT
    445               value: "465"
    446             - name: EMAIL_USE_TLS
    447               value: "false"
    448             - name: EMAIL_USE_SSL
    449               value: "true"
    450             - name: EMAIL_HOST_USER
    451               value: "support@midnightthoughts.space"
    452             - name: EMAIL_HOST_PASSWORD
    453               valueFrom:
    454                 secretKeyRef:
    455                   name: bookwyrm-secrets
    456                   key: EMAIL_HOST_PASSWORD
    457             - name: EMAIL_SENDER_NAME
    458               value: "support"
    459             - name: EMAIL_SENDER_DOMAIN
    460               value: "midnightthoughts.space"
    461             - name: USE_S3
    462               value: "false"
    463             - name: AWS_ACCESS_KEY_ID
    464               valueFrom:
    465                 secretKeyRef:
    466                   name: bookwyrm-secrets
    467                   key: AWS_ACCESS_KEY_ID
    468             - name: AWS_SECRET_ACCESS_KEY
    469               valueFrom:
    470                 secretKeyRef:
    471                   name: bookwyrm-secrets
    472                   key: AWS_SECRET_ACCESS_KEY
    473             - name: AWS_STORAGE_BUCKET_NAME
    474               valueFrom:
    475                 secretKeyRef:
    476                   name: bookwyrm-secrets
    477                   key: AWS_STORAGE_BUCKET_NAME
    478             - name: AWS_S3_CUSTOM_DOMAIN
    479               valueFrom:
    480                 secretKeyRef:
    481                   name: bookwyrm-secrets
    482                   key: AWS_S3_CUSTOM_DOMAIN
    483             - name: AWS_S3_ENDPOINT_URL
    484               valueFrom:
    485                 secretKeyRef:
    486                   name: bookwyrm-secrets
    487                   key: AWS_S3_ENDPOINT_URL
    488             - name: ENABLE_THUMBNAIL_GENERATION
    489               value: "true"
    490             - name: STATIC_ROOT
    491               value: "static/"
    492             - name: MEDIA_ROOT
    493               value: "images/"
    494             - name: MAX_UPLOAD_MiB
    495               value: "100"
    496             - name: DATA_UPLOAD_MAX_MEMORY_MiB
    497               value: "100"
    498           livenessProbe:
    499             httpGet:
    500               port: 8000
    501               path: "/"
    502             initialDelaySeconds: 15
    503             periodSeconds: 30
    504           ports:
    505             - name: bookwyrm-http
    506               containerPort: 8000
    507               protocol: TCP
    508         - name: bookwyrm-celery-worker
    509           image: registry.midnightthoughts.space/mtrnord/bookwyrm:v0.8.5 # {"$imagepolicy": "flux-system:bookwyrm"}
    510           imagePullPolicy: Always
    511           command: ["celery"]
    512           args:
    513             - "-A"
    514             - "celerywyrm"
    515             - "worker"
    516             - "-l"
    517             - "info"
    518             - "-Q"
    519             - "high_priority,medium_priority,low_priority,streams,images,suggested_users,email,connectors,lists,inbox,imports,import_triggered,broadcast,misc"
    520           securityContext:
    521             allowPrivilegeEscalation: false
    522             readOnlyRootFilesystem: false
    523             runAsNonRoot: true
    524             runAsUser: 1000
    525             runAsGroup: 1000
    526             capabilities:
    527               drop:
    528                 - ALL
    529             seccompProfile:
    530               type: RuntimeDefault
    531           resources:
    532             limits:
    533               cpu: "500m"
    534               memory: "2Gi"
    535             requests:
    536               cpu: 200m
    537               memory: 200Mi
    538           volumeMounts:
    539             - name: bookwyrm-data
    540               mountPath: /app/static
    541               subPath: static
    542             - name: bookwyrm-data
    543               mountPath: /app/media
    544               subPath: media
    545             - name: bookwyrm-data
    546               mountPath: /app/exports
    547               subPath: exports
    548             - name: bookwyrm-data
    549               mountPath: /app/images
    550               subPath: images
    551           env:
    552             - name: POD_IP
    553               valueFrom:
    554                 fieldRef:
    555                   fieldPath: status.podIP
    556             - name: DEBUG
    557               value: "false"
    558             - name: ALLOWED_HOSTS
    559               value: "books.mtrnord.blog,localhost,$(POD_IP)"
    560             - name: SECRET_KEY
    561               valueFrom:
    562                 secretKeyRef:
    563                   name: bookwyrm-secrets
    564                   key: SECRET_KEY
    565             - name: DOMAIN
    566               value: "books.mtrnord.blog"
    567             - name: USE_HTTPS
    568               value: "true"
    569             - name: PGPORT
    570               value: "5432"
    571             - name: POSTGRES_PASSWORD
    572               valueFrom:
    573                 secretKeyRef:
    574                   name: bookwyrm-secrets
    575                   key: POSTGRES_PASSWORD
    576             - name: POSTGRES_USER
    577               value: "bookwyrm"
    578             - name: POSTGRES_DB
    579               value: "bookwyrm"
    580             - name: POSTGRES_HOST
    581               value: "pg-cluster-v2-rw.postgres-cluster.svc.cluster.local"
    582             # TODO: Setup Redis
    583             - name: REDIS_ACTIVITY_URL
    584               value: "redis://bookwyrm-keydb.bookwyrm.svc.cluster.local:6379/0"
    585             - name: REDIS_BROKER_URL
    586               value: "redis://bookwyrm-keydb.bookwyrm.svc.cluster.local:6379/1"
    587             - name: FLOWER_USER
    588               value: "bookwyrm"
    589             - name: FLOWER_PASSWORD
    590               valueFrom:
    591                 secretKeyRef:
    592                   name: bookwyrm-secrets
    593                   key: FLOWER_PASSWORD
    594             - name: FLOWER_BASIC_AUTH
    595               value: "$(FLOWER_USER):$(FLOWER_PASSWORD)"
    596             - name: FLOWER_PORT
    597               value: "5555"
    598             - name: EMAIL_HOST
    599               value: "mail.midnightthoughts.space"
    600             - name: EMAIL_PORT
    601               value: "465"
    602             - name: EMAIL_USE_TLS
    603               value: "false"
    604             - name: EMAIL_USE_SSL
    605               value: "true"
    606             - name: EMAIL_HOST_USER
    607               value: "support@midnightthoughts.space"
    608             - name: EMAIL_HOST_PASSWORD
    609               valueFrom:
    610                 secretKeyRef:
    611                   name: bookwyrm-secrets
    612                   key: EMAIL_HOST_PASSWORD
    613             - name: EMAIL_SENDER_NAME
    614               value: "support"
    615             - name: EMAIL_SENDER_DOMAIN
    616               value: "midnightthoughts.space"
    617             - name: USE_S3
    618               value: "false"
    619             - name: AWS_ACCESS_KEY_ID
    620               valueFrom:
    621                 secretKeyRef:
    622                   name: bookwyrm-secrets
    623                   key: AWS_ACCESS_KEY_ID
    624             - name: AWS_SECRET_ACCESS_KEY
    625               valueFrom:
    626                 secretKeyRef:
    627                   name: bookwyrm-secrets
    628                   key: AWS_SECRET_ACCESS_KEY
    629             - name: AWS_STORAGE_BUCKET_NAME
    630               valueFrom:
    631                 secretKeyRef:
    632                   name: bookwyrm-secrets
    633                   key: AWS_STORAGE_BUCKET_NAME
    634             - name: AWS_S3_CUSTOM_DOMAIN
    635               valueFrom:
    636                 secretKeyRef:
    637                   name: bookwyrm-secrets
    638                   key: AWS_S3_CUSTOM_DOMAIN
    639             - name: AWS_S3_ENDPOINT_URL
    640               valueFrom:
    641                 secretKeyRef:
    642                   name: bookwyrm-secrets
    643                   key: AWS_S3_ENDPOINT_URL
    644             - name: ENABLE_THUMBNAIL_GENERATION
    645               value: "true"
    646             - name: STATIC_ROOT
    647               value: "static/"
    648             - name: MEDIA_ROOT
    649               value: "images/"
    650             - name: MAX_UPLOAD_MiB
    651               value: "100"
    652             - name: DATA_UPLOAD_MAX_MEMORY_MiB
    653               value: "100"
    654         - name: bookwyrm-celery-beat
    655           image: registry.midnightthoughts.space/mtrnord/bookwyrm:v0.8.5 # {"$imagepolicy": "flux-system:bookwyrm"}
    656           imagePullPolicy: Always
    657           command: ["celery"]
    658           args:
    659             - "-A"
    660             - "celerywyrm"
    661             - "beat"
    662             - "-l"
    663             - "INFO"
    664             - "--scheduler"
    665             - "django_celery_beat.schedulers:DatabaseScheduler"
    666           securityContext:
    667             allowPrivilegeEscalation: false
    668             readOnlyRootFilesystem: false
    669             runAsNonRoot: true
    670             runAsUser: 1000
    671             runAsGroup: 1000
    672             capabilities:
    673               drop:
    674                 - ALL
    675             seccompProfile:
    676               type: RuntimeDefault
    677           resources:
    678             limits:
    679               cpu: "200m"
    680               memory: "500Mi"
    681             requests:
    682               cpu: 200m
    683               memory: 200Mi
    684           volumeMounts:
    685             - name: bookwyrm-data
    686               mountPath: /app/static
    687               subPath: static
    688             - name: bookwyrm-data
    689               mountPath: /app/media
    690               subPath: media
    691             - name: bookwyrm-data
    692               mountPath: /app/exports
    693               subPath: exports
    694             - name: bookwyrm-data
    695               mountPath: /app/images
    696               subPath: images
    697           env:
    698             - name: POD_IP
    699               valueFrom:
    700                 fieldRef:
    701                   fieldPath: status.podIP
    702             - name: DEBUG
    703               value: "false"
    704             - name: ALLOWED_HOSTS
    705               value: "books.mtrnord.blog,localhost,$(POD_IP)"
    706             - name: SECRET_KEY
    707               valueFrom:
    708                 secretKeyRef:
    709                   name: bookwyrm-secrets
    710                   key: SECRET_KEY
    711             - name: DOMAIN
    712               value: "books.mtrnord.blog"
    713             - name: USE_HTTPS
    714               value: "true"
    715             - name: PGPORT
    716               value: "5432"
    717             - name: POSTGRES_PASSWORD
    718               valueFrom:
    719                 secretKeyRef:
    720                   name: bookwyrm-secrets
    721                   key: POSTGRES_PASSWORD
    722             - name: POSTGRES_USER
    723               value: "bookwyrm"
    724             - name: POSTGRES_DB
    725               value: "bookwyrm"
    726             - name: POSTGRES_HOST
    727               value: "pg-cluster-v2-rw.postgres-cluster.svc.cluster.local"
    728             # TODO: Setup Redis
    729             - name: REDIS_ACTIVITY_URL
    730               value: "redis://bookwyrm-keydb.bookwyrm.svc.cluster.local:6379/0"
    731             - name: REDIS_BROKER_URL
    732               value: "redis://bookwyrm-keydb.bookwyrm.svc.cluster.local:6379/1"
    733             - name: FLOWER_USER
    734               value: "bookwyrm"
    735             - name: FLOWER_PASSWORD
    736               valueFrom:
    737                 secretKeyRef:
    738                   name: bookwyrm-secrets
    739                   key: FLOWER_PASSWORD
    740             - name: FLOWER_BASIC_AUTH
    741               value: "$(FLOWER_USER):$(FLOWER_PASSWORD)"
    742             - name: FLOWER_PORT
    743               value: "5555"
    744             - name: EMAIL_HOST
    745               value: "mail.midnightthoughts.space"
    746             - name: EMAIL_PORT
    747               value: "465"
    748             - name: EMAIL_USE_TLS
    749               value: "false"
    750             - name: EMAIL_USE_SSL
    751               value: "true"
    752             - name: EMAIL_HOST_USER
    753               value: "support@midnightthoughts.space"
    754             - name: EMAIL_HOST_PASSWORD
    755               valueFrom:
    756                 secretKeyRef:
    757                   name: bookwyrm-secrets
    758                   key: EMAIL_HOST_PASSWORD
    759             - name: EMAIL_SENDER_NAME
    760               value: "support"
    761             - name: EMAIL_SENDER_DOMAIN
    762               value: "midnightthoughts.space"
    763             - name: USE_S3
    764               value: "false"
    765             - name: AWS_ACCESS_KEY_ID
    766               valueFrom:
    767                 secretKeyRef:
    768                   name: bookwyrm-secrets
    769                   key: AWS_ACCESS_KEY_ID
    770             - name: AWS_SECRET_ACCESS_KEY
    771               valueFrom:
    772                 secretKeyRef:
    773                   name: bookwyrm-secrets
    774                   key: AWS_SECRET_ACCESS_KEY
    775             - name: AWS_STORAGE_BUCKET_NAME
    776               valueFrom:
    777                 secretKeyRef:
    778                   name: bookwyrm-secrets
    779                   key: AWS_STORAGE_BUCKET_NAME
    780             - name: AWS_S3_CUSTOM_DOMAIN
    781               valueFrom:
    782                 secretKeyRef:
    783                   name: bookwyrm-secrets
    784                   key: AWS_S3_CUSTOM_DOMAIN
    785             - name: AWS_S3_ENDPOINT_URL
    786               valueFrom:
    787                 secretKeyRef:
    788                   name: bookwyrm-secrets
    789                   key: AWS_S3_ENDPOINT_URL
    790             - name: ENABLE_THUMBNAIL_GENERATION
    791               value: "true"
    792             - name: STATIC_ROOT
    793               value: "static/"
    794             - name: MEDIA_ROOT
    795               value: "images/"
    796             - name: MAX_UPLOAD_MiB
    797               value: "100"
    798             - name: DATA_UPLOAD_MAX_MEMORY_MiB
    799               value: "100"
    800         - name: bookwyrm-flower
    801           image: registry.midnightthoughts.space/mtrnord/bookwyrm:v0.8.5 # {"$imagepolicy": "flux-system:bookwyrm"}
    802           imagePullPolicy: Always
    803           command: ["celery"]
    804           args:
    805             - "-A"
    806             - "celerywyrm"
    807             - "flower"
    808             - "--url_prefix=flower"
    809           securityContext:
    810             allowPrivilegeEscalation: false
    811             readOnlyRootFilesystem: false
    812             runAsNonRoot: true
    813             runAsUser: 1000
    814             runAsGroup: 1000
    815             capabilities:
    816               drop:
    817                 - ALL
    818             seccompProfile:
    819               type: RuntimeDefault
    820           resources:
    821             limits:
    822               cpu: "200m"
    823               memory: "500Mi"
    824             requests:
    825               cpu: 200m
    826               memory: 200Mi
    827           volumeMounts:
    828             - name: bookwyrm-data
    829               mountPath: /app/static
    830               subPath: static
    831             - name: bookwyrm-data
    832               mountPath: /app/media
    833               subPath: media
    834             - name: bookwyrm-data
    835               mountPath: /app/exports
    836               subPath: exports
    837             - name: bookwyrm-data
    838               mountPath: /app/images
    839               subPath: images
    840           env:
    841             - name: POD_IP
    842               valueFrom:
    843                 fieldRef:
    844                   fieldPath: status.podIP
    845             - name: DEBUG
    846               value: "false"
    847             - name: ALLOWED_HOSTS
    848               value: "books.mtrnord.blog,localhost,$(POD_IP)"
    849             - name: SECRET_KEY
    850               valueFrom:
    851                 secretKeyRef:
    852                   name: bookwyrm-secrets
    853                   key: SECRET_KEY
    854             - name: DOMAIN
    855               value: "books.mtrnord.blog"
    856             - name: USE_HTTPS
    857               value: "true"
    858             - name: PGPORT
    859               value: "5432"
    860             - name: POSTGRES_PASSWORD
    861               valueFrom:
    862                 secretKeyRef:
    863                   name: bookwyrm-secrets
    864                   key: POSTGRES_PASSWORD
    865             - name: POSTGRES_USER
    866               value: "bookwyrm"
    867             - name: POSTGRES_DB
    868               value: "bookwyrm"
    869             - name: POSTGRES_HOST
    870               value: "pg-cluster-v2-rw.postgres-cluster.svc.cluster.local"
    871             # TODO: Setup Redis
    872             - name: REDIS_ACTIVITY_URL
    873               value: "redis://bookwyrm-keydb.bookwyrm.svc.cluster.local:6379/0"
    874             - name: REDIS_BROKER_URL
    875               value: "redis://bookwyrm-keydb.bookwyrm.svc.cluster.local:6379/1"
    876             - name: FLOWER_USER
    877               value: "bookwyrm"
    878             - name: FLOWER_PASSWORD
    879               valueFrom:
    880                 secretKeyRef:
    881                   name: bookwyrm-secrets
    882                   key: FLOWER_PASSWORD
    883             - name: FLOWER_BASIC_AUTH
    884               value: "$(FLOWER_USER):$(FLOWER_PASSWORD)"
    885             - name: FLOWER_PORT
    886               value: "5555"
    887             - name: EMAIL_HOST
    888               value: "mail.midnightthoughts.space"
    889             - name: EMAIL_PORT
    890               value: "465"
    891             - name: EMAIL_USE_TLS
    892               value: "false"
    893             - name: EMAIL_USE_SSL
    894               value: "true"
    895             - name: EMAIL_HOST_USER
    896               value: "support@midnightthoughts.space"
    897             - name: EMAIL_HOST_PASSWORD
    898               valueFrom:
    899                 secretKeyRef:
    900                   name: bookwyrm-secrets
    901                   key: EMAIL_HOST_PASSWORD
    902             - name: EMAIL_SENDER_NAME
    903               value: "support"
    904             - name: EMAIL_SENDER_DOMAIN
    905               value: "midnightthoughts.space"
    906             - name: USE_S3
    907               value: "false"
    908             - name: AWS_ACCESS_KEY_ID
    909               valueFrom:
    910                 secretKeyRef:
    911                   name: bookwyrm-secrets
    912                   key: AWS_ACCESS_KEY_ID
    913             - name: AWS_SECRET_ACCESS_KEY
    914               valueFrom:
    915                 secretKeyRef:
    916                   name: bookwyrm-secrets
    917                   key: AWS_SECRET_ACCESS_KEY
    918             - name: AWS_STORAGE_BUCKET_NAME
    919               valueFrom:
    920                 secretKeyRef:
    921                   name: bookwyrm-secrets
    922                   key: AWS_STORAGE_BUCKET_NAME
    923             - name: AWS_S3_CUSTOM_DOMAIN
    924               valueFrom:
    925                 secretKeyRef:
    926                   name: bookwyrm-secrets
    927                   key: AWS_S3_CUSTOM_DOMAIN
    928             - name: AWS_S3_ENDPOINT_URL
    929               valueFrom:
    930                 secretKeyRef:
    931                   name: bookwyrm-secrets
    932                   key: AWS_S3_ENDPOINT_URL
    933             - name: ENABLE_THUMBNAIL_GENERATION
    934               value: "true"
    935             - name: STATIC_ROOT
    936               value: "static/"
    937             - name: MEDIA_ROOT
    938               value: "images/"
    939             - name: MAX_UPLOAD_MiB
    940               value: "100"
    941             - name: DATA_UPLOAD_MAX_MEMORY_MiB
    942               value: "100"
    943           ports:
    944             - name: flower-http
    945               containerPort: 5555
    946               protocol: TCP
    947 ---
    948 # Service for BookWyrm
    949 apiVersion: v1
    950 kind: Service
    951 metadata:
    952   name: bookwyrm
    953   labels:
    954     app: bookwyrm
    955 spec:
    956   selector:
    957     app: bookwyrm
    958   ports:
    959     - name: http
    960       protocol: TCP
    961       port: 8080
    962       targetPort: 8080
    963 ---
    964 # HTTPRoute for BookWyrm
    965 apiVersion: gateway.networking.k8s.io/v1
    966 kind: HTTPRoute
    967 metadata:
    968   name: bookwyrm
    969   namespace: bookwyrm
    970 spec:
    971   parentRefs:
    972     - name: envoy-gateway
    973       namespace: envoy-gateway
    974   hostnames:
    975     - books.mtrnord.blog
    976   rules:
    977     - name: bookwyrm-traffic
    978       matches:
    979         - path:
    980             type: PathPrefix
    981             value: /
    982       backendRefs:
    983         - name: bookwyrm
    984           port: 8080
    985       timeouts:
    986         request: 240s
    987         backendRequest: 0s