Compare commits
3 Commits
eb6d63a533
...
ead5cfdcc6
Author | SHA1 | Date | |
---|---|---|---|
ead5cfdcc6 | |||
35283a0aea | |||
496230c4d3 |
@ -91,7 +91,8 @@ module Funko
|
|||||||
end
|
end
|
||||||
|
|
||||||
if env.params.query.fetch("format", "json") == "html"
|
if env.params.query.fetch("format", "json") == "html"
|
||||||
render "src/views/funkos.ecr" else
|
render "src/views/funkos.ecr"
|
||||||
|
else
|
||||||
result.to_json
|
result.to_json
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
require "./funko.cr"
|
require "./funko.cr"
|
||||||
require "./proxyconf.cr"
|
require "./proxy.cr"
|
||||||
require "./secrets.cr"
|
require "./secrets.cr"
|
||||||
require "./terminal.cr"
|
require "./terminal.cr"
|
||||||
require "compress/gzip"
|
require "compress/gzip"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
require "docr"
|
require "docr"
|
||||||
require "funko"
|
require "./funko.cr"
|
||||||
require "kemal"
|
require "kemal"
|
||||||
|
|
||||||
module Proxy
|
module Proxy
|
16
src/funko.cr
16
src/funko.cr
@ -178,11 +178,12 @@ module Funko
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Get all containers related to this funko
|
# Get all running containers related to this funko
|
||||||
def containers
|
def containers
|
||||||
docker_api = Docr::API.new(Docr::Client.new)
|
docker_api = Docr::API.new(Docr::Client.new)
|
||||||
docker_api.containers.list(all: true).select { |container|
|
docker_api.containers.list(all: true).select { |container|
|
||||||
container.@names.any?(&.starts_with?("/faaso-#{name}-"))
|
container.@names.any?(&.starts_with?("/faaso-#{name}-")) &&
|
||||||
|
container.@state == "running"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -206,17 +207,6 @@ module Funko
|
|||||||
end
|
end
|
||||||
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`
|
# Wait up to `t` seconds for the funko to reach the requested `state`
|
||||||
def wait_for(new_scale : Int, t)
|
def wait_for(new_scale : Int, t)
|
||||||
channel = Channel(Nil).new
|
channel = Channel(Nil).new
|
||||||
|
Loading…
Reference in New Issue
Block a user