eloravpn / EloraVPNManager

A comprehensive VPN management solution with multi-zone support, automated account management, and real-time monitoring.
https://t.me/EloraVPNManager
78 stars 18 forks source link

Installed on IPV6 VPS, panel won't load! #52

Closed softfan2019 closed 1 day ago

softfan2019 commented 2 days ago

I have installed script on a vps server that only has IPv6. i could connect to apache on server and see the page but cant load the port that panel is run on it. it show that python is running on port but on ipv4 while apache is listening on ipv6

python 5521 root 7u IPv4 715122113 0t0 TCP *:8080 (LISTEN)

apache2 4982 root 4u IPv6 714927590 0t0 TCP :80 (LISTEN) apache2 4983 www-data 4u IPv6 714927590 0t0 TCP :80 (LISTEN)

How can i make the panel run on ipv6? Thanks

eloravpn commented 2 days ago

Hi

please attach all startup log file and your .env and config.json file after Instalation.

softfan2019 commented 2 days ago

logs from journalctl -u elora-vpn -f after startup. systemd[1]: Started Elora VPN Manager. older line are same, one stop and one start. currently service status is active and running.

information after install (some info removed) Installation Details: [2024-11-29 14:15:36] - Panel URL: http://************:8080 [2024-11-29 14:15:36] - Admin User Name: admin [2024-11-29 14:15:36] - Admin Password: Nadsbrtilulm [2024-11-29 14:15:36] Configurations: [2024-11-29 14:15:36] - Database: elora_db [2024-11-29 14:15:36] - Database User: elora [2024-11-29 14:15:36] - Database Password: s**w [2024-11-29 14:15:36] Configurations: [2024-11-29 14:15:36] - Installation Directory: /opt/elora-vpn [2024-11-29 14:15:36] - Python Configuration File: /opt/elora-vpn/.env [2024-11-29 14:15:36] - Front-end Configuration File: /opt/elora-vpn/static/config.json [2024-11-29 14:15:36] - Service Name: elora-vpn [2024-11-29 14:15:36] Service Management Commands: [2024-11-29 14:15:37] - Check status: systemctl status elora-vpn [2024-11-29 14:15:37] - View logs: journalctl -u elora-vpn -f [2024-11-29 14:15:37] - Restart service: systemctl restart elora-vpn

content of /opt/elora-vpn/.env

SUDO_USERNAME = "admin" SUDO_PASSWORD = "N*****m" # Server Configuration DEBUG=false DOCS=false UVICORN_HOST=0.0.0.0 UVICORN_PORT=8080 UVICORN_UDS=""

#SSL Configuration UVICORN_SSL_CERTFILE="" UVICORN_SSL_KEYFILE=""

# Database Configuration SQLALCHEMY_DATABASE_URL="postgresql+psycopg2://elora:sL84xhkR80VAM59w@localhost:5432/elora_db"

# JWT Settings JWT_SECRETKEY=JE2r"aqv*****NSFnApNq-aK?:3 JWT_ALGORITHM=HS256 JWT_ACCESS_TOKEN_EXPIRE_MINUTES=1440

# Telegram Settings TELEGRAM_PAYMENT_API_TOKEN= BOT_USER_NAME= TELEGRAM_API_TOKEN= #TELEGRAM_ADMIN_ID= TELEGRAM_ADMIN_USER_NAME= TELEGRAM_CHANNEL= SUBSCRIPTION_BASE_URL=http://**********:8080/api/sub

content from file /opt/elora-vpn/static/config.json

{ "GENERATE_SOURCEMAP": false, "BASE_NAME": "Elora", "BASE_DESCRIPTION": "Elora Panel", "BASE_PREFIX": "elora", "BASE_URL": "http://*********:8080/api/", "NAME_MANIFEST": "manifest.json", "EXPIRE_AT": 30, "PATH_TO_LOGIN": "/accounts" }

thanks.

eloravpn commented 2 days ago

The workaround: change host parameter value in main.py in/opt/elora-vpn/main.py

try:
        uvicorn.run(
            "main:app",
            host="::" if not DEBUG else "::1",  # Changed to IPv6 address
            port=UVICORN_PORT,
            uds=uds_path,
            ssl_certfile=UVICORN_SSL_CERTFILE,
            ssl_keyfile=UVICORN_SSL_KEYFILE,
            forwarded_allow_ips="*",
            workers=1,
            reload=DEBUG,
            use_colors=True,
            log_config=log_config,
        )
    except FileNotFoundError:  # to prevent error on removing unix sock
        pass

The key changes made are:

Changed the host parameter from using UVICORN_HOST to "::" (for production) or "::1" (for debug mode) "::" is the IPv6 equivalent of 0.0.0.0 and will listen on all IPv6 interfaces "::1" is the IPv6 equivalent of 127.0.0.1 for debug mode

Then: systemctl stop elora-vpn

systemctl start elora-vpn

softfan2019 commented 2 days ago

changed the code in main.py. result failed to start

● elora-vpn.service - Elora VPN Manager Loaded: loaded (/etc/systemd/system/elora-vpn.service; enabled; vendor preset: enabled) Active: activating (auto-restart) (Result: exit-code) since Fri 2024-11-29 16:26:14 UTC; 959ms ago Process: 6280 ExecStart=/opt/elora-vpn/venv/bin/python main.py (code=exited, status=1/FAILURE) Main PID: 6280 (code=exited, status=1/FAILURE)

Do i need to put ipv6 value in host or this is correct? host="::"

eloravpn commented 2 days ago

This value listen on all interfaces. Let me test on a VM like you and back to you.

eloravpn commented 2 days ago

@softfan2019 revert any changes in main.py and just change the configuration in /opt/elora-vpn/.env

UVICORN_HOST=::

Then: systemctl stop elora-vpn

systemctl start elora-vpn

eloravpn commented 2 days ago

The default for host in main.py is:

host=("127.0.0.1" if DEBUG else UVICORN_HOST),
softfan2019 commented 2 days ago

Didn't work, still service fails to start.

sections of my current files content: /opt/elora-vpn/main.py

"main:app", host=("127.0.0.1" if DEBUG else UVICORN_HOST), port=UVICORN_PORT, uds=uds_path,

and /opt/elora-vpn/.env

Server Configuration

DEBUG=false DOCS=false UVICORN_HOST=:: UVICORN_PORT=8080 UVICORN_UDS=""

p.s. I switch "DEBUG=false" to true and back and tested in both states with same result. also done OS reboot to check.

Is there a log file for uvicorn? maybe it show the error details.

eloravpn commented 2 days ago

Could you re-install the panel?

the log file is here:

tail -f /var/log/elora-vpn/elora-vpn.log
softfan2019 commented 2 days ago

I will do a reinstall and test it again later.

for now the log file show this error

IndentationError: unindent does not match any outer indentation level File "main.py", line 39 except FileNotFoundError: # to prevent error on removing unix sock

it will get repeated.

softfan2019 commented 1 day ago

IT WORKS.

Uninstalled using command in github page reboot install panel again check status running with service on IPv4 stopped service using "systemctl stop elora-vpn" edit the file /opt/elora-vpn/.env UVICORN_HOST=:: started the service "systemctl start elora-vpn"

Check services and now python service is running in IPv6 and panel is loading.

I think the copy paste code in main.py may have overwritten some code or part that was stopping the code.

Thanks for your time and effort.

eloravpn commented 1 day ago

Good job! 👍