The user Thomas_Rother is experiencing a build error when trying to migrate from a two-container setup to a central database server. The error occurs during the db:migrate step, with a Pups::ExecError and a failed bootstrap.
Thomas_Rother initially suspected that the issue might be with the remote database connection, but pfaffman suggested checking if the remote database is available from the server. Thomas_Rother confirmed that the database server is accessible and provided the correct database credentials.
Falco suggested looking for earlier error messages, which led to the discovery of a permission issue with the discourse user on the central Postgres server. supermathie pointed out that the error was due to the discourse user lacking sufficient privileges on the users table.
Thomas_Rother granted all privileges on the discourse database to the discourse user, but supermathie suggested that this might not affect existing tables. Thomas_Rother found permission issues in the Postgres logs and supermathie provided additional SQL commands to grant the necessary privileges.
Ultimately, Thomas_Rother recreated the user, database, and permissions, including granting all privileges on tables created by the discourse user in the future. The build finished successfully, and the instance is now running fine with the remote Postgres server.
Hi,
I am currently migrating from a classical two container setup (separated web_only and data containers) to a setup where the database is hosted on a central database server (not inside a docker container).
The central database was created from the dump.sql which is part of the backup file. The docker compose web_only.yaml uses
During the build of web_only I get the following error:
FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 741 exit 1>
Location of failure: /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
bootstrap failed with exit code 1
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
The database host is accessible with these data. Any ideas whats happening here? The same build with the standard database container finishes successfully.
Are you sure that the remote database is available from the server? It looks like it’s not. Can you telnet to the database port from the web server machine?
Concerning the DISCOURSE_DB_SOCKET: ‘’: as we use a remote connection, I would guess that the socket value is not relevant in both cases (dockered data or remote data)
…
docker_manager is already at latest compatible version
wp-discourse is already at latest compatible version
I, [2023-11-10T21:08:17.388213 #1] INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'
Plugin name is 'discourse-topic-voting', but plugin directory is named 'discourse-voting'
rake aborted!
ActiveRecord::StatementInvalid: PG::InsufficientPrivilege: ERROR: permission denied for table users (ActiveRecord::StatementInvalid)
So good news! It’s connecting fine, it’s that DB permissions need adjusting.
… ok ok, irt looks as if I have some more permission issues here, see /var/log/postgresql/postgresql-13-main.log:
2023-11-10 22:07:58.371 UTC [196127] postgres@postgres STATEMENT: ALTER DEFAULT PRIVILEGES IN SCHEMA 'public' GRANT ALL ON TABLES TO 'discourse';
2023-11-10 22:10:18.270 UTC [196160] discourse@discourse ERROR: permission denied for table site_settings
2023-11-10 22:10:18.270 UTC [196160] discourse@discourse STATEMENT: SELECT name, data_type, value FROM site_settings
2023-11-10 22:10:18.313 UTC [196160] discourse@discourse ERROR: permission denied for table users
2023-11-10 22:10:18.313 UTC [196160] discourse@discourse STATEMENT: SELECT COUNT(*) FROM (SELECT 1 AS one FROM "users" LIMIT 20) subquery_for_count
I already had a discourse database in the postgres but the discourse user/role had not all required privileges on it. And I did miss some major “behavioural” differences between mariadb and postgres …
Now I re-created all: user, database, permissions for the user/role (including ALTER DEFAULT PRIVILEGES FOR ROLE discourse IN SCHEMA public GRANT ALL ON TABLES TO “discourse”; to match tables created by this user in the future)
The build finished and the instance runs fine with the remote postgres server, so its ready for importing the backup from the older instance.