mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
docs: update readme
docs: mention tinyproxy in advanced setup instructions
This commit is contained in:
parent
db4cb92c26
commit
31013ad986
@ -130,7 +130,9 @@ Wakapi relies on the open-source [WakaTime](https://github.com/wakatime/wakatime
|
|||||||
1. **Set up WakaTime** for your specific IDE or editor. Please refer to the respective [plugin guide](https://wakatime.com/plugins)
|
1. **Set up WakaTime** for your specific IDE or editor. Please refer to the respective [plugin guide](https://wakatime.com/plugins)
|
||||||
2. **Editing your local `~/.wakatime.cfg`** file as follows
|
2. **Editing your local `~/.wakatime.cfg`** file as follows
|
||||||
|
|
||||||
```
|
```ini
|
||||||
|
[settings]
|
||||||
|
|
||||||
# Your Wakapi server URL or 'https://wakapi.dev/api/heartbeat' when using the cloud server
|
# Your Wakapi server URL or 'https://wakapi.dev/api/heartbeat' when using the cloud server
|
||||||
api_url = http://localhost:3000/api/heartbeat
|
api_url = http://localhost:3000/api/heartbeat
|
||||||
|
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
# Advanced Setup
|
# Advanced Setup
|
||||||
|
This page contains instructions for additional setup options, none of which are mandatory.
|
||||||
|
|
||||||
## Optional: Client-side proxy
|
## Optional: Client-side proxy
|
||||||
Most Wakatime plugins work in a way that, for every heartbeat to send, the plugin calls your local [wakatime-cli](https://github.com/wakatime/wakatime) (a small Python program that is automatically installed when installing a Wakatime plugin) with a few command-line arguments, which is then run as a new process. Inside that process, a heartbeat request is forged and sent to the backend API – Wakapi in this case.
|
Most Wakatime plugins work in a way that, for every heartbeat to send, the plugin calls your local [wakatime-cli](https://github.com/wakatime/wakatime) (a small Python program that is automatically installed when installing a Wakatime plugin) with a few command-line arguments, which is then run as a new process. Inside that process, a heartbeat request is forged and sent to the backend API – Wakapi in this case.
|
||||||
|
|
||||||
@ -6,9 +8,24 @@ While this is convenient for plugin developers, as they do not have to deal with
|
|||||||
|
|
||||||
While this certainly does not hurt, it is still a bit of overhead. You can avoid that by setting up a local reverse proxy on your machine, that keeps running as a daemon and can therefore keep a continuous connection.
|
While this certainly does not hurt, it is still a bit of overhead. You can avoid that by setting up a local reverse proxy on your machine, that keeps running as a daemon and can therefore keep a continuous connection.
|
||||||
|
|
||||||
In this example, [Caddy](https://caddyserver.com) is used as an easy-to-set-up webserver / reverse proxy.
|
### Option 1: [tinyproxy](https://tinyproxy.github.io) forward proxy (`Linux`, `Mac` only)
|
||||||
|
In this example we use _tinyproxy_ as a small, easy-to-install proxy server, written in C, that runs on your local machine.
|
||||||
|
1. Install [tinyproxy](https://tinyproxy.github.io)
|
||||||
|
* Fedora / RHEL: `dnf install tinyproxy`
|
||||||
|
* Debian / Ubuntu: `apt install tinyproxy`
|
||||||
|
* MacOS: Install from [MacPorts](https://ports.macports.org/port/tinyproxy/summary)
|
||||||
|
1. Enable and start it
|
||||||
|
* Linux: `sudo systemctl start tinyproxy && sudo systemctl enable tinyproxy`
|
||||||
|
* Mac: Not sure, sorry ¯\_(ツ)_/¯
|
||||||
|
1. Update `~/.wakatime.cfg`
|
||||||
|
* Set `proxy = http://localhost:8888`
|
||||||
|
1. Done
|
||||||
|
* All Wakapi requests are passed through tinyproxy now, which keeps a TCP connection with the server open for some time
|
||||||
|
|
||||||
1. [Install Caddy](https://caddyserver.com/)
|
### Option 2: [Caddy](https://caddyserver.com) reverse proxy (`Win`, `Linux`, `Mac`)
|
||||||
|
In this example, we misuse Caddy, which is a web server and reverse proxy, to fulfil the above scenario.
|
||||||
|
|
||||||
|
1. [Install Caddy](https://caddyserver.com/)
|
||||||
* When installing manually, don't forget to set up a systemd service to start Caddy on system startup
|
* When installing manually, don't forget to set up a systemd service to start Caddy on system startup
|
||||||
1. Create a Caddyfile
|
1. Create a Caddyfile
|
||||||
```
|
```
|
||||||
@ -26,4 +43,5 @@ In this example, [Caddy](https://caddyserver.com) is used as an easy-to-set-up w
|
|||||||
1. Verify that you can access [`http://localhost:8070/api/health`](http://localhost:8070/api/health)
|
1. Verify that you can access [`http://localhost:8070/api/health`](http://localhost:8070/api/health)
|
||||||
1. Update `~/.wakatime.cfg`
|
1. Update `~/.wakatime.cfg`
|
||||||
* Set `api_url = http://localhost:8070/api/heartbeat`
|
* Set `api_url = http://localhost:8070/api/heartbeat`
|
||||||
1. Done
|
1. Done
|
||||||
|
* All Wakapi requests are passed through Caddy now, which keeps a TCP connection with the server open for some time
|
Loading…
Reference in New Issue
Block a user