moodlehq / moodle-php-apache

PHP + Apache docker images for Moodle development
61 stars 68 forks source link

5.6-stretch versions cleanup #52

Closed stronk7 closed 5 years ago

stronk7 commented 5 years ago

(just reconciling the tags in all branches)

stronk7 commented 5 years ago

Hi,

as commented via chat... if we are using https://github.com/moodlehq/moodle-docker to test these images (both the 5.6-jessie and 5.6-stretch ones)... there is a little change needed to get it working.

Basically, the point is that, for 5.6, we used freetds to connect to SQL*Server and for 7.0 and up... we use sqlsrv driver.

How does "moodle-docker" solve that... well, simply... it looks if there is any "mssql.$MOODLE_DOCKER_PHP_VERSION.yml" file available and then loads it.

So, when we are using MOODLE_DOCKER_PHP_VERSION=5.6 it will load the mssql.5.6.yml file (that exists!) and that will make the container to use the freetds (mssql) driver. But if there isn't match... then only the "mssql.yml" file will load... so it will try to use the sqlsrv driver, that doesn't exist for php 5.6

So, if we want to verify that the 5.6-jessie (or 5.6-stretch) images are working... then you need that mssql.5.6-jessie.yml (or mssql.5.6-stretch.yml) file matching, so it will load and force the use of the correct mssql driver for 5.6.

Here I just issued an ln -s db.mssql.5.6.yml db.mssql.5.6-jessie.yml (given my MOODLE_DOCKER_PHP_VERSION is '5.6-jessie')... and everything worked perfectly:

https://pastebin.com/2sGaB4G9

And 100% the same with 5.6-stretch (create/link the matching .yml file and done):

https://pastebin.com/6EFwAXpe

Note that, if you use just MOODLE_DOCKER_PHP_VERSION=5.6, then the stretch is used... and that doesn't need any alias because, as commented above... the matching 'db.mssql.5.6.yml' already exists.

I've been thinking about to add that pair of aliases to the moodle-docker repository, but really don't think it's worth the effort. Soon we'll be removing the jessie images... and also the 5.6 ones... so that mssql/sqlsrv duality soon will be history (we don't have any supported version requiring 5.6 anymore).

So, just try with the trick (create alias as commented above) and done. it should look like this:

lrwxr-xr-x 1 stronk7 staff  16 may 14 23:27 db.mssql.5.6-jessie.yml -> db.mssql.5.6.yml
lrwxr-xr-x 1 stronk7 staff  16 may 15 00:12 db.mssql.5.6-stretch.yml -> db.mssql.5.6.yml
-rw-r--r-- 1 stronk7 staff  87 sep 21  2017 db.mssql.5.6.yml
-rw-r--r-- 1 stronk7 staff 236 ene 18 16:05 db.mssql.yml

Hope it helps! Ciao :-)

sarjona commented 5 years ago

Hi Eloy! Thanks for working on this issue! I've been able to test it locally with moodle-docker and MSSQL using your workaround to fix the DB error.