docker-registry-sync 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/docker/registry/sync.rb +20 -0
- data/lib/docker/registry/sync/cmd.rb +3 -2
- data/lib/docker/registry/sync/s3.rb +4 -1
- data/lib/docker/registry/sync/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YjY2MmVkODljYzQzMWNmZDRjNmM3MWY5MTVkN2M1YjE4YjU5MDVlMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YmU4NjBiMDUwZDc4NWZhMDc1NTc2ZjgzODMzYzExMTM5MmIzZDhlYQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YTk1NmVkYzUwY2YxZDJlZDUzMjIyMWExMDcyM2I0MjhiYzJkYzM2YjhkM2U4
|
10
|
+
YWM3NGViZDk5MWNlOWYxZmRjYWVmYjQ4N2RlZjJjY2E5YjU0YWMyYjIzYjkz
|
11
|
+
YzZjY2MyZjhkODVhNzcwNjcyYWRjOGIwZGNmZmU0NjcyODU1N2E=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZGMyZDI5YmE4YTZiNTc1NzliYThjOWNjYTYxMDJmMGYyNjA1YWZmYzM0M2Y1
|
14
|
+
MjdhZDQ3MGI1ODRlODM3OTkwNTdhZjFkMWM3ZmU4NjRjYWZjNWE1MTM0ZGRh
|
15
|
+
YzA1NTJkN2Y1ZTViZDRlN2MyNzZkMjA5MzNhYjFjZmJkNjdkNzg=
|
data/lib/docker/registry/sync.rb
CHANGED
@@ -12,6 +12,26 @@ module Docker
|
|
12
12
|
self.config ||= Docker::Registry::Sync::Configuration.new
|
13
13
|
yield self.config
|
14
14
|
end
|
15
|
+
|
16
|
+
class RingBuffer < Array
|
17
|
+
attr_reader :max_size
|
18
|
+
|
19
|
+
def initialize(max_size, enum = nil)
|
20
|
+
@max_size = max_size
|
21
|
+
enum.each { |e| self << e } if enum
|
22
|
+
end
|
23
|
+
|
24
|
+
def <<(el)
|
25
|
+
if self.size < @max_size || @max_size.nil?
|
26
|
+
super
|
27
|
+
else
|
28
|
+
self.shift
|
29
|
+
self.push(el)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
alias :push :<<
|
34
|
+
end
|
15
35
|
end
|
16
36
|
end
|
17
37
|
end
|
@@ -30,6 +30,8 @@ module Docker
|
|
30
30
|
sqs_region, sqs_uri = nil, nil
|
31
31
|
end
|
32
32
|
|
33
|
+
@synced_images = RingBuffer.new 5000
|
34
|
+
|
33
35
|
Docker::Registry::Sync.configure do |config|
|
34
36
|
config.source_bucket = source_bucket
|
35
37
|
config.source_region = source_region
|
@@ -135,8 +137,7 @@ module Docker
|
|
135
137
|
resp = sqs.receive_message(
|
136
138
|
queue_url: @config.sqs_url,
|
137
139
|
max_number_of_messages: 1,
|
138
|
-
|
139
|
-
visibility_timeout: 30, # Give ourselves 15min to sync the image
|
140
|
+
visibility_timeout: 900, # Give ourselves 15min to sync the image
|
140
141
|
wait_time_seconds: 10, # Wait a maximum of 10s for a new message
|
141
142
|
)
|
142
143
|
@config.logger.info "SQS returned #{resp.messages.length} new images to sync..."
|
@@ -75,7 +75,10 @@ module Docker
|
|
75
75
|
ancestry_resp = s3_source.get_object(bucket: source_bucket, key: "registry/images/#{image_id}/ancestry")
|
76
76
|
# Ancestry includes self
|
77
77
|
JSON.load(ancestry_resp.body.read).each do |image|
|
78
|
-
|
78
|
+
unless @synced_images.include? image
|
79
|
+
sync_prefix(s3_source, s3_target, bucket, sse, "registry/images/#{image}/", source_bucket)
|
80
|
+
@synced_images << image
|
81
|
+
end
|
79
82
|
end
|
80
83
|
end
|
81
84
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: docker-registry-sync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Oldfield
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|