Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The backend should be able to provision sites on postgresql server sites. This issue concerns solely the backend, how to extend the current functionality and talk to postgres. It depends on #269520: Move to PDO for all database access. It is *not* related to #548882: PostgreSQL frontend support which concerns only having the frontend drupal be able to run when a pgsql backend. It *will* however require frontend work so that the dbserver nodes can have a type (postgres/mysql/...) that can be changed and everything else...
Comment | File | Size | Author |
---|---|---|---|
#14 | 585796-postgresql_support-14.patch | 11.42 KB | guillaumev |
#13 | 585796-postgresql_support-13.patch | 9.34 KB | Steven Merrill |
#11 | 585796-postgresql_support_hosting-11.patch | 3.49 KB | guillaumev |
#11 | 585796-postgresql_support-11.patch | 9.29 KB | guillaumev |
#2 | pgsql_service.inc_.patch | 4.73 KB | mradcliffe |
Comments
Comment #1
adrian CreditAttribution: adrian commentedfor what it's worth, the new backend allows for this to be developed.
i don't know if i want to make a point of it though. The API gets better by having multiple backends, but it increases our testing requirements.
Comment #2
mradcliffeFast forward about a year... I thought I'd attach a non-working/semi-working patch.
Start of a pgsql service patch for provision.
It would work much better if the db type didn't get magically changed to mysql halfway through the process. I was able to force things in by brute forcing db_type, db_user, db_passwd, db_host, and db_port in
db/db.drush.inc
in several class methods of ProvisionService_db and ProvisionService_db_pdo. It still fails on some other assumptions.Drush command that I'm using:
drush --verbose hostmaster-install --db_host=localhost --db_port=5432 --db_user=aegir --db_passwd=mypassword --version=0.4-alpha12 --master_db=pgsql://aegir:mypassword@localhost:5432 --db_service_type=pgsql --remote_host=localhost
I needed all those options because it defaults to mysql, mysql default port, etc... (I haven't been able to figure out where). Halfway through the process it will default to mysql, mysql default port, and dsn again as mentioned above.
I'm also running into an issue where I need aegir db_user and aegir db created to begin with, but then it wants to create them again later on in the install. This may be some mix up in instructions that I'm not understanding. Any help on those two issues would be appreciated.
Comment #3
mradcliffeOh wait, I see now. It's getting set to mysql in drush_provision_hostmaster_install.
Comment #4
mradcliffeI have it running better now until it explodes. At some point the $_SERVER variable turns up empty and its keys are set to empty values. I'm not sure where but drupal_get_option('db_type') etc... is returning null at some points, but not at others?
Comment #5
Steven Jones CreditAttribution: Steven Jones commentedThis might be a good headline feature to get into 6.x-2.x, bumping priority.
Comment #6
dafreak CreditAttribution: dafreak commentedHas there been any progress on a Postgresql backend with Aegir? Anyone know?
Cheers
Comment #7
ergonlogicHmm, it seems like efforts here have tried to both add a pgsql service, and install/run the Aegir front-end on said service. The latter should probably be handled separately in #548882: PostgreSQL frontend support. I think efforts in this issue should focus on the former.
Essentially, this should just involve copying
/db/Provision/Service/db/mysql.php
to/db/Provision/Service/db/pgsql.php
and adapting the syntax for PostgreSQL. The patch in #2 looks like a good start in that direction.We'd also need to add a
hostingService_db_pgsql
class added to Hosting indb_server/hosting_db_server.service.inc
, again modelled off ofhostingService_db_mysql
.Oh... and testing, of course :)
Comment #8
anarcat CreditAttribution: anarcat commentedThat is all correct.
Comment #9
Jackinloadup CreditAttribution: Jackinloadup commentedI believe the version for this feature was accidentally changed.
I would also like to provision sites on a second postgres database.
Thanks for the great work thus far. Great part of my day dealing with Aegir.
Comment #10
ergonlogicNo, this won't make it into 2.x.
Comment #11
guillaumev CreditAttribution: guillaumev commentedFYI, using the attached patches (one for provision, the other for hosting), I've been able to successfully add a pgsql server in Aegir and install a site on this pgsql server... (using Aegir 6.x-2.0). Note that the dumps are not working however...
Comment #12
land0 CreditAttribution: land0 commentedConsidering benchmarks such as these http://posulliv.github.io/2012/06/29/mysql-postgres-bench/ I am fairly excited to see pgsql support in the process of becoming a reality.
Comment #13
Steven Merrill CreditAttribution: Steven Merrill commentedThis is a small update to make sure that valid connections to the pgsql server that return a failure message of
psql: FATAL: role "intntnllyInvalid" does not exist
message will not result in a "Connection failed to fail" result.Comment #14
guillaumev CreditAttribution: guillaumev commentedHere is a new patch which adds backup and restore support. I've been able to successfully migrate a site running on pgsql using this patch, however:
CREATE SCHEMA drupal;
ALTER DATABASE xxx SET search_path="$user",drupal,public;
ALTER TABLE xxx SET schema drupal;
$databases['default']['default']['prefix'] = 'drupal.';
Comment #15
kenorb CreditAttribution: kenorb commentedComment #16
ergonlogicThanks for bumping this to the top of the heap.
We should probably add a section on PostgreSQL support to the documentation. Currently 'server' documentation is somewhat mixed in with sites and platform, or in 'advanced usage'. But we'd definitely want a place to document installation procedures, OS-specific configuration, etc.
As for the patch itself, in #14:
It seems like a number of methods are duplicated verbatim (
can_create_database()
,import_site_database()
, etc.) Maybe those should be migrated toProvision_Service_db_pdo
.generate_site_credentials()
still makes reference to 'mysqli' and so will need a cleanup.This should definitely be secure by default. For MySQL, we pass credentials without exposing them on the command-line: Provision_Service_db_mysql::safe_shell_exec(). Basically we generate a string containing the creds, and pass them to a new process as STDIN. I'm not very familiar with PostgreSQL, so I don't know whether the same mechanics would work there. That code is included here, though. So we should either use it, or remove it. However, proc_open() allows for setting environment variables, so that might be another option.
create_postgis()
seems more specific than we should really have here. I may be wrong, of course. But it seems to me that we should be generic in this class, and allow more specific configuration to happen in separate extensions, via pre- or post-hooks. I'd prefer calling a new hook here, rather than including extension-specific code.