Where is the trytond.conf in the repository?


#1

Hi,

the daemon trytond needs a config file as written in the documentation. But where is the (default) config file placed? If I start trytond without a config file, it doesn’t stop or crash. Can I just pass an empty *.ini file?
Maybe we can improve this documentation, since normally a default config file exists.

If I install tryton through the software manager in my Linux Mint/Ubuntu system, I see the config file is placed in /etc/tryton/trytond.conf. Is this file auto generated?


(Sergi Almacellas Abellana) #2

The server has a default configuration values that allow to run them without any configuration file.

All the available options and default values are explained on the configuration section of the documentation.

You can create a new file and include the sections/values you want to modify. Once you have created this file you should start the webserver using the created config file.

Each distribution package is responsible for generating a base file for its configuration but this files are not included if you install trytond from Python Packages.


#3

I tried from the ubuntu software manager and from the mercurial clone.
I just cannot find the config file in the both cloned repositories.


(Sergi Almacellas Abellana) #4

I will recommend you to create a new file from scratch and include the required sections as explained on the documentation.


#5

If I run trytond without any parameter, the tryton app will look for a sqlite db.
How to pass a postgresql db to trytond without a config file? Supposed my postgresql runs in localhost:5432, the database name is trytondb, username: “demo”, and the linux user passwd is “mypasswd”.


(Cédric Krier) #6

Could you point where it is stated? We need to remove that.

See http://doc.tryton.org/4.8/trytond/doc/topics/configuration.html#uri


#7

Yes, we have to update the documentation. It states here.

You can start the default web server bundled in Tryton with this command line:

trytond -c <config file>

There is no sentence that we can run without a config file in default mode.


(Cédric Krier) #8

I do not fully agree. It is your interpretation that a configuration file is required.
So I think it is better to show the common command line in such topic without being exhaustive.
And also this topic comes after the one that describe the configuration file format. So if you follow the First Steps, you will have a configuration file.


#9

I tried these both command without success:

 trytond -d postgresql://demo:mypasswd@localhost:5432/trytondb -v

or

trytond -d postgresql://demo:mypasswd@/trytondb -v

Instead, trytond returns:

usage: trytond [-h] [--version] [-c FILE [FILE ...]] [-v] [--dev]
               [-d DATABASE [DATABASE ...]] [--logconf FILE] [--pidfile FILE]
trytond: error: unrecognized arguments: d

Do you have a concrete example to start trytond with a postgresql db?

this is the open port of my local DB:

tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      1171/postgres   
tcp6       0      0 ::1:5432                :::*                    LISTEN      1171/postgres 

If I put this uri: uri = postgresql://demo:mypasswd@localhost:5432/ in my config file, trytond app can run. However, the client tryton cannot connect to the DB with this settings:
Host: localhost:5432
Database: trytondb
User name: demo

tryton app crash with this error (issue 7477:

Traceback (most recent call last):
  File "bin/tryton", line 69, in <module>
    client.TrytonClient().run()
   ...
  File "/usr/lib/python2.7/xmlrpclib.py", line 1283, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1313, in single_request
    response = h.getresponse(buffering=True)
  File "/usr/lib/python2.7/httplib.py", line 1136, in getresponse
    response.begin()
  File "/usr/lib/python2.7/httplib.py", line 453, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python2.7/httplib.py", line 417, in _read_status
    raise BadStatusLine(line)
BadStatusLine: ''

#10

The daemon trytond itself runs on http://localhost:8000/.

INFO werkzeug  * Running on http://localhost:8000/

is my entry on the host field wrong?


(Cédric Krier) #11

The -d option is for the database name only. The connection to the database must be configured in the configuration file.

The client does not connect to the database but to the tryton server.


#12

Hi @ced,

I created a sqlite database called trytondb.sqlite. After running the client, it throws an application error:

Traceback (most recent call last):
  File "bin/tryton", line 69, in <module>
    client.TrytonClient().run()
Fault: <Fault u'Database "trytondb.sqlite" doesn\'t exist!': u'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 40, in rpc\n    request, database_name, *request.rpc_params)\n  File "/trytond/protocols/dispatcher.py", line 47, 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)\nIOError: Database "trytondb.sqlite" doesn\'t exist!\n'>

Where do I have to place my sqlite database?


(Cédric Krier) #13

Please try to stay on topic. Are you using PostgreSQL or SQLite? (btw: SQLite is only for testing development)


#14

I cannot use both of the database options. I’m not expert with database and I need somehow more explanation how to setup a database and connect to it. I meant, I can install the Postgresql, create a database with my username and run the Postgresql server. But the application cannot connect to the database. Instead showing some hints or a concrete example what can be wrong the application just crashes.

The documentation is good, but it is not clear enough and it doesn’t solve my issue. I’m a new user here but I’m not new at all using Python and Linux. I can start Odoo without any issue after cloning the repository to my local Linux PC. But here, I’m just stuck and spent almost my two days only to start the application and connect to the database.


(Cédric Krier) #15

And what is the exception? (exception gives precious information about the issue that’s why they are not hidden)


(春节) #16

Have you solved your problem?


Execute the command startup under bin
./trytond -c /home/wangpeng/try4.8/config/wangd.conf -v


#17

Hi @chunjie,

Thanks for asking. I was disappointed that I cannot use the software and no significant support can help my issue. I tried to explain my issue and situation in a simple way. In my opinion, there is no simple step-by-step example or documentation to start tryton software.

Tryton community shall check documentation for getting started from Odoo and ERPnext.

Thus, I’m trying ERPnext now. Your screenshot regarding the PostgreSQL is not new for me. I’ll try again later.


#18

I tried again trytond by typing the Postgresql uri in my config file.
I observed two cases:

Case 1: using the postgresql database with my linux username, which is already exist for a long time ago. It seems I cannot login to the database due to invalid password.

OperationalError: FATAL:  password authentication failed for user "why2"
FATAL:  password authentication failed for user "why2"

I tried to change my password using :

> psql -c"ALTER USER why2 WITH PASSWORD 'mypassword'" -d trytondb
> ALTER ROLE

Started the daemon and the app, I saw this log:

[2018-06-01 16:02:37,690] ERROR trytond.security login failed for 'why2' from '127.0.0.1' on database 'trytondb'

Case 2: Create a new Role called tryton_admin, and its postgresql DB db_tryton. After starting the daemon and the app, this is what I get:

Traceback (most recent call last):
  File "./tryton", line 69, in <module>
    client.TrytonClient().run()
  File "/home/why2/tryton/tryton/tryton/client.py", line 294, in run
    main.sig_login()
  File "/home/why2/tryton/tryton/tryton/gui/main.py", line 858, in sig_login
    common.Login(func)
  File "/home/why2/tryton/tryton/tryton/common/common.py", line 1126, in __init__
    func(parameters)
  File "/home/why2/tryton/tryton/tryton/gui/main.py", line 855, in <lambda>
    host, port, database, username, parameters, language)
  File "/home/why2/tryton/tryton/tryton/rpc.py", line 72, in login
    result = connection.common.db.login(username, parameters, language)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1243, in __call__
    return self.__send(self.__name, args)
  File "/home/why2/tryton/tryton/tryton/jsonrpc.py", line 296, in __request
    raise Fault(*response['error'])
Fault: <Fault u'relation "ir_cache" does not exist\nLINE 1: SELECT "a"."timestamp", "a"."name" FROM "ir_cache" AS "a"\n                                                ^\n': u'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 40, in rpc\n    request, database_name, *request.rpc_params)\n  File "/trytond/protocols/dispatcher.py", line 57, in login\n    database_name, user, parameters, context=context)\n  File "/trytond/security.py", line 30, in login\n    with Transaction().start(dbname, 0, context=context) as transaction:\n  File "/trytond/transaction.py", line 106, in start\n    Cache.clean(database.name)\n  File "/trytond/cache.py", line 111, in clean\n    cursor.execute(*table.select(table.timestamp, table.name))\n  File "/trytond/backend/postgresql/database.py", line 61, in execute\n    cursor.execute(self, sql, args)\nProgrammingError: relation "ir_cache" does not exist\nLINE 1: SELECT "a"."timestamp", "a"."name" FROM "ir_cache" AS "a"\n                                                ^\n\n'>

Another case that I have is that if I start tryton with the same virtual env what I set for trytond, it cannot find gi module ImportError: No module named gi. If I start without virtual env, I can start the tryton application. But than get the error as the both cases above :frowning:.


(Cédric Krier) #19

This is a typical miss-configuration. The password, you set in the configuration is wrong (or maybe you do not need a password see https://www.postgresql.org/docs/current/static/auth-methods.html).

I guess you did not have yet created any user ‘why2’ in this Tryton database. The initilization of the database creates only one user named ‘admin’. So you must connect with this ‘admin’ user (using the password you entered at the end of the initialization) before being able to create new users. (Rem: this is the same as for Odoo)

It looks like you did not setup the database as the document describe: http://doc.tryton.org/tip/trytond/doc/topics/setup_database.html#topics-setup-database

The gobject-introspection package is installable via pip. So you can not have it in your virtualenv, you must run the client from the system Python.


(春节) #20

I hope to communicate with you. I am currently using Tryton, which can run well.

OperationalError: FATAL: password authentication failed for user “why2”

FATAL: password authentication failed for user “why2”
This error, which I’ve encountered before, can be resolved by creating users using postgres’s management software.
You can then execute the startup command under bin,The following is my configuration file and project structure.
My English is not very good. I don’t understand the description of some things. Please forgive me.