-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #110 from WildCodeSchool/develop
added DRP
- Loading branch information
Showing
16 changed files
with
2,168 additions
and
6 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,2 +1,9 @@ | ||
JWT_SECRET_KEY=mykey | ||
FRONTEND_URL=myfrontendurl | ||
FRONTEND_URL=myfrontendurl | ||
|
||
# db dump variables | ||
CONTAINER_NAME=changeme | ||
DB_USERNAME=changeme | ||
DUMPS_FOLDER=changeme | ||
RCLONE_REMOTE_NAME=changeme | ||
RCLONE_REMOTE_FOLDER=changeme |
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 |
---|---|---|
|
@@ -6,4 +6,4 @@ node_modules/ | |
.idea/ | ||
.DS_Store | ||
.env | ||
/frontend/package-lock.json | ||
/frontend/package-lock.json |
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,23 @@ | ||
Comment redéployer rapidement son application à partir (ou non) de sauvegardes | ||
Comment mettre en place les bonnes pratiques de sauvegarde | ||
Comment vérifier et tester la bonne intégrité des sauvegardes | ||
|
||
commande kron à faire sur le serveur utilisé : | ||
crontab -e | ||
y ajouter : * 5 * * * sh /home/wns_student/dump.sh | ||
|
||
fichier à exécuter pour générer un dump sql (!avoir le container de la db qui tourne!) : ./db/generate_dump.sh | ||
Date et objectifs du document | ||
|
||
27/01/2025 | ||
This document purpose is to help restore & restart the application with the latest DB dump in case of a crash. | ||
|
||
Application architecture: | ||
|
||
Contraintes techniques et infrastructure nécessaire: | ||
|
||
Notice de mise en place des routines de sauvegarde et de leur vérification: | ||
|
||
Notice de restauration pour démarrer depuis une sauvegarde: | ||
|
||
Mettre le dernier fichier dump.sql dans le dossier /db/dump et démarrer le script à la racine du projet 'restore_app.sh' |
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
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 @@ | ||
FROM postgres:16 |
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,24 @@ | ||
# This script simply removes dump files older than 7 days | ||
|
||
import os | ||
import time | ||
|
||
DUMPS_FOLDER = os.path.join(os.getcwd(), "dumps") | ||
|
||
DAYS_TO_KEEP = 7 | ||
|
||
now = time.time() | ||
limit_time = now - (DAYS_TO_KEEP * 86400) | ||
|
||
for filename in os.listdir(DUMPS_FOLDER): | ||
file_path = os.path.join(DUMPS_FOLDER, filename) | ||
|
||
if os.path.isfile(file_path): | ||
|
||
file_modified_time = os.path.getmtime(file_path) | ||
|
||
if file_modified_time < limit_time: | ||
print(f"Deleting {file_path}...") | ||
os.remove(file_path) | ||
|
||
print("Cleaning done...") |
Oops, something went wrong.