From 4bb5ab631e8512f7e12f0461b350d353505ba7a0 Mon Sep 17 00:00:00 2001 From: Roberto Alsina Date: Sat, 29 Jun 2024 20:38:34 -0300 Subject: [PATCH] tweaks --- Dockerfile | 5 +++-- src/daemon.cr | 5 +++-- tinyproxy.conf | 7 +++++++ 3 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 tinyproxy.conf diff --git a/Dockerfile b/Dockerfile index 1bfe5f0..a9bad16 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,8 @@ COPY shard.yml ./ RUN mkdir src/ COPY src/* src/ RUN shards install -RUN shards build +RUN shards build -d --error-trace +RUN strip bin/faaso-daemon FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine as ship RUN apk add tinyproxy multirun openssl zlib yaml pcre2 gc libevent libgcc @@ -15,7 +16,7 @@ RUN apk add tinyproxy multirun openssl zlib yaml pcre2 gc libevent libgcc RUN addgroup -S app && adduser app -S -G app WORKDIR /home/app -COPY tinyproxy/tinyproxy.conf ./ +COPY tinyproxy.conf ./ COPY --from=build /home/app/bin/faaso-daemon ./ CMD ["/usr/bin/multirun", "./faaso-daemon", "tinyproxy -d -c tinyproxy.conf"] \ No newline at end of file diff --git a/src/daemon.cr b/src/daemon.cr index d4f88f9..11419e4 100644 --- a/src/daemon.cr +++ b/src/daemon.cr @@ -24,9 +24,10 @@ ReverseMagic Yes ReversePath "/admin/" "http://127.0.0.1:3000/" ) + funkos.map { |funko| %(ReversePath "/faaso/#{funko}/" "http://#{funko}:3000/") }.join("\n") - File.open("/etc/tinyproxy/tinyproxy.conf", "w") do |file| + File.open("tinyproxy.conf", "w") do |file| file << proxy_config - end + end + proxy_config end Kemal.run diff --git a/tinyproxy.conf b/tinyproxy.conf new file mode 100644 index 0000000..7fd78fd --- /dev/null +++ b/tinyproxy.conf @@ -0,0 +1,7 @@ +Port 8888 +Listen 0.0.0.0 +Timeout 600 +Allow 0.0.0.0/0 +ReverseOnly Yes +ReverseMagic Yes +ReversePath "/admin/" "http://127.0.0.1:3000/"