Database not working

I have install tryton using docker and docker compose. I am not able to login http://localhost:8000 using admin as user name and password. Its asking for Database which not shows on login page. Need help thanks

Did you create and initialize a database?

When you run the “Setup the database”, it should request you to setup the password for admin user.

Perhaps my tutorial will help Install Tryton using Docker on Ubuntu – Dale Scott

yes i need help. I have followed your tutorial but same problem. I do not get option to input databse name on login page at http://localhost:8000/

i just install trytond-admin but what is config file not getting this point

Please check attached. terminal not ask me setup any password for admin user.

I do not see that you run:

$ docker run --link tryton-postgres:postgres -e DB_PASSWORD=mysecretpassword -it tryton/tryton trytond-admin -d tryton --all

PS: please do not use screenshots for text, but copy/paste so it can be searched and read by blind people.

After run this commands this is what i see:

root@cli:~# docker run --link tryton-postgres:postgres -e DB_PASSWORD=Securep@swd -it tryton/tryton trytond-admin -d tryton --all
1 140227640512576 [2024-01-09 18:09:47,873] ERROR trytond.backend.postgresql.database connection to "tryton" failed
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/trytond/backend/postgresql/database.py", line 226, in __new__
    inst._connpool = ThreadedConnectionPool(
                     ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/psycopg2/pool.py", line 161, in __init__
    AbstractConnectionPool.__init__(
  File "/usr/lib/python3/dist-packages/psycopg2/pool.py", line 59, in __init__
    self._connect()
  File "/usr/lib/python3/dist-packages/psycopg2/pool.py", line 63, in _connect
    conn = psycopg2.connect(*self._args, **self._kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/psycopg2/__init__.py", line 122, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
psycopg2.OperationalError: could not translate host name "swd@172.17.0.2" to address: Name or service not known

Traceback (most recent call last):
  File "/usr/local/bin/trytond-admin", line 31, in <module>
    admin.run(options)
  File "/usr/local/lib/python3.11/dist-packages/trytond/admin.py", line 30, in run
    database = backend.Database(db_name)
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/trytond/backend/postgresql/database.py", line 226, in __new__
    inst._connpool = ThreadedConnectionPool(
                     ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/psycopg2/pool.py", line 161, in __init__
    AbstractConnectionPool.__init__(
  File "/usr/lib/python3/dist-packages/psycopg2/pool.py", line 59, in __init__
    self._connect()
  File "/usr/lib/python3/dist-packages/psycopg2/pool.py", line 63, in _connect
    conn = psycopg2.connect(*self._args, **self._kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/psycopg2/__init__.py", line 122, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
psycopg2.OperationalError: could not translate host name "swd@172.17.0.2" to address: Name or service not known

As you put an @ in the DB_PASSWORD, the construction of the URI is failing. Retry without @ in the password until Using '@' in DB_PASSWORD fails to connect (#8) · Issues · Tryton / Tryton Docker · GitLab is solved.

changed DB password

docker run --link tryton-postgres:postgres -e DB_PASSWORD=Securep786wd -it tryton/tryton trytond-admin -d tryton --all

but same error:

root@cli:~# docker run --link tryton-postgres:postgres -e DB_PASSWORD=Securep786wd -it tryton/tryton trytond-admin -d tryton --all
1 139896292298816 [2024-01-09 20:15:02,723] ERROR trytond.backend.postgresql.database connection to "tryton" failed
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/trytond/backend/postgresql/database.py", line 226, in __new__
    inst._connpool = ThreadedConnectionPool(
                     ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/psycopg2/pool.py", line 161, in __init__
    AbstractConnectionPool.__init__(
  File "/usr/lib/python3/dist-packages/psycopg2/pool.py", line 59, in __init__
    self._connect()
  File "/usr/lib/python3/dist-packages/psycopg2/pool.py", line 63, in _connect
    conn = psycopg2.connect(*self._args, **self._kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/psycopg2/__init__.py", line 122, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
psycopg2.OperationalError: connection to server at "172.17.0.2", port 5432 failed: FATAL:  database "tryton" does not exist

Traceback (most recent call last):
  File "/usr/local/bin/trytond-admin", line 31, in <module>
    admin.run(options)
  File "/usr/local/lib/python3.11/dist-packages/trytond/admin.py", line 30, in run
    database = backend.Database(db_name)
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/trytond/backend/postgresql/database.py", line 226, in __new__
    inst._connpool = ThreadedConnectionPool(
                     ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/psycopg2/pool.py", line 161, in __init__
    AbstractConnectionPool.__init__(
  File "/usr/lib/python3/dist-packages/psycopg2/pool.py", line 59, in __init__
    self._connect()
  File "/usr/lib/python3/dist-packages/psycopg2/pool.py", line 63, in _connect
    conn = psycopg2.connect(*self._args, **self._kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/psycopg2/__init__.py", line 122, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
psycopg2.OperationalError: connection to server at "172.17.0.2", port 5432 failed: FATAL:  database "tryton" does not exist

You must change the database name to pgdb because it is was you set in previous command so it should be:

docker run --link tryton-postgres:postgres -e DB_PASSWORD=Securep786wd -it tryton/tryton trytond-admin -d pgdb --all

For smooth experience, you must follow the command of Docker like exactly.

thanks its work after follow the command exactly

For the record, I worked on a simple ready to docker compose file: Provide a simple compose file (!22) · Merge requests · Tryton / Tryton Docker · GitLab

After i click Logout it shows this error:

SyntaxError: Failed to execute ‘open’ on ‘XMLHttpRequest’: Invalid URL

REPORT BUG