Skip to content
Snippets Groups Projects
Commit 075954cb authored by BITARD Michaël's avatar BITARD Michaël Committed by BITARD Michaël
Browse files

try ofelia cron

parent d4efcf89
No related branches found
No related tags found
No related merge requests found
FROM mcuadros/ofelia:0.3.13
RUN apk add -U restic postgresql16-client postgresql16-contrib docker-cli
COPY restore-last-backup /
COPY config.ini /etc/ofelia/config.ini
......@@ -259,3 +259,9 @@ nginx-proxy/build:
nginx-proxy/push:
docker push caminofr/camino-nginx-proxy:1.6.1
cron/build:
docker build -t caminofr/cron:1.0.0 -f Dockerfile.cron crons/
cron/push:
docker push caminofr/cron:1.0.0
File moved
[job-exec "daily"]
schedule = 0 0 4 * * *
container = camino_api_app
command = make daily
tty = true
[job-exec "monthly"]
schedule = 0 0 6 1 * *
container = camino_api_app
command = make monthly
tty = true
[job-exec "cleanup_downloads"]
schedule = 0 0 5 * * *
container = camino_api_app
command = rm -rf /project/packages/api/files/downloads/*
tty = true
[job-exec "cleanup_temp_files"]
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 6 * * 0
command = /restore-last-backup
tty = true
#!/bin/bash
set -eufo pipefail
if [ "$(id -u)" != "{{camino_user_uid}}" ]; then
echo "This script must be run as user 'camino'" 1>&2
if [ "$(env)" = "prod" ]; then
echo "This script must not run in production" 1>&2
exit 1
fi
echo 'Mise en place des fichiers de prod'
docker exec -i camino_api_db /bin/bash -c 'rm -rf /dump/*'
source /srv/scripts/restic_data
restic restore latest --no-lock -t /
rsync --delete -r /srv/backups/files/ /srv/www/camino/files
echo "Arrêt de l'api et de keycloak"
docker stop camino_api_app camino_keycloak
echo "Insertion du dump de la BDD"
......@@ -19,5 +16,3 @@ docker exec -i camino_api_db createdb --username=postgres camino
docker exec -i camino_api_db pg_restore --clean --if-exists --no-owner --no-privileges --dbname=camino /dump
echo "Redémarrage de l'api et de keycloak"
docker restart camino_api_app camino_keycloak camino_ui_app
curl -i -X POST -H 'Content-Type: application/json' -d "{\"text\": \":tada: Dernier backup appliqué sur {{ env }} $(restic snapshots --no-lock | tail -3 | head -1 | cut -d' ' -f3) :tada:\"}" {{ mattermost_hook_url }}
......@@ -67,6 +67,16 @@ services:
- default
- nginx-proxy
restart: unless-stopped
cron:
container_name: camino_cron
image: caminofr/cron:1.0.0
environment:
ENV: ${ENV}
networks:
- default
restart: unless-stopped
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
oauth2:
container_name: camino_oauth2
image: quay.io/oauth2-proxy/oauth2-proxy:v7.6.0
......@@ -136,8 +146,6 @@ services:
ports:
- "80:80"
volumes:
# FIXME
# - /srv/www/nginx-proxy/proxy.conf:/etc/nginx/proxy.conf
- $EDCS_DATA_STACK/nginx_vhost:/etc/nginx/vhost.d
- $EDCS_DATA_STACK/nginx_html:/usr/share/nginx/html
- /var/run/docker.sock:/tmp/docker.sock:ro
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment