Skip to content

Commit

Permalink
Add tunnel use and change how to handle hostname
Browse files Browse the repository at this point in the history
  • Loading branch information
gbraad authored Jan 9, 2025
1 parent c9673e7 commit b9a7bd1
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 9 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/tailscale-code-tunnel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: tailscale-code-tunnel
on:
workflow_dispatch:

jobs:
code-test:
runs-on: ubuntu-24.04

steps:
- name: Run system container with `podman`
run: |
podman run -d --name code --hostname code-${HOSTNAME} --systemd=always --cap-add=NET_RAW --cap-add=NET_ADMIN --cap-add=SYS_ADMIN --device=/dev/net/tun --device=/dev/fuse ghcr.io/gbraad-devenv/fedora/code-cli:41
- name: Tailscale setup (root)
run: |
until podman exec code tailscale up --auth-key ${TAILSCALE_AUTHKEY}
do
sleep 0.1
done
podman exec code tailscale set --ssh
podman exec code chmod 640 /etc/shadow
env:
TAILSCALE_AUTHKEY: ${{ secrets.TAILSCALE_AUTHKEY}}
- name: Start `code tunnel` as `gbraad`
run: |
podman exec code code tunnel user login --provider github
podman exec code systemctl enable --now code-tunnel@gbraad
- name: Hang around
run: |
until podman exec code systemctl is-active --quiet code-tunnel@gbraad
do
sleep 1
done
IP=`podman exec code tailscale ip -4`
echo "Open in your web browser: http://${IP}:8000"
sleep infinity
10 changes: 7 additions & 3 deletions .github/workflows/tailscale-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,23 @@ jobs:
steps:
- name: Run system container with `podman`
run: |
podman run -d --name code --systemd=always --cap-add=NET_RAW --cap-add=NET_ADMIN --cap-add=SYS_ADMIN --device=/dev/net/tun --device=/dev/fuse ghcr.io/gbraad-devenv/fedora/code-cli:41
podman run -d --name code --hostname code-${HOSTNAME} --systemd=always --cap-add=NET_RAW --cap-add=NET_ADMIN --cap-add=SYS_ADMIN --device=/dev/net/tun --device=/dev/fuse ghcr.io/gbraad-devenv/fedora/code-cli:41
- name: Tailscale setup (root)
run: |
until podman exec code tailscale up --auth-key ${TAILSCALE_AUTHKEY} --hostname code-${HOSTNAME}
until podman exec code tailscale up --auth-key ${TAILSCALE_AUTHKEY}
do
sleep 0.1
done
podman exec code tailscale set --ssh
podman exec code chmod 640 /etc/shadow
env:
TAILSCALE_AUTHKEY: ${{ secrets.TAILSCALE_AUTHKEY}}
- name: Start `code serve-web` as `gbraad`
run: |
podman exec code systemctl enable --now code-serveweb@gbraad
- name: Hang around
run: |
until podman exec code systemctl is-active --quiet code-serveweb@root
until podman exec code systemctl is-active --quiet code-serveweb@gbraad
do
sleep 1
done
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tailscale-rdesktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
steps:
- name: Run system container with `podman`
run: |
podman run -d --name rdesktop ghcr.io/gbraad-devenv/fedora/rdesktop:41
podman run -d --name rdesktop --hostname code-${HOSTNAME} ghcr.io/gbraad-devenv/fedora/rdesktop:41
- name: Tailscale setup (root)
run: |
until podman exec rdesktop tailscale up --auth-key ${TAILSCALE_AUTHKEY} --hostname github-${HOSTNAME}
until podman exec rdesktop tailscale up --auth-key ${TAILSCALE_AUTHKEY}
do
sleep 0.1
done
Expand Down
2 changes: 1 addition & 1 deletion assets/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Description=Code Tunnel Service
After=network.target

[Service]
ExecStart=/usr/bin/code tunnel --accept-server-license-terms
ExecStart=/usr/bin/code tunnel --accept-server-license-terms --name %H
Restart=always
User=%i

Expand Down
4 changes: 1 addition & 3 deletions containers/Containerfile-code-cli
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,4 @@ RUN cd /tmp \
COPY assets/[email protected] /etc/systemd/system/
COPY assets/[email protected] /etc/systemd/system/

RUN systemctl enable [email protected]

#ENTRYPOINT [ "/sbin/init" ]
#ENTRYPOINT [ "/sbin/init" ]

0 comments on commit b9a7bd1

Please sign in to comment.