eloravpn / EloraVPNManager

A central solution to manage accounts in a Cluster enviroment of VPN Servers.
https://t.me/EloraVPNChannel
32 stars 9 forks source link

error when trying to launch the panel #40

Open deadcxap opened 4 days ago

deadcxap commented 4 days ago

I did a clean install of ubuntu 22, installed only python 3.10.12, pip 22.0.2, libpq-dev, Nodejs 20.18.0, npm 10.8.2, yarn 1.22.22 I configured api_token in .env, admin_id and sub_base_url When I try to launch I get this error after the "alembic upgrade head" command

deadcxap@ubucxap:~/EloraVPNManager$ alembic upgrade head
Telegram Payment Bot not set!
Notification jobs are disabled!
Sync accounts JOBS are disabled!
Remove disabled account JOBS are disabled!
Order JOBS are disabled!
Traceback (most recent call last):
  File "/home/deadcxap/.local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 145, in __init__
    self._dbapi_connection = engine.raw_connection()
  File "/home/deadcxap/.local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 3292, in raw_connection
    return self.pool.connect()
  File "/home/deadcxap/.local/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 452, in connect
    return _ConnectionFairy._checkout(self)
  File "/home/deadcxap/.local/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 1269, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/deadcxap/.local/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 716, in checkout
    rec = pool._do_get()
  File "/home/deadcxap/.local/lib/python3.10/site-packages/sqlalchemy/pool/impl.py", line 284, in _do_get
    return self._create_connection()
  File "/home/deadcxap/.local/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 393, in _create_connection
    return _ConnectionRecord(self)
  File "/home/deadcxap/.local/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 678, in __init__
    self.__connect()
  File "/home/deadcxap/.local/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 902, in __connect
    with util.safe_reraise():
  File "/home/deadcxap/.local/lib/python3.10/site-packages/sqlalchemy/util/langhelpers.py", line 146, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/deadcxap/.local/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 898, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
  File "/home/deadcxap/.local/lib/python3.10/site-packages/sqlalchemy/engine/create.py", line 637, in connect
    return dialect.connect(*cargs, **cparams)
  File "/home/deadcxap/.local/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 616, in connect
    return self.loaded_dbapi.connect(*cargs, **cparams)
  File "/home/deadcxap/.local/lib/python3.10/site-packages/psycopg2/__init__.py", line 122, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused
        Is the server running on that host and accepting TCP/IP connections?

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/deadcxap/.local/bin/alembic", line 8, in <module>
    sys.exit(main())
  File "/home/deadcxap/.local/lib/python3.10/site-packages/alembic/config.py", line 632, in main
    CommandLine(prog=prog).main(argv=argv)
  File "/home/deadcxap/.local/lib/python3.10/site-packages/alembic/config.py", line 626, in main
    self.run_cmd(cfg, options)
  File "/home/deadcxap/.local/lib/python3.10/site-packages/alembic/config.py", line 603, in run_cmd
    fn(
  File "/home/deadcxap/.local/lib/python3.10/site-packages/alembic/command.py", line 385, in upgrade
    script.run_env()
  File "/home/deadcxap/.local/lib/python3.10/site-packages/alembic/script/base.py", line 582, in run_env
    util.load_python_file(self.dir, "env.py")
  File "/home/deadcxap/.local/lib/python3.10/site-packages/alembic/util/pyfiles.py", line 94, in load_python_file
    module = load_module_py(module_id, path)
  File "/home/deadcxap/.local/lib/python3.10/site-packages/alembic/util/pyfiles.py", line 110, in load_module_py
    spec.loader.exec_module(module)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/deadcxap/EloraVPNManager/src/migration/alembic/env.py", line 82, in <module>
    run_migrations_online()
  File "/home/deadcxap/EloraVPNManager/src/migration/alembic/env.py", line 72, in run_migrations_online
    with connectable.connect() as connection:
  File "/home/deadcxap/.local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 3268, in connect
    return self._connection_cls(self)
  File "/home/deadcxap/.local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 147, in __init__
    Connection._handle_dbapi_exception_noconnection(
  File "/home/deadcxap/.local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2430, in _handle_dbapi_exception_noconnection
    raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
  File "/home/deadcxap/.local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 145, in __init__
    self._dbapi_connection = engine.raw_connection()
  File "/home/deadcxap/.local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 3292, in raw_connection
    return self.pool.connect()
  File "/home/deadcxap/.local/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 452, in connect
    return _ConnectionFairy._checkout(self)
  File "/home/deadcxap/.local/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 1269, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/deadcxap/.local/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 716, in checkout
    rec = pool._do_get()
  File "/home/deadcxap/.local/lib/python3.10/site-packages/sqlalchemy/pool/impl.py", line 284, in _do_get
    return self._create_connection()
  File "/home/deadcxap/.local/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 393, in _create_connection
    return _ConnectionRecord(self)
  File "/home/deadcxap/.local/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 678, in __init__
    self.__connect()
  File "/home/deadcxap/.local/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 902, in __connect
    with util.safe_reraise():
  File "/home/deadcxap/.local/lib/python3.10/site-packages/sqlalchemy/util/langhelpers.py", line 146, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/deadcxap/.local/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 898, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
  File "/home/deadcxap/.local/lib/python3.10/site-packages/sqlalchemy/engine/create.py", line 637, in connect
    return dialect.connect(*cargs, **cparams)
  File "/home/deadcxap/.local/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 616, in connect
    return self.loaded_dbapi.connect(*cargs, **cparams)
  File "/home/deadcxap/.local/lib/python3.10/site-packages/psycopg2/__init__.py", line 122, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused
        Is the server running on that host and accepting TCP/IP connections?

(Background on this error at: https://sqlalche.me/e/20/e3q8)
deadcxap@ubucxap:~/EloraVPNManager$

If I run main.py, the service starts, but any attempt to contact the telegram bot gives an error

 ERROR - utils.add_or_get_user:298 - (psycopg2.OperationalError) connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused
        Is the server running on that host and accepting TCP/IP connections?

(Background on this error at: https://sqlalche.me/e/20/e3q8)

EloraVPNManagerPanel is installed and starts, but when I try to log in with the username/password admin I get an error

Uncaught runtime errors:
×
ERROR
Cannot read properties of undefined (reading 'data')
TypeError: Cannot read properties of undefined (reading 'data')
    at Object.error (http://192.168.20.208:3000/static/js/bundle.js:4809:38)
    at http://192.168.20.208:3000/static/js/bundle.js:16479:76

I tried installing postgresql separately, but that didn't solve the problem. Should the script configure the database itself, or should it be done manually?

eloravpn commented 4 days ago

Hi

onnection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused Is the server running on that host and accepting TCP/IP connections?

do you install postgresql on this server?

eloravpn commented 4 days ago

https://github.com/eloravpn/EloraVPNManager?tab=readme-ov-file#database

deadcxap commented 3 days ago

I reinstalled the entire stack, used an external postgre, created a database and user there, and the error changed to this:

deadcxap@ubucxap:~/EloraVPNManager$ alembic upgrade head
Telegram Payment Bot not set!
Order JOBS are disabled!
Sync accounts JOBS are disabled!
Remove disabled account JOBS are disabled!
Notification jobs are disabled!
INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO  [alembic.runtime.migration] Will assume transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade  -> 704bb66b328f, Create a baseline migrations
INFO  [alembic.runtime.migration] Running upgrade 704bb66b328f -> d8b2d9e1700d, Add network field to InboundConfig
INFO  [alembic.runtime.migration] Running upgrade d8b2d9e1700d -> 8c6b724752e9, Add Notification models
INFO  [alembic.runtime.migration] Running upgrade 8c6b724752e9 -> 3b5685f8dd99, Init commerce tables
INFO  [alembic.runtime.migration] Running upgrade 3b5685f8dd99 -> 33bad9194cea, Add column enable to service model
INFO  [alembic.runtime.migration] Running upgrade 33bad9194cea -> c48ee34607da, Add date columns to service model
INFO  [alembic.runtime.migration] Running upgrade c48ee34607da -> 42f7b8e1a7af, Add referral user id columns to user model
INFO  [alembic.runtime.migration] Running upgrade 42f7b8e1a7af -> c639b45954ac, Add commerce types to notificationtype
INFO  [alembic.runtime.migration] Running upgrade c639b45954ac -> 9b69e8d4688e, Add user_id to Notification model
INFO  [alembic.runtime.migration] Running upgrade 9b69e8d4688e -> 76945c05dad7, Add HostZone model
INFO  [alembic.runtime.migration] Running upgrade 76945c05dad7 -> 1d0e2502f045, Add Reality to InboundSecurity
INFO  [alembic.runtime.migration] Running upgrade 1d0e2502f045 -> 6f6fcd3424aa, Add gRPC to InboundNetwork
INFO  [alembic.runtime.migration] Running upgrade 6f6fcd3424aa -> 82515a1003a8, Add Reality params to InboundConfig
INFO  [alembic.runtime.migration] Running upgrade 82515a1003a8 -> b21f5b2d77ec, Add InboundFlow type
INFO  [alembic.runtime.migration] Running upgrade b21f5b2d77ec -> 2b59bac07ae2, Add IP Limit
INFO  [alembic.runtime.migration] Running upgrade 2b59bac07ae2 -> 0a889efbe845, Add host zone id to Order model
INFO  [alembic.runtime.migration] Running upgrade 0a889efbe845 -> 77c9260b83e6, Add force_join_channel to User model
INFO  [alembic.runtime.migration] Running upgrade 77c9260b83e6 -> 56e35f688981, Add Monitoring Result model
INFO  [alembic.runtime.migration] Running upgrade 56e35f688981 -> f452162261a7, add send_to_admin to Notification model
INFO  [alembic.runtime.migration] Running upgrade f452162261a7 -> d986a59ac521, Add some fields to Account model
INFO  [alembic.runtime.migration] Running upgrade d986a59ac521 -> c1ea3c87fe77, Add service host zones relation
INFO  [alembic.runtime.migration] Running upgrade c1ea3c87fe77 -> fe1a3ae27e35, Add Club Score model
INFO  [alembic.runtime.migration] Running upgrade fe1a3ae27e35 -> 318548385b4c, Add Desription To Club Score
INFO  [alembic.runtime.migration] Running upgrade 318548385b4c -> b70bc92791cd, Add Club Profile Model
INFO  [alembic.runtime.migration] Running upgrade b70bc92791cd -> 5c89d4bccd15, Add photo_url and keyboard to Notification Model
Traceback (most recent call last):
  File "/home/deadcxap/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1969, in _exec_single_context
    self.dialect.do_execute(
  File "/home/deadcxap/.local/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 922, in do_execute
    cursor.execute(statement, parameters)
psycopg2.errors.UndefinedObject: index "ix_account_used_traffic_account_id" does not exist

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/bin/alembic", line 33, in <module>
    sys.exit(load_entry_point('alembic==1.13.1.dev0', 'console_scripts', 'alembic')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/deadcxap/.local/lib/python3.12/site-packages/alembic/config.py", line 632, in main
    CommandLine(prog=prog).main(argv=argv)
  File "/home/deadcxap/.local/lib/python3.12/site-packages/alembic/config.py", line 626, in main
    self.run_cmd(cfg, options)
  File "/home/deadcxap/.local/lib/python3.12/site-packages/alembic/config.py", line 603, in run_cmd
    fn(
  File "/home/deadcxap/.local/lib/python3.12/site-packages/alembic/command.py", line 385, in upgrade
    script.run_env()
  File "/home/deadcxap/.local/lib/python3.12/site-packages/alembic/script/base.py", line 582, in run_env
    util.load_python_file(self.dir, "env.py")
  File "/home/deadcxap/.local/lib/python3.12/site-packages/alembic/util/pyfiles.py", line 94, in load_python_file
    module = load_module_py(module_id, path)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/deadcxap/.local/lib/python3.12/site-packages/alembic/util/pyfiles.py", line 110, in load_module_py
    spec.loader.exec_module(module)  # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/home/deadcxap/EloraVPNManager/src/migration/alembic/env.py", line 82, in <module>
    run_migrations_online()
  File "/home/deadcxap/EloraVPNManager/src/migration/alembic/env.py", line 76, in run_migrations_online
    context.run_migrations()
  File "<string>", line 8, in run_migrations
  File "/home/deadcxap/.local/lib/python3.12/site-packages/alembic/runtime/environment.py", line 928, in run_migrations
    self.get_context().run_migrations(**kw)
  File "/home/deadcxap/.local/lib/python3.12/site-packages/alembic/runtime/migration.py", line 628, in run_migrations
    step.migration_fn(**kw)
  File "/home/deadcxap/EloraVPNManager/src/migration/alembic/versions/5c89d4bccd15_add_photo_url_and_keyboard_to_.py", line 22, in upgrade
    op.drop_index(
  File "<string>", line 8, in drop_index
  File "<string>", line 3, in drop_index
  File "/home/deadcxap/.local/lib/python3.12/site-packages/alembic/operations/ops.py", line 1094, in drop_index
    return operations.invoke(op)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/deadcxap/.local/lib/python3.12/site-packages/alembic/operations/base.py", line 395, in invoke
    return fn(self, operation)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/deadcxap/.local/lib/python3.12/site-packages/alembic/operations/toimpl.py", line 104, in drop_index
    operations.impl.drop_index(
  File "/home/deadcxap/.local/lib/python3.12/site-packages/alembic/ddl/impl.py", line 395, in drop_index
    self._exec(schema.DropIndex(index))
  File "/home/deadcxap/.local/lib/python3.12/site-packages/alembic/ddl/impl.py", line 193, in _exec
    return conn.execute(  # type: ignore[call-overload]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/deadcxap/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1416, in execute
    return meth(
           ^^^^^
  File "/home/deadcxap/.local/lib/python3.12/site-packages/sqlalchemy/sql/ddl.py", line 181, in _execute_on_connection
    return connection._execute_ddl(
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/deadcxap/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1528, in _execute_ddl
    ret = self._execute_context(
          ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/deadcxap/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1848, in _execute_context
    return self._exec_single_context(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/deadcxap/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1988, in _exec_single_context
    self._handle_dbapi_exception(
  File "/home/deadcxap/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2343, in _handle_dbapi_exception
    raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
  File "/home/deadcxap/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1969, in _exec_single_context
    self.dialect.do_execute(
  File "/home/deadcxap/.local/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 922, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedObject) index "ix_account_used_traffic_account_id" does not exist

[SQL:
DROP INDEX ix_account_used_traffic_account_id]
(Background on this error at: https://sqlalche.me/e/20/f405)