donaldzou / WGDashboard

Simple dashboard for WireGuard VPN written in Python & Vue.js
https://donaldzou.github.io/WGDashboard-Documentation/
Apache License 2.0
1.53k stars 229 forks source link

Python Version does not get updated #422

Open Raukze opened 2 weeks ago

Raukze commented 2 weeks ago

Describe The Problem I tried to update wireguard's dashboard today (./wgd.sh update), but it fails because the installed Python version is too low. I would have expected the update script to also update my Python version if it is below the minimum required version.

Expected Error / Traceback

root@wireguard:/etc/wgdashboard/src# ./wgd.sh update
[WGDashboard] OS: debian
[WGDashboard] ✔ Python is installed
[WGDashboard] ✗ Could not find a compatible version of Python. Current Python is Python 3.9.2.
[WGDashboard] WGDashboard required Python 3.10, 3.11 or 3.12. Halting install now.
Terminated

To Reproduce LXC-Container in Proxmox created via https://tteck.github.io/Proxmox/#wireguard-lxc Running ./wgd.sh update

OS Information:

DaanSelen commented 1 week ago

Hello Raukze, I think updating Python itself is kind of a big ask if you just want to update your WGDashboard, because there are a lot of changes between Python versions. therefore it is really riskful to suddenly update the Python version.

But if you see this differently! Please tell me how we can improve this!

Raukze commented 1 week ago

The point I want to make is that ./wgd.sh installs Python if it is not already installed. Therefore, I would have expected it to also update the version of Python when I use the update command of ./wgd.sh. I mean, I also understand your point that it is risky, but in my case I have a dedicated LCX container in Proxmox running only wireguard and WGDashboard. Maybe an optional flag would be a way to let the user decide. What do you think?

Raukze commented 1 week ago

To add to that. I tried manually updating the Python version to 3.10.0 with the following commands from here

wget https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz && \
tar -xvf Python-3.10.0.tgz && \
cd Python-3.10.0 && \
sudo ./configure --enable-optimizations && \
sudo make && \
sudo make altinstall

I then added the symlink ln -s /usr/local/bin/python3.10 /usr/local/bin/python3

When running the ./wgd.sh update I get the following errors:

root@wireguard:/etc/wgdashboard/src# ./wgd.sh update
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.10/urllib/request.py", line 216, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/local/lib/python3.10/urllib/request.py", line 519, in open
    response = self._open(req, data)
  File "/usr/local/lib/python3.10/urllib/request.py", line 541, in _open
    return self._call_chain(self.handle_open, 'unknown',
  File "/usr/local/lib/python3.10/urllib/request.py", line 496, in _call_chain
    result = func(*args)
  File "/usr/local/lib/python3.10/urllib/request.py", line 1419, in unknown_open
    raise URLError('unknown url type: %s' % type)
urllib.error.URLError: <urlopen error unknown url type: https>
------------------------------------------------------------
| Are you sure you want to update to the ? (Y/N): Y
| Shutting down WGDashboard...                             |
| Downloading  from GitHub...                            |
| Upgrading pip                                            |
| Installing latest Python dependencies                    |
| Update Successfully!                                     |
------------------------------------------------------------

I then tried running ./wgd.sh start which also is no success:

root@wireguard:/etc/wgdashboard/src# ./wgd.sh start
[WGDashboard] WireGuard is already installed.
------------------------------------------------------------
[WGDashboard] Starting WGDashboard with Gunicorn in the background.
[WGDashboard] Creating Python Virtual Environment under ./venv
sudo: ./venv/bin/gunicorn: command not found

it seems to be stuck in the script after that output.

donaldzou commented 1 week ago

Hi, please try the step 1,2 and 3 on here "How to update?" and see if it works?

Raukze commented 1 week ago

Damn I just restored the backup. Will try the whole update progress later again. Thanks!

Raukze commented 1 week ago

Update is successful:

root@wireguard:/etc/wgdashboard/src# ./wgd.sh update
------------------------------------------------------------
| Are you sure you want to update to the v4.0.4? (Y/N): Y
| Shutting down WGDashboard...                             |
| Downloading v4.0.4 from GitHub...                            |
| Upgrading pip                                            |
| Installing latest Python dependencies                    |
| Update Successfully!                                     |
------------------------------------------------------------

But when trying to start:

root@wireguard:/etc/wgdashboard/src# ./wgd.sh start
------------------------------------------------------------
[WGDashboard] Starting WGDashboard with Gunicorn in the background.
[WGDashboard] Creating Python Virtual Environment under ./venv
sudo: ./venv/bin/gunicorn: command not found

and it stops there.

barryboom commented 1 week ago

reported a few weeks ago that the upgrade process does not work moving from v3 to v4 but as yet still no resoloution but some troubleshooting links it back to bcrypt

donaldzou commented 1 week ago

Hi @Raukze , you mind follow these steps instead of using ./wgd.sh update?

  1. Change your directory to wgdashboard

    cd wgdashboard/src
  2. Update the dashboard

    git pull https://github.com/donaldzou/WGDashboard.git --force
  3. Install

    sudo ./wgd.sh install
DaanSelen commented 6 hours ago

@donaldzou the updating method is through GitHub correct?