Skip to content

Commit

Permalink
Refactor rdesktop
Browse files Browse the repository at this point in the history
  • Loading branch information
gbraad committed Jan 6, 2025
1 parent bee4a16 commit 45c15c5
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 36 deletions.
35 changes: 10 additions & 25 deletions .github/workflows/tailscale-rdesktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,24 @@ on:
jobs:
rdesktop-test:
runs-on: ubuntu-24.04
container:
image: ghcr.io/gbraad-devenv/fedora/rdesktop:41
volumes:
- workspace:/workspace
options: --cpus 1

steps:
- name: Tailscale setup (root)
- name: Run system container with `podman`
run: |
sudo dnf update -y tailscale
sudo sed -i 's|--state=/var/lib/tailscale/tailscaled.state|--state=mem:|' /etc/init.d/tailscaled
sudo sed -i 's|--socket=/run/tailscale/tailscaled.sock|--socket=/var/run/tailscale/tailscaled.sock|' /etc/init.d/tailscaled
sudo sed -i '/--port 41641/ s/$/\n --tun=userspace-networking \\/' /etc/init.d/tailscaled
- name: Tailscale setup (user)
podman run -d --name rdesktop ghcr.io/gbraad-devenv/fedora/rdesktop:41
- name: Tailscale setup (root)
run: |
sudo chmod o+w /var/run/tailscale/
/etc/init.d/tailscaled start
until tailscale up
until podman exec rdesktop tailscale up --auth-key ${TAILSCALE_AUTHKEY}
do
sleep 0.1
done
tailscale set --hostname github-${HOSTNAME}
podman exec rdesktop tailscale set --ssh
podman exec rdesktop tailscale set --hostname github-${HOSTNAME}
env:
TAILSCALE_AUTHKEY: ${{ secrets.TAILSCALE_AUTHKEY}}
- name: Prepare VNC server environment
run: |
su - gbraad -c 'echo "passwd\npasswd\n" | kasmvncpasswd -u gbraad -w'
su - gbraad -c 'touch ~/.vnc/.de-was-selected'
- name: Start `kasmvncserver`
run: |
su - gbraad -c 'kasmvncserver'
- name: Hang around
run: |
whoami
tailscale ip
sleep infinity
sleep 5
podman exec rdesktop systemctl is-active kasmvncserver
podman exec rdesktop tailscale ip
sleep infinity
16 changes: 16 additions & 0 deletions assets/kasmvncserver.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[Unit]
Description=KasmVNC service
After=network.target

[Service]
Type=forking
WorkingDirectory=/home/gbraad
User=gbraad
Group=gbraad

ExecStartPre=/bin/sh -c '/usr/bin/kasmvncserver -kill :1 > /dev/null 2>&1 || :'
ExecStart=/usr/bin/kasmvncserver :1
ExecStop=/usr/bin/kasmvncserver -kill :1

[Install]
WantedBy=multi-user.target
File renamed without changes.
9 changes: 4 additions & 5 deletions containers/Containerfile-base
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ RUN dnf config-manager addrepo --from-repofile=https://pkgs.tailscale.com/stable
&& rm -rf /var/cache/yum \
&& mkdir -p /var/run/tailscale /var/cache/tailscale /var/lib/tailscale

COPY scripts/tailscaled /etc/init.d/tailscaled
COPY assets/tailscaled /etc/init.d/tailscaled

# install cloudflared
#RUN dnf install -y \
Expand All @@ -52,7 +52,8 @@ RUN dnf install -y \
python3-pip \
python3-pygments \
&& dnf clean all \
&& rm -rf /var/cache/yum
&& rm -rf /var/cache/yum \
&& pip install ipykernel

# ranger
RUN dnf install -y \
Expand Down Expand Up @@ -84,6 +85,4 @@ RUN dnf config-manager addrepo --from-repofile=https://cli.github.com/packages/r
&& dnf clean all \
&& rm -rf /var/cache/yum

USER gbraad

RUN pip install pygments-style-tomorrownightbright
USER gbraad
4 changes: 4 additions & 0 deletions containers/Containerfile-dotfiles
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ FROM ghcr.io/gbraad-devenv/fedora/base:${BASE_VERSION}

LABEL org.opencontainers.image.source = "https://github.com/gbraad-devenv/fedora"

USER gbraad

RUN git clone https://github.com/gbraad/dotfiles ~/.dotfiles \
&& ~/.dotfiles/install.sh

RUN pip install pygments-style-tomorrownightbright

ENTRYPOINT [ "/bin/zsh" ]
12 changes: 9 additions & 3 deletions containers/Containerfile-rdesktop
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,21 @@ RUN dnf install -y https://github.com/spotsnel/AltRPMS-KasmVNC/releases/download
&& rm -rf /var/cache/yum \
&& usermod -a -G kasmvnc-cert gbraad

COPY assets/kasmvncserver.service /etc/systemd/system

RUN sed -i 's/^FLAGS=".*"/FLAGS="--tun=userspace-networking"/' /etc/default/tailscaled

USER gbraad

RUN mkdir -p ~/.vnc \
&& echo '#!/bin/sh' > ~/.vnc/xstartup \
&& echo 'i3 &' >> ~/.vnc/xstartup \
&& chmod +x ~/.vnc/xstartup
&& echo $'#!/bin/sh\ni3 &' > ~/.vnc/xstartup \
&& chmod +x ~/.vnc/xstartup \
&& /bin/bash -c "echo -e 'password\npassword\n\n' | kasmvncpasswd -u gbraad -w" \
&& touch ~/.vnc/.de-was-selected

# systemd is already set up in systemd image; make sure to use root
USER root

RUN systemctl enable kasmvncserver

#ENTRYPOINT ["/sbin/init"]
3 changes: 0 additions & 3 deletions github/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,4 @@ git init /workspaces/fedora

cd ~

# additional files
pip install ipykernel

exit 0

0 comments on commit 45c15c5

Please sign in to comment.