Change to ghost:alpine

This commit is contained in:
Ruben Hensen
2025-03-26 12:56:12 +01:00
parent ef86b68df9
commit 549f47462d
2 changed files with 63 additions and 77 deletions
+28 -52
View File
@@ -1,66 +1,42 @@
apiVersion: external-secrets.io/v1beta1 apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret kind: ExternalSecret
metadata: metadata:
name: ghost-config-prod name: ghost-mail-config
namespace: ghost-blog namespace: ghost-blog
annotations:
argocd.argoproj.io/sync-wave: "4"
spec: spec:
refreshInterval: "15m" refreshInterval: "15m"
secretStoreRef: secretStoreRef:
name: vault-backend name: vault-backend
kind: ClusterSecretStore kind: ClusterSecretStore
target: target:
name: ghost-config-prod name: ghost-mail-config
creationPolicy: Owner creationPolicy: Owner
data: data:
- secretKey: config.production.json - secretKey: mail__transport
remoteRef: remoteRef:
key: kv/ghost-blog/config key: kv/ghost-blog/config
template: property: email_transport
engine: gotmpl - secretKey: mail__from
data: | remoteRef:
{ key: kv/ghost-blog/config
"url": "https://blog.hensen.io", property: email_from
"admin": { - secretKey: mail__options__service
"url": "https://blog.hensen.io" remoteRef:
}, key: kv/ghost-blog/config
"server": { property: email_service
"port": 2368, - secretKey: mail__options__host
"host": "0.0.0.0" remoteRef:
}, key: kv/ghost-blog/config
"mail": { property: email_host
"transport": "SMTP", - secretKey: mail__options__port
"from": "{{ .email_from }}", remoteRef:
"options": { key: kv/ghost-blog/config
"service": "{{ .email_service }}", property: email_port
"host": "{{ .email_host }}", - secretKey: mail__options__auth__user
"port": {{ .email_port }}, remoteRef:
"secure": {{ .email_secure }}, key: kv/ghost-blog/config
"auth": { property: email_user
"user": "{{ .email_user }}", - secretKey: mail__options__auth__pass
"pass": "{{ .email_password }}" remoteRef:
} key: kv/ghost-blog/config
} property: email_password
},
"logging": {
"transports": [
"stdout"
]
},
"database": {
"client": "mysql",
"connection":
{
"host": "ghost-mysql-service",
"user": "{{ .db_user }}",
"password": "{{ .db_password }}",
"database": "{{ .db_name }}",
"port": "3306"
}
},
"process": "local",
"paths": {
"contentPath": "/home/nonroot/app/ghost/content"
}
}
+35 -25
View File
@@ -10,8 +10,6 @@ metadata:
app.kubernetes.io/version: '5.92' app.kubernetes.io/version: '5.92'
app.kubernetes.io/component: ghost app.kubernetes.io/component: ghost
app.kubernetes.io/part-of: ghost-blog app.kubernetes.io/part-of: ghost-blog
annotations:
argocd.argoproj.io/sync-wave: "6"
spec: spec:
replicas: 1 replicas: 1
selector: selector:
@@ -36,35 +34,24 @@ spec:
- name: ghost-content - name: ghost-content
persistentVolumeClaim: persistentVolumeClaim:
claimName: ghost-content claimName: ghost-content
- name: ghost-config-prod
secret:
secretName: ghost-config-prod
defaultMode: 420
- name: tmp - name: tmp
emptyDir: emptyDir:
sizeLimit: 64Mi sizeLimit: 64Mi
- name: ghost-logs
emptyDir:
sizeLimit: 256Mi
initContainers: initContainers:
- name: permissions-fix - name: permissions-fix
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
image: docker.io/busybox:stable-musl image: docker.io/busybox:stable-musl
env: env:
- name: GHOST_INSTALL
value: /home/nonroot/app/ghost
- name: GHOST_CONTENT - name: GHOST_CONTENT
value: /home/nonroot/app/ghost/content value: /var/lib/ghost/content
- name: NODE_ENV
value: production
securityContext: securityContext:
readOnlyRootFilesystem: true readOnlyRootFilesystem: true
allowPrivilegeEscalation: false allowPrivilegeEscalation: false
resources: resources:
limits: limits:
cpu: 900m cpu: 500m
memory: 1000Mi memory: 256Mi
requests: requests:
cpu: 100m cpu: 100m
memory: 128Mi memory: 128Mi
@@ -81,20 +68,17 @@ spec:
echo "Creating $GHOST_CONTENT/$dir directory" echo "Creating $GHOST_CONTENT/$dir directory"
mkdir -pv $GHOST_CONTENT/$dir || echo "Error creating $GHOST_CONTENT/$dir directory" mkdir -pv $GHOST_CONTENT/$dir || echo "Error creating $GHOST_CONTENT/$dir directory"
fi fi
chown -Rfv 65532:65532 $GHOST_CONTENT/$dir && echo "chown ok on $dir" || echo "Error changing ownership of $GHOST_CONTENT/$dir directory" chown -Rfv 1000:1000 $GHOST_CONTENT/$dir && echo "chown ok on $dir" || echo "Error changing ownership of $GHOST_CONTENT/$dir directory"
done done
exit 0 exit 0
volumeMounts: volumeMounts:
- name: ghost-content - name: ghost-content
mountPath: /home/nonroot/app/ghost/content mountPath: /var/lib/ghost/content
readOnly: false
- name: ghost-logs
mountPath: /home/nonroot/app/ghost/versions/5.114.0/content/logs
readOnly: false readOnly: false
containers: containers:
- name: ghost-blog - name: ghost-blog
image: ghost:latest image: ghost:5.114.1-alpine
imagePullPolicy: Always imagePullPolicy: Always
ports: ports:
- name: ghost - name: ghost
@@ -131,6 +115,30 @@ spec:
env: env:
- name: NODE_ENV - name: NODE_ENV
value: production value: production
- name: database__client
value: mysql
- name: database__connection__host
value: ghost-mysql-service
- name: database__connection__user
valueFrom:
secretKeyRef:
name: ghost-mysql-env
key: MYSQL_USER
- name: database__connection__password
valueFrom:
secretKeyRef:
name: ghost-mysql-env
key: MYSQL_PASSWORD
- name: database__connection__database
valueFrom:
secretKeyRef:
name: ghost-mysql-env
key: MYSQL_DATABASE
- name: url
value: https://blog.hensen.io
envFrom:
- secretRef:
name: ghost-mail-config
resources: resources:
limits: limits:
cpu: 800m cpu: 800m
@@ -153,10 +161,12 @@ spec:
mountPath: /home/nonroot/app/ghost/versions/5.114.0/content/logs mountPath: /home/nonroot/app/ghost/versions/5.114.0/content/logs
readOnly: false readOnly: false
securityContext: securityContext:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false allowPrivilegeEscalation: false
runAsNonRoot: true runAsNonRoot: true
runAsUser: 65532 runAsUser: 1000
restartPolicy: Always restartPolicy: Always
terminationGracePeriodSeconds: 15 terminationGracePeriodSeconds: 15
dnsPolicy: ClusterFirst dnsPolicy: ClusterFirst
securityContext:
seccompProfile:
type: RuntimeDefault