Compare commits

..

No commits in common. "2c513b34c8f61203a35db581e721a6543d6a66b8" and "f828268cbac928206636a0bdf22a9a6e67cc0098" have entirely different histories.

6 changed files with 22 additions and 29 deletions

View File

@ -6,7 +6,7 @@
http://*:8888 { http://*:8888 {
basicauth /admin/* { basicauth /admin/* {
admin {$HTTP_BASIC_AUTH_PASSWORD} admin {$FAASO_PASSWORD}
} }
handle_path /admin/terminal/* { handle_path /admin/terminal/* {
@ -15,13 +15,4 @@ http://*:8888 {
handle_path /admin/* { handle_path /admin/* {
reverse_proxy /* http://127.0.0.1:3000 reverse_proxy /* http://127.0.0.1:3000
} }
handle_path /faaso/myfunko/* {
reverse_proxy /* http://faaso-myfunko-kyfo2v:3000 {
health_uri /ping
fail_duration 30s
}
}
} }

View File

@ -17,11 +17,12 @@ RUN addgroup -S app && adduser app -S -G app
WORKDIR /home/app WORKDIR /home/app
RUN mkdir /home/app/tmp && chown app /home/app/tmp RUN mkdir /home/app/tmp && chown app /home/app/tmp
RUN mkdir runtimes public
COPY public/ public/ COPY public/ public/
COPY Caddyfile ./
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/
# Mount points for persistent data
RUN mkdir /secrets RUN mkdir /secrets
RUN mkdir /config
CMD ["/usr/bin/multirun", "-v", "faaso-daemon", "caddy run --config config/Caddyfile"] CMD ["/usr/bin/multirun", "-v", "faaso-daemon", "caddy run --config Caddyfile"]

View File

@ -5,14 +5,7 @@ build: shard.yml $(wildcard src/**/*) $(runtimes/**/*)
proxy: build proxy: build
docker build . -t faaso-proxy docker build . -t faaso-proxy
start-proxy: start-proxy:
docker run --name faaso-proxy-one \ docker run --name faaso-proxy-one --rm --network=faaso-net --env-file=proxy.env -e FAASO_SECRET_PATH=${PWD}/secrets -v /var/run/docker.sock:/var/run/docker.sock -v ${PWD}/secrets:/home/app/secrets -p 8888:8888 faaso-proxy
--rm --network=faaso-net \
--env-file=proxy.env \
-e FAASO_SECRET_PATH=${PWD}/secrets \
-v /var/run/docker.sock:/var/run/docker.sock \
-v ${PWD}/secrets:/home/app/secrets \
-v ${PWD}/config:/home/app/config \
-p 8888:8888 faaso-proxy
.PHONY: build proxy-image start-proxy .PHONY: build proxy-image start-proxy

View File

@ -3,8 +3,6 @@
* User flow for initial proxy setup * User flow for initial proxy setup
* Setting up password * Setting up password
* Setting up hostname for Caddy's automatic HTTPS * Setting up hostname for Caddy's automatic HTTPS
* Config UI in frontend?
* Version checks for consistency between client/server
* Have 3 runtimes: * Have 3 runtimes:
* Crystal + Kemal ✅ * Crystal + Kemal ✅
* Python + Flask [WIP] * Python + Flask [WIP]
@ -17,4 +15,4 @@
* Sanitize all inputs * Sanitize all inputs
* Streaming responses in slow operations * Streaming responses in slow operations
like scaling down or building like scaling down or building
* Make more things configurable / remove hardcoded stuff

View File

@ -2,10 +2,8 @@ require "docr"
require "./funko.cr" require "./funko.cr"
require "kemal" require "kemal"
module Proxy module Proxy
CADDY_CONFIG_PATH = "config/Caddyfile" @@current_config = File.read("Caddyfile")
@@current_config = File.read(CADDY_CONFIG_PATH)
# Get current proxy config # Get current proxy config
get "/proxy/" do get "/proxy/" do
@ -66,7 +64,7 @@ CONFIG
if @@current_config != config if @@current_config != config
Log.info { "Updating proxy config" } Log.info { "Updating proxy config" }
File.open(CADDY_CONFIG_PATH, "w") do |file| File.open("Caddyfile", "w") do |file|
file << config file << config
end end
# Reload config # Reload config

12
tinyproxy.conf Normal file
View File

@ -0,0 +1,12 @@
User nobody
Group nogroup
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/"
ReversePath "/admin/terminal" "http://127.0.0.1:7681"
ReversePath "/faaso/hello/" "http://hello-d89veq:3000/"