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

dlid-backup

v0.5.2

Published

CLI tool to make a simple backup from a source to a target

Downloads

2

Readme

dlid-backup

CLI tool to make a simple backup from a source to a target

dlid-backup 
 ACTION = run | help
 -s:COLLECTOR_TYPE 
 [-s.COLLECTOR_PROPERTY=value]...
 -t:TARGET_TYPE 
 [-s.TARGET_PROPERTY=value]...

All files are collected into a ZIP archive. This ZIP file is then sent to the target.

Installation

npm install dlid-backup

Example - MySQL backup

The MySQL backup will use mysqldump and will only work for the local server.

dlid-backup
 run
 -s:mysql                                                # We want to make a MySQL backup
 -s.host=localhost                                       # from a local server
 -s.include=wp_*                                         # of all databases starting with wp_*
 -t:filesystem                                           # Save the backup in the local filesystem
 -t.folder=/usr/david/bak                                # in this folder
 -t.filename={date:yyyy'-'MM'-'dd}-{date}-{date}-wp.zip  # with this filename {these} values are macros  (2020-07-15-wp.zip)
 -t.keep=3                                               # Keep maximum 3 files in the target location that...
 -t.keep-match=*_wp-zip                                  # ..match this pattern - ending with_wp.zip

Collector

A collector is used to gather data/files and put it inside a zip archive. These are the current collectors.

  • Filesystem - Zip files using glob patterns or zip an entire folder
  • MySQL - Zip SQL database dumps

Target

A Target is where the Collected zip file should be stored. These are the current targets:

  • Filesystem
  • Firebase

Development

# Installation
npm install
npm start    # Will watch files and build to dist/ folder

# Run dlid-backup
node ./     # Will run developmente build (dist/bin/index.js)

# Build npm-package
npm run build   # Will build into release/ folder

# Tests
npm test       # Will run tests

Changes

0.5.2 (2020-07-16)

  • Added Target: Synology FileStation

More documentation and examples will come - this is just the first release


Firebase target

Firebase key

Download from Firebase console

folder.js

Not completed

MySQL preparations

You should make sure root can run mysqldump and mysql commands without passwords in the command line.

mysql_config_editor set --login-path=client --host=localhost --user=root --password

NOTE! Put " around the password if it contains special characters

Enter password then connect without parameters (or using parameter --login-path=hej if you named it hej)

Cron

Cron jobs should be setup to execute mysqldump, compress and upload files

  • Montly backup at 00:15 the first of each month. Save 12 backup files.
  • Weekly backup at 00:30 the first day of each week. Save 12 backup files.
  • Weekdaily backup at 00:15 every day. Max 7 files will exist at any one time.
15 00 1 * * nodejs /usr/local/sbin/dlid-backup/db.js --dateformat="YYYY-MM" -z="mysql-backup" -p="{hostname}/mysql/monthly" --keep 12 > /usr/local/sbin/dlid-backup/mysql-monthly.log
30 00 * * 1 nodejs /usr/local/sbin/dlid-backup/db.js --dateformat="YYYY[W]WW" -z="mysql-backup" -p="{hostname}/mysql/weekly" --keep 12 > /usr/local/sbin/dlid-backup/mysql-weekly.log
05 00 * * * nodejs /usr/local/sbin/dlid-backup/db.js --dateformat="ddd" -z="mysql-backup" -p="{hostname}/mysql/weekdaily" > /usr/local/sbin/dlid-backup/mysql-weekdaily.log