RobLoach / drush-docker

:whale: Docker Container to run Drush
http://registry.hub.docker.com/u/drush/drush
Other
19 stars 19 forks source link

Allow choosing different versions of PHP #28

Open RobLoach opened 8 years ago

RobLoach commented 8 years ago
  1. The container tags become what PHP version you want to run (drush/drush:php-5 for PHP5, drush/drush:php-7 for PHP7, etc)
  2. Split up Composer to allow chosing PHP 5 composer/composer:php-5/composer/composer:php-7
  3. Download all versions of Drush (8, 9)
  4. Drush entry point selects which version of Drush you want
    • Wrapper script? /drush/$DRUPAL_VERSION/drush $@
    • Use DRUSH_VERSION in entry point to select correctly? Does this work?
    • Full blown PHP Drush launcher application to select which Drush version to run and pass the args on
danquah commented 8 years ago

1: I would expect the tags to reference drush-versions and php-versions, so I would expect: drush/drush:7 drush/drush:8 and drush/drush:9 (which will also be drush/drush:latest) 2: I understand it complicates things, but I think using composer/composer as a base-image should be seen as a nice-to-have - if it stands it the way of supporting the drush/php versions a user would expect, it should be sacrificed in favor of either a new base-image - or "just" basing each drush image straigt off of the php-images 3: The drush-project supports some pretty different versions of Drush - combining them all in one image runs the risk of inter-version conflicts - what about having one drush-version pr image? 4: see 3

I think it would make most sense to support all officially supported drush-versions (7, 8, 9) running on their lowest supported php version (5.3, 5.4.5, 5.5) and then throw in php 7 (does Drush actually officially support php7). And just to address the 5.3 thing: it still has a lot of installs (http://w3techs.com/technologies/details/pl-php/5/all), both Drupal 6 and 7 runs just fine on it, and as 5.4 had a number of backwards-compabillity breaking changes (http://php.net/releases/5_4_0.php) a lot of installations out there are stuck on it.

So... that leaves us with the following standard combinations Drush 7 on php 5.3 Drush 8 on php 5.4.5 Drush 9 on php 5.5 and 7

The tags for drush 9 on php7 could be drush/drush:9-php7

In order to handle all of these combinations we would probably have to script the build, and ideally have some kind of basic sanity-test we could run to see if the combination worked out. If we get that working I suspect it would be easy to throw in some additional php-versions.

Am I to ambitious? :)

RobLoach commented 8 years ago

The Composer container now has the -php5 suffixes to the packages:

composer/composer:php5
composer/composer:1.0.0-php5
composer/composer:1-php5
composer/composer:1.0-php5
... etc

Now to open up the php5 branch on Drush. Supporting all the PHP 5 versions may get a little crazy. Just the latest in PHP5 may be easier. Took the same approach for Drush, you'll find the php5 branch.

RobLoach commented 8 years ago
drush/drush:php5
drush/drush:8-php5
drush/drush:7-php5
drush/drush:backdrop-php5
danquah commented 8 years ago

Agree that supporting all versions will take some work :)

But, at the very least I think there should be a version that is usable on a Drupal 6 site, and you won't get D6 running on "php5" if that means 5.6.

I think at the very least there should be a tag for drush 8 or 7 running on a "low" version of php 5, according to https://www.drupal.org/requirements/php#6 it might have to go as low as 5.2 - but as most major linux distributions used while Drupal 6 was big (eg Debian Squeeze, Ubuntu 12.04, Centos 6, RHEL 6) shipped with 5.3 I think is a safe choice.

RobLoach commented 8 years ago

The builds are going through on Docker Hub: https://hub.docker.com/r/drush/drush/builds/

Should take a little for them to go through. It's all in the php5 branch: https://github.com/RobLoach/drush-docker/tree/php5

danquah commented 8 years ago

And big thumbs up for the alpine image!

RobLoach commented 8 years ago

That was all @sylus in https://github.com/RobLoach/drush-docker/pull/30 !

neclimdul commented 8 years ago

Thanks for you work on this! I was so excited when I saw the docker image and thought surely the docker image would solve my problem of having PHP7 installed but Drush not working on a old Drupal 6 site I was trying to work on. Sadly I was mistaken... at least for the documented tags.

@danquah seemed to be suggesting php5 as the default. Is there the next step to to move php7 to a separate tag and make php5 the default for those versions of drush supporting ancient versions of Drupal?

neclimdul commented 8 years ago

Oh and some feedback. PHP's default config, which is what most php containers end up with, has multibyte config that Drupal really dislikes.

Multibyte string input conversion in PHP is active and must be [warning] disabled. Check the php.ini mbstring.http_input setting. Please refer to the PHP mbstring documentation for more information. (Currently using Unicode library Error)

neclimdul commented 8 years ago

Additionally, a lot of D6 commands like updb and si are failing because despite having almost every mysql extension installed mysql is not. Drush generalizes mysqli to mysql but an absolutely ancient Drush bug causes that generalized value to be used to load the database and install includes. Because of that you must have both mysqli and mysql installed for drush to work correctly with D6.

RobLoach commented 8 years ago

Drush 6? drush/drush:php5?

Drush 7 with Drupal 6?

neclimdul commented 8 years ago

Admittedly the docker container can have its own requirements, mostly I figured that docker run drush/drush:8 updb in a D6 site would just work since Drush 8 documents support for D6. http://docs.drush.org/en/master/install/#drupal-compatibility

RobLoach commented 8 years ago

May want to try docker run drush/drush:8-php5, haven't tested Drupal 6 on PHP7.

neclimdul commented 8 years ago

I have and 8-php5 and 8-php5-alpine work fine with the exception of the warning I mentioned and the commands that don't work because of the mysql/mysqli bug.

Drupal 6 core uses things like ereg and will fatal in php7. Running code that avoids that, quite a few contrib will also fatal. Its pretty bad.