feat: connect terminal service to backend

feat: put terminal service into container

refactor: separate main into terminal and websocket

feat: create zsh using commander in home

feat: pass backendUrl to container

feat: pass token to ws server to cmd-hook

feat: gen terminal access token for frontend

feat: success to connect through traefik

fix: handle invalid jwt

feat: connect to session container via traefik
This commit is contained in:
Justin Lin committed 2025-05-05 19:53:33 +08:00
1 parent 0b08a9a5d9
commit 5e81db2759
20 files changed
+281 -209

No files matched your search

+6 -9
View File
@@ -3,19 +3,16 @@
USERNAME=commander
echo "Initializing container for $USERNAME"
echo "BACKEND_URL: $BACKEND_URL"
if ! id -u ${USERNAME} >/dev/null 2>&1; then
echo "Adding user $USERNAME"
adduser --disabled-password --gecos '' --shell /bin/zsh ${USERNAME} && \
find / -name ".gitkeep" -type f -exec rm -f {} +
echo "Adding public key for $USERNAME"
echo "Public key: $PUB_KEY"
PUB_KEY_PATH=/etc/ssh/authorized_keys/${USERNAME}
echo $PUB_KEY > ${PUB_KEY_PATH}
chmod 644 ${PUB_KEY_PATH}
fi
mkdir -p /run/sshd
echo "Starting SSH server"
/usr/sbin/sshd -D -e
# Preserve environment variables
export BACKEND_URL
echo "Starting terminal service"
su - ${USERNAME} -w BACKEND_URL -c "/usr/local/lib/terminal-service/terminal-service"