From dd68cee0331155d149fd77fc90000b033988e25d Mon Sep 17 00:00:00 2001 From: Mark Bundschuh Date: Sat, 9 Dec 2023 02:31:22 -0500 Subject: [PATCH] put ttyd on base path --- autotag1.env | 1 + autotag2.env | 1 + bot/index.ts | 8 +++++++- images/ttyd-viewable.service | 3 ++- images/ttyd-writable.service | 2 +- 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/autotag1.env b/autotag1.env index 56d18aa..36f39f3 100644 --- a/autotag1.env +++ b/autotag1.env @@ -1 +1,2 @@ TTYD_PASSWORD=tag1 +TTYD_ID=tag1 diff --git a/autotag2.env b/autotag2.env index 800f2ba..535ba07 100644 --- a/autotag2.env +++ b/autotag2.env @@ -1 +1,2 @@ TTYD_PASSWORD=tag2 +TTYD_ID=tag1 diff --git a/bot/index.ts b/bot/index.ts index 80af130..b50ceed 100644 --- a/bot/index.ts +++ b/bot/index.ts @@ -148,7 +148,7 @@ const createKubernetesResources = async (id: string, password: string) => { }, }, data: { - "autotag.env": `TTYD_PASSWORD=${password}`, + "autotag.env": `TTYD_ID=${id}\nTTYD_PASSWORD=${password}\n`, }, }, }); @@ -231,6 +231,12 @@ const startTagCommand: Command = { type: ApplicationCommandOptionType.User, description: "The second player", }, + { + name: "image", + type: ApplicationCommandOptionType.String, + choices: [{ name: "Arch Linux", value: "archlinux" }], + description: "The image to use", + }, ], }, { diff --git a/images/ttyd-viewable.service b/images/ttyd-viewable.service index 0134aeb..3ad553a 100644 --- a/images/ttyd-viewable.service +++ b/images/ttyd-viewable.service @@ -3,7 +3,8 @@ Description=ttyd viewable web terminal [Service] Type=simple -ExecStart=/usr/bin/ttyd.x86_64 -p 7682 tmux new -A -s ttyd +EnvironmentFile=/etc/autotag.env +ExecStart=/usr/bin/ttyd.x86_64 -p 7682 -b /${TTYD_ID}/view tmux new -A -s ttyd WorkingDirectory=/home/admin Restart=always User=admin diff --git a/images/ttyd-writable.service b/images/ttyd-writable.service index df26257..0118001 100644 --- a/images/ttyd-writable.service +++ b/images/ttyd-writable.service @@ -4,7 +4,7 @@ Description=ttyd writable web terminal [Service] Type=simple EnvironmentFile=/etc/autotag.env -ExecStart=/usr/bin/ttyd.x86_64 -p 7681 -c admin:${TTYD_PASSWORD} -W tmux new -A -s ttyd +ExecStart=/usr/bin/ttyd.x86_64 -p 7681 -b /${TTYD_ID} -c admin:${TTYD_PASSWORD} -W tmux new -A -s ttyd WorkingDirectory=/home/admin Restart=always User=admin