Giter VIP home page Giter VIP logo

Comments (6)

clementgoclock avatar clementgoclock commented on September 6, 2024

We currently host 3 DMBS:

  • MariaDB
  • PostgreSQL
  • MongoDB

The first solution is to add and host single volumes, one for each system.
Another solution could be to use a single volume and backup only that one. This could simplify the backup solution. However, it's important to note that when multiple containers access the same volume on a host, file locks must be managed by the applications running in the containers, otherwise there may be risks.

Exemple for a single, shared, volume:

services:
  db_mysql:
    image: mysql:latest
    volumes:
      - db_data:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: password

  db_postgres:
    image: postgres:latest
    volumes:
      - db_data:/var/lib/postgresql/data
    environment:
      POSTGRES_PASSWORD: password

volumes:
  db_data:

Documentation for backing up data volumes

Another solution could be to use remote volume hosting (such as Amazon EBS) or to enhance volume management with volume plugins, some examples.

Just to recall something: data volumes can be initiated with backup through --volumes-from option.

Another another solution could be to use the container backup.

Just letting everything sink in before chosing solution.

from teleporter-compose.

profy12 avatar profy12 commented on September 6, 2024

No I want that each DB is independant, and I don't want physical backup by logical IE dumps SQL, generated with mysqldump, pgdump, mongodump etc. Theses dumps sould be stocked in the local backup directory by default in the repository, with a mount bind. This directory should be customisable like the code dir.

from teleporter-compose.

clementgoclock avatar clementgoclock commented on September 6, 2024

So:

  • One volume for each DBMS
  • One backup container
    • Local dir using a mount bind
    • Backup local dir can be configured with .env
    • Using mysqldump, pg_dump and mongodump
    • Crontab
    • The backup starts after each container startup. First check if a backup has been made recently
    • A manual backup (by the student) can be made on request
  • Backup retention : 1 week
    • Keep the last 5 files if backups older than one week
  • In the future could be use for drive sync

from teleporter-compose.

profy12 avatar profy12 commented on September 6, 2024

Crontab is uselessl, a backup at every start will do the job.
Name every backup with the day name will automate a 7 day retention, ex: monday-mysql.sql.gz, monday-pg.sql.gz, etc.

from teleporter-compose.

clementgoclock avatar clementgoclock commented on September 6, 2024

As we talked about, the current objective is to go fast and use simplicity before developing a better backup management system in the future.
The first introduction to the backup container is therefore on this PR #92

Backup container

  • Always restart
  • Make backup, sleep for 4 hours and restart
  • One entrypoint script (called by command in the compose file) calling 3 scripts
  • 3 scripts, one for each db system (yep could be only one with argument for each manual save or db choice, etc, we'll see in the future)
  • Manual save can be call through --save argument : docker compose exec backup /scripts/backup-mongodb.sh --save
    • Alias can be added in terminal container like backup mysql (not done yet)
  • Script logic:
    • Check if current day backup is already made, if yes do nothign
    • If no, do the daily backup
    • If asked, do the manual backup (different name than daily backup, no rotation here)
    • Backup rotation (deleted with mtime +6d) for 1 week
    • Install dependancies if needed (no custom image yet, first run is not that long)

from teleporter-compose.

clementgoclock avatar clementgoclock commented on September 6, 2024

Logic have been changed to :

  • docker in docker (including dind image from docker)
  • scripts directly call dump app though docker exec

from teleporter-compose.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.