Open dpacassi opened 2 years ago
hey! Same for me, while I am looking for the twelve version. Also I cannot override the credentials
@dpacassi @Daisuke-sama can you please provide steps to replicate. Using the following lando file:
name: d9-postgres
recipe: drupal9
config:
webroot: .
php: '7.4'
xdebug: false
database: postgres:13
The commands show the right version:
john@tandem:~/lando/1-test-sites/d9-postgres$ lando psql --version
psql (PostgreSQL) 13.5
john@tandem:~/lando/1-test-sites/d9-postgres$ lando psql
psql (13.5)
sure, my steps:
name: web
recipe: lemp
config:
php: 7.4
database: postgres:12
//or
services:
database:
type: postgres:12
portforward: 54321
and I get pg_restore --version
or sql --version
is 10 unless I force the installation of 12 using the run section of the configuration. Because my dump file doesn't load to the database and writes incompatible version.
strange @Daisuke-sama on this lando file:
name: d9-postgres
recipe: drupal9
config:
webroot: .
php: '7.4'
xdebug: false
database: postgres:13
I get the following:
john@tandem:~/lando/1-test-sites/d9-postgres$ lando ssh -s database
www-data@5a3068247653:/app$ psql --version
psql (PostgreSQL) 13.5
www-data@5a3068247653:/app$ pg_restore --version
pg_restore (PostgreSQL) 13.5
And on yours:
name: lando-rando
recipe: lemp
config:
php: 7.4
database: postgres:12
john@tandem:~/lando/1-test-sites/rando-tests$ lando ssh -s database
www-data@bed14b152d0c:/app$ pg_restore --version
pg_restore (PostgreSQL) 12.9
www-data@bed14b152d0c:/app$ psql --version
psql (PostgreSQL) 12.9
What version of Lando are you on? Have you tried purging your system and starting over? https://docs.lando.dev/help/purging-containers.html
Same problem
After purging my system and starting over.
I think the issue description captures this, but our team ran into this and the cause wasn't obvious so I'll add a comment. Here's a minimal repro, showing that with a simple configuration it's possible to see mismatched client versions:
.lando.yml:
name: lando-test
recipe: drupal7
config:
database: postgres:12
steps to reproduce:
$ lando ssh -s database -c 'pg_restore --version'
pg_restore (PostgreSQL) 12.9
$ lando ssh -s appserver -c 'pg_restore --version'
pg_restore (PostgreSQL) 10.23 (Debian 10.23-1.pgdg110+1)
$ lando ssh -c 'pg_restore --version'
pg_restore (PostgreSQL) 10.23 (Debian 10.23-1.pgdg110+1)
(the last two commands are the same, specifying then omitting the host)
In a Drupal recipe, drush sql:*
will be wrapping the appserver versions of the commands, while Lando's sql-import
command will use the database
host's client tools and versions (unless the user specifies -h
).
If the appserver needs matching versions (eg to use drush sql:*
commands with PostgreSQL), then a workaround is to add a build step for your appserver to install a matching set of PostgreSQL client commands, as noted by @dpacassi in the issue description.
Working on both postgres and non-postgres projects, I'd probably rather Lando didn't add such a build step by default, unless it applied only to Lando configurations where postgres was used, as I wouldn't want to have to wait for extra steps on a rebuild if the project at hand won't use those tools at all.
NB: @Daisuke-sama https://github.com/lando/postgres/issues/2#issuecomment-1086101718 did not behave as expected because the test was done with lando ssh database
(which drops the user into an appserver shell), not lando ssh -s database
(database shell).
When creating a Drupal project with Lando and the following yml file:
The DB version is 13 while the client bin versions (
psql
andpg_dump
on appserver) are still on version 10. If I define another Postgres version in the config, I'd expect that the recipe automatically uses the right version also for the client commands (psql
,pg_dump
).I guess this is related to lando/lando#1680. I found a workaround also there. I added following lines to get the client bins with the right version: