npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rbaker

v1.6.4

Published

`rbaker` is a Node.js application designed for scheduling and executing various backup tasks. It supports backing up directories, MySQL databases, media files, and websites to both local and remote locations. The scheduling of these tasks is managed using

Downloads

24

Readme

rbaker

rbaker is a Node.js application designed for scheduling and executing various backup tasks. It supports backing up directories, MySQL databases, media files, and websites to both local and remote locations. The scheduling of these tasks is managed using cron-like syntax.

Features

  • Backup Directories: Sync specified directories to a remote location.
  • Backup MySQL Databases: Dump MySQL databases and move them to a remote backup location.
  • Move Media Files: Move media files from specified directories to a remote location.
  • Backup Websites: Backup website directories and move the backups to a remote location.
  • Task Scheduling: Schedule tasks using cron-like syntax.
  • Database Support: Use SQLite to store task schedules.

Installation

  1. Clone the repository:

    git clone https://github.com/dannymichel/rbaker.git
    cd rbaker
  2. Install dependencies:

    npm install
  3. Global Installation: To install rbaker globally and ensure configuration files are set up correctly, use:

    sudo npm install -g rbaker
  4. Initial Configuration: On the first run, rbaker will create the configuration directory and copy example configuration files:

    ~/.config/rbaker/

Configuration

  • MySQL Configuration (~/.config/rbaker/mysql.json):

    {
      "backup_dir": "/home/example_user/backups/database/",
      "remote": "cloud:backups/dev/database/",
      "retention_days": 10,
      "mysql_user": "root",
      "mysql_password": "example_password"
    }
  • Websites Configuration (~/.config/rbaker/websites.json):

    {
      "sites": [
        {
          "source": "/var/www",
          "backup_dir": "/home/example_user/backups/dev/site"
        },
        {
          "source": "/var/lib/gazelle/torrent",
          "backup_dir": "/home/example_user/backups/dev/tor"
        }
      ],
      "remote": "cloud:backups/dev/site/",
      "retention_days": 10
    }
  • Directories Configuration (~/.config/rbaker/directories.json):

    {
      "remote": "cloud:backups/dev/",
      "directories": [
        "/etc/dkimkeys",
        "/etc/init.d",
        "/etc/letsencrypt"
      ]
    }
  • Media Configuration (~/.config/rbaker/media.json):

    {
      "media_directories": [
         "/local/music",
         "/local/tv",
         "/local/movies"
      ],
      "remote": "cloud:media/"
    }
  • Schedule Configuration (~/.config/rbaker/schedule.json):

    {
      "tasks": [
        {
          "task": "backupDirectories",
          "interval": "0 */1 * * *",
          "timeout": 3600
        },
        {
          "task": "backupMySQL",
          "interval": "*/5 * * * *",
          "timeout": 3600
        },
        {
          "task": "moveMedia",
          "interval": "0 0 * * *",
          "timeout": 7200
        },
        {
          "task": "backupWebsites",
          "interval": "*/10 * * * *",
          "timeout": 7200
        }
      ]
    }

Usage

Command Line Interface

rbaker provides a CLI to manage and run backup tasks.

  • Scheduler

    rbaker scheduler
  • Add Task

    rbaker add-task <task> <interval> <timeout>

    Example:

    rbaker add-task backupMySQL "*/5 * * * *" 3600
  • Remove Task

    rbaker remove-task <task>

    Example:

    rbaker remove-task backupMySQL
  • Backup Directories

    rbaker backup-directories
  • Backup MySQL

    rbaker backup-mysql -u <user> -p <password>
  • Move Media

    rbaker move-media
  • Backup Websites

    rbaker backup-websites

Systemd Service

To run rbaker as a service, create a systemd service file:

[Unit]
Description=rbaker service
After=network.target

[Service]
ExecStart=/usr/bin/rbaker scheduler
Restart=always
User=root
Environment=NODE_ENV=production
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=rbaker
WorkingDirectory=/root/.config/rbaker/

[Install]
WantedBy=multi-user.target

Contributing

Feel free to submit issues or pull requests if you have any suggestions or improvements.

License

This project is licensed under the MIT License.

References