# prism-backup

> A backup utility for backing up databases and files to S3 cloud storage.

Latest version **0.1.5** (published 2021-10-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install prism-backup
pnpm add prism-backup
yarn add prism-backup
bun add prism-backup
```

Provides the command `prism-backup`.

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.5 |
| Published | 2021-10-22 |
| First published | 2021-09-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 33.5 KB |
| Known vulnerabilities | 0 (+31 in 3 direct dependencies) |
| Install scripts | no |
| Author | Dan Carter |
| Maintainers | equals-dan |

## Links

- npm: https://www.npmjs.com/package/prism-backup
- npm.io page: https://npm.io/package/prism-backup

## Dependencies (7)

- [yaml](https://npm.io/package/yaml.md) ^2.0.0-8
- [axios](https://npm.io/package/axios.md) ^0.21.4
- [yargs](https://npm.io/package/yargs.md) ^17.2.0
- [mysql2](https://npm.io/package/mysql2.md) ^2.3.0
- [aws-sdk](https://npm.io/package/aws-sdk.md) ^2.993.0
- [archiver](https://npm.io/package/archiver.md) ^5.3.0
- [mysqldump](https://npm.io/package/mysqldump.md) ^3.2.0

## Recent versions

- 0.1.5 (latest) — 2021-10-22
- 0.1.4 — 2021-10-14
- 0.1.3 — 2021-10-01
- 0.1.2 — 2021-09-30
- 0.1.1 — 2021-09-30
- 0.1.0 — 2021-09-30

## README

# Prism Backup

A backup utility for backing up databases and files to S3 cloud storage.


## Installation

Install globally using `npm i -g prism-backup`

Alternatively use `npx prism-backup` to run the latest version without installation.


## Usage

1. Create your configuration file.
2. Run `prism-backup --config path/to/config/file.yml`.

For scheduled backups this command can be run via a cron job or similar system.


## Configuration

Example configuration.yml:
```yaml
id: backup-id
reporting:
  webhook:
    endpoint: https://webhook.url.com/endpoint
    key: REPORTING_WEBHOOK_KEY
connect:
  endpoint: s3.example.com
  key: ACCESS_KEY_ID
  secret: SECRET_ACCESS_KEY
  bucket: bucket-name
files:
- label: file-group-name
  paths:
  - /path/to/directory
  - /path/to/single-file.txt
- label: second-file-group
  paths:
  - /path/to/another-file.txt
databases:
- label: database-backup-name
  type: mysql
  host: localhost
  username: foo
  password: bar
  database: baz
```

## Uploading to storage

The `connect` object configures the S3 storage connection details.

For use with DigitalOcean spaces, use the spaces key and spaces secret as the `key` and `secret` respectively.

## File backups

Groups of file and directory paths can be defined in `files` to allow more control of the structure of your backup.

Each group can have multiple paths and will group all under one zip archive within the backup.

File paths can either be absolute paths or relative to the location of the configuration file.

## Database backups

Multiple databases details can be defined in `databases`.

**Note: Currently only MySQL databases are supported**

## Reporting

An optional reporting webhook can be provided in `reporting` to report successful backup uploads and any errors.

Example success webhook POST payload:
```json
{
  "id": "backup-id",
  "upload": {
    "bucket": "bucket-name",
    "object": "20210830-105654_backup-id_27213.zip",
  },
  "key": "REPORTING_WEBHOOK_KEY"
}
```

Example error webhook POST payload:
```json
{
  "id": "backup-id",
  "error": "Error message",
  "key": "REPORTING_WEBHOOK_KEY"
}
```

---
_Source: https://npm.io/package/prism-backup · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
