Gozargah / Marzban-scripts

Some scripts for Marzban
83 stars 72 forks source link

Update marzban.sh #29

Open DigneZzZ opened 1 month ago

DigneZzZ commented 1 month ago

I'm significantly improved the original Marzban installation script.

Key Changes:

  1. Added MySQL Support:

    • You can now install Marzban using MySQL by specifying --database mysql during installation.
    • The script generates a docker-compose.yml with MySQL configuration and updates the .env file accordingly.
  2. Enhanced Xray-core Version Selection Interface:

    • The get_xray_core function now features a user-friendly, colored menu.
    • Select from available Xray-core versions or manually enter a specific version.
    • Improved validation ensures only valid versions are accepted.
  3. Suppressed Logs During Installation and Execution:

    • To improve readability, unnecessary logs are now hidden during installation and command execution.
    • Essential success and error messages are still displayed for clarity.

Brief Usage Instructions:

DigneZzZ commented 3 weeks ago

Marzban-node.sh:

I fixed the script hanging issue during package installation by removing background execution and output redirection in the get_xray_core function. I also modified the install_package function to suppress installation logs using quiet mode flags and output redirection, while keeping errors visible for debugging.

DigneZzZ commented 3 weeks ago

Special for @iamtheted
Enhanced the usage function in Marzban and Marzban-node CLI for improved readability and functionality.

These updates improve the user experience by adding new functionality and making CLI instructions clearer and more visually organized.

iamtheted commented 3 weeks ago

I really appreciate you! This will make things easier for sure.

DigneZzZ commented 1 week ago

Some improvements from the PR have been added.

MILADALEF commented 1 week ago

بررسی نشد ؟؟

zapzocket commented 1 week ago

tnx!!!!!!!!!!!!!

Aknuun commented 1 week ago

عجیبه که چرا pr های به درد بخور دیر تایید میشه اصلا سینت انگار ول کرده رفته

Multivpnlive commented 1 week ago

امیدوارم زودتر بررسی بشه این pr

Iman-GTR commented 1 week ago

I hope so Marzban check and add this PR 🙏 as soon as possible Thanks to Marzban🌹 Thanks to Alexey🌹

nemppn commented 1 week ago

خیلی کاربردی هست امیدوارم زودتر بیاد رو پنل ،✌️😎

nemppn commented 1 week ago

I hope so Marzban check and add this PR 🙏 as soon as possible Thanks to Marzban Thanks to Alexey 😎✌️ you are best brooo

Надеюсь, Marzban проверит и добавит этот PR 🙏 как можно скорее Спасибо Marzban Спасибо Алексею 😎✌️ Ты лучший, братан

Nima786 commented 1 week ago

این خیلی کاربردی و مفید هست و امیدوارم زودتر مرج بشه 👍

iamtheted commented 6 days ago

After testing the script, we found out some points:

1.MySQL username is set to marzban while the default is root and that's what backup scripts use.

2.There's no PhpMyAdmin included, The default password is set to the word "password" so if user decides to setup PhpMyAdmin, he MUST change the password and if he forgets the default password will be the word "password". I believe the script must ask for a password in the first place, choosing a default one is not reasonable.

3.MySQL version is set to 8.3 while it has to be latest

I believe we need to include the default docker file in marzban's document and only add a step in the script to ask for a password. no need for the extra stuff which makes it super complex.

DigneZzZ commented 6 days ago

After testing the script, we found out some points:

1.MySQL username is set to marzban while the default is root and that's what backup scripts use.

2.There's no PhpMyAdmin included, The default password is set to the word "password" so if user decides to setup PhpMyAdmin, he MUST change the password and if he forgets the default password will be the word "password". I believe the script must ask for a password in the first place, choosing a default one is not reasonable.

3.MySQL version is set to 8.3 while it has to be latest

I believe we need to include the default docker file in marzban's document and only add a step in the script to ask for a password. no need for the extra stuff which makes it super complex.

The message above doesn’t quite match reality.

But I’ll make some adjustments.

DigneZzZ commented 6 days ago

Changelog

Implemented Adjustments:

MySQL DB

image

Env file after install:

image

MariaDB

image

MySQL + custom password

image

Optimization MySQL DB:

    command:
      - --mysqlx=OFF                             # Disables MySQL X Plugin to save resources if X Protocol isn't used
      - --bind-address=127.0.0.1                  # Restricts access to localhost for increased security
      - --character_set_server=utf8mb4            # Sets UTF-8 character set for full Unicode support
      - --collation_server=utf8mb4_unicode_ci     # Defines collation for Unicode
      - --log-bin=mysql-bin                       # Enables binary logging for point-in-time recovery
      - --binlog_expire_logs_seconds=1209600      # Sets binary log expiration to 14 days
      - --host-cache-size=0                       # Disables host cache to prevent DNS issues
      - --innodb-open-files=1024                  # Sets the limit for InnoDB open files
      - --innodb-buffer-pool-size=256M            # Allocates buffer pool size for InnoDB
      - --innodb-log-file-size=64M                # Sets InnoDB log file size to balance log retention and performance
      - --innodb-log-files-in-group=2             # Uses two log files to balance recovery and disk I/O
      - --general_log=0                           # Disables general query log for lower disk usage
      - --slow_query_log=1                        # Enables slow query log for performance analysis
      - --slow_query_log_file=/var/lib/mysql/slow.log # Logs slow queries for troubleshooting
      - --long_query_time=2                       # Defines slow query threshold as 2 seconds

Optimization MariaDB:

    command:
      - --bind-address=127.0.0.1                  # Restricts access to localhost for increased security
      - --character_set_server=utf8mb4            # Sets UTF-8 character set for full Unicode support
      - --collation_server=utf8mb4_unicode_ci     # Defines collation for Unicode
      - --host-cache-size=0                       # Disables host cache to prevent DNS issues
      - --innodb-open-files=1024                  # Sets the limit for InnoDB open files
      - --innodb-buffer-pool-size=256M            # Allocates buffer pool size for InnoDB
      - --binlog_expire_logs_seconds=1209600      # Sets binary log expiration to 14 days (2 weeks)
      - --innodb-log-file-size=64M                # Sets InnoDB log file size to balance log retention and performance
      - --innodb-log-files-in-group=2             # Uses two log files to balance recovery and disk I/O
      - --innodb-doublewrite=0                    # Disables doublewrite buffer (reduces disk I/O; may increase data loss risk)
      - --general_log=0                           # Disables general query log to reduce disk usage
      - --slow_query_log=1                        # Enables slow query log for identifying performance issues
      - --slow_query_log_file=/var/lib/mysql/slow.log # Logs slow queries for troubleshooting
      - --long_query_time=2                       # Defines slow query threshold as 2 seconds
Nima786 commented 5 days ago

I ran the script with the first command (installed marzban with mysql) and gave this error on Ubuntu 24.04 and 22.04. "Invalid version format. Please enter a valid version (e.g. v0.5.2)" Then I specified the version as well, but the same error.

DigneZzZ commented 5 days ago

I ran the script with the first command (installed marzban with mysql) and gave this error on Ubuntu 24.04 and 22.04.

"Invalid version format. Please enter a valid version (e.g. v0.5.2)"

Then I specified the version as well, but the same error.

Which command?

Nima786 commented 5 days ago

I ran the script with the first command (installed marzban with mysql) and gave this error on Ubuntu 24.04 and 22.04. "Invalid version format. Please enter a valid version (e.g. v0.5.2)" Then I specified the version as well, but the same error.

Which command?

sudo bash -c "$(curl -sL https://github.com/Gozargah/Marzban-scripts/raw/master/marzban.sh)" @ install --database mysql

DigneZzZ commented 5 days ago

I ran the script with the first command (installed marzban with mysql) and gave this error on Ubuntu 24.04 and 22.04.

"Invalid version format. Please enter a valid version (e.g. v0.5.2)"

Then I specified the version as well, but the same error.

Which command?

sudo bash -c "$(curl -sL https://github.com/Gozargah/Marzban-scripts/raw/master/marzban.sh)" @ install --database mysql

No wonder, this PR hasn’t been merged yet, so this command can’t work.

Nima786 commented 5 days ago

I ran the script with the first command (installed marzban with mysql) and gave this error on Ubuntu 24.04 and 22.04.

"Invalid version format. Please enter a valid version (e.g. v0.5.2)"

Then I specified the version as well, but the same error.

Which command?

sudo bash -c "$(curl -sL https://github.com/Gozargah/Marzban-scripts/raw/master/marzban.sh)" @ install --database mysql

No wonder, this PR hasn’t been merged yet, so this command can’t work.

Oh thanks, is there any way we can test it?

DigneZzZ commented 5 days ago

I ran the script with the first command (installed marzban with mysql) and gave this error on Ubuntu 24.04 and 22.04.

"Invalid version format. Please enter a valid version (e.g. v0.5.2)"

Then I specified the version as well, but the same error.

Which command?

sudo bash -c "$(curl -sL https://github.com/Gozargah/Marzban-scripts/raw/master/marzban.sh)" @ install --database mysql

No wonder, this PR hasn’t been merged yet, so this command can’t work.

Oh thanks, is there any way we can test it?

yes, test it from here commands https://github.com/DigneZzZ/Marzban-scripts-beta

Nima786 commented 5 days ago

I tested and found that phpMyAdmin is not getting installed which I believe should be the part of the instructions. Thank

DigneZzZ commented 5 days ago

I tested and found that phpMyAdmin is not getting installed which I believe should be the part of the instructions. Thank

I don’t agree with the practice of installing PMA directly with the script, as it creates an additional security risk for the server. You can install it yourself if needed.

Nima786 commented 5 days ago

I tested and found that phpMyAdmin is not getting installed which I believe should be the part of the instructions. Thank

I don’t agree with the practice of installing PMA directly with the script, as it creates an additional security risk for the server.

Yeah, it makes sense but if you make it optimal it would be nice, so users have choice. But anyway, thanks for your efforts and really appreciate your contribution

iamtheted commented 5 days ago

Everything is perfect! Thanks a lot!

Except for the docker sample for MySQL, which is still set to 8.3, shouldn't be latest or lts ?

DigneZzZ commented 5 days ago

Except for the docker sample for MySQL, which is still set to 8.3, shouldn't be latest or lts ?

..................