s3reamer 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +22 -0
- data/README.md +65 -0
- data/bin/s3reamer +16 -1
- data/lib/s3reamer/directory_streamer.rb +4 -2
- data/lib/s3reamer/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87b01cd26a019b04330bdce3ab30d8d55ae39c5d
|
4
|
+
data.tar.gz: 66eabdddfd8e19b19435d90b714bc6717b220c87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7e40f9d91ef30e5d8a9127bfa602f37a9e34003278cf97ffe425e10d379b1d60e4a0bcadf461aca0f1ca03c6cbbf1a879c9d42275d5dc2d5fe2150b4f37ede8
|
7
|
+
data.tar.gz: 6b647a4ccec6cf6734fbbc669d42f09bada1cbbce6b7c411cf4ccb313c87f69b3458b9236e707640363c0d28eca83c457b9f305ec1639c0587a1223a29d461eb
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Chris Mullins
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
|
data/README.md
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
# s3reamer
|
2
|
+
|
3
|
+
*(pronounced "ss-three-mer")*
|
4
|
+
|
5
|
+
Automatically upload files to S3 as they're created
|
6
|
+
|
7
|
+
## Details
|
8
|
+
|
9
|
+
s3reamer watches a provided directory and starts uploading newly created files as soon as they're created. It uses [`rb-inotify`](https://github.com/rb-inotify) for filesystem event notifications. As such, it only works on Linux systems.
|
10
|
+
|
11
|
+
When it detects a new file, it immediately begins uploading it to S3 using the multipart upload API. It buffers each part (default and minimum 5MB) in memory.
|
12
|
+
|
13
|
+
## Installing
|
14
|
+
|
15
|
+
s3reamer is available on [Rubygems](https://rubygems.org). You can install it with:
|
16
|
+
|
17
|
+
```
|
18
|
+
$ gem install s3reamer
|
19
|
+
```
|
20
|
+
|
21
|
+
You can also add it to your Gemfile:
|
22
|
+
|
23
|
+
```
|
24
|
+
gem 's3reamer'
|
25
|
+
```
|
26
|
+
|
27
|
+
In order to access the executables, you might have to do something like:
|
28
|
+
|
29
|
+
```
|
30
|
+
rbenv rehash
|
31
|
+
```
|
32
|
+
|
33
|
+
depending on how your Ruby environment is configured.
|
34
|
+
|
35
|
+
## Usage
|
36
|
+
|
37
|
+
It's probably easiest to use the bundled ruby script:
|
38
|
+
|
39
|
+
```
|
40
|
+
$ s3reamer
|
41
|
+
Usage: s3reamer DIRECTORY BUCKET_NAME [options]
|
42
|
+
-r, --region [AWS_REGION]
|
43
|
+
--file-read-timeout [SECONDS]
|
44
|
+
Number of seconds to wait for a file to grow before timing out (defaults to 10)
|
45
|
+
--reader-sleep-interval [SECONDS]
|
46
|
+
Number of seconds to sleep after an attempted read (defaults to 1)
|
47
|
+
-n, --parallelism [N] Maximum number of concurrent files being processed (defaults to 4)
|
48
|
+
-v, --verbose
|
49
|
+
-c, --aws-credientials [PATH] Path to AWS credentials file. Defaults to ~/.aws/credentials
|
50
|
+
-p [PROFILE], AWS credentials profile. Defaults to "default".
|
51
|
+
--aws-credentials-profile
|
52
|
+
--s3-prefix [PREFIX] Prefix to append to all uploaded files. Defaults to empty string.
|
53
|
+
```
|
54
|
+
|
55
|
+
It expects credentials to be in the standard AWS credentials conf format, and reads from `~/.aws/credentials` by default:
|
56
|
+
|
57
|
+
```
|
58
|
+
$ cat ~/.aws/credentials
|
59
|
+
[default]
|
60
|
+
aws_access_key_id = <access_key_id>
|
61
|
+
aws_secret_access_key = <secret_access_key>
|
62
|
+
region = us-east-1
|
63
|
+
```
|
64
|
+
|
65
|
+
It's important to note that s3reamer will **NOT** attempt to upload files that already exist (and don't change) when it's started.
|
data/bin/s3reamer
CHANGED
@@ -15,7 +15,8 @@ options = {
|
|
15
15
|
log_level: Logger::INFO,
|
16
16
|
credentials_file: ENV['HOME'] + '/.aws/credentials',
|
17
17
|
credentials_profile: 'default',
|
18
|
-
prefix: ''
|
18
|
+
prefix: '',
|
19
|
+
log_file: STDOUT
|
19
20
|
}
|
20
21
|
opts = OptionParser.new do |opts|
|
21
22
|
opts.banner = banner
|
@@ -58,6 +59,20 @@ opts = OptionParser.new do |opts|
|
|
58
59
|
v = "#{v}/" unless v.end_with?("/")
|
59
60
|
options[:prefix] = v
|
60
61
|
end
|
62
|
+
|
63
|
+
opts.on("-l", "--log-file [FILE]", String,
|
64
|
+
"Where logs should be written to. Defaults to STDOUT.") do |v|
|
65
|
+
f = File.new(v)
|
66
|
+
if !f.file?
|
67
|
+
$stderr.puts "Specified log file is not a file: #{v}"
|
68
|
+
exit 1
|
69
|
+
elsif !File.exists?((log_dir = f.basename))
|
70
|
+
$stderr.puts "Log file's directory does not exist: #{log_dir}"
|
71
|
+
exit 1
|
72
|
+
end
|
73
|
+
|
74
|
+
options[:log_file] = File.open(v, File::WRONLY | File::APPEND)
|
75
|
+
end
|
61
76
|
end
|
62
77
|
|
63
78
|
if ARGV.length < 2
|
@@ -14,14 +14,16 @@ module S3reamer
|
|
14
14
|
pool_size: 4,
|
15
15
|
log_level: Logger::INFO,
|
16
16
|
reader_sleep_interval: 1,
|
17
|
-
reader_timeout: 10
|
17
|
+
reader_timeout: 10,
|
18
|
+
encryption_key: nil,
|
19
|
+
log_file: STDOUT
|
18
20
|
}
|
19
21
|
|
20
22
|
attr_reader :options
|
21
23
|
|
22
24
|
def initialize(options = {})
|
23
25
|
@options = DEFAULT_OPTIONS.merge(options)
|
24
|
-
@log = Logger.new(
|
26
|
+
@log = Logger.new(options[:log_file])
|
25
27
|
@log.level = options[:log_level]
|
26
28
|
end
|
27
29
|
|
data/lib/s3reamer/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: s3reamer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christopher Mullins
|
@@ -103,6 +103,8 @@ extra_rdoc_files: []
|
|
103
103
|
files:
|
104
104
|
- ".gitignore"
|
105
105
|
- Gemfile
|
106
|
+
- LICENSE
|
107
|
+
- README.md
|
106
108
|
- bin/s3reamer
|
107
109
|
- lib/s3reamer.rb
|
108
110
|
- lib/s3reamer/directory_streamer.rb
|