Giter Site home page Giter Site logo

pg-backup-bot's Introduction

PostgreSQL Backup Bot ๐Ÿ“ฆ๐Ÿ”

This project provides a robust solution for automating PostgreSQL database backups and delivering those backups directly via Telegram. It utilizes Docker to encapsulate the backup process and Telegram API for a convenient backup delivery method.

Description ๐Ÿ“–

Using a combination of PostgreSQL client tools, cron jobs for scheduling, and a Telegram bot for notifications and file delivery, this solution is perfect for those seeking an automated, secure, and straightforward way to handle database backups.

Features ๐ŸŒŸ

  • Automated database backups scheduled via cron.
  • Direct delivery of backup files to your Telegram chat.
  • Easy setup with Docker and Docker Compose.
  • Utilizes environment variables for secure handling of sensitive information.

Prerequisites ๐Ÿ› ๏ธ

Before you begin, ensure you have installed:

  • Docker
  • Docker Compose

Also, you will need:

  • PostgreSQL database access details.
  • A Telegram bot token and chat ID to receive the backup files.

Setup Instructions ๐Ÿš€

  1. Setup Docker Compose

    Within the project's root, create a docker-compose.yml file with the following content:

    version: '3.8'
    services:
      backup_bot:
        build: https://github.com/Radim296/pg-backup-bot.git
        environment:
          - DB_HOST=
          - DB_USER=
          - DB_PASSWORD=
          - DB_NAME=
          - CHAT_ID=
          - TELEGRAM_BOT_TOKEN=
    
          # configuring the time (you can set one of the following options)
          - TIME_TO_SEND=00:00 # hour:minute in 24h format
          - INTERVAL=100 # minutes
    
          # optional variables
          - MESSAGE_THREAD_ID=

    This file instructs Docker Compose on how to build and run the service, passing in the necessary environment variables and mapping the backup script into the container.

  2. Build and Run

    Execute the following command to build and start the backup bot:

    docker-compose up --build
    

    To run it in detached mode (in the background), use:

    docker-compose up -d --build
    

Usage ๐Ÿ“‹

With the service running, it will execute the backup script according to the schedule defined in the crontab within the Dockerfile (default is midnight daily). The script dumps the PostgreSQL database and sends the resulting file to the specified Telegram chat.

Contributing ๐Ÿค

Contributions, issues, and feature requests are welcome! Feel free to fork the repository and submit your contributions via pull requests.

License ๐Ÿ“„

This project is open-source and available under the MIT License.

Acknowledgments ๐Ÿ’ก

  • This project was inspired by the need for a simple, automated backup solution with notifications and delivery via Telegram.
  • Thanks to all contributors and the open-source community for the tools and libraries that made this project possible.

Let this ๐Ÿšข sail smoothly with your backups secured and delivered straight to your ๐Ÿ“ฑ!

pg-backup-bot's People

Contributors

radim296 avatar

Stargazers

Aliya Gumirova avatar  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.