Multiplex http and ssh ports

This commit is contained in:
Tom Wiesing 2023-03-08 11:27:19 +01:00
parent 668f1dd193
commit f0073a649f
No known key found for this signature in database
20 changed files with 188 additions and 29 deletions

View file

@ -82,7 +82,7 @@ func (ssh2 *SSH2) handleConnection(session ssh.Session) {
{"${SLUG}", slug},
{"${DOMAIN}", ssh2.Config.HTTP.PrimaryDomain},
{"${HOSTNAME}", slug + "." + ssh2.Config.HTTP.PrimaryDomain},
{"${PORT}", strconv.FormatUint(uint64(ssh2.Config.PublicSSHPort), 10)},
{"${PORT}", strconv.FormatUint(uint64(ssh2.Config.Listen.AdvertisedSSHPort), 10)},
} {
banner = strings.ReplaceAll(banner, oldnew[0], oldnew[1])
}

View file

@ -6,5 +6,3 @@ SELF_OVERRIDES_FILE=${SELF_OVERRIDES_FILE}
SELF_RESOLVER_BLOCK_FILE=${SELF_RESOLVER_BLOCK_FILE}
DOCKER_NETWORK_NAME=${DOCKER_NETWORK_NAME}
HTTPS_ENABLED=${HTTPS_ENABLED}
SSH_PORT=${SSH_PORT}

View file

@ -1,13 +1,12 @@
version: "3.7"
services:
dis:
ssh:
read_only: true
build: .
restart: always
environment:
CONFIG_PATH: ${CONFIG_PATH}
ports:
- "${SSH_PORT}:2222"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- "${CONFIG_PATH}:${CONFIG_PATH}:ro"

View file

@ -3,7 +3,6 @@ package ssh2
import (
"embed"
"path/filepath"
"strconv"
"github.com/FAU-CDI/wisski-distillery/internal/bootstrap"
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
@ -17,7 +16,7 @@ func (ssh SSH2) Path() string {
var resources embed.FS
func (ssh *SSH2) Stack() component.StackWithResources {
stt := component.MakeStack(ssh, component.StackWithResources{
return component.MakeStack(ssh, component.StackWithResources{
Resources: resources,
ContextPath: "ssh2",
EnvPath: "ssh2.env",
@ -25,20 +24,16 @@ func (ssh *SSH2) Stack() component.StackWithResources {
EnvContext: map[string]string{
"DOCKER_NETWORK_NAME": ssh.Config.Docker.Network,
"HOST_RULE": ssh.Config.HTTP.DefaultHostRule(),
"HTTPS_ENABLED": ssh.Config.HTTP.HTTPSEnabledEnv(),
"CONFIG_PATH": ssh.Config.ConfigPath,
"DEPLOY_ROOT": ssh.Config.Paths.Root,
"SELF_OVERRIDES_FILE": ssh.Config.Paths.OverridesJSON,
"SELF_RESOLVER_BLOCK_FILE": ssh.Config.Paths.ResolverBlocks,
"SSH_PORT": strconv.FormatUint(uint64(ssh.Config.PublicSSHPort), 10),
},
CopyContextFiles: []string{bootstrap.Executable},
})
return stt
}
func (ssh SSH2) Context(parent component.InstallationContext) component.InstallationContext {