wodby / docker4drupal

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

Fatal error: require(): Failed opening required '/var/www/html/web/../vendor/autoload.php' #225

Closed soupman99 closed 6 years ago

soupman99 commented 6 years ago

I copied the docker-compose.yml exactly from github & when I try install drupal I get this error: Fatal error: require(): Failed opening required '/var/www/html/web/../vendor/autoload.php'

Codebase

Built-in vanilla Drupal

Host OS

macOS Sierra - 10.13.2

Docker info output

# Run "docker info" on the host machine and paste output here 
Containers: 21
 Running: 11
 Paused: 0
 Stopped: 10
Images: 117
Server Version: 17.09.1-ce
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 361
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host ipvlan macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 06b9cb35161009dcb7123345749fef02f7cea8e0
runc version: 3f2f8b84a77f73d38244dd690525642a72156c64
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.49-moby
Operating System: Alpine Linux v3.5
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 1.952GiB
Name: moby
ID: BXXU:7OQY:GRCJ:GIPM:BZCH:NCYN:UI7W:3LJT:TYHJ:5YB5:HN4R:2HYB
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 111
 Goroutines: 129
 System Time: 2018-01-08T18:45:22.779139477Z
 EventsListeners: 3
No Proxy: *.local, 169.254/16
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

Docker compose file

# Content of your docker-compose.yml file. Make sure you remove all sensible information you might have there.

version: "2"

services:
  mariadb:
    image: wodby/mariadb:10.2-3.0.2
#    image: wodby/mariadb:10.1-3.0.2
    environment:
      MYSQL_ROOT_PASSWORD: password
      MYSQL_DATABASE: drupal
      MYSQL_USER: drupal
      MYSQL_PASSWORD: drupal
#    volumes:
#      - ./mariadb-init:/docker-entrypoint-initdb.d # Place init .sql file(s) here.
#      - /path/to/mariadb/data/on/host:/var/lib/mysql # I want to manage volumes manually.

#  postgres:
#    image: wodby/postgres:10.1-1.2.0
##    image: wodby/postgres:9.6-1.2.0
#    environment:
#      POSTGRES_PASSWORD: password
#      POSTGRES_DB: drupal
#      POSTGRES_USER: drupal
#    volumes:
#      - ./postgres-init:/docker-entrypoint-initdb.d # Place init file(s) here.
#      - /path/to/postgres/data/on/host:/var/lib/postgresql/data # I want to manage volumes manually.

  php:
# 1. Images with vanilla Drupal – wodby/drupal:[DRUPAL_VERSION]-[PHP_VERSION]-[STABILITY_TAG].
    image: wodby/drupal:8-7.1-3.3.2
#    image: wodby/drupal:8-7.0-3.3.2
#    image: wodby/drupal:7-7.1-3.3.2
#    image: wodby/drupal:7-7.0-3.3.2
#    image: wodby/drupal:7-5.6-3.3.2
#    image: wodby/drupal:6-5.6-3.3.2
#    image: wodby/drupal:6-5.3-3.3.2
# 2. Images without Drupal – wodby/drupal-php:[PHP_VERSION]-[STABILITY_TAG].
#    image: wodby/drupal-php:7.1-3.3.1
#    image: wodby/drupal-php:7.0-3.3.1
#    image: wodby/drupal-php:5.6-3.3.1
#    image: wodby/drupal-php:5.3-3.3.1
# 3. Images without Drupal – wodby/drupal-php:[PHP_VERSION]-[STABILITY_TAG]. Version for development (--enable-debug)
#    image: wodby/drupal-php:7.1-dev-3.3.1
#    image: wodby/drupal-php:7.0-dev-3.3.1
#    image: wodby/drupal-php:5.6-dev-3.3.1
#    image: wodby/drupal-php:5.3-dev-3.3.1
    environment:
      PHP_SENDMAIL_PATH: /usr/sbin/sendmail -t -i -S mailhog:1025
      PHP_FPM_CLEAR_ENV: "no"
      DB_HOST: mariadb
      DB_USER: drupal
      DB_PASSWORD: drupal
      DB_NAME: drupal
      DB_DRIVER: mysql
#      PHP_XDEBUG: 1
#      PHP_XDEBUG_DEFAULT_ENABLE: 1
#      PHP_XDEBUG_REMOTE_CONNECT_BACK: 0
#      PHP_XDEBUG_REMOTE_HOST: "10.254.254.254"
#      PHP_XDEBUG_PROFILER_OUTPUT_DIR: /mnt/files/xdebug/profiler
#      PHP_XDEBUG_TRACE_OUTPUT_DIR: /mnt/files/xdebug/traces
#      PHP_BLACKFIRE: 1
    volumes:
      - codebase:/var/www/html
## Options for macOS users (https://docker4drupal.readthedocs.io/en/latest/macos)
#      - codebase:/var/www/html:cached # User-guided caching
#      - docker-sync:/var/www/html # Docker-sync
## For Xdebug profiler files
#      - files:/mnt/files

  nginx:
# wodby/drupal-nginx:[DRUPAL_VERSION]-[NGINX_VERSION]-[STABILITY_TAG].
    image: wodby/drupal-nginx:8-1.13-3.0.2
#    image: wodby/drupal-nginx:7-1.13-3.0.2
#    image: wodby/drupal-nginx:6-1.13-3.0.2
#    image: wodby/drupal-nginx:8-1.12-3.0.2
#    image: wodby/drupal-nginx:7-1.12-3.0.2
#    image: wodby/drupal-nginx:6-1.12-3.0.2
    depends_on:
      - php
    environment:
      NGINX_STATIC_CONTENT_OPEN_FILE_CACHE: "off"
      NGINX_ERROR_LOG_LEVEL: debug
      NGINX_BACKEND_HOST: php
      NGINX_SERVER_ROOT: /var/www/html/web
#      NGINX_DRUPAL_FILE_PROXY_URL: http://example.com
    volumes:
      - codebase:/var/www/html
# Options for macOS users (https://docker4drupal.readthedocs.io/en/latest/macos)
#      - codebase:/var/www/html:cached # User-guided caching
#      - docker-sync:/var/www/html # Docker-sync
    labels:
      - 'traefik.backend=nginx'
      - 'traefik.port=80'
      - 'traefik.frontend.rule=Host:drupal.docker.localhost'

#  apache:
#    image: wodby/php-apache:2.4-2.0.2
#    depends_on:
#      - php
#    environment:
#      APACHE_LOG_LEVEL: debug
#      APACHE_BACKEND_HOST: php
#      APACHE_SERVER_ROOT: /var/www/html/web
#    volumes:
#      - codebase:/var/www/html
## Options for macOS users (https://docker4drupal.readthedocs.io/en/latest/macos)
##      - codebase:/var/www/html:cached # User-guided caching
##      - docker-sync:/var/www/html # Docker-sync
#    labels:
#      - 'traefik.backend=apache'
#      - 'traefik.port=80'
#      - 'traefik.frontend.rule=Host:drupal.docker.localhost'

#  varnish:
#    image: wodby/drupal-varnish:4.1-2.2.1
#    depends_on:
#      - nginx
#    environment:
#      VARNISH_SECRET: secret
#      VARNISH_BACKEND_HOST: nginx
#      VARNISH_BACKEND_PORT: 80
#    labels:
#      - 'traefik.backend=varnish'
#      - 'traefik.port=6081'
#      - 'traefik.frontend.rule=Host:varnish.drupal.docker.localhost'

#  redis:
#    image: wodby/redis:4.0-2.1.4
##    image: wodby/redis:3.2-2.1.4

#  adminer:
#    image: wodby/adminer:4.3-1.1.0
#    environment:
#      ADMINER_SALT: adminer-salt
#    labels:
#      - 'traefik.backend=adminer'
#      - 'traefik.port=9000'
#      - 'traefik.frontend.rule=Host:adminer.drupal.docker.localhost'

#  pma:
#    image: phpmyadmin/phpmyadmin
#    environment:
#      PMA_HOST: mariadb
#      PMA_USER: drupal
#      PMA_PASSWORD: drupal
#      PHP_UPLOAD_MAX_FILESIZE: 1G
#      PHP_MAX_INPUT_VARS: 1G
#    labels:
#      - 'traefik.backend=pma'
#      - 'traefik.port=80'
#      - 'traefik.frontend.rule=Host:pma.drupal.docker.localhost'

#  solr:
## wodby/drupal-solr:[DRUPAL_VERSION]-[SOLR_VERSION]-[STABILITY_TAG].
#    image: wodby/drupal-solr:8-6.6-2.3.0
##    image: wodby/drupal-solr:8-6.5-2.3.0
##    image: wodby/drupal-solr:8-6.4-2.3.0
##    image: wodby/drupal-solr:8-6.3-2.3.0
##    image: wodby/drupal-solr:8-5.5-2.3.0
##    image: wodby/drupal-solr:8-7.0-2.3.0
##    image: wodby/drupal-solr:8-7.1-2.3.0
##    image: wodby/drupal-solr:7-5.4-2.3.0
#    environment:
#      SOLR_HEAP: 1024m
#    labels:
#      - 'traefik.backend=solr'
#      - 'traefik.port=8983'
#      - 'traefik.frontend.rule=Host:solr.drupal.docker.localhost'

  mailhog:
    image: mailhog/mailhog
    labels:
      - 'traefik.backend=mailhog'
      - 'traefik.port=8025'
      - 'traefik.frontend.rule=Host:mailhog.drupal.docker.localhost'

#  nodejs:
#    image: wodby/drupal-node:1.0-1.0.0
#    environment:
#       NODE_SERVICE_KEY: node-service-key
#    labels:
#      - 'traefik.backend=nodejs'
#      - 'traefik.port=8080'
#      - 'traefik.frontend.rule=Host:nodejs.drupal.docker.localhost'
#    volumes:
#      - ./path/to/your/single-page-app:/app
#    command: sh -c 'npm install && npm run start'

#  node:
#    image: node:alpine
#    working_dir: /app
#    labels:
#      - 'traefik.backend=node'
#      - 'traefik.port=3000'
#      - 'traefik.frontend.rule=Host:front.drupal.docker.localhost'
#    expose:
#      - "3000"
#    volumes:
#      - ./path/to/your/single-page-app:/app
#    command: sh -c 'npm install && npm run start'

#  memcached:
#    image: wodby/memcached:1.4-2.0.0

#  rsyslog:
#    image: wodby/rsyslog

#  athenapdf:
#    image: arachnysdocker/athenapdf-service:2.10.0
#    environment:
#      WEAVER_AUTH_KEY: weaver-auth-key
#      WEAVER_ATHENA_CMD: "athenapdf -S"
#      WEAVER_MAX_WORKERS: 10
#      WEAVER_MAX_CONVERSION_QUEUE: 50
#      WEAVER_WORKER_TIMEOUT: 90
#      WEAVER_CONVERSION_FALLBACK: false

#  blackfire:
#    image: blackfire/blackfire
#    environment:
#      BLACKFIRE_SERVER_ID: XXXXX
#      BLACKFIRE_SERVER_TOKEN: YYYYY

#  webgrind:
#    image: wodby/webgrind:1.5-1.0.0
#    environment:
#      WEBGRIND_PROFILER_DIR: /mnt/files/xdebug/profiler
#    labels:
#      - 'traefik.backend=webgrind'
#      - 'traefik.port=8080'
#      - 'traefik.frontend.rule=Host:webgrind.drupal.docker.localhost'
#    volumes:
#      - files:/mnt/files

  portainer:
    image: portainer/portainer
    command: --no-auth -H unix:///var/run/docker.sock
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    labels:
      - 'traefik.backend=portainer'
      - 'traefik.port=9000'
      - 'traefik.frontend.rule=Host:portainer.drupal.docker.localhost'

  traefik:
    image: traefik
    command: -c /dev/null --web --docker --logLevel=INFO
    ports:
      - '8000:80'
#      - '8080:8080' # Dashboard
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

volumes:
  codebase:
## Docker-sync for macOS users
#  docker-sync:
#    external: true
## For Xdebug profiler
#  files:

Logs output

# Run "docker-compose logs [service]". Let's say you get 500 error for some reason then it'll be helpful to provide logs for php and http server (nginx/apache) services.

##PHP
DRUPAL_ROOT=/var/www/html/web init.sh
[08-Jan-2018 18:43:46] NOTICE: fpm is running, pid 1
[08-Jan-2018 18:43:46] NOTICE: ready to handle connections
172.26.0.7 -  08/Jan/2018:18:44:21 +0000 "GET /index.php" 200
[08-Jan-2018 18:46:36] NOTICE: Terminating ...
[08-Jan-2018 18:46:36] ERROR: unable to read what child say: Bad file descriptor (9)
[08-Jan-2018 18:46:36] ERROR: unable to read what child say: Bad file descriptor (9)
[08-Jan-2018 18:46:36] NOTICE: exiting, bye-bye!
DRUPAL_ROOT=/var/www/html/web init.sh
[08-Jan-2018 18:46:48] NOTICE: fpm is running, pid 1
[08-Jan-2018 18:46:48] NOTICE: ready to handle connections

##nginx
2018/01/08 18:43:47 [notice] 1#1: using the "epoll" event method
2018/01/08 18:43:47 [notice] 1#1: nginx/1.13.7
2018/01/08 18:43:47 [notice] 1#1: built by gcc 6.3.0 (Alpine 6.3.0) 
2018/01/08 18:43:47 [notice] 1#1: OS: Linux 4.9.49-moby
2018/01/08 18:43:47 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2018/01/08 18:43:47 [notice] 1#1: start worker processes
2018/01/08 18:43:47 [notice] 1#1: start worker process 28
2018/01/08 18:43:47 [notice] 1#1: start worker process 29
2018/01/08 18:43:47 [notice] 1#1: start worker process 30
2018/01/08 18:43:47 [notice] 1#1: start worker process 31
172.26.0.5 - - [08/Jan/2018:18:44:21 +0000] "GET / HTTP/1.1" 200 227 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"
172.26.0.5 - - [08/Jan/2018:18:44:23 +0000] "GET /favicon.ico HTTP/1.1" 200 43 "http://drupal.docker.localhost:8000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"
2018/01/08 18:46:36 [notice] 1#1: signal 15 (SIGTERM) received, exiting
2018/01/08 18:46:36 [notice] 29#29: exiting
2018/01/08 18:46:36 [notice] 28#28: exiting
2018/01/08 18:46:36 [notice] 29#29: exit
2018/01/08 18:46:36 [notice] 28#28: exit
2018/01/08 18:46:36 [notice] 31#31: exiting
2018/01/08 18:46:36 [notice] 30#30: exiting
2018/01/08 18:46:36 [notice] 31#31: exit
2018/01/08 18:46:36 [notice] 1#1: signal 17 (SIGCHLD) received from 29
2018/01/08 18:46:36 [notice] 1#1: worker process 28 exited with code 0
2018/01/08 18:46:36 [notice] 1#1: worker process 29 exited with code 0
2018/01/08 18:46:36 [notice] 1#1: signal 29 (SIGIO) received
2018/01/08 18:46:36 [notice] 30#30: exit
2018/01/08 18:46:36 [notice] 1#1: signal 17 (SIGCHLD) received from 31
2018/01/08 18:46:36 [notice] 1#1: worker process 31 exited with code 0
2018/01/08 18:46:36 [notice] 1#1: signal 29 (SIGIO) received
2018/01/08 18:46:36 [notice] 1#1: signal 17 (SIGCHLD) received from 30
2018/01/08 18:46:36 [notice] 1#1: worker process 30 exited with code 0
2018/01/08 18:46:36 [notice] 1#1: exit
2018/01/08 18:46:48 [notice] 1#1: using the "epoll" event method
2018/01/08 18:46:48 [notice] 1#1: nginx/1.13.7
2018/01/08 18:46:48 [notice] 1#1: built by gcc 6.3.0 (Alpine 6.3.0) 
2018/01/08 18:46:48 [notice] 1#1: OS: Linux 4.9.49-moby
2018/01/08 18:46:48 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2018/01/08 18:46:48 [notice] 1#1: start worker processes
2018/01/08 18:46:48 [notice] 1#1: start worker process 29
2018/01/08 18:46:48 [notice] 1#1: start worker process 30
2018/01/08 18:46:48 [notice] 1#1: start worker process 31
2018/01/08 18:46:48 [notice] 1#1: start worker process 32
csandanov commented 6 years ago

We copy drupal's source codes to the volume from /usr/src when using Vanilla. So when you launch a container for the first time it takes some time to copy the sources. It could be that for some reason copying wasn't fully completed for the first time. You can validate it by checking that /vendor/autoload.php exists under /usr/src and does not under /var/www/html.

The solution is to clean up your docker volumes and run again or running rsync again manually inside of the php container:

rsync -rlt "/usr/src/drupal/" "${APP_ROOT}/"
csandanov commented 6 years ago

Resolved in 5.0.0