Update README

main
Gerard Braad 2023-06-24 04:22:32 +00:00
parent 7078542414
commit 1bba34958b
1 changed files with 48 additions and 16 deletions

View File

@ -19,7 +19,7 @@ The easiest to get started is by using the following cloud development environme
* Open in [Gitpod workspace](https://gitpod.io/#https://github.com/spotsnel/cockpit-tailscale) * Open in [Gitpod workspace](https://gitpod.io/#https://github.com/spotsnel/cockpit-tailscale)
* Open in [CodeSandbox](https://codesandbox.io/p/github/spotsnel/cockpit-tailscale) * Open in [CodeSandbox](https://codesandbox.io/p/github/spotsnel/cockpit-tailscale)
or you can either use a local `devsys`/`almsys`, like published here: or you can either use a local `devsys`/`almsys`, as published here:
* https://github.com/gbraad-devenv/fedora * https://github.com/gbraad-devenv/fedora
* https://github.com/gbraad-devenv/almalinux * https://github.com/gbraad-devenv/almalinux
@ -30,22 +30,22 @@ or you can either use a local `devsys`/`almsys`, like published here:
Install the following packages to develop and build: Install the following packages to develop and build:
``` ```bash
$ sudo dnf install -y make npm $ sudo dnf install -y make npm
``` ```
and to make the RPM you need: and to make the RPM you need:
``` ```bash
$ sudo dnf install -y rpm-build gettext libappstream-glib $ sudo dnf install -y rpm-build gettext libappstream-glib
``` ```
#### Cockpit user #### Cockpit user
If you want to run cockpit, you need a user with a password: If you want to run Cockpit, you need a user with a password:
``` ```bash
$ sudo dnf install -y passwd $ sudo dnf install -y passwd
$ sudo passwd gbraad $ sudo passwd gbraad
``` ```
@ -56,17 +56,17 @@ After which you can use this user to log in to Cockpit.
### Build ### Build
To perform a development build: To perform a development build:
``` ```bash
$ npm run dev $ npm run dev
```` ````
To perform a production build: To perform a production build:
``` ```bash
$ npm run build $ npm run build
``` ```
For the RPM package: For the RPM package:
``` ```bash
$ npm run rpm $ npm run rpm
``` ```
@ -77,31 +77,50 @@ After the build, copy contents to `/usr/share/cockpit/tailscale`, `/usr/share/lo
#### Link development #### Link development
For convenience, you can also create a symlink to `~/.local/share/cockpit/tailscale` to `$PWD/dist`. However, you will need to logout/login because Cockpit caches the page and assets. For convenience, you can also create a symlink to `~/.local/share/cockpit/tailscale` to `$PWD/dist`. However, you will need to log out and log in because Cockpit caches the page and assets.
To create a link: To create a link:
```
```bash
$ npm run link $ npm run link
``` ```
And to remove: And to remove:
```
```bash
$ npm run unlink $ npm run unlink
``` ```
#### Run Cockpit #### Run Cockpit
You can run Cockpit in a container or remote development environment with the following command: You can run Cockpit in a container or remote development environment with the following command:
```
```bash
$ npm run cockpit $ npm run cockpit
``` ```
You will need to use an account with a password to log in. You will need to use an account with a password to log in.
### Tailscale systemd image #### Origins
For example, on an instance of [spotsnel/tailscale-systemd](https://github.com/spotsnel/tailscale-systemd): If the login fails and you see `bad Origin` errors, you need to modify the `/etc/cockpit/cockpit.conf` file and add something like:
```ini
[WebService]
Origins=https://jqgnyj-9090.csb.app
``` ```
The example shows CodeSandbox. For Gitpod this might look like this:
```ini
[WebService]
Origins=https://9090-spotsnel-cockpittailsca-57e5sbbb0zb.ws-us100.gitpod.io
```
### Tailscale systemd image
You can run this as part of [spotsnel/tailscale-systemd](https://github.com/spotsnel/tailscale-systemd) container image to deploy this inside a Podman machine or similar:
```bash
$ tailscale ssh podmandesktop / podman exec -it tailscale-system bash $ tailscale ssh podmandesktop / podman exec -it tailscale-system bash
# dnf install -y cockpit passwd # dnf install -y cockpit passwd
# systemctl enable --now cockpit.socket # systemctl enable --now cockpit.socket
@ -112,23 +131,36 @@ $ tailscale ssh podmandesktop / podman exec -it tailscale-system bash
# passwd root # passwd root
# tailscale up --ssh # tailscale up --ssh
``` ```
Now you can access the remote cockpit from another host by 'add new host'. Now you can access the remote cockpit from another host by 'add new host'.
Note: remote hosts get authenticated over SSH. If you have conflicts, like on WSL, you can serve on `localhost` instead. Note: remote hosts get authenticated over SSH. If you have conflicts, like on WSL, you can serve on `localhost` instead.
`/etc/systemd/system/cockpit.socket.d/listen.conf` `/etc/systemd/system/cockpit.socket.d/listen.conf`
``` ```ini
[Socket] [Socket]
ListenStream= ListenStream=
ListenStream=127.0.0.1:9090 ListenStream=127.0.0.1:9090
FreeBind=yes FreeBind=yes
``` ```
``` Note: the blank `ListenStream` is intentional as it resets the parameter.
Now set up the forward from the Tailscale client to open port `9090`:
```bash
# tailscale serve tcp:9090 tcp://localhost:9090 # tailscale serve tcp:9090 tcp://localhost:9090
# systemctl daemon-reload # systemctl daemon-reload
# systemctl restart cockpit.socket # systemctl restart cockpit.socket
``` ```
Now you can navigate to the Tailscale IP:
```
# tailscale ip -4
100.113.113.114
```
Open https://100.113.113.114:9090.
Authors Authors
------- -------