Installtion¶
From source code¶
$ pip install -e ./
From deb or rpm¶
$ dpkg -i swift-watch-folder-0.0.2-1.noarch.rpm
$ rpm -ivh swift-watch-folder_0.0.2-1_all.deb
Pre-build packges¶
Configuration¶
The configuration file (folder.conf)¶
[global]
user = <ST_USER>
auth = https://<swift_cluster>/auth/v1.0
key = <PASSWORD>
insecure = False
# How many upload workers
concurrency = 10
# default is SLO
use_slo = True
# default segment_size is 10MB
segment_size = 10485760
segment_container_prefix = .segment_
# Watch subdirectories for file changes if set True (default: False)
recursive = False
# Include the relative path when this set True
preserve_path = False
[/syncing_folder_directory]
storage_policy = Standard-Replica
container = test_bulk_a
# this option overwrite segment_container_prefix
segment_container = test_bulk_a+seg
# expired objects after 30 second or more
# or you can use
#
# expired_after = 300s (seconds)
# expired_after = 5m (minutes)
# expired_after = 24h (hours)
# expired_after = 90d (days)
# expired_after = 7y (years)
#
# Note, ignore this option if `expired_at_date` is set
expired_after_second = 30
# the date format is "YYYY-MM-DD hh:mm:ss"
expired_at_date = 2016-10-01 10:00:00
# allow user to set metadata for object likes 'x-objet-meta-key-1: value-1'
metadata = key-1:value-1,key-2:value-2
# only upload files that matched the patterns, split with comma
file_patterns = *.log.gz, *.log
[/sync_another_folder_directory]
#e.g: [/home/charles/folder_b]
container = test_bulk_b
# this option overwrite segment_container_prefix
segment_container = test_bulk_b+seg
# expired objects after 30 second or more
# or you can use
#
# expired_after = 300s (seconds)
# expired_after = 5m (minutes)
# expired_after = 24h (hours)
# expired_after = 90d (days)
# expired_after = 7y (years)
#
# Note, ignore this option if `expired_at_date` is set
expired_after = 1h
# the date format is "YYYY-MM-DD hh:mm:ss"
#expired_at_date = 2016-10-01 10:00:00
# Checker will check local file and remote object,
# it'll delete local file when the md5sum is matched after 10 mins
delete_uploaded_file_after = 10m
# allow user to set metadata for object likes 'x-objet-meta-key-1: value-1'
metadata = key-1:value-1,key-2:value-2
# only upload files that matched the patterns, split with comma
file_patterns = *.log.gz
Run¶
# generate a sample config
$ swift-watch-folder -g test.conf
# run it in debug mode (turn on log-level to debug)
$ swift-watch-folder -c test.conf -l log.txt --debug
Package¶
Build wheel package¶
$ python setup.py bdist_wheel
Build DEB/RPM package with fpm¶
- Install fpm
$ sudo apt-get install ruby-dev build-essential software-properties-common
$ sudo gem install fpm
- Pull submodule and build it
$ git submodule init
$ git submodule update
$ make clean all
Build Windows(MSI) pcakge¶
- Install Wix Toolset v3.11.
- Install Python 2.7.x.
- Run
cmd.exe
and executeMakefile.bat
.
You can find all deb/rpm/msi files in dist folder
dist/
├── swift-watch-folder
├── swift-watch-folder-0.0.2-1.noarch.rpm
├── swift-watch-folder_0.0.2-1_all.deb
└── swift_watch_folder-0.0.2-py2.7.egg
0 directories, 4 files
And you can run the command dist/swift-watch-folder
without any additional
python package. It’s a standalone file.