-
Notifications
You must be signed in to change notification settings - Fork 60
Convert into Dev Container feature #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@DentonGentry Would you be able to review this (or find someone who could)? I think this would simplify the Tailscale experience on GitHub Codespaces pretty dramatically. You would also need to update https://tailscale.com/kb/1160/github-codespaces/ with the new instructions: I've updated the README with the basic gist and some supporting links to assist. |
|
@zombiezen This looks very useful. How would one use it prior to Tailscale merging this PR? I attempted to publish it but the Action failed with: |
|
I tested locally by copying the |
|
@zombiezen Thanks. That built successfully but running EDIT: Also, EDIT: Following this seems to fix the issue running |
|
@domkm Was this running on GitHub Codespaces or on your local machine? Can you post both the |
|
@zombiezen Codespaces. Here is likely the most relevant part of You'd need at least the full |
|
What's the base distribution for the container image? And is there anything relevant in the container file If nothing else, I'm suspecting that |
|
I see a few error exits in |
|
Really seems like the entry point isn't getting called. Try removing the |
README.md
Outdated
| Then launch your Codespace. After it starts up, run [`tailscale up`](https://tailscale.com/kb/1080/cli/#up): | ||
|
|
||
| ```shell | ||
| sudo tailscale up --netfilter-mode=off |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could I ask why it sets --netfilter-mode=off? I wouldn't expect to need this in codespaces.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll defer to you: I was cargo-culting from 94af521 Removed for now, since I was able to QA without it and it seemed to work.
| script_dir="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" | ||
| scratch_dir="/tmp/tailscale" | ||
| mkdir -p "$scratch_dir" | ||
| trap 'rm -rf "$scratch_dir"' EXIT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this line: it seems like it deletes the /tmp/tailscale directory which the previous line should have just created.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trap ... EXIT can be thought of like a defer in Go. It runs a command once the shell exits. More docs here: https://tldp.org/LDP/Bash-Beginners-Guide/html/sect_12_02.html
|
FYI, This branch worked for me without issue. (once I added curl to my container) I used the method described here: #6 (comment) devcontainer.json Dockerfile |
DentonGentry
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is good. I'll merge it when a PR for the knowledgebase article is ready to merge along with it.
I've QA'd this manually and was able to connect to my Tailnet.
Unfortunately, I couldn't get the
tailscale upto work as nicely in this model because the entrypoint does not have access to the Codespaces secrets. OTOH, this is now a one-time inconvenience and allows the user to go through the interactive login flow rather than always having to generate a key, since the state is persisted.I was also dismayed that the user has to add
runArgs, but the Dev Container spec does not include a metadata key for that. The spec is still evolving and it's probably just an oversight, so I've opened devcontainers/spec#153 to see if we can get that fixed.I added a GitHub Actions workflow to publish the feature to GitHub Container Registry. The preferred distribution mechanism for Dev Container features is Docker images, but it doesn't matter what registry you use if you want to host elsewhere. I wasn't able to test the image deployment, so you may need to hack on it a little bit to get it to work. LMK if I can help.
Fixes #5