CLI app to upload files in any readable local directories to Cloud Provider.
Mainly used in conjunction with cron-backup. The cron-backup is for archiving local files and database dump, then this app is for uploading them to Cloud Provider.
- Upload any readable local directories as many as possible. (make sure your cloud provider's capacity is sufficient).
- Automatically create folders (that doesn't exist yet) in cloud provider based on config file.
- Option to set the maximum number of days (retain) delete files in cloud provider that exceed the maximum number of days (retain).
- Option to set the number of worker for upload and or delete job.
- Option to set the chunk size (in byte) of the file when uploading.
-
Download the latest binary file from Releases.
-
Extract the downloaded binary file and make sure it's executable.
tar -xzf cron-upload....tar.gz chmod u+x cron-upload
-
Create configuration file from the template.
cp app.yml.example app.yml
-
Edit the app config file as needed. You can check the template for explanation of each field.
-
Try to execute and check if there is any error in the app config file.
./cron-upload -test
-
Check the logs file for any error. Maybe failed to upload or delete files, etc.
-
Create a cronjob to run this app. (optional but recommended)
Example:
@daily cd /full/path/to/cron-upload && ./cron-upload -log file
Currently, support Google Drive & AWS S3 Bucket as the cloud provider. See below how to setup the prerequisite for each provider.
- Create Google Service Account and download the credential in json format. You can follow this awesome tutorial,
but following until the #4 step will be sufficient. Use the shared folder's name as
root
in app config file. - Put the full file path where the downloaded credential is to the app config, like so.
provider: name: drive cred: /full/path/to/credential.json
- Create an administrative user with
AmazonS3FullAccess
permission. see docs. - Create new access key for that admin user and select
Other
option in Access key best practices & alternatives step. see docs. - Save the
Access key
&Secret access key
to json file like so.{ "key": "KEY", "secret": "SECRET" }
- Login to console using the admin user from step #1.
- Create new S3 bucket. see docs.
- Create new folder and use that folder as
root
in app config file. - Put the full file path where the saved json file in step #4 is to the app config, like so.
provider: name: s3 cred: /full/path/to/credential.json region: eu-central-1 # set to where your bucket's region. see step #5 bucket: chum-bucket # your bucket name. should be created beforehand. see step #5
-path
: set where to find the config file. Default is set to current directory where the binary file is run.-log
: set where to write the log. Default is set to stdout. You can change it to-log file
to write the log to file in the directory that you set in config file.-test
: run all sort of tests such as, validations for the config file, try to create folder, upload & delete files to cloud provider and also check if there is any error.
This project is licensed under the MIT License - see the LICENSE file for details.