Connecting to PostgreSQL Server

I’m hoping to migrate over from PostBooks. Very familiar with how that connects to PostgreSQL, but am challenged with Tryton since my knowledge is very limited to what I have figured out before.

I installed the 5.0 lts desktop client on Windows 10 and it seems to run the demo just fine. In PostgreSQL, I created a role named trytond, user with all the permissions, then a database with same settings as PostBooks.

There was no folder named “tryton” in my etc folder in the Tryton 5.0 folder on my c drive for the trytond.config file. I only found a .config file in the docs folder. A trytond.application.app is mentioned in the WSGI server section - do I need that or is that just for the server that runs the GUI for the client in a web browser?

I added a “tryton” folder in my etc folder and put a config file in there that I found here on the forum - edited my server user name and tried that. Is it required to put the actual password in where “password” is in the example - such as : user:password@localhost:5432/ ? Is it required to use “admin” for a user - matching a “admin” user in PostgreSQL?

Thanks in advance for any help given!

Hello @jayd, welcome to Tryton :slight_smile:.

In fact tryton, as you said, is just a client that can connect to a trytond server.
You need to install this server, which will in turn connects to the backend of your choice (usually PostgreSQL indeed).

You might want to start with a docker image as it’s usually easier to set up: Tryton - Get Tryton

Thank you very much - I do have a PostgreSQL server set up already, was using that for PostBooks. Set up a fresh database for Tryton, and I believe I am having trouble with the trytond.conf file. I will try the docker image on another windows 10 later today and see if that is helpful.

You can find the description of the file at Configuration file for Tryton — Tryton server

Thank you! I have read that through many times but I think I am confused about this part of that:

I’ve assumed that I do not need to initiate the PostgreSQL server as directed in the documentation, because this only refers to the web server to run the client, which is working already just fine with the demo database - but I am not confident my thinking is correct:
How to start the server

Web service

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

trytond -c

The server will wait for client connections on the interface defined in the web section of the configuration.

You always need to run the server even if you use the desktop client.
Tryton is based on a three-tiers architecture not matter the presentation tier you are using (desktop, browser etc.).

Just to be clear - I understand I need the PostgreSQL server for the database - but do I need to go through this initiation step if the desktop client is working? Am I correct that this step only applies to the web server that the client runs on in the browser?

Yes.

No, you always need the application tiers which is the trytond server.

Ok thanks - so there are not two “servers”, one for the database and one for the client app - there is only one?

Back to the tryton.config file - adding the tryton folder in the etc file with the tryton.config.py file inside is on the right track then or do I need to use the trytond.application.app I mentioned? If so where do I find this app?
tryton%20folder
Regarding the config file, Is it required to put the actual password in where “password” is in the example - such as : user:password@localhost:5432/ or do I just leave “password” alone ?

Is it required to use “admin” for a user - matching a “admin” user in PostgreSQL? or is any name fine for the user as long as it matches?

I am studying the Docker approach, sounds like that may be an easier way to go. Thank you for the extra help, I will be happy to make a donation to the foundation if I can get this up and running!

What you are trying to do is connecting with the tryton-client directly to the database. But you must connect with the tryton-client to the tryton-server. The tryton-server then connects to the database. In this situation you can have multiple tryton-clients connected to a tryton-server at the same time.

So what you have to do is setting up a tryton-server. You have already installed the tryton-client. Unfortunately the tryton-server has no setup.exe for windows because it’s fully programmed in Python. So the way you have to go is to learn Docker and use that if you want to stay on Windows. See Tryton - Get Tryton and https://hub.docker.com/r/tryton/tryton/ for more information how to setup tryton-server with Docker.

I think there are still some misunderstanding here.
The screenshot you are showing is clearly the folder of the client installation. You do not need to touch this at all.

You must install the tryton server named trytond inside a Python environment using for example pip etc. We do not provide any executable for the server because it requires a full Python stack.
Or you can use the Docker image which provide a trytond server fully installed.

You need:

  • tryton client
  • trytond server
  • postgresql server

The config file is for trytond server. If you are working on Windows, you will need the docker container due to trytond is Linux citizen.

You have to put your Postgresql connection data and user credentials (user, password, machine and port).

There is no limitation about backend user name.

Ah ok very clear now - thank you very much all of you for your replies! Downloading docker now :).

It is doable to make an install directly on Windows but it requires a good skill in Python on Windows. But once Python setup, normally it should be installable with pip.

I do have linux mint rosa as well that I will work on later perhaps. I noticed the distribution available in my package manager was older (3. something), and I assume that could cause problems if I wanted to restore a backup database built using the newer 5.0 windows client - would that indeed have potential issues?

I should set up a dedicated linux server for all of my workstations to connect to and back it up well, but I’m not smart enough yet to set one up properly, so having multiple workstations with internal servers is my crazy preference for now since I am the only user for the Tryton application.

I believe I understand correctly now that the tritond server would still be required on the windows machines if I were to connect to a remote linux postgresql server?

Thank you all for your help!

The 3.* series are no more supported since long time now. You should try to get a more recent version and if you do not want to much pain to update to often, you can go with the LTS 5.0.

Yes you always need a tryton server but instead of installing it on the windows machine, you can install it on yout linux server next to PostgreSQL. It is better to have a close connection between tryton server and the database because some processes may read a lot of data from the database.

In the world of scientists a Python distribution is used called Anaconda https://www.anaconda.com/ It comes with a lot of packages and boilerplate. It has it’s own package installer but can also use pip.

Nope that’s not needed, imagine you have several workstations to work in Tryton. You have to:

  • setup a postgresql database on a server
  • on that same server (for the sake of clarity) you install tryton-server (e.g. creating a Python virtual environment and than installing with pip the tryton-server with pip install trytond)
  • you have to configure your tryton-server to be able to connect to the postgresql database with the connection string. And then run the tryton-server in administrator mode to initialize the database
  • on your workstations you have to install the tryton-clients. Your tryton-clients connect to the tryton-server. You fill those parameters into the connection dialog when you start the tryton-client

You cannot mix major versions between tryton-server and tryton-clients. So you cannot connect with tryton-client 5.0.2 to a tryton-server 3.8.4. However you can connect with a tryton-client 5.0.2 to a tryton-server 5.0.9.

If needed I can write down the steps I take to install tryton-server into a Python virtual environment.

A post was split to a new topic: Access Tryton from another machine