🪜 Usage
Start
This command will start WGDashboard and run it in the background.
Stop
This command will stop WGDashboard.
Restart
This command will stop and start WGDashboard in the background.
Debug Mode
This command will run WGDashboard in the foreground and output logs on the screen.
Run WGDashboard as a system service
In the src
folder, it contained a file called wg-dashboard.service
, we can use this file to let our system autostart the dashboard after reboot. The following guide has tested on Ubuntu, most Debian based OS might be the same, but some might not. Please don't hesitate to provide your system if you have tested the autostart on another system.
Changing the directory to the dashboard's directory
cd WGDashboard/srcGet the full path of the dashboard's directory
pwd #Output: /root/WGDashboard/srcFor this example, the output is
/root/wireguard-dashboard/src
, your path might be different since it depends on where you downloaded the dashboard in the first place. Copy the the output to somewhere, we will need this in the next step.Edit the service file, the service file is located in
wireguard-dashboard/src
, you can use other editor you like, here will be usingnano
nano wg-dashboard.serviceYou will see something like this:
[Unit] After=syslog.target network-online.target Wants=wg-quick.target ConditionPathIsDirectory=/etc/wireguard [Service] Type=forking PIDFile=<absolute_path_of_WGDashboard_src>/gunicorn.pid WorkingDirectory=<absolute_path_of_WGDashboard_src> ExecStart=<absolute_path_of_WGDashboard_src>/wgd.sh start ExecStop=<absolute_path_of_WGDashboard_src>/wgd.sh stop ExecReload=<absolute_path_of_WGDashboard_src>/wgd.sh restart TimeoutSec=120 PrivateTmp=yes Restart=always [Install] WantedBy=multi-user.targetNow, we need to replace all
<absolute_path_of_WGDashboard_src>
to the one you just copied from step 2. After doing this, the file will become something like this, your file might be different:Be aware that after the value of
WorkingDirectory
, it does not have a/
(slash). And then save the file after you edited itCopy the service file to systemd folder
$ sudo cp wg-dashboard.service /etc/systemd/system/wg-dashboard.serviceTo make sure you copy the file successfully, you can use this command
cat /etc/systemd/system/wg-dashboard.service
to see if it will output the file you just edited.Enable the service
$ sudo chmod 664 /etc/systemd/system/wg-dashboard.service $ sudo systemctl daemon-reload $ sudo systemctl enable wg-dashboard.service $ sudo systemctl start wg-dashboard.service # <-- To start the serviceCheck if the service run correctly
$ sudo systemctl status wg-dashboard.serviceAnd you should see something like this
● wg-dashboard.service Loaded: loaded (/etc/systemd/system/wg-dashboard.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2024-08-14 22:21:47 EDT; 55s ago Process: 494968 ExecStart=/root/WGDashboard/src/wgd.sh start (code=exited, status=0/SUCCESS) Main PID: 495005 (gunicorn) Tasks: 5 (limit: 4523) Memory: 36.8M CPU: 789ms CGroup: /system.slice/wg-dashboard.service ├─495005 /root/WGDashboard/src/venv/bin/python3 ./venv/bin/gunicorn --config ./gunicorn.conf.py └─495007 /root/WGDashboard/src/venv/bin/python3 ./venv/bin/gunicorn --config ./gunicorn.conf.py Aug 14 22:21:40 wg sudo[494978]: root : PWD=/root/WGDashboard/src ; USER=root ; COMMAND=./venv/bin/gunicorn --config ./gunicorn.conf.py Aug 14 22:21:40 wg sudo[494978]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=0) Aug 14 22:21:40 wg wgd.sh[494979]: [WGDashboard] WGDashboard w/ Gunicorn will be running on 0.0.0.0:10086 Aug 14 22:21:40 wg wgd.sh[494979]: [WGDashboard] Access log file is at ./log/access_2024_08_14_22_21_40.log Aug 14 22:21:40 wg wgd.sh[494979]: [WGDashboard] Error log file is at ./log/error_2024_08_14_22_21_40.log Aug 14 22:21:40 wg sudo[494978]: pam_unix(sudo:session): session closed for user root Aug 14 22:21:45 wg wgd.sh[494968]: [WGDashboard] Checking if WGDashboard w/ Gunicorn started successfully Aug 14 22:21:47 wg wgd.sh[494968]: [WGDashboard] WGDashboard w/ Gunicorn started successfully Aug 14 22:21:47 wg wgd.sh[494968]: ------------------------------------------------------------ Aug 14 22:21:47 wg systemd[1]: Started wg-dashboard.service.If you see
Active:
followed byactive (running) since...
then it means it run correctly.Stop/Start/Restart the service
sudo systemctl stop wg-dashboard.service # <-- To stop the service sudo systemctl start wg-dashboard.service # <-- To start the service sudo systemctl restart wg-dashboard.service # <-- To restart the serviceAnd now you can reboot your system, and use the command at step 6 to see if it will auto start after the reboot, or just simply access the dashboard through your browser. If you have any questions or problem, please report it in the issue page.
Enable WireGuard configuration when WGDashboard start
You can add this in the service file. For example you want to enable wg0
when WGDashboard start
So now wg0
will start before WGDashboard starts.