Start trytond with posgresql

Hello!

I want to test Tryton if it fits my needs, so i want to set up a testserver. But i have a problem to start trytond with a postgresql. The topic is simmilar to https://discuss.tryton.org/t/cannot-connect-to-postgressql-db/574.

As you see below i have made a posgresql database with utf8 named trytondatabase and the owner trytonuser.

postgres=# \l
                                 List of databases
      Name      |   Owner    | Encoding  | Collate | Ctype |   Access privileges   
----------------+------------+-----------+---------+-------+-----------------------
 postgres       | postgres   | SQL_ASCII | C       | C     | 
 template0      | postgres   | SQL_ASCII | C       | C     | =c/postgres          +
                |            |           |         |       | postgres=CTc/postgres
 template1      | postgres   | UTF8      | C       | C     | 
 trytondatabase | trytonuser | UTF8      | C       | C     | 
(4 rows)

Output from

sudo netstat -anpt | grep LISTEN

is

tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN 701/postgres

(i only show the posgresql).

When try the first run with

trytond-admin -c /home/testserver/.config/tryton/5.0/trytond.conf -d trytondatabase --all

(also tried
trytond-admin -c /home/testserver/.config/tryton/5.0/trytond.conf --all
because the database is defined the the trytond.conf file, neither that works)

with this

[database]
uri = postgresql://trytonuser:testpassword@localhost:5432/
path = /var/lib/tryton
list = True
language = en

trytond.conf file, Tryton asks me to set up an e-mail adress und a password. So far, so good. But when i try to login on the Tryton Client, see below

2019-07-15%2023-15-34

i get an error:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/tryton/gui/main.py", line 276, in do_activate
    common.Login()
  File "/usr/lib/python3/dist-packages/tryton/common/common.py", line 1012, in __init__
    func(parameters)
  File "/usr/lib/python3/dist-packages/tryton/rpc.py", line 88, in login
    result = connection.common.db.login(username, parameters, language)
  File "/usr/lib/python3.7/xmlrpc/client.py", line 1112, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python3/dist-packages/tryton/jsonrpc.py", line 285, in __request
    raise Fault(*response['error'])
tryton.jsonrpc.Fault: <Fault 'Database "trytondatabase.sqlite" doesn\'t exist!': 'Traceback (most recent call last):\n  File "/trytond/wsgi.py", line 73, in dispatch_request\n    return endpoint(request, **request.view_args)\n  File "/trytond/protocols/dispatcher.py", line 46, in rpc\n    request, database_name, *request.rpc_params)\n  File "/trytond/protocols/dispatcher.py", line 53, in login\n    Database(database_name).connect()\n  File "/trytond/backend/sqlite/database.py", line 265, in connect\n    raise IOError(\'Database "%s" doesn\\\'t exist!\' % db_filename)\nOSError: Database "trytondatabase.sqlite" doesn\'t exist!\n'>

But i do not use sqlite? What i am doing wrong?

Many thanks for help!

Greetings
name1234

btw: i sign in before with an other name, but it seems that outlook . com does not like Tryton . org (spaces because i am a new user) . I also looked at the spams, no register mail there, just for information!

Probably you are pointing to a wrong trytond.conf server configuration file.
By default trytond server uses sqlite as backend if you miss configuration file or point to a wrong file path.

You need to pass the tryton configuration file to the trytond server/Daemon:
trytond -c /path/to/conf
You can check if you start the tryton server with the correct config via ps (assuming you’re on Linux):
ps -ax | egrep trytond

Thank you for the extreme fast reply! But i do not think that this is the case. Because when i try to link a file, what does not exists, i get an error like

could not load /home/testserver/.config/tryton/5.0/xtrytond.conf
Traceback (most recent call last):
  File "/usr/bin/trytond-admin", line 21, in <module>
    admin.run(options)
  File "/usr/lib/python3/dist-packages/trytond/admin.py", line 25, in run
    with Transaction().start(db_name, 0, _nocache=True):
  File "/usr/lib/python3/dist-packages/trytond/transaction.py", line 93, in start
    database = Database(database_name).connect()
  File "/usr/lib/python3/dist-packages/trytond/backend/sqlite/database.py", line 265, in connect
    raise IOError('Database "%s" doesn\'t exist!' % db_filename)
OSError: Database "trytondatabase.sqlite" doesn't exist!

I think that the error is in the command

trytond-admin -c /home/testserver/.config/tryton/5.0/trytond.conf -d trytondatabase --all

or similar. But i do not get it. Also in the docs i do not find a solution.

Btw, i use Tryton Server 5.0.4-2 and Tryton Client 5.0.5-1 with Posgresql 11.4-1 with Debian 10, if relevant.

Thank you for helping!

Greetings
name1234

Hello!

Thanks for the hint! I thought that the file can lie everywere when i link it. I will it this tomorrow an will respond.

Greetings
name1234

Your are poiting to the wrong configuration file or the file is not readable by the user you are running trytond, which makes the server ignore it.

If you the trytond server with verbose flags enabled (-vv) you will see some logs at the start of the process indicating the configuration files used and which are discarded by permision issues.

Hope it helps!

The file can not be loaded. So either the path is incorrect or the file does not exist or the user does not have the right to read this file.

But how do you start the server (until now you always shown the trytond-admin command line).
As you seem to have installed tryton from the Debian packages, I suspect that you have a trytond running as a service which is not configured to use your configuration file.

Hello!

wifasoi : It seems that when i do the link like above, it still links to /etc/trytond/trytond.conf . Thanks for the hint.

pokoli : yes that seems is one issue, but not the only. Thanks for that.

nicoe : that was just a test case, if i get an error when i set a false path, and yes, i get an error. But when the path is OK, it also does not like the file (without error or warnings). But thanks anyway.

ced : yes, you are right. The trytond run at the start with the preseted config file in /etc/tryton/trytond.conf . Thanks for helping.

So i stopped the server, deleted the old database and created a new. I also edited the config file in /etc/tryton/trytond.conf like above and run

trytond-admin -c /etc/tryton/trytond.conf --all

. No reaction but also no error. Then i started with trytond -c /etc/tryton/trytond.conf . When i start the client i get a error

ERROR trytond.security login failed for 'trytonuser' from '127.0.0.1' on database 'trytondatabase'

in the log of the trytond console (not in /var/log/tryton). The password is correct (double checked it). Have anyone a hint for me?

btw.: of course i also read the docs, but it seems that i am too supid for that.

Thanks for helping.

Greetings
name1234

This does nothing if you do set a database option.

Hello!

When i do the same procedure ident like before exept the command with
trytond-admin -c /etc/tryton/trytond.conf -d trytondatabase --all
i get the same error like before with the sqlite database, which i does not use. I think there is a syntax issue or similar. The database is named trytondatabase on the server (localhost). Should the command be different when i use postgresql?

Thanks for helping!

Greetings
user1234

That just means that the configuration does not define postgresql as backend.
So the file has wrong syntax or can not be read.

OK. That could be. My tryton.conf looks like

[database]
uri = postgresql://trytonuser:password@localhost:5432/
path = /var/lib/tryton
list = True
language = en

that. Not more, not less. Do you see any error?

Thanks for any hint!

In previous message you talked about /etc/tryton/trytond.conf and now tryton.conf.
It can not work if you edit another configuration file than the one used.

Sorry, just a typo in the message …

With all the different explanation, example, I think it is no more possible to help you without having a full/complete description of everything. All the configuration files used with their content, every command lines typed with the full output.

OK, i write it tomorrow. But i can not upload a conf file (only pictures), i hope the code tags are enough.

Many thanks for helping.

Greetings
name1234

Check out your pg_hba.conf file where postgres manages permissions between user and database.

Hello!

Sorry for late replying.

@josesalvador : checked that before, all config in postgresql was right. With the settings of postgresql i spent many days before i installed tryton.

But i get worked. The answer is here: stackoverflow link .

The first time when you login in the client you have set the user name to “admin”.

01
I always thought that you have to set it like the owner of the database, like mine trytonuser.

postgres=# \l
                                 List of databases
      Name      |   Owner    | Encoding  | Collate | Ctype |   Access privileges   
----------------+------------+-----------+---------+-------+-----------------------
 postgres       | postgres   | SQL_ASCII | C       | C     | 
 template0      | postgres   | SQL_ASCII | C       | C     | =c/postgres          +
                |            |           |         |       | postgres=CTc/postgres
 template1      | postgres   | UTF8      | C       | C     | 
 trytondatabase | trytonuser | UTF8      | C       | C     | 
(4 rows)

To be honest, a little confusing, but ok. But i do not read that in the docs. The only hint, that the first login user could be “admin” is here, but not more described in any form. Correct me, if i am wrong. (no offensive).

Summary what i am doing wrong.

  1. The only config file, the trytond accept is in /etc/tryton/trytond.conf . (at least in debian 10)
  2. The admin thing above.

Maybe i will asking some questions later, but for now i am happy.

Greetings
name1234

1 Like