diff --git a/docker/backup/Dockerfile b/docker/backup/Dockerfile index 3e6773a..cafaec0 100644 --- a/docker/backup/Dockerfile +++ b/docker/backup/Dockerfile @@ -4,19 +4,16 @@ FROM alpine:latest RUN apk add --no-cache mariadb-client bash dcron # Créer les répertoires nécessaires -RUN mkdir -p /backups \ - && mkdir -p /etc/periodic/daily +RUN mkdir -p /backups +RUN mkdir -p /etc/periodic/15min -# Copier le script de sauvegarde -COPY backup/backup_db.sh /etc/periodic/daily/backup_db - -# Copier le script d'entrypoint +# Copier les fichiers depuis le dossier `backup/` +COPY backup/backup_db.sh /etc/periodic/15min/backup_db COPY backup/entrypoint2.sh /entrypoint.sh # Donner les permissions d'exécution -RUN chmod +x /etc/periodic/daily/backup_db \ - && chmod +x /entrypoint.sh +RUN chmod +x /etc/periodic/15min/backup_db +RUN chmod +x /entrypoint.sh -# Lancer cron +# Utiliser le script d'entrée ENTRYPOINT ["/entrypoint.sh"] - diff --git a/docker/backup/backup_db.sh b/docker/backup/backup_db.sh index 5cea399..57b04aa 100755 --- a/docker/backup/backup_db.sh +++ b/docker/backup/backup_db.sh @@ -17,4 +17,4 @@ FILE="$BACKUP_DIR/$DAY.sql" mysqldump -h mariadb -u "$DB_USER" -p"$DB_PASS" "$DB_NAME" > "$FILE" # Log -echo "[$(date)] Backup $DB_NAME sauvegardé dans $FILE" >> "$BACKUP_DIR/backup.log" +echo "[$(date)] Backup $DB_NAME sauvegardé dans $FILE" >> "$BACKUP_DIR/backup.log" \ No newline at end of file diff --git a/docker/backup/entrypoint2.sh b/docker/backup/entrypoint2.sh index 5a8025f..fa52e5b 100755 --- a/docker/backup/entrypoint2.sh +++ b/docker/backup/entrypoint2.sh @@ -1,3 +1,2 @@ #!/bin/sh -crond -f -l 8 - +crond -f -l 2 diff --git a/docker/backups/09.sql b/docker/backups/09.sql new file mode 100644 index 0000000..aaa3eba --- /dev/null +++ b/docker/backups/09.sql @@ -0,0 +1,356 @@ +/*M!999999\- enable the sandbox mode */ +-- MariaDB dump 10.19-11.4.9-MariaDB, for Linux (x86_64) +-- +-- Host: mariadb Database: laravel +-- ------------------------------------------------------ +-- Server version 12.1.2-MariaDB-ubu2404 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*M!100616 SET @OLD_NOTE_VERBOSITY=@@NOTE_VERBOSITY, NOTE_VERBOSITY=0 */; + +-- +-- Table structure for table `cache` +-- + +DROP TABLE IF EXISTS `cache`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `cache` ( + `key` varchar(255) NOT NULL, + `value` mediumtext NOT NULL, + `expiration` int(11) NOT NULL, + PRIMARY KEY (`key`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `cache` +-- + +LOCK TABLES `cache` WRITE; +/*!40000 ALTER TABLE `cache` DISABLE KEYS */; +/*!40000 ALTER TABLE `cache` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `cache_locks` +-- + +DROP TABLE IF EXISTS `cache_locks`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `cache_locks` ( + `key` varchar(255) NOT NULL, + `owner` varchar(255) NOT NULL, + `expiration` int(11) NOT NULL, + PRIMARY KEY (`key`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `cache_locks` +-- + +LOCK TABLES `cache_locks` WRITE; +/*!40000 ALTER TABLE `cache_locks` DISABLE KEYS */; +/*!40000 ALTER TABLE `cache_locks` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `events` +-- + +DROP TABLE IF EXISTS `events`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `events` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `description` varchar(255) NOT NULL, + `start` datetime DEFAULT NULL, + `end` datetime DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `events` +-- + +LOCK TABLES `events` WRITE; +/*!40000 ALTER TABLE `events` DISABLE KEYS */; +/*!40000 ALTER TABLE `events` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `jobs` +-- + +DROP TABLE IF EXISTS `jobs`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `jobs` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `queue` varchar(255) NOT NULL, + `payload` longtext NOT NULL, + `attempts` tinyint(3) unsigned NOT NULL, + `reserved_at` int(10) unsigned DEFAULT NULL, + `available_at` int(10) unsigned NOT NULL, + `created_at` int(10) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `jobs_queue_index` (`queue`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `jobs` +-- + +LOCK TABLES `jobs` WRITE; +/*!40000 ALTER TABLE `jobs` DISABLE KEYS */; +/*!40000 ALTER TABLE `jobs` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `migrations` +-- + +DROP TABLE IF EXISTS `migrations`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `migrations` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `migration` varchar(255) NOT NULL, + `batch` int(11) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `migrations` +-- + +LOCK TABLES `migrations` WRITE; +/*!40000 ALTER TABLE `migrations` DISABLE KEYS */; +INSERT INTO `migrations` VALUES +(1,'2025_10_13_213713_create_jobs_table',1), +(2,'2025_10_13_215246_create_users_table',1), +(3,'2025_10_14_210658_create_sessions_table',1), +(4,'2025_10_14_210940_add_remember_token_to_users_table',1), +(5,'2025_10_27_211752_create_events_table',1), +(6,'2025_11_07_103448_create_notifications_table',1), +(7,'2025_11_09_144248_create_tasks_table',1), +(8,'2025_11_14_081656_task_user',1), +(9,'2025_11_28_112359_create_cache_table',1), +(10,'2025_12_10_092809_notification_user',1); +/*!40000 ALTER TABLE `migrations` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `notification_user` +-- + +DROP TABLE IF EXISTS `notification_user`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `notification_user` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `notification_id` bigint(20) unsigned NOT NULL, + `user_id` bigint(20) unsigned NOT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `notification_user_notification_id_foreign` (`notification_id`), + KEY `notification_user_user_id_foreign` (`user_id`), + CONSTRAINT `notification_user_notification_id_foreign` FOREIGN KEY (`notification_id`) REFERENCES `notifications` (`id`) ON DELETE CASCADE, + CONSTRAINT `notification_user_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `notification_user` +-- + +LOCK TABLES `notification_user` WRITE; +/*!40000 ALTER TABLE `notification_user` DISABLE KEYS */; +/*!40000 ALTER TABLE `notification_user` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `notifications` +-- + +DROP TABLE IF EXISTS `notifications`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `notifications` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `content` varchar(255) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `notifications` +-- + +LOCK TABLES `notifications` WRITE; +/*!40000 ALTER TABLE `notifications` DISABLE KEYS */; +/*!40000 ALTER TABLE `notifications` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `sessions` +-- + +DROP TABLE IF EXISTS `sessions`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `sessions` ( + `id` varchar(255) NOT NULL, + `user_id` bigint(20) unsigned DEFAULT NULL, + `ip_address` varchar(45) DEFAULT NULL, + `user_agent` text DEFAULT NULL, + `payload` longtext NOT NULL, + `last_activity` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `sessions_user_id_index` (`user_id`), + KEY `sessions_last_activity_index` (`last_activity`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `sessions` +-- + +LOCK TABLES `sessions` WRITE; +/*!40000 ALTER TABLE `sessions` DISABLE KEYS */; +INSERT INTO `sessions` VALUES +('6hFPozHN6KwcsaTCwjLfYBKL1TZN1jh6ViET3Qdw',1,'192.168.200.1','Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0','YTo0OntzOjY6Il90b2tlbiI7czo0MDoib0MyMTNvSWJSc1U5blVqUDkxQ3I5bW9RcDhZOXBpR2F5ZHdBUGF1USI7czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6Mjg6Imh0dHA6Ly9sb2NhbGhvc3QvYXBpL3VzZXJzLzUiO3M6NToicm91dGUiO047fXM6NTA6ImxvZ2luX3dlYl81OWJhMzZhZGRjMmIyZjk0MDE1ODBmMDE0YzdmNThlYTRlMzA5ODlkIjtpOjE7fQ==',1767803921); +/*!40000 ALTER TABLE `sessions` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `task_user` +-- + +DROP TABLE IF EXISTS `task_user`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `task_user` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `task_id` bigint(20) unsigned NOT NULL, + `user_id` bigint(20) unsigned NOT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `task_user_task_id_foreign` (`task_id`), + KEY `task_user_user_id_foreign` (`user_id`), + CONSTRAINT `task_user_task_id_foreign` FOREIGN KEY (`task_id`) REFERENCES `tasks` (`id`) ON DELETE CASCADE, + CONSTRAINT `task_user_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `task_user` +-- + +LOCK TABLES `task_user` WRITE; +/*!40000 ALTER TABLE `task_user` DISABLE KEYS */; +/*!40000 ALTER TABLE `task_user` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `tasks` +-- + +DROP TABLE IF EXISTS `tasks`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `tasks` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `description` varchar(255) NOT NULL, + `location` varchar(255) NOT NULL, + `start` datetime NOT NULL, + `end` datetime NOT NULL, + `max_participants` int(11) NOT NULL, + `events_id` bigint(20) unsigned NOT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `tasks_events_id_foreign` (`events_id`), + CONSTRAINT `tasks_events_id_foreign` FOREIGN KEY (`events_id`) REFERENCES `events` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `tasks` +-- + +LOCK TABLES `tasks` WRITE; +/*!40000 ALTER TABLE `tasks` DISABLE KEYS */; +/*!40000 ALTER TABLE `tasks` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `users` +-- + +DROP TABLE IF EXISTS `users`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `users` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `lastname` varchar(255) NOT NULL, + `email` varchar(255) NOT NULL, + `password` varchar(255) NOT NULL, + `phone` varchar(255) DEFAULT NULL, + `validate` int(11) NOT NULL, + `role` int(11) DEFAULT NULL, + `verified_at` datetime DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `remember_token` varchar(100) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `users_email_unique` (`email`) +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `users` +-- + +LOCK TABLES `users` WRITE; +/*!40000 ALTER TABLE `users` DISABLE KEYS */; +INSERT INTO `users` VALUES +(1,'Malo','Leblond','a@gmail.com','$2y$12$xbPw0/LtE7w8uzkk/EHxPey0vD8IrgqCwUxl8hYqGDbmrQp5dzF86','+33 7 67 87 11 11',1,NULL,NULL,'2026-01-05 08:35:22','2026-01-05 08:35:22','FsnEvcbRjNXNd2W0JhD535V6OIJKWl6WWHgfNAjwDvwrNKzSX5Wzv5h5J5nq'), +(2,'user2','user','b@gmail.com','$2y$12$pg2rdRW3gTw7BMC0l/PVIud719YTuspoGapfNNWmOx1JXb7sVbitq','+33 7 55 55 55 55',0,NULL,NULL,'2026-01-05 10:00:58','2026-01-05 10:00:58',NULL), +(4,'compte1','sjs','1@gmail.com','$2y$12$ct4u8kOHqKg9ona.KzrjLuHFZfgkSsG3xQPFkAjoLnBy9hoUa/U4O','+33 9 88 88 88 88',0,NULL,NULL,'2026-01-07 15:06:07','2026-01-07 15:06:07',NULL), +(5,'compte2','sknssk','2@gmail.com','$2y$12$CsTLO8A0a4nRaiRBNEOn5O5gLas3ortE.zkT/91XX5OjIp.tKBa6q','+33 855 55 55 55',0,NULL,NULL,'2026-01-07 15:06:41','2026-01-07 15:06:41',NULL); +/*!40000 ALTER TABLE `users` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*M!100616 SET NOTE_VERBOSITY=@OLD_NOTE_VERBOSITY */; + +-- Dump completed on 2026-01-09 8:21:15