Giter Club home page Giter Club logo

backup-engine's Introduction

Warning! This package is not maintained any more

Try this alternative instead: https://github.com/dimsav/backupish

Documentation

This is a library, written in php, used to backup your project's files and databases.

Installation

  1. Clone the repository
  2. Install the composer dependencies: composer install
  3. Create a file config/config.php according config/config.ini.php

Execution

Run php backup.php

Features

  • Multiple projects can be backed up at once
  • Custom selection of backup directories per project
  • Custom selection of excluded paths
  • Password protection of backup files (.zip)
  • Detailed logs are saved to the server and are uploaded to dropbox.

Requirements

  1. This script can only be used in Unix systems (Linux/Mac), as we are using the zip command of the system.
  2. The function exec() should be available as we use it to zip our backups.
  3. The user executing the script must be able to write in the backups folder.
  4. The cURL extension is required if you want to use the dropbox uploader.

Instructions

  1. Copy config.ini.php to config.php.
  2. Edit config.php to define your projects to be backed up.
  3. Run cron.php using the command line or a web server.
  4. See the magic happen!

Defining your projects is a piece of cake:

    /*
     * Define in this array the projects you wish to backup.
     *
     * The key of the array marks the name of the project
     * and it is used for folder and file names. So better
     * use alphanumeric characters with slash/underscores.
     */

    "projects" => array(

        /*
         * Here we define a project to be backed-up.
         * For this project, we want to backup only
         * the database. We use the default host and
         * port, and we override the username and password.
         *
         * For this project we are overriding the default
         * password with another one.
         */
        "project-1" => array(

            "database" => array(
                "name"    =>"db-name",
                "username"=>"db-user",
                "password"=>"db-pass",
            ),

            "password" => "another-secret",
        ),

        /*
         * For this project we backup both some files
         * and the database.
         *
         * We use the default database settings, so we
         * define only the database name.
         *
         * Under "paths" we put a list of absolute paths
         * of directories or files.
         *
         * Under "excludes" we put a list of absolute paths
         * of directories or files that should not be
         * included in the compressed backup files. The
         * contents of these directories will be skipped
         * recursively.
         */
        "project-2" => array(

            "database" => array(
                "name"=>"db-name",
            ),

            "paths" => array(
                "/absolute/project/folder/path",
                "/absolute/project/file/text.txt",
            ),

            "excludes" => array(
                "/absolute/project/folder/path/cache",
                "/absolute/project/folder/path/logs",
                "/absolute/project/folder/path/bigfile.tar",
            ),
        ),

        /*
         * Here we disable for project-3 the default password,
         * as we don't want any password for this project.
         */
        "project-3" => array(
            "paths" => array(
                "/project/folder",
            ),
            "password" => null,
        )

    ),

backup-engine's People

Contributors

dimsav avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

backup-engine's Issues

Email notification

If errors have occurred at the end of the script, send an email with the contents of the log file.
Use register_shutdown_function to decrease the chances to not send the mail.

Delete older backup files

Two configuration options:

  • max files mode
  • time_machine mode: after 30 days, allow 1 per week. after 6 months, allow 1 per month

Sync mode

For projects containing many big zip files, it is not needed some times to have older versions of these files in backup. To save bandwidth and storage space it is sometimes better to synchronise the storage according the current state of the project.

Define a path-root under the config

A path-root parameter can be defined under a project configuration array. It can be either an absolute either a relative path. If a relative path is given, it should be based on the project root directory (php-mysql-backup).

path-root will be used if the paths/excludes of a project are set as relative paths.

path-root can also be defined in the default.

Number of backups

First of all superb script.

One small feature request, it would be good if we can mention the number to backup to keep and remove all old incremental backups.

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.