forked from tailscale-dev/docker-mod
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Xe Iaso <[email protected]>
- Loading branch information
Xe Iaso
committed
Apr 11, 2023
0 parents
commit 29092f7
Showing
27 changed files
with
191 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
use flake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.direnv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM scratch | ||
|
||
COPY root/ / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
BSD 3-Clause License | ||
|
||
Copyright (c) 2023, Tailscale Community | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
3. Neither the name of the copyright holder nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
description = "Flake utils demo"; | ||
|
||
inputs.flake-utils.url = "github:numtide/flake-utils"; | ||
|
||
outputs = { self, nixpkgs, flake-utils }: | ||
flake-utils.lib.eachDefaultSystem (system: | ||
let pkgs = nixpkgs.legacyPackages.${system}; in | ||
{ | ||
devShells.default = pkgs.mkShell { | ||
buildInputs = with pkgs; [ dive tree go_1_20 go-tools gotools gopls ]; | ||
}; | ||
} | ||
); | ||
} |
Empty file added
0
...s6-rc.d/init-mod-universal-tailscale-postinstall/dependencies.d/init-mods-package-install
Empty file.
20 changes: 20 additions & 0 deletions
20
root/etc/s6-overlay/s6-rc.d/init-mod-universal-tailscale-postinstall/run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/with-contenv bash | ||
|
||
set -euo pipefail | ||
|
||
dir="$(mktemp -d)" | ||
pushd . | ||
cd "${dir}" | ||
|
||
tarball="$(curl 'https://pkgs.tailscale.com/stable/?mode=json' | jq -r .Tarballs.amd64)" | ||
version="$(echo ${tarball} | cut -d_ -f2)" | ||
|
||
curl "https://pkgs.tailscale.com/stable/${tarball}" -o tailscale.tgz | ||
|
||
tar xzf tailscale.tgz | ||
|
||
cp -vrf "tailscale_${version}_amd64"/tailscale /usr/bin/tailscale | ||
cp -vrf "tailscale_${version}_amd64"/tailscaled /usr/sbin/tailscaled | ||
|
||
popd | ||
rm -rf "${dir}" |
1 change: 1 addition & 0 deletions
1
root/etc/s6-overlay/s6-rc.d/init-mod-universal-tailscale-postinstall/type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
oneshot |
1 change: 1 addition & 0 deletions
1
root/etc/s6-overlay/s6-rc.d/init-mod-universal-tailscale-postinstall/up
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/etc/s6-overlay/s6-rc.d/init-mod-universal-tailscale-postinstall/run |
Empty file added
0
root/etc/s6-overlay/s6-rc.d/init-mod-universal-tailscale/dependencies.d/init-mods
Empty file.
15 changes: 15 additions & 0 deletions
15
root/etc/s6-overlay/s6-rc.d/init-mod-universal-tailscale/run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/with-contenv bash | ||
|
||
## Ubuntu | ||
if [ -f /usr/bin/apt ]; then | ||
echo "\ | ||
jq \ | ||
iptables" >> /mod-repo-packages-to-install.list | ||
|
||
fi | ||
# Alpine | ||
if [ -f /sbin/apk ]; then | ||
echo "\ | ||
jq \ | ||
iptables" >> /mod-repo-packages-to-install.list | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
oneshot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/etc/s6-overlay/s6-rc.d/init-mod-universal-tailscale/run |
Empty file added
0
.../s6-overlay/s6-rc.d/init-mods-end/dependencies.d/init-mod-universal-tailscale-postinstall
Empty file.
Empty file.
Empty file.
Empty file added
0
.../s6-overlay/s6-rc.d/init-mods-package-install/dependencies.d/init-mod-universal-tailscale
Empty file.
Empty file added
0
...-overlay/s6-rc.d/svc-tailscale-up/dependencies.d/init-mod-universal-tailscale-postinstall
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/with-contenv bash | ||
|
||
FLAGS="" | ||
|
||
# configure `tailscale up` | ||
if ! [ -v TAILSCALE_AUTHKEY ]; then | ||
echo '[!] TAILSCALE_AUTHKEY is not defined, this will print a login URL to the screen' | ||
else | ||
FLAGS="${FLAGS} --authkey=${TAILSCALE_AUTHKEY}" | ||
fi | ||
|
||
if [ -v TAILSCALE_HOSTNAME ]; then | ||
FLAGS="${FLAGS} --hostname=${TAILSCALE_HOSTNAME}" | ||
fi | ||
|
||
if [ -v TAILSCALE_USE_SSH ]; then | ||
FLAGS="${FLAGS} --ssh=${TAILSCALE_USE_SSH}" | ||
fi | ||
|
||
if [ -v TAILSCALE_BE_EXIT_NODE ]; then | ||
echo '[!] acting as an exit node, you may need to approve this in the admin console' | ||
FLAGS="${FLAGS} --advertise-exit-node=${TS_BE_EXIT_NODE}" | ||
fi | ||
|
||
tailscale up $FLAGS | ||
|
||
# configure serve | ||
if [ -v TAILSCALE_SERVE_PORT ] && [ -v TAILSCALE_SERVE_MODE ]; then | ||
tailscale serve "${TAILSCALE_SERVE_MODE}":443 / http://localhost:"${TAILSCALE_SERVE_PORT}" | ||
fi | ||
|
||
# configure funnel | ||
if [ -v TAILSCALE_FUNNEL ]; then | ||
tailscale funnel 443 on | ||
fi | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
oneshot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/etc/s6-overlay/s6-rc.d/svc-tailscale-up/run |
Empty file added
0
.../s6-overlay/s6-rc.d/svc-tailscale/dependencies.d/init-mod-universal-tailscale-postinstall
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/with-contenv bash | ||
|
||
FLAGS="" | ||
|
||
if ! [ -e /dev/net/tun ]; then | ||
FLAGS="$flags --tun=userspace-networking" | ||
fi | ||
|
||
if [ -v TAILSCALE_STATE_DIR ]; then | ||
FLAGS="$FLAGS --statedir=${TAILSCALE_STATE_DIR}" | ||
else | ||
echo '[!] TAILSCALE_STATE_DIR is not set, this node will be ephemeral.' | ||
FLAGS="$FLAGS --state=mem:" | ||
fi | ||
|
||
if ! [ -v TAILSCALE_TAILSCALED_LOG ]; then | ||
tailscaled $FLAGS 2>&1 > /dev/null | ||
else | ||
tailscaled $FLAGS | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
longrun |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/etc/s6-overlay/s6-rc.d/svc-tailscale-up/run |