Compare commits
No commits in common. "ead5cfdcc642bb60ab1b00fb22e536f13ed62311" and "eb6d63a5336934f3c0ded0e7cc866e684344574f" have entirely different histories.
ead5cfdcc6
...
eb6d63a533
@ -91,8 +91,7 @@ module Funko
|
||||
end
|
||||
|
||||
if env.params.query.fetch("format", "json") == "html"
|
||||
render "src/views/funkos.ecr"
|
||||
else
|
||||
render "src/views/funkos.ecr" else
|
||||
result.to_json
|
||||
end
|
||||
end
|
||||
|
@ -1,5 +1,5 @@
|
||||
require "./funko.cr"
|
||||
require "./proxy.cr"
|
||||
require "./proxyconf.cr"
|
||||
require "./secrets.cr"
|
||||
require "./terminal.cr"
|
||||
require "compress/gzip"
|
||||
|
@ -1,5 +1,5 @@
|
||||
require "docr"
|
||||
require "./funko.cr"
|
||||
require "funko"
|
||||
require "kemal"
|
||||
|
||||
module Proxy
|
16
src/funko.cr
16
src/funko.cr
@ -178,12 +178,11 @@ module Funko
|
||||
end
|
||||
end
|
||||
|
||||
# Get all running containers related to this funko
|
||||
# Get all containers related to this funko
|
||||
def containers
|
||||
docker_api = Docr::API.new(Docr::Client.new)
|
||||
docker_api.containers.list(all: true).select { |container|
|
||||
container.@names.any?(&.starts_with?("/faaso-#{name}-")) &&
|
||||
container.@state == "running"
|
||||
container.@names.any?(&.starts_with?("/faaso-#{name}-"))
|
||||
}
|
||||
end
|
||||
|
||||
@ -207,6 +206,17 @@ module Funko
|
||||
end
|
||||
end
|
||||
|
||||
# Stop container with the newer image
|
||||
def stop
|
||||
docker_api = Docr::API.new(Docr::Client.new)
|
||||
images = self.image_history
|
||||
containers = self.containers.sort! { |i, j|
|
||||
(images.index(j.@image_id) || 9999) <=> (images.index(i.@image_id) || 9999)
|
||||
}
|
||||
return docker_api.containers.stop(containers[0].@id) unless containers.empty?
|
||||
nil
|
||||
end
|
||||
|
||||
# Wait up to `t` seconds for the funko to reach the requested `state`
|
||||
def wait_for(new_scale : Int, t)
|
||||
channel = Channel(Nil).new
|
||||
|
Loading…
Reference in New Issue
Block a user