Merge branch 'develop' into trunk

This commit is contained in:
Vincent BRIDIER 2023-12-11 15:57:55 +01:00
commit 87273397b2
No known key found for this signature in database
GPG key ID: 8571BFA20420D512
4 changed files with 70 additions and 3 deletions

1
.gitignore vendored
View file

@ -9,6 +9,7 @@
/.phpunit.cache
/.vscode
/node_modules
/bootstrap
/public/build
/public/cache
/public/hot

View file

@ -1,7 +1,5 @@
FROM registry.s-web.fr/ldc-web/projets/ldc-web-images-docker/ldcweb-production-8.2:latest
COPY --chown=www-data:www-data . /app/srcs
COPY --chown=www-data:www-data ./public /app/srcs/public
COPY --chown=www-data:www-data ./vendor /app/srcs/vendor
USER root
RUN chmod -R 755 /app/srcs/storage
USER www-data

30
k8s-queues.sh Normal file
View file

@ -0,0 +1,30 @@
#!/usr/bin/env bash
# From https://stackoverflow.com/a/76488746/17320077
work=true
function stopQueues() {
echo "Stopping queues..."
work=false
php artisan queue:restart
sleep 300
exit 0
}
# handle graceful shutdown
trap "" SIGPIPE
trap stopQueues SIGTERM SIGINT SIGHUP
echo "Starting PHP queue workers..."
while $work; do
php artisan queue:work --queue=default,stats --sleep=3 --tries=3 --max-time=3600 --no-interaction
sleep 1
done
# Si besoin de plusieurs threads puis terminer par un done sans &
#(while $work; do
# php artisan queue:work --queue="$(grep -oP 'SQS_QUEUE=\K.*' .env)" --no-interaction
# sleep 1
#done &)

View file

@ -144,7 +144,7 @@ spec:
containers:
- name: ${CI_PROJECT_PATH_SLUG}-scheduled
image: $IMAGE_TAG
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
command:
- "php"
args:
@ -168,3 +168,41 @@ spec:
fsGroup: 33
fsGroupChangePolicy: "OnRootMismatch"
restartPolicy: OnFailure
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: ${CI_PROJECT_PATH_SLUG}-queue-worker-deployment
spec:
replicas: 1
selector:
matchLabels:
app: ${CI_PROJECT_PATH_SLUG}-app
template:
metadata:
labels:
app: ${CI_PROJECT_PATH_SLUG}-app
spec:
containers:
- name: ${CI_PROJECT_PATH_SLUG}-container
image: $IMAGE_TAG
command:
- "bash k8s-queues.sh"
envFrom:
- configMapRef:
name: ${CI_PROJECT_PATH_SLUG}-config-map
volumeMounts:
- name: storage
mountPath: /app/srcs/storage
imagePullSecrets:
- name: docker-registry-credentials
securityContext:
runAsUser: 33
runAsGroup: 33
fsGroup: 33
fsGroupChangePolicy: "OnRootMismatch"
volumes:
- name: storage
persistentVolumeClaim:
claimName: ${CI_PROJECT_PATH_SLUG}-pvc-storage