-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔧(tray) add cronjob for delete_stuck_orders management command
We have to add a cronjob in the tray to manage the delete_stuck_orders management command.
- Loading branch information
Showing
2 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
81 changes: 81 additions & 0 deletions
81
src/tray/templates/services/app/cronjob_delete_stuck_orders.yml.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
metadata: | ||
labels: | ||
app: joanie | ||
service: app | ||
version: "{{ joanie_image_tag }}" | ||
deployment_stamp: "{{ deployment_stamp }}" | ||
name: "joanie-delete-stuck-orders-{{ deployment_stamp }}" | ||
namespace: "{{ namespace_name }}" | ||
spec: | ||
schedule: "{{ joanie_delete_stuck_orders_cronjob_schedule }}" | ||
successfulJobsHistoryLimit: 2 | ||
failedJobsHistoryLimit: 1 | ||
concurrencyPolicy: Forbid | ||
suspend: {{ suspend_cronjob | default(false) }} | ||
jobTemplate: | ||
spec: | ||
template: | ||
metadata: | ||
name: "joanie-delete-stuck-orders-{{ deployment_stamp }}" | ||
labels: | ||
app: joanie | ||
service: app | ||
version: "{{ joanie_image_tag }}" | ||
deployment_stamp: "{{ deployment_stamp }}" | ||
spec: | ||
{% set image_pull_secret_name = joanie_image_pull_secret_name | default(none) or default_image_pull_secret_name %} | ||
{% if image_pull_secret_name is not none %} | ||
imagePullSecrets: | ||
- name: "{{ image_pull_secret_name }}" | ||
{% endif %} | ||
containers: | ||
- name: "joanie-delete-stuck-orders" | ||
image: "{{ joanie_image_name }}:{{ joanie_image_tag }}" | ||
imagePullPolicy: Always | ||
command: | ||
- "/bin/bash" | ||
- "-c" | ||
- python manage.py delete_stuck_orders | ||
env: | ||
- name: DB_HOST | ||
value: "joanie-{{ joanie_database_host }}-{{ deployment_stamp }}" | ||
- name: DB_NAME | ||
value: "{{ joanie_database_name }}" | ||
- name: DB_PORT | ||
value: "{{ joanie_database_port }}" | ||
- name: DJANGO_ALLOWED_HOSTS | ||
value: "{{ joanie_host | blue_green_hosts }},{{ joanie_admin_host | blue_green_hosts }}" | ||
- name: DJANGO_CSRF_TRUSTED_ORIGINS | ||
value: "{{ joanie_host | blue_green_hosts | split(',') | map('regex_replace', '^(.*)$', 'https://\\1') | join(',') }},{{ joanie_admin_host | blue_green_hosts | split(',') | map('regex_replace', '^(.*)$', 'https://\\1') | join(',') }}" | ||
- name: DJANGO_CONFIGURATION | ||
value: "{{ joanie_django_configuration }}" | ||
- name: DJANGO_CORS_ALLOWED_ORIGINS | ||
value: "{{ richie_host | blue_green_hosts | split(',') | map('regex_replace', '^(.*)$', 'https://\\1') | join(',') }},{{ joanie_admin_host | blue_green_hosts | split(',') | map('regex_replace', '^(.*)$', 'https://\\1') | join(',') }}" | ||
- name: DJANGO_CSRF_COOKIE_DOMAIN | ||
value: ".{{ joanie_host }}" | ||
- name: DJANGO_SETTINGS_MODULE | ||
value: joanie.configs.settings | ||
- name: JOANIE_BACKOFFICE_BASE_URL | ||
value: "https://{{ joanie_admin_host }}" | ||
- name: DJANGO_CELERY_DEFAULT_QUEUE | ||
value: "default-queue-{{ deployment_stamp }}" | ||
envFrom: | ||
- secretRef: | ||
name: "{{ joanie_secret_name }}" | ||
- configMapRef: | ||
name: "joanie-app-dotenv-{{ deployment_stamp }}" | ||
resources: {{ joanie_delete_stuck_orders_cronjob_resources }} | ||
volumeMounts: | ||
- name: joanie-configmap | ||
mountPath: /app/joanie/configs | ||
restartPolicy: Never | ||
securityContext: | ||
runAsUser: {{ container_uid }} | ||
runAsGroup: {{ container_gid }} | ||
volumes: | ||
- name: joanie-configmap | ||
configMap: | ||
defaultMode: 420 | ||
name: joanie-app-{{ deployment_stamp }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters