More reorg
This commit is contained in:
parent
5961f8b0a1
commit
baf60a1bf7
@ -1,5 +1,5 @@
|
|||||||
# This configuration file was generated by `ameba --gen-config`
|
# This configuration file was generated by `ameba --gen-config`
|
||||||
# on 2024-07-01 13:11:14 UTC using Ameba version 1.6.1.
|
# on 2024-07-01 18:57:31 UTC using Ameba version 1.6.1.
|
||||||
# The point is for the user to remove these configuration records
|
# The point is for the user to remove these configuration records
|
||||||
# one by one as the reported problems are removed from the code base.
|
# one by one as the reported problems are removed from the code base.
|
||||||
|
|
||||||
@ -10,9 +10,9 @@ Documentation/DocumentationAdmonition:
|
|||||||
Timezone: UTC
|
Timezone: UTC
|
||||||
Excluded:
|
Excluded:
|
||||||
- src/faaso.cr
|
- src/faaso.cr
|
||||||
- src/daemon.cr
|
- src/daemon/main.cr
|
||||||
|
- src/daemon/secrets.cr
|
||||||
- src/funko.cr
|
- src/funko.cr
|
||||||
- src/daemon-secrets.cr
|
|
||||||
- spec/faaso_spec.cr
|
- spec/faaso_spec.cr
|
||||||
Admonitions:
|
Admonitions:
|
||||||
- TODO
|
- TODO
|
||||||
|
@ -4,7 +4,7 @@ RUN addgroup -S app && adduser app -S -G app
|
|||||||
WORKDIR /home/app
|
WORKDIR /home/app
|
||||||
COPY shard.yml ./
|
COPY shard.yml ./
|
||||||
RUN mkdir src/
|
RUN mkdir src/
|
||||||
COPY src/* src/
|
COPY src/ src/
|
||||||
RUN shards install
|
RUN shards install
|
||||||
RUN shards build -d --error-trace
|
RUN shards build -d --error-trace
|
||||||
RUN strip bin/*
|
RUN strip bin/*
|
||||||
@ -16,8 +16,9 @@ RUN apk add tinyproxy multirun openssl zlib yaml pcre2 gc libevent libgcc libxml
|
|||||||
RUN addgroup -S app && adduser app -S -G app
|
RUN addgroup -S app && adduser app -S -G app
|
||||||
WORKDIR /home/app
|
WORKDIR /home/app
|
||||||
|
|
||||||
RUN mkdir runtimes
|
RUN mkdir runtimes public
|
||||||
COPY runtimes/* ./runtimes/
|
COPY runtimes/ runtimes/
|
||||||
|
COPY public/ public/
|
||||||
COPY tinyproxy.conf ./
|
COPY tinyproxy.conf ./
|
||||||
COPY --from=build /home/app/bin/faaso-daemon /home/app/bin/faaso /usr/bin/
|
COPY --from=build /home/app/bin/faaso-daemon /home/app/bin/faaso /usr/bin/
|
||||||
|
|
||||||
|
34
public/index.html
Normal file
34
public/index.html
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<head>
|
||||||
|
<script src="https://cdn.jsdelivr.net/gh/vanjs-org/van/public/van-1.5.0.nomodule.min.js"></script>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
const { a, div, li, p, ul, span, button } = van.tags;
|
||||||
|
|
||||||
|
const funkos = van.state([]);
|
||||||
|
const funko_list = () => {
|
||||||
|
console.log("derived");
|
||||||
|
return div(
|
||||||
|
p("hello"),
|
||||||
|
ul(
|
||||||
|
...funkos.val.map((funko) => {
|
||||||
|
return li(funko);
|
||||||
|
})
|
||||||
|
)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
async function getFunkos() {
|
||||||
|
for (;;) {
|
||||||
|
const response = await fetch("funkos/");
|
||||||
|
funkos.val = await response.json();
|
||||||
|
console.log(funkos.val);
|
||||||
|
await new Promise((r) => setTimeout(r, 5000));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
van.add(document.body, funko_list());
|
||||||
|
|
||||||
|
getFunkos();
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</head>
|
26
src/daemon/funkos.cr
Normal file
26
src/daemon/funkos.cr
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
require "docr"
|
||||||
|
require "kemal"
|
||||||
|
|
||||||
|
module Funkos
|
||||||
|
struct Funko
|
||||||
|
include JSON::Serializable
|
||||||
|
property name : String
|
||||||
|
|
||||||
|
def initialize(@name : String)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
get "/funkos/" do |_|
|
||||||
|
docker_api = Docr::API.new(Docr::Client.new)
|
||||||
|
containers = docker_api.containers.list(all: true)
|
||||||
|
|
||||||
|
funkos = [] of Funko
|
||||||
|
containers.each { |container|
|
||||||
|
names = container.names.select &.starts_with? "/faaso-"
|
||||||
|
next if names.empty?
|
||||||
|
funkos << Funko.new(name: names[0][7..])
|
||||||
|
}
|
||||||
|
funkos.sort! { |a, b| a.name <=> b.name}
|
||||||
|
funkos.to_json
|
||||||
|
end
|
||||||
|
end
|
@ -1,5 +1,6 @@
|
|||||||
require "./secrets.cr"
|
require "./funkos.cr"
|
||||||
require "./proxyconf.cr"
|
require "./proxyconf.cr"
|
||||||
|
require "./secrets.cr"
|
||||||
require "compress/gzip"
|
require "compress/gzip"
|
||||||
require "crystar"
|
require "crystar"
|
||||||
require "docr"
|
require "docr"
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
UserName nobody
|
|
||||||
Port 8888
|
UserName nobody
|
||||||
Listen 0.0.0.0
|
Port 8888
|
||||||
Timeout 600
|
Listen 0.0.0.0
|
||||||
Allow 0.0.0.0/0
|
Timeout 600
|
||||||
ReverseOnly Yes
|
Allow 0.0.0.0/0
|
||||||
ReverseMagic Yes
|
ReverseOnly Yes
|
||||||
ReversePath "/admin/" "http://127.0.0.1:3000/"
|
ReverseMagic Yes
|
||||||
ReversePath "/faaso/hello/" "http://hello:3000/"
|
ReversePath "/admin/" "http://127.0.0.1:3000/"
|
||||||
|
ReversePath "/faaso/hello/" "http://hello:3000/"
|
Loading…
Reference in New Issue
Block a user