Skip to content

Commit

Permalink
Fix docs formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
majabojarska committed Mar 5, 2024
1 parent a244eab commit 3cbf646
Show file tree
Hide file tree
Showing 5 changed files with 324 additions and 324 deletions.
32 changes: 17 additions & 15 deletions docs/dns-records.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,25 @@ An example use case is to serve apps on the same host via a reverse proxy like N

1. Change the `config.yaml` to contain the desired records like so:

```yaml
dns_config:
...
extra_records:
- name: "prometheus.myvpn.example.com"
type: "A"
value: "100.64.0.3"

- name: "grafana.myvpn.example.com"
type: "A"
value: "100.64.0.3"
...
```
```yaml
dns_config:
...
extra_records:
- name: "prometheus.myvpn.example.com"
type: "A"
value: "100.64.0.3"

- name: "grafana.myvpn.example.com"
type: "A"
value: "100.64.0.3"
...
```

1. Restart your headscale instance.

2. Restart your headscale instance.
!!! warning

Beware of the limitations listed later on!
Beware of the limitations listed later on!

### 2. Verify that the records are set

Expand Down
152 changes: 75 additions & 77 deletions docs/running-headscale-container.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,107 +17,105 @@ not work with alternatives like [Podman](https://podman.io). The Docker image ca

1. Prepare a directory on the host Docker node in your directory of choice, used to hold `headscale` configuration and the [SQLite](https://www.sqlite.org/) database:

```shell
mkdir -p ./headscale/config
cd ./headscale
```
```shell
mkdir -p ./headscale/config
cd ./headscale
```

2. Create an empty SQlite datebase in the headscale directory:
1. Create an empty SQlite datebase in the headscale directory:

```shell
touch ./config/db.sqlite
```
```shell
touch ./config/db.sqlite
```

3. **(Strongly Recommended)** Download a copy of the [example configuration](https://github.com/juanfont/headscale/blob/main/config-example.yaml) from the headscale repository.
1. **(Strongly Recommended)** Download a copy of the [example configuration](https://github.com/juanfont/headscale/blob/main/config-example.yaml) from the headscale repository.

Using wget:
- Using `wget`:

```shell
wget -O ./config/config.yaml https://raw.githubusercontent.com/juanfont/headscale/main/config-example.yaml
```
```shell
wget -O ./config/config.yaml https://raw.githubusercontent.com/juanfont/headscale/main/config-example.yaml
```

Using curl:
- Using `curl`:

```shell
curl https://raw.githubusercontent.com/juanfont/headscale/main/config-example.yaml -o ./config/config.yaml
```
```shell
curl https://raw.githubusercontent.com/juanfont/headscale/main/config-example.yaml -o ./config/config.yaml
```

**(Advanced)** If you would like to hand craft a config file **instead** of downloading the example config file, create a blank `headscale` configuration in the headscale directory to edit:
- **(Advanced)** If you would like to hand craft a config file **instead** of downloading the example config file, create a blank `headscale` configuration in the headscale directory to edit:

```shell
touch ./config/config.yaml
```
```shell
touch ./config/config.yaml
```

Modify the config file to your preferences before launching Docker container.
Here are some settings that you likely want:

```yaml
# Change to your hostname or host IP
server_url: http://your-host-name:8080
# Listen to 0.0.0.0 so it's accessible outside the container
metrics_listen_addr: 0.0.0.0:9090
# The default /var/lib/headscale path is not writable in the container
noise:
private_key_path: /etc/headscale/noise_private.key
# The default /var/lib/headscale path is not writable in the container
derp:
private_key_path: /etc/headscale/private.key
# The default /var/run/headscale path is not writable in the container
unix_socket: /etc/headscale/headscale.sock
# The default /var/lib/headscale path is not writable in the container
database.type: sqlite3
database.sqlite.path: /etc/headscale/db.sqlite
```
Modify the config file to your preferences before launching Docker container.
Here are some settings that you likely want:

Alternatively, you can mount `/var/lib` and `/var/run` from your host system by adding
`--volume $(pwd)/lib:/var/lib/headscale` and `--volume $(pwd)/run:/var/run/headscale`
in the next step.
```yaml
# Change to your hostname or host IP
server_url: http://your-host-name:8080
# Listen to 0.0.0.0 so it's accessible outside the container
metrics_listen_addr: 0.0.0.0:9090
# The default /var/lib/headscale path is not writable in the container
noise:
private_key_path: /etc/headscale/noise_private.key
# The default /var/lib/headscale path is not writable in the container
derp:
private_key_path: /etc/headscale/private.key
# The default /var/run/headscale path is not writable in the container
unix_socket: /etc/headscale/headscale.sock
# The default /var/lib/headscale path is not writable in the container
database.type: sqlite3
database.sqlite.path: /etc/headscale/db.sqlite
```

4. Start the headscale server while working in the host headscale directory:
Alternatively, you can mount `/var/lib` and `/var/run` from your host system by adding
`--volume $(pwd)/lib:/var/lib/headscale` and `--volume $(pwd)/run:/var/run/headscale`
in the next step.

```shell
docker run \
--name headscale \
--detach \
--volume $(pwd)/config:/etc/headscale/ \
--publish 127.0.0.1:8080:8080 \
--publish 127.0.0.1:9090:9090 \
headscale/headscale:<VERSION> \
headscale serve
1. Start the headscale server while working in the host headscale directory:

```
```shell
docker run \
--name headscale \
--detach \
--volume $(pwd)/config:/etc/headscale/ \
--publish 127.0.0.1:8080:8080 \
--publish 127.0.0.1:9090:9090 \
headscale/headscale:<VERSION> \
headscale serve
```

Note: use `0.0.0.0:8080:8080` instead of `127.0.0.1:8080:8080` if you want to expose the container externally.
Note: use `0.0.0.0:8080:8080` instead of `127.0.0.1:8080:8080` if you want to expose the container externally.

This command will mount `config/` under `/etc/headscale`, forward port 8080 out of the container so the
`headscale` instance becomes available and then detach so headscale runs in the background.
This command will mount `config/` under `/etc/headscale`, forward port 8080 out of the container so the
`headscale` instance becomes available and then detach so headscale runs in the background.

5. Verify `headscale` is running:
1. Verify `headscale` is running:
Follow the container logs:

Follow the container logs:
```shell
docker logs --follow headscale
```

```shell
docker logs --follow headscale
```
Verify running containers:

Verify running containers:
```shell
docker ps
```

```shell
docker ps
```
Verify `headscale` is available:

Verify `headscale` is available:
```shell
curl http://127.0.0.1:9090/metrics
```

```shell
curl http://127.0.0.1:9090/metrics
```

6. Create a user ([tailnet](https://tailscale.com/kb/1136/tailnet/)):
1. Create a user ([tailnet](https://tailscale.com/kb/1136/tailnet/)):

```shell
docker exec headscale \
headscale users create myfirstuser
```
```shell
docker exec headscale \
headscale users create myfirstuser
```

### Register a machine (normal login)

Expand Down
Loading

0 comments on commit 3cbf646

Please sign in to comment.