Skip to content

Commit

Permalink
docs: docs update to 1.0.0-rc2
Browse files Browse the repository at this point in the history
  • Loading branch information
almeidapaulopt committed Nov 30, 2024
1 parent c5e2ea8 commit 0ba9e2c
Show file tree
Hide file tree
Showing 22 changed files with 10,945 additions and 40 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ docker_image:
## docs local server
.PHONY: docs
docs:
cd docs && hugo server --buildDrafts --disableFastRender
cd docs && hugo server --disableFastRender
## cd docs && hugo server --buildDrafts --disableFastRender

# ==================================================================================== #
# QUALITY CONTROL
Expand Down
5 changes: 3 additions & 2 deletions docs/content/docs/advanced/_index.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
---
linkTitle: Advanced
title: Advanced Topics
prev: /docs/services
prev: /docs/scenarios
next: /docs/advanced/dashboard
weight: 5
---
{{< cards >}}
{{< card link="dashboard" title="Dashboard" icon="view-boards" >}}
{{< card link="docker-secrets" title="Docker secrets" icon="key" >}}
{{< card link="headscale" title="Headscale" icon="server" >}}
<!-- {{< card link="headscale" title="Headscale" icon="server" >}} -->
{{< card link="host-mode" title="Service with Host Network Mode" icon="view-boards" >}}
{{< /cards >}}
30 changes: 18 additions & 12 deletions docs/content/docs/advanced/docker-secrets.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,24 @@
title: Docker secrets
---

If you want to use Docker secrets to store your Tailscale authkey, you can use the following example:
If you want to use Docker secrets to store your Tailscale authkey, you can use
the following example:

{{% steps %}}

### Requirements ###
### Requirements

Make sure you have Docker Swarm enabled on your server.

<https://docs.docker.com/engine/swarm/secrets/>

"Docker secrets are only available to swarm services, not to standalone containers. To use this feature, consider adapting your container to run as a service."
"Docker secrets are only available to swarm services, not to standalone
containers. To use this feature, consider adapting your container to run as a service."

### Add a docker secret

We need to create a docker secret, which we can name `authkey` and store the Tailscale authkey in it. We can do that using the following command:
We need to create a docker secret, which we can name `authkey` and store the Tailscale
authkey in it. We can do that using the following command:

```bash
printf "Your Tailscale AuthKey" | docker secret create authkey -
Expand All @@ -26,18 +29,12 @@ printf "Your Tailscale AuthKey" | docker secret create authkey -

```yaml docker-compose.yml
services:
tailscale-docker-proxy:
tsdproxy:
image: almeidapaulopt/tsdproxy:latest
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- datadir:/data
restart: unless-stopped
environment:
# Get AuthKey from your Tailscale account
- TSDPROXY_AUTHKEYFILE=/run/secrets/authkey
# Address of docker server (access to example.com ports)
- TSDPROXY_HOSTNAME=192.168.1.1
- DOCKER_HOST=unix:///var/run/docker.sock
- <PATH TO CONFIG>:/config
secrets:
- authkey

Expand All @@ -49,6 +46,15 @@ secrets:
external: true
```
### TsDProxy configuration
```yaml /config/tsdproxy.yaml
tailscale:
providers:
default: # name of the provider
authkeyfile: "/run/secrets/authkey"
```
### Restart tsdproxy
``` bash
Expand Down
1 change: 1 addition & 0 deletions docs/content/docs/advanced/headscale.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Headscale
draft: true
---

In case you want to use the Headscale service, please read the following:
Expand Down
8 changes: 6 additions & 2 deletions docs/content/docs/advanced/host-mode.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
---
title: Service with host network_mode
next: /docs/scenarios
---

If you want to run a service in `network_mode: host`, TSDProxy will not detect any port mapping. You need to specify a port in the `tsdproxy.container_port` option.
If you want to run a service in `network_mode: host`, TSDProxy tries to detect how
to proxy the container. In case of not autodetection work for your case, you need
to specify a port in the `tsdproxy.container_port` option.

{{% steps %}}

Expand All @@ -17,6 +20,7 @@ labels:
### Restart your service
After you restart your service, you should be able to access it using the port you specified in the label.
After you restart your service, you should be able to access it using the port
you specified in the label.
{{% /steps %}}
61 changes: 61 additions & 0 deletions docs/content/docs/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
title: Changelog
prev: /docs/advanced
weight: 200
---


{{% steps %}}

### 1.0.0_rc2

#### New Autodetection function for containers network

TSDProxy now tries to connect to the container using docker internal
ip addresses and ports. It's more reliable and faster, even in container without
exposed ports.

#### New configuration method

TSDProxy still supports the Environment variable method. But there's much more
power with the new configuration yaml file.

#### Multiple Tailscale servers

TSDProxy now supports multiple Tailscale servers. This option is useful if you
have multiple Tailscale accounts, if you want to group containers with the same
AUTHKEY or if you want to use different servers for different containers.

#### Multiple Docker servers

TSDProxy now supports multiple Docker servers. This option is useful if you have
multiple Docker instances and don't want to deploy and manage TSDProxy on each one.

#### New instalation scenarios documentation

Now there is a new [scenarios](/docs/scenarios) section.

#### New logs

Now logs are more readable and easier to read and with context.

#### New Docker container labels

**tsdproxy.proxyprovider** is the label that defines the Tailscale proxy
provider. It's optional.

#### TSDProxy can now run standalone

With the new configuration file, TSDProxy can be run standalone.
Just run tsdproxyd --config ./config .

#### New flag --config

This new flag allows you to specify a configuration file. It's useful if you
want to use as a command line tool instead of a container.

```bash
tsdproxyd --config ./config/tsdproxy.yaml
```

{{% /steps %}}
58 changes: 46 additions & 12 deletions docs/content/docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
title: Getting Started
weight: 1
prev: /docs
next: /docs/services
---

## Quick Start
Expand All @@ -15,18 +14,13 @@ Using Docker Compose, you can easily configure the proxy to your Tailscale conta

```yaml docker-compose.yml
services:
tailscale-docker-proxy:
tsdproxy:
image: almeidapaulopt/tsdproxy:latest
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- datadir:/data
- <PATH_TO_YOUR_CONFIG_DIR>:/config
restart: unless-stopped
environment:
# Get AuthKey from your Tailscale account
- TSDPROXY_AUTHKEY=tskey-auth-SecretKey
# Address of docker server (access to example.com ports)
- TSDPROXY_HOSTNAME=192.168.1.1
- DOCKER_HOST=unix:///var/run/docker.sock

volumes:
datadir:
Expand All @@ -38,14 +32,53 @@ volumes:
docker compose up -d
```

### Configure TSDProxy

After the TSDProxy container is started, a configuration file
`/config/tsdproxy.yaml` is created and populated with the following:

```yaml
defaultproxyprovider: default
docker:
local: # name of the docker provider
host: unix:///var/run/docker.sock # host of the docker socket or daemon
targethostname: 172.31.0.1 # hostname or IP of docker server
defaultproxyprovider: default # name of which proxy provider to use
file: {}
tailscale:
providers:
default: # name of the provider
authkey: your-authkey # define authkey here
authkeyfile: "" # use this to load authkey from file. If this is defined, Authkey is ignored
controlurl: https://controlplane.tailscale.com # use this to override the default control URL
datadir: /data/
http:
hostname: 0.0.0.0
port: 8080
log:
level: info # set logging level info, error or trace
json: false # set to true to enable json logging
proxyaccesslog: true # set to true to enable container access log
```
#### Edit the configuration file
1. Set your authkey in the file `/config/tsdproxy.yaml`.
2. Change yout docker host if your are not using the socket.
3. restart the service.

```bash
docker compose restart
```

### Run a sample service

Here we’ll use the nginx image to serve a sample service.
The container name is `sample-nginx`, expose port 8181, and add the `tsdproxy.enable` label.
The container name is `sample-nginx`, expose port 8181, and add the
`tsdproxy.enable` label.

```bash
docker run -d --name sample-nginx -p 8181:80 \
--label "tsdproxy.enable=true" nginx:latest
docker run -d --name sample-nginx -p 8111:80 --label "tsdproxy.enable=true" nginx:latest
```

### Test the sample service
Expand All @@ -60,7 +93,8 @@ Note that you need to replace `FUNNY-NAME` with the name of your network.

{{< callout type="warning" >}}
The first time you run the proxy, it will take a few seconds to start, because it
needs to connect to the Tailscale network, generate the certificates, and start the proxy.
needs to connect to the Tailscale network, generate the certificates, and start
the proxy.
{{< /callout >}}

{{% /steps %}}
Loading

0 comments on commit 0ba9e2c

Please sign in to comment.