Compare commits

...

2 commits

Author SHA1 Message Date
5f12b3aea8 Add oxitraffic for corrode.dev 2023-08-13 02:01:13 +02:00
d240bb5c2e Update ttyd scripts 2023-08-13 02:00:47 +02:00
8 changed files with 58 additions and 56 deletions

View file

@ -0,0 +1,26 @@
#!/usr/bin/env fish
set -l container_name oxitraffic-corrode-dev
set -l container_volumes_dir ~/volumes/$container_name
buildah build -t $container_name:latest ~/code/oxitraffic
set -l db_container_name oxitraffic-corrode-dev-db
set -l db_container_volumes_dir $container_volumes_dir/db
set -l db_env_file $container_volumes_dir/.postgres.env
podman-default-create \
$db_container_name \
--network traefik \
-v $db_container_volumes_dir:/var/lib/postgresql/data:Z \
-e TZ=Europe/Berlin \
-e PGTZ=Europe/Berlin \
--env-file $db_env_file \
--label "io.containers.autoupdate=registry" \
docker.io/library/postgres:15-alpine
podman-default-create \
$container_name \
--network traefik \
-v $container_volumes_dir/data:/volumes/data:Z \
localhost/$container_name:latest

View file

@ -1,7 +1,7 @@
#!/usr/bin/env fish
if test -z $argv[1]
echo "A container number as an argument is required!"
echo "A container number is required as the first argument!"
exit 1
end
@ -12,7 +12,7 @@ set -l container_home_dir $container_volumes_dir/home
mkdir -p $container_volumes_dir
if not test -d $container_home_dir
cp -r ~/sync/volumes/fedora_home $container_home_dir
cp -r ~/fedora_home_clone $container_home_dir
end
podman-default-create \

8
images/ttyd/buildah_unshare.sh Executable file
View file

@ -0,0 +1,8 @@
#!/usr/bin/env bash
MNT=$(buildah mount builder)
rm -rf ~/fedora_home_clone
cp -r $MNT/home/student ~/fedora_home_clone
buildah unmount builder

View file

@ -1,16 +1,12 @@
#!/usr/bin/env fish
if podman image exists ttyd
if not podman rmi ttyd
exit 1
end
end
# Clean up
podman rmi -i ttyd
buildah rm builder &>/dev/null
buildah from --pull --name builder registry.fedoraproject.org/fedora:latest
# Remove flag that prevents installing docs
# Remove the flag that prevents installing docs
buildah run builder -- sed -i /nodocs/d /etc/dnf/dnf.conf
buildah run builder -- dnf update -y
@ -20,7 +16,6 @@ set -l installed_packages (buildah run builder -- dnf list --installed | tail -n
buildah run builder -- dnf reinstall -y $installed_packages
buildah run builder -- dnf install -y \
cargo \
fish \
git \
htop \
@ -28,25 +23,28 @@ buildah run builder -- dnf install -y \
man-db \
man-pages \
nano \
neovim \
openssh-clients \
# openssh-clients \
openssl-devel \
passwd \
procps-ng \
# procps-ng \
python3 \
python3-ipython \
rsync \
tree \
util-linux
tree
# util-linux
buildah run builder -- dnf autoremove -y
buildah run builder -- dnf clean all
buildah run builder -- dnf clean -y all
set -l user_password "student:$STUDENT_USER_PASSWORD"
set -l user_credentials "student:$STUDENT_USER_PASSWORD"
buildah run builder -- useradd student
buildah run builder -- bash -c "echo $user_password | chpasswd"
buildah run builder -- bash -c "echo $user_credentials | chpasswd"
buildah run builder -- usermod -aG wheel student
# Install Rust
buildah run builder -- bash -c "runuser -u student -- bash -c \"curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y\""
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'" \

View file

@ -1,2 +0,0 @@
# ~/.bash_logout

View file

@ -1,8 +0,0 @@
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs

View file

@ -1,27 +0,0 @@
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific environment
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]
then
PATH="$HOME/.local/bin:$HOME/bin:$PATH"
fi
export PATH
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
# User specific aliases and functions
if [ -d ~/.bashrc.d ]; then
for rc in ~/.bashrc.d/*; do
if [ -f "$rc" ]; then
. "$rc"
fi
done
fi
unset rc

View file

@ -123,6 +123,9 @@ http:
to_oxitraffic:
rule: Host(`oxitraffic.mo8it.com`)
service: oxitraffic
to_oxitraffic_corrode_dev:
rule: Host(`oxitraffic-corrode-dev.mo8it.com`)
service: oxitraffic_corrode_dev
services:
nginx:
@ -193,3 +196,7 @@ http:
loadBalancer:
servers:
- url: http://oxitraffic
oxitraffic_corrode_dev:
loadBalancer:
servers:
- url: http://oxitraffic-corrode-dev