lsst-git-lfs-s3 0.1.4 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +5 -1
- data/bin/git-lfs-s3 +1 -0
- data/lib/git-lfs-s3.rb +3 -3
- data/lib/git-lfs-s3/application.rb +3 -1
- data/lib/git-lfs-s3/services/ceph_presigner.rb +24 -0
- data/lib/git-lfs-s3/services/upload/base.rb +4 -0
- data/lib/git-lfs-s3/services/upload/upload_required.rb +7 -1
- data/lib/git-lfs-s3/version.rb +1 -1
- metadata +15 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 437091d8955c2a60f97a25e2ea0594da402e0cba
|
4
|
+
data.tar.gz: ff1da32dc48a5cd13b48f78b605e261311ccc4e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6be37b7523a881c3ab2ed9537966f814db9478535ef08c919df31c5f99a713562a870d4c2cff863de3e31d07ddcb68b9bba192bbc168a4da0fd424f6e694c9d
|
7
|
+
data.tar.gz: ba42f8a39304e878996f7c9f3da82276e0225230ad9d34aa4444fc1c95c4b1af0c80c1c71b69b7b0fe0a7e057911e942fbaadc11b070e170ce75738666820f3e
|
data/.gitignore
CHANGED
data/bin/git-lfs-s3
CHANGED
@@ -10,6 +10,7 @@ GitLfsS3::Application.set :aws_secret_access_key, ENV['AWS_SECRET_ACCESS_KEY']
|
|
10
10
|
GitLfsS3::Application.set :s3_bucket, ENV['S3_BUCKET']
|
11
11
|
GitLfsS3::Application.set :server_url, ENV['LFS_SERVER_URL']
|
12
12
|
GitLfsS3::Application.set :public_server, (ENV['LFS_PUBLIC_SERVER'] == 'true')
|
13
|
+
GitLfsS3::Application.set :ceph_s3, (ENV['LFS_CEPH_S3'] == 'true')
|
13
14
|
GitLfsS3::Application.set :logger, Logger.new(STDOUT)
|
14
15
|
|
15
16
|
GitLfsS3::Application.on_authenticate do |username, password, is_safe|
|
data/lib/git-lfs-s3.rb
CHANGED
@@ -90,7 +90,9 @@ module GitLfsS3
|
|
90
90
|
post '/verify', provides: 'application/vnd.git-lfs+json' do
|
91
91
|
data = MultiJson.load(request.body.tap { |b| b.rewind }.read)
|
92
92
|
object = object_data(data['oid'])
|
93
|
-
|
93
|
+
if settings.public_server and settings.ceph_s3
|
94
|
+
object.acl.put(acl: "public-read")
|
95
|
+
end
|
94
96
|
if object.exists? && object.size == data['size']
|
95
97
|
status 200
|
96
98
|
else
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'base64'
|
2
|
+
require 'date'
|
3
|
+
require 'digest/sha1'
|
4
|
+
require 'openssl'
|
5
|
+
require 'uri'
|
6
|
+
|
7
|
+
module GitLfsS3
|
8
|
+
module CephPresignerService
|
9
|
+
extend self
|
10
|
+
extend AwsHelpers
|
11
|
+
|
12
|
+
def signed_url(obj)
|
13
|
+
expire_at = (DateTime.now + 1).strftime("%s")
|
14
|
+
secret_access_key = Aws.config[:secret_access_key]
|
15
|
+
access_key_id = Aws.config[:access_key_id]
|
16
|
+
endpoint = Aws.config[:endpoint]
|
17
|
+
digest = OpenSSL::Digest.new('sha1')
|
18
|
+
can_string = "PUT\n\napplication/octet-stream\n#{expire_at}\n/#{obj.bucket_name}/#{obj.key}"
|
19
|
+
hmac = OpenSSL::HMAC.digest(digest, secret_access_key, can_string)
|
20
|
+
signature = URI.escape(Base64.encode64(hmac).strip, /[\+=?@$&,\/:;\?]/)
|
21
|
+
"#{endpoint}/#{obj.bucket_name}/#{obj.key}?Signature=#{signature}&AWSAccessKeyId=#{access_key_id}&Expires=#{expire_at}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require "git-lfs-s3/services/ceph_presigner"
|
2
|
+
|
1
3
|
module GitLfsS3
|
2
4
|
module UploadService
|
3
5
|
class UploadRequired < Base
|
@@ -26,7 +28,11 @@ module GitLfsS3
|
|
26
28
|
private
|
27
29
|
|
28
30
|
def upload_destination
|
29
|
-
|
31
|
+
if ceph_s3
|
32
|
+
GitLfsS3::CephPresignerService::signed_url(object)
|
33
|
+
else
|
34
|
+
object.presigned_url(:put)
|
35
|
+
end
|
30
36
|
end
|
31
37
|
|
32
38
|
def upload_headers
|
data/lib/git-lfs-s3/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lsst-git-lfs-s3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan LeFevre
|
@@ -9,62 +9,62 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-10-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws-sdk
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ~>
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '2'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - ~>
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '2'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: sinatra
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ~>
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '1'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - ~>
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '1'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: multi_json
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- -
|
46
|
+
- - ~>
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '1'
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- -
|
53
|
+
- - ~>
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '1'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: rake
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- -
|
60
|
+
- - ~>
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '10'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - ~>
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '10'
|
70
70
|
description: LSST's Git LFS server that uses S3 for the storage backend.
|
@@ -76,7 +76,7 @@ executables:
|
|
76
76
|
extensions: []
|
77
77
|
extra_rdoc_files: []
|
78
78
|
files:
|
79
|
-
-
|
79
|
+
- .gitignore
|
80
80
|
- Gemfile
|
81
81
|
- README.md
|
82
82
|
- Rakefile
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- lib/git-lfs-s3.rb
|
86
86
|
- lib/git-lfs-s3/application.rb
|
87
87
|
- lib/git-lfs-s3/aws.rb
|
88
|
+
- lib/git-lfs-s3/services/ceph_presigner.rb
|
88
89
|
- lib/git-lfs-s3/services/upload.rb
|
89
90
|
- lib/git-lfs-s3/services/upload/base.rb
|
90
91
|
- lib/git-lfs-s3/services/upload/object_exists.rb
|
@@ -100,17 +101,17 @@ require_paths:
|
|
100
101
|
- lib
|
101
102
|
required_ruby_version: !ruby/object:Gem::Requirement
|
102
103
|
requirements:
|
103
|
-
- -
|
104
|
+
- - '>='
|
104
105
|
- !ruby/object:Gem::Version
|
105
106
|
version: '0'
|
106
107
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
108
|
requirements:
|
108
|
-
- -
|
109
|
+
- - '>='
|
109
110
|
- !ruby/object:Gem::Version
|
110
111
|
version: '0'
|
111
112
|
requirements: []
|
112
113
|
rubyforge_project:
|
113
|
-
rubygems_version: 2.
|
114
|
+
rubygems_version: 2.0.14
|
114
115
|
signing_key:
|
115
116
|
specification_version: 4
|
116
117
|
summary: LSST's Git LFS server that uses S3 for the storage backend by providing presigned
|