hack news

Golink: A non-public shortlink service for tailnets


living: experimental

golink is a non-public shortlink service for your tailnet.
It lets you build short, memorable links for the web sites you and your crew exhaust most.
If you stop up fresh to golink, be taught more in our announcement weblog post.

Screenshot of golink house conceal

Constructing and operating

To build from source and bustle in dev mode:

go run ./cmd/golink -dev-listen :8080

golink will be obtainable at //http://localhost:8080/,
storing links in a transient database, and can no longer strive to be part of a tailnet.

The identical the utilization of the pre-constructed docker image:

docker run -it --rm -p 8080:8080 ghcr.io/tailscale/golink:main -dev-listen :8080

When you discover the docker error unable to open database file: out of memory (14),
exhaust a chronic volume as documented in Running in manufacturing.

Joining a tailnet

Create an [auth key] for your tailnet at //https://login.tailscale.com/admin/settings/keys.
Configure the auth key to your preferences, however at a minimum we most frequently advocate:

  • add a stamp (maybe one thing like tag:golink) to create it more uncomplicated to set up of abode ACLs for controlling access and to create definite the node would now not expires.
  • don’t set up of abode “ephemeral” so the node is never any longer eradicated if it goes offline

When you occupy a key, set up of abode it because the TS_AUTHKEY atmosphere variable when starting golink.
You are going to additionally occupy to specify your sqlite database file:

” drag bustle ./cmd/golink -sqlitedb golink.db”>

TS_AUTHKEY="tskey-auth-" go run ./cmd/golink -sqlitedb golink.db

golink stores its tailscale recordsdata recordsdata in a tsnet-golink directory inside os.UserConfigDir.
As long as here is on a chronic volume, the auth key handiest desires to be equipped on first bustle.


When golink joins your tailnet, this could strive to make exhaust of “drag” as its node name,
and will be obtainable at //http://drag.tailnet0000.ts.gain/ (or whatever your tailnet name is).
To create it accessible merely as //http://drag/, enable MagicDNS for your tailnet.
With MagicDNS enabled, no particular configuration or browser extensions are wanted on client devices.
Users correct occupy to occupy Tailscale installed and linked to the tailnet.

Running in manufacturing

golink compiles as a single static binary (at the side of the frontend) and could per chance also be deployed and bustle like all assorted binary.
Two pieces of recordsdata ought to silent be on chronic volumes:

  • tailscale recordsdata recordsdata in the tsnet-golink directory inside os.UserConfigDir
  • the sqlite database file where links are saved

Within the docker image, each and each are saved in /home/nonroot, so you are going to be in a group up of abode to mount a chronic volume:

docker run -v /persistant/data:/home/nonroot ghcr.io/tailscale/golink:main

The mounted directory will ought to silent be writable by the nonroot particular person (uid: 65532, gid: 65532),
as an illustration by calling sudo chown 65532 /persistent/data.
Alternatively, you are going to be in a group up of abode to bustle golink as root the utilization of docker run -u root.

No ports ought to silent be uncovered, whether operating as a binary or in docker.
golink will listen on port 80 on the tailscale interface, so could per chance also be accessed at //http://drag/.

Deploy on Fly

Look //https://fly.io/doctors/ for chubby instructions for deploying apps on Fly, however this ought to silent give you a respectable launch.
Exchange FLY_APP_NAME and FLY_VOLUME_NAME along with your app and volume names.

Create a fly.toml file:

app = "FLY_APP_NAME"

image = "ghcr.io/tailscale/golink:main"

strategy = "immediate"


Then bustle the instructions with the flyctl CLI.


When you occupy golink operating, you are going to be in a group up of abode to backup your entire links in JSON lines structure from //http://drag/.export.
At Tailscale, we snapshot our links weekly and retailer them in git.

To revive links, specify the snapshot file on startup.
Utterly links that don’t exist already in the database will be added.

golink -snapshot links.json

You would maybe per chance maybe also additionally resolve links domestically the utilization of a snapshot file:

golink -resolve-from-backup links.json go/link

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button