Compare commits

...

2 Commits

Author SHA1 Message Date
2c513b34c8 Move Caddyfile into config/ 2024-07-06 11:57:30 -03:00
d6e8a6013a todo management 2024-07-06 11:57:18 -03:00
6 changed files with 29 additions and 22 deletions

View File

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

View File

@ -5,7 +5,14 @@ build: shard.yml $(wildcard src/**/*) $(runtimes/**/*)
proxy: build
docker build . -t faaso-proxy
start-proxy:
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
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 \
-v ${PWD}/config:/home/app/config \
-p 8888:8888 faaso-proxy
.PHONY: build proxy-image start-proxy

View File

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

View File

@ -6,7 +6,7 @@
http://*:8888 {
basicauth /admin/* {
admin {$FAASO_PASSWORD}
admin {$HTTP_BASIC_AUTH_PASSWORD}
}
handle_path /admin/terminal/* {
@ -15,4 +15,13 @@ http://*:8888 {
handle_path /admin/* {
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

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

View File

@ -1,12 +0,0 @@
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/"