GithubHelp home page GithubHelp logo

fx505 / telegram-db-backup Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hkfuertes/telegram-db-backup

0.0 0.0 0.0 14 KB

Docker Container to backup MySQL/MariaDB to a *.sql.zip file to a Telegram Bot Chat

Shell 77.39% Dockerfile 22.61%

telegram-db-backup's Introduction

Telegram Database Backup

Simple docker image to cron a database backup to a Telegram Bot.

Run

You can run it via docker-compose, but there are several environment variables that need to be passed on:

Variable Example Value Description
DATABASE_NAME csbookdb Name of the database.
DATABASE_USER admin Database user to be used.
DATABASE_PASSWORD **** Database user's password.
DATABASE_HOST localhost Database url.
DATABASE_PORT 3306 Database port.
CRON_EXPRESION * * * * * CRON expresion for the backup to happen.
TELEGRAM_TOKEN ******** Telegram token from BotFather
CHAT_ID **** Chat ID to where the backup will be sent.

Integration with existing project

To integrate into an existing project you can just first build the project:

docker build -t telegram-db-backup .

...and add the following docker-compose.override.yml file:

version: '3.5'

services:
  telegrambot:
    image: telegram-db-backup:latest # or the <tag> you specified on build...
    # build:
    #   context: .
    environment:
      - DATABASE_USER=${DATABASE_USER}
      - DATABASE_PASSWORD=${DATABASE_PASSWORD}
      - DATABASE_NAME=${DATABASE_NAME}
      - DATABASE_HOST=${DATABASE_HOST}
      - DATABASE_PORT=${DATABASE_PORT}
      - TELEGRAM_TOKEN=${TELEGRAM_TOKEN}
      - CHAT_ID=${CHAT_ID}
      - CRON_EXPRESION=${CRON_EXPRESION}
    restart: unless-stopped

Provided that you added the required variables in the .env file, by running docker-compose up on your project, docker-compose will pick both docker-compose.yml and docker-compose.override.yml files and so, both project will be on the same network and no ports need to be exported.

telegram-db-backup's People

Contributors

hkfuertes 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.