Merge branch 'develop' into trunk
This commit is contained in:
commit
87273397b2
4 changed files with 70 additions and 3 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -9,6 +9,7 @@
|
|||
/.phpunit.cache
|
||||
/.vscode
|
||||
/node_modules
|
||||
/bootstrap
|
||||
/public/build
|
||||
/public/cache
|
||||
/public/hot
|
||||
|
|
|
|||
|
|
@ -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
30
k8s-queues.sh
Normal 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 &)
|
||||
|
|
@ -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
|
||||
Loading…
Add table
Reference in a new issue