usmannasir / cyberpanel

Cyber Panel - The hosting control panel for OpenLiteSpeed
GNU General Public License v3.0
1.49k stars 582 forks source link

[BUG] MySQL Configuration Error with remote db host in settings.py and db user creation #1125

Open ghost opened 10 months ago

ghost commented 10 months ago

Describe the bug When installing Cyberpanel with the script and MySQL on a remote host, the script on my opinion misconfigures /usr/local/CyberCP/CyberCP/settings.py which causes the a 500 error because Cyberpanel cannot read/write on the database “cyberpanel”.

To Reproduce What steps did you take when the issue occurred?

  1. Installation with Script on Rocky Linux 8
  2. Remote MySQL / MariaDB Host
  3. calling https://IP:8090 causes Error 500

Expected behavior Showing Panel Login Page

Operating system: Rocky 8

CyberPanel version: 2.3.4

Additional context when installing Cyberpanel with the script and MySQL on a remote host, the script on my opinion misconfigures /usr/local/CyberCP/CyberCP/settings.py which causes the a 500 error because Cyberpanel cannot read/write on the database “cyberpanel”.

The IP of the remote MySQL Host is correctly configured for the root user (local IP of container running MariaDB). But for the cyberpanel database it sets the public IP:


    DATABASES = {
    ‘default’: {
    ‘ENGINE’: ‘django.db.backends.mysql’,
    ‘NAME’: ‘cyberpanel’,
    ‘USER’: ‘cyberpanel’,
    ‘PASSWORD’: ‘XXXXXXXX’,
    ‘HOST’: ‘1.2.3.4’, ← public IP of LXD host
    ‘PORT’:‘3306’
    },
    ‘rootdb’: {
    ‘ENGINE’: ‘django.db.backends.mysql’,
    ‘NAME’: ‘mysql’,
    ‘USER’: ‘root’,
    ‘PASSWORD’: ‘XXXXXXXX’,
    ‘HOST’: ‘192.168. 100.10’, ← local IP of LXD Database Container
    ‘PORT’:‘3306’,
    },
    }

The cyberpanel user created on the database container is granted all privileges on the public IP, not on the local IP as specified in the set up script as it should to in order to be able to read/write the database.

So the remote cyberpanel database cannot be accessed from the cyberpanel container which causes the 500 error on access of the panel (http://192.168.100.20:8090/).

I tried to simply update /usr/local/CyberCP/CyberCP/settings.py and grant the cyberpanel user all privileges on the local IP as well but debug mode then shows

    ProgrammingError at /
    (1146, “Table ‘cyberpanel.django_session’ doesn’t exist”)

I assume that because of the public IP Cyberpanel could not initially create all database tables and data.

What could I do? Does the script has to be adapted?

Thanks for helping!

Magnus

asklinux commented 10 months ago

I have the same issue..Any update how to fix? Check in databases the table is emptyTs hasnan bin hasim ceo & co foundertunnelbiz studio sdn bhd tunnelbiz.comPada 10 Sep 2023 9:29 PM, AGENCIES UNITED labs @.***> menulis: Describe the bug When installing Cyberpanel with the script and MySQL on a remote host, the script on my opinion misconfigures /usr/local/CyberCP/CyberCP/settings.py which causes the a 500 error because Cyberpanel cannot read/write on the database “cyberpanel”. To Reproduce What steps did you take when the issue occurred? Installation with Script on Rocky Linux 8Remote MySQL / MariaDB Hostcalling https://IP:8090 causes Error 500 Expected behavior Showing Panel Login Page Operating system: Rocky 8 CyberPanel version: 2.3.4 Additional context when installing Cyberpanel with the script and MySQL on a remote host, the script on my opinion misconfigures /usr/local/CyberCP/CyberCP/settings.py which causes the a 500 error because Cyberpanel cannot read/write on the database “cyberpanel”. The IP of the remote MySQL Host is correctly configured for the root user (local IP of container running MariaDB). But for the cyberpanel database it sets the public IP:

DATABASES = {
‘default’: {
‘ENGINE’: ‘django.db.backends.mysql’,
‘NAME’: ‘cyberpanel’,
‘USER’: ‘cyberpanel’,
‘PASSWORD’: ‘XXXXXXXX’,
‘HOST’: ‘1.2.3.4’, ← public IP of LXD host
‘PORT’:‘3306’
},
‘rootdb’: {
‘ENGINE’: ‘django.db.backends.mysql’,
‘NAME’: ‘mysql’,
‘USER’: ‘root’,
‘PASSWORD’: ‘XXXXXXXX’,
‘HOST’: ‘192.168. 100.10’, ← local IP of LXD Database Container
‘PORT’:‘3306’,
},
}

The cyberpanel user created on the database container is granted all privileges on the public IP, not on the local IP as specified in the set up script as it should to in order to be able to read/write the database. So the remote cyberpanel database cannot be accessed from the cyberpanel container which causes the 500 error on access of the panel (http://192.168.100.20:8090/). I tried to simply update /usr/local/CyberCP/CyberCP/settings.py and grant the cyberpanel user all privileges on the local IP as well but debug mode then shows ProgrammingError at / (1146, “Table ‘cyberpanel.django_session’ doesn’t exist”)

I assume that because of the public IP Cyberpanel could not initially create all database tables and data. What could I do? Does the script has to be adapted? Thanks for helping! Magnus

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

ghost commented 10 months ago

If you want to sell Add-Ons, you should be a bit faster with reacting to issues. We love your features and your OLS integration but we decided to buy another solution now.

Before we buy it, we wanted to make sure that the system is running perfectly. That is not the case. Pity.