harbr 0.1.99 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/harbr +33 -0
- data/lib/harbr/version.rb +1 -1
- data/lib/harbr.rb +0 -4
- 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: 46c7ecffea48ede3af2a8ec861789af5fd25db85ce788220a904b8bb99c0b8c9
|
4
|
+
data.tar.gz: a8f7121f6a306b30440e20566580695e4313d27357baa2f15d5cccd7dd1b4e57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fe1698d6e251800ce45aa4125febba459c3b5f69a89e5f124a9b9519d6bcb3e68f1a760cc32e41ff2da890122c12affb9964b23bb77ef82495dfca1d967e538
|
7
|
+
data.tar.gz: 076feb114f3323ba74c8ae421f6c006e8a09c6632660cdcbb04bde5020d2c53c93929aba6404c02c54206bbcf9c402ca3ccff44cabe784ec1814018b3baa970f
|
data/exe/harbr
CHANGED
@@ -48,6 +48,39 @@ class HarbrCLI < Thor
|
|
48
48
|
system("sudo apt install #{package}") or raise "Failed to install #{package}"
|
49
49
|
end
|
50
50
|
|
51
|
+
def create_traefik_config(containers)
|
52
|
+
config = {
|
53
|
+
"http" => {
|
54
|
+
"routers" => {},
|
55
|
+
"services" => {}
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
containers.each do |container|
|
60
|
+
container.ip = "127.0.0.1"
|
61
|
+
name = container.name.tr(".", "-")
|
62
|
+
|
63
|
+
router_key = "#{name}-router-secure"
|
64
|
+
config["http"]["routers"][router_key] = {
|
65
|
+
"rule" => "Host(`#{container.host_header}`)",
|
66
|
+
"service" => "#{name}-service",
|
67
|
+
"entryPoints" => ["https"],
|
68
|
+
"tls" => {
|
69
|
+
"certResolver" => "myresolver"
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
config["http"]["services"]["#{name}-service"] = {
|
74
|
+
"loadBalancer" => {
|
75
|
+
"servers" => [{"url" => "http://#{container.ip}:#{container.port}"}]
|
76
|
+
}
|
77
|
+
}
|
78
|
+
end
|
79
|
+
|
80
|
+
File.write("/etc/traefik/harbr.toml", TomlRB.dump(config))
|
81
|
+
puts "Traefik configuration written to /etc/traefik/harbr.toml"
|
82
|
+
end
|
83
|
+
|
51
84
|
end
|
52
85
|
|
53
86
|
desc "destroy", "Destroy a container and remove all traces"
|
data/lib/harbr/version.rb
CHANGED
data/lib/harbr.rb
CHANGED