diff --git a/Caddyfile b/Caddyfile
index 2c16579..9f89473 100644
--- a/Caddyfile
+++ b/Caddyfile
@@ -12,4 +12,13 @@ http://localhost:8888 {
handle_path /admin/* {
reverse_proxy /* http://127.0.0.1:3000
}
-}
+
+
+ handle_path /faaso/hello/* {
+ reverse_proxy /* http://faaso-hello-8t3u59:3000 http://faaso-hello-5epnbg:3000 http://faaso-hello-zt5j6g:3000 {
+ health_uri /ping
+ fail_duration 30s
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/public/index.html b/public/index.html
index bbf614e..1b5cb94 100644
--- a/public/index.html
+++ b/public/index.html
@@ -23,9 +23,7 @@
diff --git a/src/daemon/funko.cr b/src/daemon/funko.cr
index 99f92a0..5f708c6 100644
--- a/src/daemon/funko.cr
+++ b/src/daemon/funko.cr
@@ -79,14 +79,14 @@ module Funko
get "/funkos/" do |env|
funkos = Funko.from_docker
funkos.sort! { |a, b| a.name <=> b.name }
- result = [] of Hash(String, String)
+ result = [] of Hash(String, String | Array(Docr::Types::ContainerSummary))
funkos.each do |funko|
result << {
- "name" => funko.name,
- "scale" => funko.scale.to_s,
- "containers" => funko.containers.size.to_s,
- "images" => funko.images.size.to_s,
+ "name" => funko.name,
+ "scale" => funko.scale.to_s,
+ "containers" => funko.containers,
+ "latest_image" => funko.latest_image,
}
end
diff --git a/src/funko.cr b/src/funko.cr
index b0003fd..543c6ef 100644
--- a/src/funko.cr
+++ b/src/funko.cr
@@ -178,8 +178,12 @@ module Funko
end
end
+ def latest_image
+ image_history.first
+ end
+
# Get all running containers related to this funko
- def containers
+ def containers : Array(Docr::Types::ContainerSummary)
docker_api = Docr::API.new(Docr::Client.new)
docker_api.containers.list(all: true).select { |container|
container.@names.any?(&.starts_with?("/faaso-#{name}-")) &&
diff --git a/src/views/funkos.ecr b/src/views/funkos.ecr
index 7491e99..62e399b 100644
--- a/src/views/funkos.ecr
+++ b/src/views/funkos.ecr
@@ -1,13 +1,42 @@
<%- result.each do |f| -%>
Name
- Scale
- Containers
- Images
+ Instances
Actions
ID | +Current? | +Actions | + + + <%- f["containers"].as(Array(Docr::Types::ContainerSummary)).each do |c| -%> +
---|---|---|
<%= c.@names[0].split("-")[-1] %> | ++ <%- if c.image_id == f["latest_image"] -%> + 🟢 + <%- else -%> + 🟢 + <%- end -%> + | ++ + + | +