Git Product home page Git Product logo

auto-backup's Introduction

VK AutoBackups

A simple library to make auto backups of PostgreSQL database instances.

Installation

There are two ways to install this library:

  • Docker
  • Directly from sources

Installation using Docker

  1. Clone this repository using git clone https://github.com/varijkapil13/auto-backup.git

  2. Add your database configuration to server.ini file.

    [localhost]
    url = localhost
    port = 5432
    username = postgres
    password = password
    database = testdb
    

    Using this configuration the script will create a folder named localhost (taken from the block [localhost]) and save the backups in that directory with time stamps

    More than one database servers can be added to the file. Below is an example configuration for such a setting:

    [localhost]
    url = localhost
    port = 5432
    username = postgres
    password = password
    database = testdb
    
    [My other server]
    url = otherserver.com
    port = 5432
    username = postgres
    password = password
    database = testdb
    

    Using this configuration the script will create two folders named localhost and My other server and save the backups in these directories with time stamps.

  3. Create docker container using docker build -t vk-auto-backup:latest . && docker run -v /Users/varijkapil13/backups:/app/Backups/ --name vk-auto-backup vk-auto-backup:latest

    Replace /Users/varijkapil13/backups with path to the folder where you want to store your backups.

  4. The application is now in a docker container and will automatically backup your databases everyday at 00:00 Hours.

Installation from sources

  1. Clone this repository using git clone https://github.com/varijkapil13/auto-backup.git

  2. Install virtualenv.

    pip install virtualenv

  3. Create a virtual environment and activate it.

    virtualenv venv

    source venv/bin/activate

  4. Add your database configuration to server.ini file.

    [localhost]
    url = localhost
    port = 5432
    username = postgres
    password = password
    database = testdb
    

    Using this configuration the script will create a folder named localhost (taken from the block [localhost]) and save the backups in that directory with time stamps

    More than one database servers can be added to the file. Below is an example configuration for such a setting:

    [localhost]
    url = localhost
    port = 5432
    username = postgres
    password = password
    database = testdb
    
    [My other server]
    url = otherserver.com
    port = 5432
    username = postgres
    password = password
    database = testdb
    

    Using this configuration the script will create two folders named localhost and My other server and save the backups in these directories with time stamps.

  5. Run the script using:

    python3 backup.py

    The script will backup your database at 00:00 Hours to folder .../path/to/app/auto-backup/Backups/. It will only create the backup once. To make it run automoatically you will have to link the script with some external service link supervisor.d or in init.d in Ubuntu

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.