CentOS Installation (No VM) failed - no pg_ctlcluster available

I want to setup Spryker Demo (No VM) on a CentOS 7. Everything is installed and running fine. But after starting the vendor/bin/install the script abortet with the error message

Exception: sudo: pg_ctlcluster: command not found

After doing some research, pg_ctlcluster is only available at Ubuntu/Debian. CentOS /usr/pgsql-9.6/bin does contain pg_ctl only. It looks like pg_ctl is different to pg_ctlcluster. I dont know if pg_ctl will do the job.

Can you please provide an installation script which works with CentOS Enviroment?

Hello,

Thanks for pointing it out. You findings are correct, our code depends at the moment on pg_ctlcluster for restarting DB in order to drop all connections. We were not aware that it is available in Debian-family only. Internally this will be fixed, but I can’t provide estimation about release date of the fix.

From top of my head, I guess you could workaround this issue by doing something like described below. We use the missing command only to restart the database and drop all connections, which is pre-requirement for DROP DATABASE call. Note that I don’t have at the moment environment similar to you, so I can’t actually test those steps. Hopefully you will be able to take it from here.

  • make sure that all connections to postgres (ie. from IDE) are closed.
  • stop jenkins service in order to make sure that no running jobs are connected to the DB
  • comment out a line with call to pg_ctlcluster in vendor/spryker/propel/src/Spryker/Zed/Propel/Business/Model/PropelDatabase/Adapter/PostgreSql/DropPostgreSqlDatabase.php::closeOpenConnections()

Best regards,
Marek Obuchowicz
KoreKontrol Germany GmbH - Spryker hosting

Thank you @marekobu. I changed the source in DropPostgreSqlDatabase.php the following way:

    - $process = $this->getProcess(sprintf('sudo pg_ctlcluster %s main restart --force', $postgresVersion));
    + $process = $this->getProcess(sprintf('sudo -i -u postgres /usr/pgsql-9.6/bin/pg_ctl %s restart', NULL));
    + $process = $this->getProcess(sprintf('exit', NULL));

This is working fine. I had some issues about open database connections, Postgres Roles and so on. Maybe because the script aborted at the first try.

General to all readers:
Please dont use this workaround in production systems

1 Like

Hello,

Thank you very much for your update. In the future, we will investigate ways of getting rid of
pg_ctlcluster whatsoever.

As to your disclaimer, pg_ctlcluster is used only in the dev configuration, but not in production.


Best regards,
The Forum Team

1 Like