Beginnings of terminal support, but tinyproxy doesn't handle UPGRADE
This commit is contained in:
parent
3646cb1777
commit
0e55f6a2d9
@ -1,5 +1,5 @@
|
||||
FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine as build
|
||||
RUN apk add crystal shards yaml-dev openssl-dev zlib-dev libxml2-dev
|
||||
RUN apk update && apk add crystal shards yaml-dev openssl-dev zlib-dev libxml2-dev && apk cache clean
|
||||
RUN addgroup -S app && adduser app -S -G app
|
||||
WORKDIR /home/app
|
||||
COPY shard.yml ./
|
||||
@ -10,7 +10,7 @@ RUN shards build -d --error-trace
|
||||
RUN strip bin/*
|
||||
|
||||
FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine as ship
|
||||
RUN apk add tinyproxy multirun openssl zlib yaml pcre2 gc libevent libgcc libxml2
|
||||
RUN apk update && apk add tinyproxy multirun openssl zlib yaml pcre2 gc libevent libgcc libxml2 ttyd && apk cache clean
|
||||
|
||||
# Unprivileged user
|
||||
RUN addgroup -S app && adduser app -S -G app
|
||||
|
@ -1,6 +1,7 @@
|
||||
require "./funko.cr"
|
||||
require "./proxyconf.cr"
|
||||
require "./secrets.cr"
|
||||
require "./terminal.cr"
|
||||
require "compress/gzip"
|
||||
require "crystar"
|
||||
require "docr"
|
||||
|
@ -30,15 +30,16 @@ module Proxy
|
||||
funkos.sort!
|
||||
|
||||
config = %(
|
||||
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/"
|
||||
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"
|
||||
) + funkos.map { |funko| %(ReversePath "/faaso/#{funko.split("-")[0]}/" "http://#{funko}:3000/") }.join("\n")
|
||||
|
||||
if @@current_config != config
|
||||
|
20
src/daemon/terminal.cr
Normal file
20
src/daemon/terminal.cr
Normal file
@ -0,0 +1,20 @@
|
||||
module Terminal
|
||||
extend self
|
||||
|
||||
@@terminal_process : Process | Nil = nil
|
||||
|
||||
def start_terminal(_args = ["bash"], readonly = false)
|
||||
args = ["-p", "7681", "-c", "admin:admin", "-o"]
|
||||
args += ["-W"] unless readonly
|
||||
args += _args
|
||||
# We have a process there, kill it
|
||||
@@terminal_process.as(Process).terminate if !@@terminal_process.nil?
|
||||
@@terminal_process = Process.new(
|
||||
command: "/usr/bin/ttyd",
|
||||
args: args)
|
||||
Log.info {"Terminal started on port 7681"}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Terminal.start_terminal
|
@ -1,10 +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/"
|
||||
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/"
|
Loading…
Reference in New Issue
Block a user