diff --git a/manifest.yaml b/manifest.yaml index f352159..9c2a314 100644 --- a/manifest.yaml +++ b/manifest.yaml @@ -12,6 +12,18 @@ data: SENTRY_LARAVEL_DSN: "${APP_SENTRY_LARAVEL_DSN}" MATOMO_SITE_ID: "${APP_MATOMO_SITE_ID}" --- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: ${CI_PROJECT_PATH_SLUG}-pvc-storage +spec: + storageClassName: "csi-cinder-classic" + accessModes: + - ReadWriteOnce + resources: + requests: + storage: $APP_PVC_SIZE +--- apiVersion: apps/v1 kind: Deployment metadata: @@ -29,10 +41,11 @@ spec: volumes: - name: apache-run emptyDir: {} - # TODO remettre avec readOnlyFilesystem- name: laravel-storage - # emptyDir: {} - name: laravel-cache emptyDir: {} + - name: storage + persistentVolumeClaim: + claimName: ${CI_PROJECT_PATH_SLUG}-pvc-storage containers: - name: ${CI_PROJECT_PATH_SLUG}-container image: $IMAGE_TAG @@ -40,10 +53,10 @@ spec: - configMapRef: name: ${CI_PROJECT_PATH_SLUG}-config-map volumeMounts: + - name: storage + mountPath: /app/srcs/storage - name: apache-run mountPath: /var/run - # - name: laravel-storage - # mountPath: /app/srcs/storage - name: laravel-cache mountPath: /app/srcs/bootstrap/cache securityContext: @@ -126,4 +139,58 @@ spec: middlewares: - name: redirect-www-to-no-www tls: - secretName: ${CRT_TLS_NAME} \ No newline at end of file + secretName: ${CRT_TLS_NAME} +--- +apiVersion: batch/v1 +kind: CronJob +metadata: + name: ${CI_PROJECT_PATH_SLUG}-cronjob +spec: + schedule: "* * * * *" + successfulJobsHistoryLimit: 1 + failedJobsHistoryLimit: 1 + concurrencyPolicy: Forbid + jobTemplate: + spec: + template: + spec: + affinity: + podAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchExpressions: + - key: app + operator: In + values: + - ${CI_PROJECT_PATH_SLUG}-app + topologyKey: "kubernetes.io/hostname" + namespaces: [ $KUBE_NAMESPACE ] + containers: + - name: ${CI_PROJECT_PATH_SLUG}-scheduled + image: $IMAGE_TAG + imagePullPolicy: IfNotPresent + command: + - "php" + args: + - "artisan" + - "schedule:run" + envFrom: + - configMapRef: + name: ${CI_PROJECT_PATH_SLUG}-config-map + volumeMounts: + - name: storage + mountPath: /app/srcs/storage + imagePullSecrets: + - name: docker-registry-credentials + volumes: + - name: storage + persistentVolumeClaim: + claimName: ${CI_PROJECT_PATH_SLUG}-pvc-storage + securityContext: + runAsUser: 33 + runAsGroup: 33 + #TODO : valider le POC readOnlyRootFilesystem: true + allowPrivilegeEscalation: false + fsGroup: 33 + fsGroupChangePolicy: "OnRootMismatch" + restartPolicy: OnFailure diff --git a/resources/ts/app.tsx b/resources/ts/app.tsx index 3010bbb..5c6d2fc 100644 --- a/resources/ts/app.tsx +++ b/resources/ts/app.tsx @@ -13,7 +13,7 @@ interface PageModule { const appPages = import.meta.glob("./*/Pages/**/*.tsx"); void createInertiaApp({ - title: (title) => `${title}`, + title: (title) => title, resolve: async (name) => { const page = await resolvePageComponent( `./${name}.tsx`, diff --git a/resources/ts/ssr.tsx b/resources/ts/ssr.tsx index 410de49..3ece327 100644 --- a/resources/ts/ssr.tsx +++ b/resources/ts/ssr.tsx @@ -20,15 +20,12 @@ interface PageModule { default: PageComponent; } -const appName: string = (import.meta.env as Record) - .VITE_APP_NAME; - const appPages = import.meta.glob("./front/Pages/**/*.tsx"); createServer((page) => createInertiaApp({ page, - title: (title) => `${title} - ${appName}`, + title: (title) => title, render: ReactDOMServer.renderToString, resolve: async (name) => { const pageModule = await resolvePageComponent(