Compare commits

..

No commits in common. "4371444fa4d9ef859f7b765cf91439bd9baa1572" and "f87802142598176c520ca048b84e3db7be6c31a2" have entirely different histories.

8 changed files with 8 additions and 74 deletions

View File

@ -1,5 +1,5 @@
# This configuration file was generated by `ameba --gen-config`
# on 2024-07-01 18:57:31 UTC using Ameba version 1.6.1.
# on 2024-07-01 13:11:14 UTC using Ameba version 1.6.1.
# The point is for the user to remove these configuration records
# one by one as the reported problems are removed from the code base.
@ -10,9 +10,9 @@ Documentation/DocumentationAdmonition:
Timezone: UTC
Excluded:
- src/faaso.cr
- src/daemon/main.cr
- src/daemon/secrets.cr
- src/daemon.cr
- src/funko.cr
- src/daemon-secrets.cr
- spec/faaso_spec.cr
Admonitions:
- TODO

View File

@ -4,7 +4,7 @@ RUN addgroup -S app && adduser app -S -G app
WORKDIR /home/app
COPY shard.yml ./
RUN mkdir src/
COPY src/ src/
COPY src/* src/
RUN shards install
RUN shards build -d --error-trace
RUN strip bin/*
@ -16,9 +16,8 @@ RUN apk add tinyproxy multirun openssl zlib yaml pcre2 gc libevent libgcc libxml
RUN addgroup -S app && adduser app -S -G app
WORKDIR /home/app
RUN mkdir runtimes public
COPY runtimes/ runtimes/
COPY public/ public/
RUN mkdir runtimes
COPY runtimes/* ./runtimes/
COPY tinyproxy.conf ./
COPY --from=build /home/app/bin/faaso-daemon /home/app/bin/faaso /usr/bin/

View File

@ -1,25 +0,0 @@
<head>
<link rel="stylesheet" href="https://matcha.mizu.sh/matcha.css" />
<script src="https://unpkg.com/htmx.org@2.0.0"></script>
<body>
<script>
async function getFunkos() {
const response = await fetch("funkos/");
funkos = await response.json();
console.log(funkos);
}
getFunkos();
</script>
<button hx-get="funkos/?format=html" hx-target="#funko-list">Update</button>
<table>
<thead>
<tr>
<th>Name</th>
<th>Status</th>
<th>Action</th>
</tr>
<tbody id="funko-list">
</tbody>
</thead>
</body>
</head>

View File

@ -1,31 +0,0 @@
require "docr"
require "kemal"
module Funkos
struct Funko
include JSON::Serializable
property name : String
def initialize(@name : String)
end
end
get "/funkos/" do |env|
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 }
if env.params.query.fetch("format", "json") == "html"
render "src/views/funkos.ecr"
else
funkos.to_json
end
end
end

View File

@ -1,6 +1,5 @@
require "./funkos.cr"
require "./proxyconf.cr"
require "./secrets.cr"
require "./proxyconf.cr"
require "compress/gzip"
require "crystar"
require "docr"

View File

@ -1,4 +1,3 @@
require "docr"
require "kemal"
module Proxy
@ -30,7 +29,6 @@ module Proxy
funkos.sort!
config = %(
UserName nobody
Port 8888
Listen 0.0.0.0
Timeout 600

View File

@ -1,5 +0,0 @@
<%- funkos.each do |funko| -%>
<td><%= funko.name %></td>
<td>sarasa</td>
<td><button>DOSTUFF</button></td>
<%- end -%>

View File

@ -1,5 +1,4 @@
UserName nobody
Port 8888
Listen 0.0.0.0
Timeout 600
@ -7,4 +6,4 @@
ReverseOnly Yes
ReverseMagic Yes
ReversePath "/admin/" "http://127.0.0.1:3000/"
ReversePath "/faaso/hello/" "http://hello:3000/"