https://github.com/scderox/simple-directory-to-s3-backup
https://github.com/scderox/simple-directory-to-s3-backup
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/scderox/simple-directory-to-s3-backup
- Owner: SCDerox
- License: wtfpl
- Created: 2021-07-14T14:24:09.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2024-10-29T13:33:48.000Z (over 1 year ago)
- Last Synced: 2025-01-24T05:41:45.839Z (over 1 year ago)
- Language: JavaScript
- Size: 29.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Simple directory to S3
## Features
* This system will backup folders and upload them to your s3 bucket
* Every backup is encrypted using the ZIP encryption algorithm
* Backups can automatically done every hour
* Backups can automatically be deleted from your S3-Bucket every x days
## Should I use this?
Probably not tbh. It's quite complicated to set up, and the project only hase a very small and specific use-case.
`Why is it called "Simple.." if it's complicated to set up? ~ I am very glad you asked, it's because the code is quite simple and it took not a very long time to develop this "thing".`
## Installation
Make sure you have `zip` installed on your system: `apt install zip`.
1. Clone this repo: `git clone https://github.com/SCDerox/simple-directory-to-s3-backup.git`
2. Install dependencies `npm ci`
3. Set up a S3-Bucket on AWS
4. Create a configuration-file called `config.json` in the cloned directory and change the configured parameters (
explained below).
5. Then start the script as described below.
## Start the system
* If you only want to back up once run `npm start` in the cloned directory
* To ensure that backups are performed hourly, I suggest to use [pm2](https://pm2.keymetrics.io/): `pm2 start index.js`
## Configure
You can change these parameters in the `config.json` you created earlier.
* `key`: Password with which the ZIP should be encrypted
* `prefix`: Optional prefix which should be put before every filenname
* `path`: Path on your S3-Bucket in which the backup should be saved
* `enabledHourlyUpload`: If enabled the script will backup your files hourly
* `limitHoursTo`: Array of strings; Hours to limit the hourly upload to
* `folders`: Array of the following paths that should get backed up
* `runCommandsBeforeExecution`: Array of commands to run before execution (for example `mysqldump`or something)
* `bucketID`: ID of your S3-Bucket
* `accessKeyID`: ID of your access-key
* `bucketRegion`: Region of your bucket
* `secretAccessKey`: Secret of your access-key
* `deleteItems`: If enabled, S3 objects will be deleted automatically (in the specified folder) if they are older than
`daysBeforeDeletion`. We suggest using lifecycle rules is supported by your S3 provider.
* `doNotDeleteLocalBackup`: By default local backup files will be deleted after they have been uploaded. Enable this
option do disable this behavior.
## How do I decrypt the encrypted file?
Use `unzip ` to unzip your file. You'll be asked for a password when decrypting.