README improvements. (#268)

This commit is contained in:
Paul Dee 2022-12-13 21:31:19 +01:00 committed by GitHub
parent d32064dd0e
commit 99b586f1f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,7 +7,7 @@ A web user interface to manage your WireGuard setup.
## Features ## Features
- Friendly UI - Friendly UI
- Authentication - Authentication
- Manage extra client's information (name, email, etc) - Manage extra client information (name, email, etc)
- Retrieve configs using QR code / file - Retrieve configs using QR code / file
## Run WireGuard-UI ## Run WireGuard-UI
@ -87,9 +87,9 @@ These environment variables only apply to the docker container.
### Email configuration ### Email configuration
To use custom `wg.conf` template set the `WG_CONF_TEMPLATE` environment variable to a path to such file. Make sure `wireguard-ui` will be able to work with it - use [default template](templates/wg.conf) for reference. To use a custom `wg.conf` template, set the `WG_CONF_TEMPLATE` environment variable to a path to such file. To make sure `wireguard-ui` will be able to work with it - refer to the [default template](templates/wg.conf).
In order to sent the wireguard configuration to clients via email, set the following environment variables: In order to send the wireguard configuration to clients via email, set the following environment variables:
- using SendGrid API - using SendGrid API
@ -117,9 +117,11 @@ WireGuard-UI only takes care of configuration generation. You can use systemd to
### systemd ### systemd
Create /etc/systemd/system/wgui.service Create `/etc/systemd/system/wgui.service`
``` ```bash
cd /etc/systemd/system/
cat << EOF > wgui.service
[Unit] [Unit]
Description=Restart WireGuard Description=Restart WireGuard
After=network.target After=network.target
@ -130,11 +132,14 @@ ExecStart=/usr/bin/systemctl restart wg-quick@wg0.service
[Install] [Install]
RequiredBy=wgui.path RequiredBy=wgui.path
EOF
``` ```
Create /etc/systemd/system/wgui.path Create `/etc/systemd/system/wgui.path`
``` ```bash
cd /etc/systemd/system/
cat << EOF > wgui.path
[Unit] [Unit]
Description=Watch /etc/wireguard/wg0.conf for changes Description=Watch /etc/wireguard/wg0.conf for changes
@ -143,39 +148,52 @@ PathModified=/etc/wireguard/wg0.conf
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
EOF
``` ```
Apply it Apply it
``` ```sh
systemctl enable wgui.{path,service} systemctl enable wgui.{path,service}
systemctl start wgui.{path,service} systemctl start wgui.{path,service}
``` ```
### openrc ### openrc
Create and `chmod +x` /usr/local/bin/wgui Create and `chmod +x` /usr/local/bin/wgui
``` ```sh
cd /usr/local/bin/
cat << EOF > wgui
#!/bin/sh #!/bin/sh
wg-quick down wg0 wg-quick down wg0
wg-quick up wg0 wg-quick up wg0
EOF
chmod +x wgui
``` ```
Create and `chmod +x` /etc/init.d/wgui Create and `chmod +x` /etc/init.d/wgui
``` ```sh
cd /etc/init.d/
cat << EOF > wgui
#!/sbin/openrc-run #!/sbin/openrc-run
command=/sbin/inotifyd command=/sbin/inotifyd
command_args="/usr/local/bin/wgui /etc/wireguard/wg0.conf:w" command_args="/usr/local/bin/wgui /etc/wireguard/wg0.conf:w"
pidfile=/run/${RC_SVCNAME}.pid pidfile=/run/${RC_SVCNAME}.pid
command_background=yes command_background=yes
EOF
chmod +x wgui
``` ```
Apply it Apply it
``` ```sh
rc-service wgui start rc-service wgui start
rc-update add wgui default rc-update add wgui default
``` ```
### docker ### docker
@ -190,30 +208,34 @@ These settings can also pick up changes to Wireguard Config File Path, after res
Go to the project root directory and run the following command: Go to the project root directory and run the following command:
``` ```sh
docker build -t wireguard-ui . docker build -t wireguard-ui .
``` ```
### Build binary file ### Build binary file
Prepare the assets directory Prepare the assets directory
``` ```sh
./prepare_assets.sh ./prepare_assets.sh
``` ```
Then you can embed resources by generating Go source code Then you can embed resources by generating Go source code
``` ```sh
rice embed-go rice embed-go
go build -o wireguard-ui go build -o wireguard-ui
``` ```
Or, append resources to executable as zip file Or, append resources to executable as zip file
``` ```sh
go build -o wireguard-ui go build -o wireguard-ui
rice append --exec wireguard-ui rice append --exec wireguard-ui
``` ```
## Screenshot ## Screenshot