Compare commits

...

6 commits

Author SHA1 Message Date
510d68a7dd Add more packages to ttyd 2023-08-13 14:48:41 +02:00
d8a3f5f4de Return on failure 2023-08-13 14:48:27 +02:00
b111378a4d Check env vars 2023-08-13 14:47:20 +02:00
8232a5c4e9 Limit ttyd 2023-08-13 14:40:26 +02:00
511e844e3c Add ttyds to Traefik 2023-08-13 14:40:05 +02:00
c7f0e10d00 Remove two xyz rules 2023-08-13 12:55:44 +02:00
3 changed files with 45 additions and 18 deletions

View file

@ -2,22 +2,26 @@
if test -z $argv[1]
echo "A container number is required as the first argument!"
exit 1
return 1
end
set -l container_name ttyd$argv[1]
set -l container_volumes_dir ~/volumes/$container_name
set -l container_home_dir $container_volumes_dir/home
mkdir -p $container_volumes_dir
mkdir -p $container_volumes_dir; or return 1
if not test -d $container_home_dir
cp -r ~/fedora_home_clone $container_home_dir
cp -r ~/fedora_home_clone $container_home_dir; or return 1
end
podman-default-create \
$container_name \
--network traefik \
--net traefik \
-v $container_home_dir:/home/student:Z \
-v ~/bin/linux_course:/usr/local/bin:z,ro \
-v ~/bin/ttyd:/usr/local/bin:z,ro \
--cpu-shares 256 \
--cpus 8 \
--memory 8g \
--memory-reservation 1g \
localhost/ttyd:latest

View file

@ -1,10 +1,15 @@
#!/usr/bin/env fish
if test -z "$STUDENT_USER_PASSWORD" || test -z "$TTYD_USER" || test -z "$TTYD_PASSWORD"
echo "Missing environment variables!"
return 1
end
# Clean up
podman rmi -i ttyd
podman rmi -i ttyd; or return 1
buildah rm builder &>/dev/null
buildah from --pull --name builder registry.fedoraproject.org/fedora:latest
buildah from --pull --name builder registry.fedoraproject.org/fedora:latest; or return 1
# Remove the flag that prevents installing docs
buildah run builder -- sed -i /nodocs/d /etc/dnf/dnf.conf
@ -18,19 +23,25 @@ buildah run builder -- dnf reinstall -y $installed_packages
buildah run builder -- dnf install -y \
fish \
git \
git-lfs \
htop \
jq \
man-db \
man-pages \
nano \
# openssh-clients \
openssl-devel \
passwd \
# procps-ng \
python3 \
rsync \
tree
# util-linux
tree \
vim \
# Important utils
openssh-clients \
procps-ng \
util-linux \
# Compilation
clang \
cmake \
openssl-devel
buildah run builder -- dnf autoremove -y
buildah run builder -- dnf clean -y all
@ -48,6 +59,6 @@ buildah unshare -- sh (status dirname)/buildah_unshare.sh
buildah config \
--workingdir /home/student \
--cmd "bash -c 'chown -R student:student /home/student && runuser -u student -- ttyd -c $TTYD_USER:$TTYD_PASSWORD bash'" \
builder
builder; or return 1
buildah commit --rm builder ttyd

View file

@ -58,14 +58,11 @@ http:
rule: Host(`advlabdb.mo8it.com`)
service: advlabdb
to_forgejo:
rule: Host(`git.mo8it.com`) || Host(`git.mo8it.xyz`)
middlewares:
- mo8it_xyz_to_com
rule: Host(`git.mo8it.com`)
service: forgejo
to_nextcloud:
rule: Host(`nextcloud.mo8it.com`) || Host(`nextcloud.mo8it.xyz`)
rule: Host(`nextcloud.mo8it.com`)
middlewares:
- mo8it_xyz_to_com
- nextcloud_dav
service: nextcloud
to_hedgedoc:
@ -126,6 +123,15 @@ http:
to_oxitraffic_corrode_dev:
rule: Host(`oxitraffic-corrode-dev.mo8it.com`)
service: oxitraffic_corrode_dev
{{ $n_ttyds := 28 }}
{{ range $index, $num := until $n_ttyds }}
to_ttyd{{ $num }}:
rule: Host(`ttyd{{ $num }}.mo8it.com`)
service: ttyd{{ $num }}
tls:
certResolver: le
{{ end }}
services:
nginx:
@ -200,3 +206,9 @@ http:
loadBalancer:
servers:
- url: http://oxitraffic-corrode-dev
{{ range $index, $num := until $n_ttyds }}
ttyd{{ $num }}:
loadBalancer:
servers:
- url: http://ttyd{{ $num }}:7681
{{ end }}