Coder Social home page Coder Social logo

xbackup's Introduction


Xbackup

Xbackup is a Docker-based backup solution for MySQL databases, utilizing xtrabackup for creating backups and s3cmd for pushing these backups to Amazon S3. The setup includes incremental and full backups, managed by cron jobs, with configurable parameters for database credentials, S3 credentials, and backup schedules.

Features

  • Full and incremental MySQL backups using xtrabackup
  • Secure backup storage in Amazon S3
  • Configurable backup schedules via cron jobs
  • Easy deployment using Docker and Docker Compose

Prerequisites

  • bash and sudo privilege
  • AWS S3 bucket and credentials
  • Rest will be installed at the runtime

Installation

  1. Clone the repository:

    git clone https://github.com/Cosmicoppai/xbackup.git
    cd xbackup
  2. Configure Environment Variables:

    Create a .env file in the project root and add your configuration:

    DB_HOST=your_database_host
    DB_USER=your_database_user
    DB_PASSWORD=your_database_password
    DB_NAME=your_database_name
    S3_ACCESS_KEY=your_s3_access_key
    S3_SECRET_KEY=your_s3_secret_key
    S3_BUCKET=your_s3_bucket_name
    S3_REGION=your_s3_region
  3. Build and Run the Docker Container:

    chmod +x ./xbackup.sh
    sudo ./xbackup.sh start

Backup Scheduling

Backups are managed using cron jobs defined in the docker-compose.yml file. Modify the cron job schedule as needed:

Edit the cron job time in .env file to set your backup schedules:

CRON_TIME="0 */3 * * *"

Restoring Backups

To restore a backup, download the backup files from S3 and use xtrabackup to apply logs and restore the database:

./xbackup.sh load # it'll download the backup from s3
# check everything is correct and correctly downloaded/decompressed

# move the backup into the data dir
./xbackup.sh apply 

Contributing

Feel free to fork this repository and submit pull requests. Contributions are welcome!

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact

For any questions or suggestions, feel free to open an issue or contact the repository owner.


xbackup's People

Stargazers

 avatar

Watchers

 avatar

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.