Compare commits
No commits in common. "29d3c399ac0e12bb4d4e73d9db3aff06db15ab93" and "5cc0996ce0a983f60d02a4bbe18037eb86417c0d" have entirely different histories.
29d3c399ac
...
5cc0996ce0
14
Caddyfile
14
Caddyfile
@ -2,13 +2,23 @@
|
||||
http_port 8888
|
||||
https_port 8887
|
||||
local_certs
|
||||
admin off
|
||||
}
|
||||
|
||||
http://mindy:8888 {
|
||||
http://localhost:8888 {
|
||||
handle_path /admin/terminal/* {
|
||||
reverse_proxy /* http://127.0.0.1:7681
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -10,7 +10,7 @@ RUN shards build -d --error-trace
|
||||
RUN strip bin/*
|
||||
|
||||
FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine as ship
|
||||
RUN apk update && apk add caddy nss-tools multirun docker openssl zlib yaml pcre2 gc libevent libgcc libxml2 ttyd && apk cache clean
|
||||
RUN apk update && apk add caddy multirun docker openssl zlib yaml pcre2 gc libevent libgcc libxml2 ttyd && apk cache clean
|
||||
|
||||
# Unprivileged user
|
||||
RUN addgroup -S app && adduser app -S -G app
|
||||
|
2
Makefile
2
Makefile
@ -1,7 +1,7 @@
|
||||
build: shard.yml $(wildcard src/**/*cr)
|
||||
shards build
|
||||
proxy: build
|
||||
docker build . -t faaso-proxy
|
||||
docker build . -t faaso-proxy --no-cache
|
||||
start-proxy:
|
||||
docker run --name faaso-proxy-one --rm --network=faaso-net -v /var/run/docker.sock:/var/run/docker.sock -v secrets:/home/app/secrets -p 8888:8888 faaso-proxy
|
||||
|
||||
|
@ -125,16 +125,24 @@ module Funko
|
||||
end
|
||||
|
||||
# Return an iframe that shows the container's logs
|
||||
get "/funkos/terminal/logs/:instance/" do |env|
|
||||
instance = env.params.url["instance"]
|
||||
Terminal.start_terminal(["docker", "logs", "-f", instance])
|
||||
get "/funkos/:name/terminal/logs" do |env|
|
||||
name = env.params.url["name"]
|
||||
funko = Funko.from_names([name])[0]
|
||||
# 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>"
|
||||
end
|
||||
|
||||
# Get an iframe with a shell into the container
|
||||
get "/funkos/terminal/shell/:instance/" do |env|
|
||||
instance = env.params.url["instance"]
|
||||
Terminal.start_terminal(["docker", "exec", "-ti", instance, "/bin/sh"], readonly: false)
|
||||
get "/funkos/:name/terminal/shell" do |env|
|
||||
name = env.params.url["name"]
|
||||
funko = Funko.from_names([name])[0]
|
||||
# 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>"
|
||||
end
|
||||
|
||||
|
@ -13,7 +13,7 @@ require "uuid"
|
||||
basic_auth "admin", "admin"
|
||||
|
||||
get "/" do |env|
|
||||
env.redirect "/index.html"
|
||||
env.redirect "index.html"
|
||||
end
|
||||
|
||||
Kemal.run
|
||||
|
@ -26,9 +26,10 @@ module Proxy
|
||||
http_port 8888
|
||||
https_port 8887
|
||||
local_certs
|
||||
admin off
|
||||
}
|
||||
|
||||
http://mindy:8888 {
|
||||
http://localhost:8888 {
|
||||
handle_path /admin/terminal/* {
|
||||
reverse_proxy /* http://127.0.0.1:7681
|
||||
}
|
||||
@ -64,7 +65,7 @@ CONFIG
|
||||
file << config
|
||||
end
|
||||
# Reload config
|
||||
Process.run(command: "caddy", args: ["reload", "--config", "Caddyfile"])
|
||||
Process.run(command: "/usr/bin/killall", args: ["-USR1", "caddy"])
|
||||
@@current_config = config
|
||||
end
|
||||
config
|
||||
|
@ -23,8 +23,8 @@
|
||||
<%- end -%>
|
||||
</td>
|
||||
<td>
|
||||
<button hx-target="#terminal" hx-get="funkos/terminal/logs/<%= c.@names[0].lstrip("/") %>/">Logs</button>
|
||||
<button hx-target="#terminal" hx-get="funkos/terminal/shell/<%= c.@names[0].lstrip("/") %>/">Shell</button>
|
||||
<button hx-target="#terminal" hx-get="funkos/<%= f["name"] %>/terminal/logs/">Logs</button>
|
||||
<button hx-target="#terminal" hx-get="funkos/<%= f["name"] %>/terminal/shell/">Shell</button>
|
||||
</td>
|
||||
</tr>
|
||||
<%- end -%>
|
||||
|
Loading…
Reference in New Issue
Block a user