docker4drupal icon indicating copy to clipboard operation
docker4drupal copied to clipboard

Dockerize existing Drupal 8 Multisite

Open webmasterpf opened this issue 4 years ago • 3 comments

Codebase mounted codebase D8.8.6

Describe your issue Hello,

I try to put my LAMP D8 multisite install (with virtualhosts) into a dockerized stack via D4D. My tree folder looklke this: projetcfolder:

  • docker4drupal folder contain docker-compose and env files
  • racine folder: contains drupal core and other files and folders like sites, themes...
  • .git folder
  • .gitignore file

Change for PHP7.3 cause this error error: Warning: require(/var/www/html/vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/autoload.php on line 17

Output of docker info

Paste hereServer:
 Containers: 9
  Running: 8
  Paused: 0
  Stopped: 1
 Images: 8
 Server Version: 19.03.8
 Storage Driver: overlay2

Contents of your docker-compose.yml

  apache:
    image: wodby/apache:$APACHE_TAG
    container_name: "${PROJECT_NAME}_apache"
    depends_on:
    - php
    environment:
      APACHE_LOG_LEVEL: debug
      APACHE_BACKEND_HOST: php
      APACHE_VHOST_PRESET: php
      APACHE_DOCUMENT_ROOT: /var/www/html
    volumes:
    - ../racine:/var/www/html:cached
#    # Alternative for macOS users: docker-sync https://wodby.com/docs/stacks/drupal/local#docker-for-mac
#    - docker-sync:/var/www/html
    labels:
    - "traefik.http.routers.${PROJECT_NAME}_apache.rule=Host(`${PROJECT_BASE_URL}`)"


php:
    image: wodby/drupal-php:$PHP_TAG
    container_name: "${PROJECT_NAME}_php"
    environment:
      PHP_SENDMAIL_PATH: /usr/sbin/sendmail -t -i -S mailhog:1025
    volumes:
    - ../racine:/var/www/html:cached

Contents of your .env

PROJECT_NAME=drupal8-multiste
PROJECT_BASE_URL=drupal.docker.localhost

MARIADB_TAG=10.4-3.8.5

Thanks for tips and help

webmasterpf avatar Jun 23 '20 12:06 webmasterpf

After adding the vendor folder and set the APACHE_DOCUMENT_ROOT: /var/www/html/racine and keep volume mount as default , the error 404 disappear. Next step, connect to the imported db. Actually get php_network_getaddresses: getaddrinfo failed: Name does not resolve error.

webmasterpf avatar Jun 26 '20 09:06 webmasterpf

Next step to go, create vhost working. Actually I add this to the apache container:

labels:
#    - "traefik.enable: true" #Expose les domaines à l'extérieur
    - "traefik.http.routers.${PROJECT_NAME}_apache.rule=Host(`${PROJECT_BASE_URL}`)"
    - "traefik.http.routers.${PROJECT_NAME}_apache.rule=Host(`ce.${PROJECT_BASE_URL}`)"

but only the second work. The first stop working after adding the second. So, how can I add vhosts to reach each of my mutisites (8 for all)

webmasterpf avatar Jun 30 '20 13:06 webmasterpf

Update: vhost works with something like this and traefik 2.0:

- "traefik.http.routers.${PROJECT_NAME}_apache.rule=Host(`${PROJECT_BASE_URL}`)"
    - "traefik.http.routers.${PROJECT_NAME}_apache_ce.rule=Host(`ce.${PROJECT_BASE_URL}`)"
    - "traefik.http.routers.${PROJECT_NAME}_apache_ca.rule=Host(`ca.${PROJECT_BASE_URL}`)"
    - "traefik.http.routers.${PROJECT_NAME}_apache_cg.rule=Host(`cg.${PROJECT_BASE_URL}`)"
  • into docker-compose: - ./param_custom/apache_custom/httpd.conf:/usr/local/apache2/conf/httpd.conf But I can't modify php.ini settings with an external file like this in docker-compose:
    - ./param_custom/php_custom/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini    
    - ./param_custom/php_custom/php-7.3.ini:/usr/local/etc/php/conf.d/php.ini

Files are loaded but not applied according phpinfo(): Additional .ini files parsed: /usr/local/etc/php/conf.d/php.ini, /usr/local/etc/php/conf.d/uploads.ini, memory_limit 512M instead of 1G

If someone can help me.

In addition container (php) can't access internet behind a proxy, settings provided to docker desktop but no effects. There, help needed too.

Thanks

webmasterpf avatar Jul 09 '20 10:07 webmasterpf