Skip to content
Snippets Groups Projects
Verified Commit cd9b4dc8 authored by BITARD Michaël's avatar BITARD Michaël
Browse files

good cron config

parent 03c067de
No related branches found
No related tags found
No related merge requests found
ARG BUILD_ENV
ENV BUILD_ENV=${BUILD_ENV}
FROM mcuadros/ofelia:0.3.13
RUN apk add -U curl restic postgresql16-client postgresql16-contrib docker-cli bash
COPY restore-last-backup /
COPY backup /
COPY config-${BUILD_ENV}.ini /etc/ofelia/config.ini
ARG BUILD_ENV
COPY config-$BUILD_ENV.ini /etc/ofelia/config.ini
......@@ -263,9 +263,9 @@ nginx-proxy/push:
docker push caminofr/camino-nginx-proxy:1.6.1
cron/build:
docker build -t caminofr/cron:1.0.0-dev --build-arg ENV=dev -f Dockerfile.cron infra/ecocompose/crons/
docker build -t caminofr/cron:1.0.0-preprod --build-arg ENV=preprod -f Dockerfile.cron infra/ecocompose/crons/
docker build -t caminofr/cron:1.0.0-prod --build-arg ENV=prod -f Dockerfile.cron infra/ecocompose/crons/
docker build -t caminofr/cron:1.0.0-dev --build-arg BUILD_ENV=dev -f Dockerfile.cron infra/ecocompose/crons/
docker build -t caminofr/cron:1.0.0-preprod --build-arg BUILD_ENV=preprod -f Dockerfile.cron infra/ecocompose/crons/
docker build -t caminofr/cron:1.0.0-prod --build-arg BUILD_ENV=prod -f Dockerfile.cron infra/ecocompose/crons/
cron/push:
docker push caminofr/cron:1.0.0-dev
......
#!/bin/bash
set -eufo pipefail
source /srv/scripts/restic_data
if [ "$(id -u)" != "{{camino_user_uid}}" ]; then
echo "This script must be run as user 'camino'" 1>&2
exit 1
fi
# backup
USER_GROUP_ID=$(getent group users | cut -d: -f3)
docker exec camino_api_db pg_dump --clean --if-exists --no-owner --no-privileges -B --dbname=camino --format c > /srv/backups/dump_without_files.backup
docker exec camino_api_db /bin/bash -c 'rm -rf /dump/*'
docker exec camino_api_db vacuumlo camino
docker exec camino_api_db pg_dump --clean --if-exists --format=d --no-owner --no-privileges --dbname=camino -f /dump
docker exec camino_api_db chown -R "{{camino_user_uid}}:${USER_GROUP_ID}" /dump
chown camino:users -R /srv/backups/
restic backup /srv/backups/
curl -i -X POST -H 'Content-Type: application/json' -d "{\"message\": \":tada: backup effectué sur ${ENV} :tada:\"}" ${TCHAP_HOOK}
[job-exec "daily"]
schedule = 0 0 9 * * *
schedule = 0 0 4 * * *
container = camino_api_app
command = make daily
tty = true
[job-exec "monthly"]
schedule = 0 0 10 * * *
schedule = 0 0 6 1 * *
container = camino_api_app
command = make monthly
tty = true
......@@ -23,5 +23,5 @@ command = find /project/packages/api/files/tmp/ -mtime +7 -type f -delete
tty = true
[job-local "restore_backup"]
schedule = 0 0 12 * * *
schedule = 0 0 6 * * SUN
command = /restore-last-backup
[job-exec "daily"]
schedule = 0 0 9 * * *
schedule = 0 0 4 * * *
container = camino_api_app
command = make daily
tty = true
[job-exec "monthly"]
schedule = 0 0 10 * * *
schedule = 0 0 6 1 * *
container = camino_api_app
command = make monthly
tty = true
......@@ -21,7 +21,3 @@ schedule = 0 30 5 * * *
container = camino_api_app
command = find /project/packages/api/files/tmp/ -mtime +7 -type f -delete
tty = true
[job-local "restore_backup"]
schedule = 0 0 12 * * *
command = /restore-last-backup
[job-exec "daily"]
schedule = 0 0 9 * * *
schedule = 0 0 4 * * *
container = camino_api_app
command = make daily
tty = true
[job-exec "monthly"]
schedule = 0 0 10 * * *
schedule = 0 0 6 1 * *
container = camino_api_app
command = make monthly
tty = true
......@@ -22,6 +22,6 @@ container = camino_api_app
command = find /project/packages/api/files/tmp/ -mtime +7 -type f -delete
tty = true
[job-local "restore_backup"]
schedule = 0 0 12 * * *
command = /restore-last-backup
[job-local "backup"]
schedule = 0 0 2 * * *
command = /backup
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment