Skip to content
Snippets Groups Projects
Commit 9332d7c8 authored by Nathan Rodet's avatar Nathan Rodet
Browse files

Added ttyd service

parent 5c81104d
No related branches found
No related tags found
No related merge requests found
......@@ -8,10 +8,11 @@ package_upgrade: true
packages:
- curl
- git
- argon2
runcmd:
#
# cloud-init execute cmd before HOME and USER are set.
# Cloud-init execute cmd before HOME and USER are set.
#
- "export HOME=/root"
- "export USER=root"
......@@ -26,18 +27,20 @@ runcmd:
#
# Install Atrium
#
- "curl https://forge.grandlyon.com/systemes-dinformation/alpha/projects/labo-rust/-/raw/develop/instance-scripts/config-files/atrium.yaml -o root/atrium.yaml"
- "curl https://forge.grandlyon.com/systemes-dinformation/alpha/projects/labo-rust/-/raw/develop/instance-scripts/scripts/atrium.sh | bash"
#
# Install And Run Code Server
# Install Code Server
#
- "curl https://forge.grandlyon.com/systemes-dinformation/alpha/projects/labo-rust/-/raw/develop/instance-scripts/config-files/config.yaml -o root/config.yaml"
- "curl https://forge.grandlyon.com/systemes-dinformation/alpha/projects/labo-rust/-/raw/develop/instance-scripts/scripts/code-server.sh | bash"
#
# Run Webtop Container
# Install Webtop
#
- "curl https://forge.grandlyon.com/systemes-dinformation/alpha/projects/labo-rust/-/raw/develop/instance-scripts/scripts/webtop.sh | sh"
#
# Install ttyd
#
- "curl https://forge.grandlyon.com/systemes-dinformation/alpha/projects/labo-rust/-/raw/develop/instance-scripts/scripts/ttyd.sh | bash"
#
# Install Repository
#
- "git clone https://github.com/NathanRodet/rust-axum-demo /root/rust-axum-demo"
\ No newline at end of file
......@@ -17,4 +17,19 @@ apps: # optional : applications served by atrium
color: 4292030255
is_proxy: true
host: desktop-%atrium_count_index%
target: localhost:8081
\ No newline at end of file
target: localhost:8081
- id: 3
name: Terminal %atrium_count_index%
icon: terminal
color: 4292030255
is_proxy: true
host: terminal-%atrium_count_index%
target: localhost:8082
secured: true
login: admin
password: %user_password%
users:
- login: admin
password: %user_password_hash%
roles:
- ADMINS
\ No newline at end of file
[Unit]
Description=ttyd web server to allow remote access to terminal
After=network.target
[Service]
ExecStart=/root/ttyd/ttyd.86_64 -p 8082 -i lo -c admin:%user_password% -T xterm bash
[Install]
WantedBy=multi-user.target
\ No newline at end of file
......@@ -4,12 +4,17 @@
# Install Atrium
#
export USER_PASSWORD_HASH=$(echo "$(scw-userdata user_password)" | argon2 "$(echo $RANDOM | md5sum | head -c 12)" -i -l 32 -e)
mkdir -p /root/atrium/data && mkdir -p /root/atrium/letsencrypt_cache
sed -i "s/%atrium_hostname%/$(scw-userdata atrium_hostname)/g" /root/atrium.yaml
sed -i "s/%project_domain%/$(scw-userdata project_domain)/g" /root/atrium.yaml
sed -i "s/%atrium_letsencrypt_email%/$(scw-userdata atrium_letsencrypt_email)/g" /root/atrium.yaml
sed -i "s/%atrium_count_index%/$(scw-userdata atrium_count_index)/g" /root/atrium.yaml
mv /root/atrium.yaml /root/atrium/atrium.yaml
curl https://forge.grandlyon.com/systemes-dinformation/alpha/projects/labo-rust/-/raw/develop/instance-scripts/config-files/atrium.yaml -o root/atrium/atrium.yaml
sed -i "s|%atrium_hostname%|$(scw-userdata atrium_hostname)|g" /root/atrium/atrium.yaml
sed -i "s|%project_domain%|$(scw-userdata project_domain)|g" /root/atrium/atrium.yaml
sed -i "s|%atrium_letsencrypt_email%|$(scw-userdata atrium_letsencrypt_email)|g" /root/atrium/atrium.yaml
sed -i "s|%atrium_count_index%|$(scw-userdata atrium_count_index)|g" /root/atrium/atrium.yaml
sed -i "s|%user_password_hash%|$USER_PASSWORD_HASH|g" /root/atrium/atrium.yaml
sed -i "s|%user_password%|$(scw-userdata atrium_count_index)|g" /root/atrium/atrium.yaml
chown -Rf 1000:1000 /root/atrium
#
......@@ -22,3 +27,9 @@ docker run -d --name atrium \
-v /root/atrium/atrium.yaml:/app/atrium.yaml \
-v /root/atrium/letsencrypt_cache:/app/letsencrypt_cache \
-v /root/atrium/data:/app/data nicolaspernoud/atrium:latest
#
# Example : Generate user_password Argon2 encoded hash for Atrium
#
# echo $(scw-userdata user_password) | argon2 $(echo $RANDOM | md5sum | head -c 12) -i -l 32 -e
......@@ -5,8 +5,8 @@
#
mkdir -p /root/.config/code-server/
sed -i "s/%user_password%/$(scw-userdata user_password)/g" /root/config.yaml
mv /root/config.yaml /root/.config/code-server/config.yaml
curl https://forge.grandlyon.com/systemes-dinformation/alpha/projects/labo-rust/-/raw/develop/instance-scripts/config-files/config.yaml -o root/.config/code-server/config.yaml
sed -i "s/%user_password%/$(scw-userdata user_password)/g" /root/.config/code-server/config.yaml
curl -fsSL https://code-server.dev/install.sh | sh
#
......
#!/bin/sh
#
# Run ttyd service
#
mkdir -p /root/ttyd
curl https://github.com/tsl0922/ttyd/releases/download/1.7.2/ttyd.x86_64 -o root/ttyd/ttyd.x86_64
chmod +x /root/ttyd/ttyd.x86_64
curl https://forge.grandlyon.com/systemes-dinformation/alpha/projects/labo-rust/-/raw/develop/instance-scripts/config-files/ttyd.service -o etc/systemd/system/ttyd.service
sed -i "s|%user_password%|$(scw-userdata atrium_count_index)|g" /etc/systemd/system/ttyd.service
systemctl enable ttyd.service && systemctl start ttyd.service
\ No newline at end of file
......@@ -3,6 +3,7 @@
#
# Run Webtop Container
#
docker run -d --name=webtop \
--security-opt seccomp=unconfined \
-e PUID=0 \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment