How to use trytond-console with docker?

I am doing post migration database update : Migration from 6.8 to 7.0

I entered the command as so :

docker run --network tryton_network --link tryton_postgres:postgres -e DB_PASSWORD=XXXXXXX --rm -ti tryton/tryton trytond-console -d tryton_database

Now Powershell displays this :

/usr/lib/python3/dist-packages/passlib/utils/init.py:854: DeprecationWarning: ‘crypt’ is deprecated and slated for removal in Python 3.13
from crypt import crypt as _crypt
:1049: ImportWarning: PluginImportFixer.find_spec() not found; falling back to find_module()
/usr/lib/python3/dist-packages/zeep/utils.py:1: DeprecationWarning: ‘cgi’ is deprecated and slated for removal in Python 3.13
import cgi
/usr/local/lib/python3.11/dist-packages/braintree/dispute.py:83: DeprecationWarning: Use ProtectionLevel enum instead
warnings.warn(“Use ProtectionLevel enum instead”, DeprecationWarning)
/usr/local/lib/python3.11/dist-packages/braintree/search.py:79: DeprecationWarning: Use protection_level parameter instead
warnings.warn(“Use protection_level parameter instead”, DeprecationWarning)
:1049: ImportWarning: PluginImportFixer.find_spec() not found; falling back to find_module()

Then the cursor blinks and I can type but it doesn’t seem to react.
Can I ignore the warnings and type the commands like below please ?

Yes, you should ignore those warnings.

Once the transaction.commit() is finished (will allow you to continue writing in the console) you can exit() and this part of the migration is done!

In other words, if you can type exit() after transaction.commit() the change have been made, otherwise is not completed because it’s writing all the changes, so when it ends to write the transaction, you can write exit()

1 Like

I was able to type exit() but it doesn’t seem to actually exit and go back to “PowerShell prompt”.

Is there a way to confirm that the changes where made please ?
Thank you very much for your help.

You do not seem to have typed into the prompt. Normally it starts with >>>.
I think you are missing the docker run -ti options.

Hello,
the -ti option is there unfortunately.

I’d suggest starting a regular shell first, to verify that everything works as expected. Then, from the shell start trytond-console.

Thanks @philipp.ludwig
Good idea.
I tried but it doesn’t seem to give the expected >>>.

I meant a shell like bash or sh.

But I just see that you are using docker run, that is not going to work to start the tryton shell. Start your tryton container, then use the docker exec command.

1 Like

So I entered :

docker run --network tryton_network --link tryton_postgres:postgres -e DB_PASSWORD=XXX --rm -ti tryton/tryton bash

The powershell displayed a prompt starting with :

trytond@xxxxxxxxx:/$

so I think it’s in bash mode.
I entered :

trytond-console -d tryton_database

and it displayed this error :

Traceback (most recent call last):
File “/usr/local/bin/trytond-console”, line 30, in
console.run(options)
File “/usr/local/lib/python3.11/dist-packages/trytond/console.py”, line 46, in run
pool.init()
File “/usr/local/lib/python3.11/dist-packages/trytond/pool.py”, line 144, in init
restart = not load_modules(
_____________ ^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/dist-packages/trytond/modules/init.py”, line 401, in load_modules
_load_modules(update)
File “/usr/local/lib/python3.11/dist-packages/trytond/modules/init.py”, line 366, in _load_modules
load_module_graph(graph, pool, update, lang, indexes)
File “/usr/local/lib/python3.11/dist-packages/trytond/modules/init.py”, line 280, in load_module_graph
create_indexes(concurrently=True)
File “/usr/local/lib/python3.11/dist-packages/trytond/modules/init.py”, line 263, in create_indexes
model._update_sql_indexes(concurrently=concurrently)
File “/usr/local/lib/python3.11/dist-packages/trytond/model/modelsql.py”, line 528, in _update_sql_indexes
table_h.set_indexes(indexes, concurrently=concurrently)
File “/usr/local/lib/python3.11/dist-packages/trytond/backend/postgresql/table.py”, line 538, in set_indexes
cursor.execute(
File “/usr/local/lib/python3.11/dist-packages/trytond/backend/postgresql/database.py”, line 71, in execute
cursor.execute(self, sql, args)
psycopg2.errors.UndefinedColumn: column “line” does not exist

Can somebody help again please ?
Sorry for not figuring out alone.
I hope it will help somebody else too.

Did you initialize the database as explained in How to setup a database — Tryton server

I guess so ?
Sorry, I don’t remember it’s been some years since I setup the thing.

I can and am using the software.
I am just trying to input the post database update commands.
Do I have initialize it again please ?

You are missing a line column on some table.
So this means that the database schema is not up to date with the code.

1 Like

Ok the problem was in the calling of bash terminal.
I added the 7.0 tag.>

docker run --network tryton_network --link tryton_postgres:postgres -e DB_PASSWORD=XXX --rm -ti tryton/tryton:7.0 bash

Thanks for your help.

BTW is there a way to check that the post migration transactions have been correctly commited please ?

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.