wodby / drupal-php

PHP docker container image for Drupal
https://wodby.com/stacks/drupal
MIT License
60 stars 81 forks source link

Cannot pass variables in from docker-compose #44

Closed ohthehugemanatee closed 6 years ago

ohthehugemanatee commented 7 years ago

I use environment variables for sensitive data. For example, my database username and password in settings.php simply use getenv('DB_USERNAME') and getenv('DB_PASSWORD') . I also have a variable that indicates the environment (local/dev/stage/live).

I recently switched from wodby php 7.0 to 7.1 . With 7.0 I configured those environment variables in docker.compose:

  php:
    image: wodby/drupal-php:7.0
    environment:
      PHP_SENDMAIL_PATH: /usr/sbin/sendmail -t -i -S mailhog:1025
      DB_HOST: mariadb
      DB_USER: drupal
      DB_PASSWORD: drupal
      DB_NAME: drupal
      DB_DRIVER: mysql
      ENVIRONMENT: localdev
      PHP_XDEBUG: 1
    volumes:
      - .:/var/www/html

In 7.1, this no longer works. Those environment variables are set for root, but php runs as www-data, and doesn't get those vars.

What's the recommended way to pass in environment-specific values with the current version?

csandanov commented 7 years ago

See https://github.com/wodby/drupal-php/issues/42#issuecomment-326866337, set env var PHP_FPM_CLEAR_ENV to yes

kees-dev commented 6 years ago

It looks like this issue is back in current release? If I require wodby/drupal-php:7.1 I loose environment variables. If I require wodby/drupal-php:7.1-3.3.1 it works as expected.

pianomansam commented 6 years ago

I'm experiencing the same issue

csandanov commented 6 years ago

Yes, we made some changes recently and it should be OK by now. Anyway, you should not use images without stability tags. From our README file:

For better reliability we additionally release images with stability tags (wodby/drupal-php:7.1-X.X.X) which correspond to git tags. We strongly recommend using images only with stability tags.

kees-dev commented 6 years ago

I learned something the hard way then ;-) thanks

pianomansam commented 6 years ago

For most docker images, LATEST is the most recent stable image.

On Feb 1, 2018 3:10 AM, "Chingis" notifications@github.com wrote:

Yes, we made some changes recently and it should be OK by now. Anyway, you should not use images without stability tags. From our README file:

For better reliability we additionally release images with stability tags (wodby/drupal-php:7.1-X.X.X) which correspond to git tags. We strongly recommend using images only with stability tags.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/wodby/drupal-php/issues/44#issuecomment-362189585, or mute the thread https://github.com/notifications/unsubscribe-auth/AA2AiJJB1l5stSuNwDN4K4WtSyVHXa_6ks5tQXGGgaJpZM4PMwvR .

csandanov commented 6 years ago

Yes, that works for images provided by vendors with the most basic setup where tag == software version. Since our images are much more than just PHP and we perform many changes that may not be related to PHP itself, we'll have to additionally provide stability tags. Otherwise, there's no guarantee your latest image will continue working, what stability in that?