wodby / docker4drupal

Docker-based Drupal stack
https://wodby.com/docker4drupal
MIT License
1.23k stars 535 forks source link

Dockerize existing Drupal 8 Multisite #448

Open webmasterpf opened 4 years ago

webmasterpf commented 4 years ago

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:

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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}`)"

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