Per-instance shell/logs
This commit is contained in:
parent
8637c3a4cf
commit
29d3c399ac
@ -125,24 +125,16 @@ module Funko
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Return an iframe that shows the container's logs
|
# Return an iframe that shows the container's logs
|
||||||
get "/funkos/:name/terminal/logs" do |env|
|
get "/funkos/terminal/logs/:instance/" do |env|
|
||||||
name = env.params.url["name"]
|
instance = env.params.url["instance"]
|
||||||
funko = Funko.from_names([name])[0]
|
Terminal.start_terminal(["docker", "logs", "-f", instance])
|
||||||
# FIXME: Just getting the 1st one for now, it
|
|
||||||
# may not even be running
|
|
||||||
container_name = funko.containers.map { |c| c.@names[0] }[0]
|
|
||||||
Terminal.start_terminal(["docker", "logs", "-f", container_name.to_s])
|
|
||||||
"<iframe src='terminal/' width='100%' height='100%'></iframe>"
|
"<iframe src='terminal/' width='100%' height='100%'></iframe>"
|
||||||
end
|
end
|
||||||
|
|
||||||
# Get an iframe with a shell into the container
|
# Get an iframe with a shell into the container
|
||||||
get "/funkos/:name/terminal/shell" do |env|
|
get "/funkos/terminal/shell/:instance/" do |env|
|
||||||
name = env.params.url["name"]
|
instance = env.params.url["instance"]
|
||||||
funko = Funko.from_names([name])[0]
|
Terminal.start_terminal(["docker", "exec", "-ti", instance, "/bin/sh"], readonly: false)
|
||||||
# FIXME: Just getting the 1st one for now, it
|
|
||||||
# may not even be running
|
|
||||||
container_name = funko.containers.map { |c| c.@names[0] }[0].lstrip("/")
|
|
||||||
Terminal.start_terminal(["docker", "exec", "-ti", container_name, "/bin/sh"], readonly: false)
|
|
||||||
"<iframe src='terminal/' width='100%' height='100%'></iframe>"
|
"<iframe src='terminal/' width='100%' height='100%'></iframe>"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ require "uuid"
|
|||||||
basic_auth "admin", "admin"
|
basic_auth "admin", "admin"
|
||||||
|
|
||||||
get "/" do |env|
|
get "/" do |env|
|
||||||
env.redirect "index.html"
|
env.redirect "/index.html"
|
||||||
end
|
end
|
||||||
|
|
||||||
Kemal.run
|
Kemal.run
|
||||||
|
@ -23,8 +23,8 @@
|
|||||||
<%- end -%>
|
<%- end -%>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button hx-target="#terminal" hx-get="funkos/<%= f["name"] %>/terminal/logs/">Logs</button>
|
<button hx-target="#terminal" hx-get="funkos/terminal/logs/<%= c.@names[0].lstrip("/") %>/">Logs</button>
|
||||||
<button hx-target="#terminal" hx-get="funkos/<%= f["name"] %>/terminal/shell/">Shell</button>
|
<button hx-target="#terminal" hx-get="funkos/terminal/shell/<%= c.@names[0].lstrip("/") %>/">Shell</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<%- end -%>
|
<%- end -%>
|
||||||
|
Loading…
Reference in New Issue
Block a user