Skip to main content

Used to upload files to cold storage

Project description

coldsync

Build Status Coverage Status PyPI version License Downloads

Python 3.4 Python 3.5 Python 3.6 Python 3.7 Python 3.8 Pypy 3.5

Backup important files to cold storage.

pip install coldsync

Google Cloud Storage is supported for now. The API is can be extend to add support other providers. Inside the storage module extend the BaseStorage to add support for other providers.

Usage

To use the commands you must first setup the following environment variables:

  • CS_DATA_CENTER
  • CS_PROJECT_NAME
  • CS_ENV_NAME
  • CS_GOOGLE_SERVICE_ACCOUNT_PATH

Where CS_DATA_CENTER, CS_PROJECT_NAME, CS_ENV_NAME are used to identify the bucket in which files are stored.

The CS_GOOGLE_SERVICE_ACCOUNT_PATH must point to your google credentials.json file.

Examples

Show all files inside the bucket

CS_DATA_CENTER='central-europe' \
CS_PROJECT_NAME='coold-data-storage' \
CS_ENV_NAME='production' \
CS_GOOGLE_SERVICE_ACCOUNT_PATH='credentials.json' \
coldsync list-files

Upload a file to the bucket

You may need to mount the file in the docker container in order to have access to it.

CS_DATA_CENTER='central-europe' \
CS_PROJECT_NAME='coold-data-storage' \
CS_ENV_NAME='production' \
CS_GOOGLE_SERVICE_ACCOUNT_PATH='credentials.json' \
coldsync upload-file sample.jpg --remote_path 'thecat.jpg'

Download a file from the bucket

You may need to mount the download directory in the docker container in order to have access to the files which have been downloaded from your local file system.

CS_DATA_CENTER='central-europe' \
CS_PROJECT_NAME='coold-data-storage' \
CS_ENV_NAME='production' \
CS_GOOGLE_SERVICE_ACCOUNT_PATH='credentials.json' \
coldsync download-file 'thecat.jpg' thecat.jpg

Deleting a file from the bucket

CS_DATA_CENTER='central-europe' \
CS_PROJECT_NAME='coold-data-storage' \
CS_ENV_NAME='production' \
CS_GOOGLE_SERVICE_ACCOUNT_PATH='credentials.json' \
coldsync delete-file 'thecat.jpg'

Tests

Running test suite

python setup.py test

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

coldsync-0.0.4.tar.gz (4.8 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page