firespring_dev_commands 2.1.27.pre.alpha.1 → 2.1.27.pre.alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/firespring_dev_commands/certificate.rb +1 -1
- data/lib/firespring_dev_commands/docker.rb +1 -1
- data/lib/firespring_dev_commands/platform.rb +25 -32
- data/lib/firespring_dev_commands/templates/certificate.rb +5 -5
- data/lib/firespring_dev_commands/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fce5da47cf928179b220c2d30c295fb5c853aee03ca1cad7bbf9684f8b8aea3a
|
4
|
+
data.tar.gz: 33100d5b2127c7cb422f6695e19e85b3f8bfe41d0dd13f7f0ab4f4721351286b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb735b569248c55a15bd51bb971054107ea1d885fb08e4a2da43bafdc3093b86daf00c42962fcb0ce4aeb543e76afff8ca06be4359bbbd4c489dc83c09d46bc6
|
7
|
+
data.tar.gz: 4e43a5eee15f6dbbbeab27c006a0dbdb1802be2c882008627b4d1025f99e72a52d3855c8121eba967b21fba4f766daf1e2f0e90e11bb06ab32f7c6e110f86d7e
|
@@ -43,7 +43,7 @@ module Dev
|
|
43
43
|
def save(dest_dir)
|
44
44
|
raise "directory #{dest_dir} must be an existing directory" unless File.directory?(dest_dir)
|
45
45
|
|
46
|
-
domain = domains.first.sub(/^\*\./, '')
|
46
|
+
domain = domains.first.sub(/^\*\./, '') # Need to strip off the '*.' if this is a wildcard cert
|
47
47
|
directories = Dir.glob("/etc/letsencrypt/live/#{domain}*/")
|
48
48
|
no_suffix = directories.delete("/etc/letsencrypt/live/#{domain}/")
|
49
49
|
biggest_suffix = directories.max
|
@@ -144,7 +144,7 @@ module Dev
|
|
144
144
|
puts "\nPulling #{name}:#{tag}"
|
145
145
|
opts = {
|
146
146
|
fromImage: "#{name}:#{tag}",
|
147
|
-
platform: Dev::
|
147
|
+
platform: Dev::Platform.new.architecture
|
148
148
|
}
|
149
149
|
::Docker::Image.create(**opts) { |response| Dev::Docker::Status.new.response_callback(response) }
|
150
150
|
end
|
@@ -1,40 +1,33 @@
|
|
1
1
|
module Dev
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
ALLOWED_ARCHITECTURES = %w(arm64 amd64).freeze
|
2
|
+
# Class which returns information about the current platform
|
3
|
+
class Platform
|
4
|
+
# Constant containing all supported architectures
|
5
|
+
ALLOWED_ARCHITECTURES = %w(linux/arm64 linux/amd64).freeze
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
'linux/amd64' # 64-bit Intel/AMD architecture
|
13
|
-
when /arm|aarch64/
|
14
|
-
'linux/arm64' # ARM architecture
|
15
|
-
else
|
16
|
-
raise 'Unknown or unsupported architecture'
|
17
|
-
end
|
18
|
-
end
|
7
|
+
# If an architecture was specified in the ENV, use that. Otherwise auto-deted based of the OS reported architecture
|
8
|
+
def architecture
|
9
|
+
arch = env_architecture || os_architecture
|
10
|
+
raise "Invalid DOCKER_ARCHITECTURE: #{arch} (allowed are #{ALLOWED_ARCHITECTURES.join(', ')})" unless ALLOWED_ARCHITECTURES.include?(arch)
|
19
11
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
12
|
+
arch
|
13
|
+
end
|
14
|
+
|
15
|
+
# Check to see if a docker architecture has been specified in the ENV
|
16
|
+
# If it has, verify the format and the value
|
17
|
+
private def env_architecture
|
18
|
+
arch = ENV['DOCKER_ARCHITECTURE'].to_s.strip.downcase
|
19
|
+
return nil if arch.empty?
|
20
|
+
|
21
|
+
"linux/#{arch}" unless arch.start_with?('linux/')
|
22
|
+
arch
|
23
|
+
end
|
29
24
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
25
|
+
# Returns a valid docker architecture based off the RUBY_PLATFORM
|
26
|
+
private def os_architecture
|
27
|
+
return 'linux/amd64' if RUBY_PLATFORM.match?(/x86_64|amd64|x64-mingw/)
|
28
|
+
return 'linux/arm64' if RUBY_PLATFORM.match?(/arm|aarch64/)
|
34
29
|
|
35
|
-
|
36
|
-
end
|
37
|
-
end
|
30
|
+
raise 'Unknown or unsupported architecture'
|
38
31
|
end
|
39
32
|
end
|
40
33
|
end
|
@@ -4,10 +4,10 @@ module Dev
|
|
4
4
|
module Template
|
5
5
|
# Class contains rake templates for managing configured certificates
|
6
6
|
class Certificate < Dev::Template::BaseInterface
|
7
|
-
attr_reader :
|
7
|
+
attr_reader :domains, :email, :paths
|
8
8
|
|
9
|
-
def initialize(
|
10
|
-
@
|
9
|
+
def initialize(domains, email:, paths:, exclude: [])
|
10
|
+
@domains = domains
|
11
11
|
@email = email
|
12
12
|
@paths = Array(paths)
|
13
13
|
|
@@ -17,7 +17,7 @@ module Dev
|
|
17
17
|
# Create the rake task for the generate method
|
18
18
|
def create_generate_task!
|
19
19
|
# Have to set a local variable to be accessible inside of the instance_eval block
|
20
|
-
|
20
|
+
domains = @domains
|
21
21
|
email = @email
|
22
22
|
paths = @paths
|
23
23
|
exclude = @exclude
|
@@ -29,7 +29,7 @@ module Dev
|
|
29
29
|
desc 'Requests a new certificate for the configured domain using the route53 validation and deposits it in the configured paths'
|
30
30
|
task generate: %w(init_docker ensure_aws_credentials) do
|
31
31
|
Dev::Docker.new.pull_image('certbot/dns-route53', 'latest')
|
32
|
-
c = Dev::Certificate.new(
|
32
|
+
c = Dev::Certificate.new(domains, email)
|
33
33
|
c.request
|
34
34
|
paths.each { |path| c.save(path) }
|
35
35
|
end
|