wodby / docker4drupal

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

PROJECT_BASE_URL #434

Open superromeo opened 4 years ago

superromeo commented 4 years ago

OS type: Windows WSL2 Drupal version: 8 Codebase: mounted codebase

Problem PROJECT_BASE_URL=lom-ru.localhost - OK. PROJECT_BASE_URL=lom-ru.loc - portainer and others: "Server IP address cannot be found'".

Output of docker info

Client:
 Debug Mode: false

Server:
 Containers: 8
  Running: 7
  Paused: 0
  Stopped: 1
 Images: 26
 Server Version: 19.03.8
 Storage Driver: overlay2
  Backing Filesystem: <unknown>
  Supports d_type: true
  Native Overlay Diff: 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 local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
 init version: fec3683
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 4.19.84-microsoft-standard
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 12
 Total Memory: 31.33GiB
 Name: docker-desktop
 ID: NZYW:FBFL:4Z35:F7SJ:WYOO:KPI2:CXPI:P6FB:GQBR:5CQN:UPJW:4N2F
 Docker Root Dir: /var/lib/docker
 Debug Mode: true
  File Descriptors: 101
  Goroutines: 105
  System Time: 2020-05-05T13:55:12.1530691Z
  EventsListeners: 5
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: true
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine

WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled

Contents of your docker-compose.yml

version: "3"

services:
  mysql:
    image: mysql:5.7
    container_name: "${PROJECT_NAME}_mysql"
    stop_grace_period: 30s
    environment:
      MYSQL_ROOT_PASSWORD: $DB_ROOT_PASSWORD
      MYSQL_DATABASE: $DB_NAME
      MYSQL_USER: $DB_USER
      MYSQL_PASSWORD: $DB_PASSWORD
    ports:
      - '42333:3306'

  php:
    image: wodby/drupal-php:$PHP_TAG
    container_name: "${PROJECT_NAME}_php"
    environment:
      PHP_SENDMAIL_PATH: /usr/sbin/sendmail -t -i -S mailhog:1025
      DB_HOST: $DB_HOST
      DB_PORT: $DB_PORT
      DB_USER: $DB_USER
      DB_PASSWORD: $DB_PASSWORD
      DB_NAME: $DB_NAME
      DB_DRIVER: $DB_DRIVER
      PHP_FPM_USER: wodby
      PHP_FPM_GROUP: wodby
      COLUMNS: 80 # Set 80 columns for docker exec -it.
"${DB_DRIVER}://${DB_USER}:${DB_PASSWORD}@${DB_HOST}/${DB_NAME}#tests_"
{"browserName":"chrome","goog:chromeOptions":{"args":["--disable-gpu","--headless"]}}, "http://chrome:9515"]'

    volumes:
      - ../drupal_8:/var/www/drupal_8:cached
      - /mnt/j/SSH_keys/linux:/tmp/SSH_keys

  nginx:
    image: wodby/nginx:$NGINX_TAG
    container_name: "${PROJECT_NAME}_nginx"
    depends_on:
      - php
    environment:
      NGINX_STATIC_OPEN_FILE_CACHE: "off"
      NGINX_ERROR_LOG_LEVEL: debug
      NGINX_BACKEND_HOST: php
      NGINX_SERVER_ROOT: /var/www/drupal_8/web
      NGINX_VHOST_PRESET: $NGINX_VHOST_PRESET
    volumes:
      - ../drupal_8:/var/www/drupal_8:cached
    labels:
      - "traefik.http.routers.${PROJECT_NAME}_nginx.rule=Host(`${PROJECT_BASE_URL}`)"

  mailhog:
    image: mailhog/mailhog
    container_name: "${PROJECT_NAME}_mailhog"
    labels:
      - "traefik.http.services.${PROJECT_NAME}_mailhog.loadbalancer.server.port=8025"
      - "traefik.http.routers.${PROJECT_NAME}_mailhog.rule=Host(`mailhog.${PROJECT_BASE_URL}`)"

Contents of your .env

PROJECT_NAME=lom
PROJECT_BASE_URL=lom-ru.loc

DB_NAME=sdaylom_8
DB_USER=sdaylom_user
DB_PASSWORD=uW9Jb9Bh
DB_ROOT_PASSWORD=password
DB_HOST=mysql
DB_PORT=3306
DB_DRIVER=mysql

MARIADB_TAG=10.4-3.8.2
DRUPAL_TAG=8-4.17.12
PHP_TAG=7.3-dev-4.15.8
NGINX_TAG=1.17-5.8.14
NGINX_VHOST_PRESET=drupal8
SOLR_CONFIG_SET="search_api_solr_8.x-3.2"
SOLR_TAG=8-4.5.2
ELASTICSEARCH_TAG=7-5.4.2
KIBANA_TAG=7-5.4.2
REDIS_TAG=5-3.3.0
NODE_TAG=12-dev-0.34.5
VARNISH_TAG=6.0-4.4.6
POSTGRES_TAG=12-1.9.3
ADMINER_TAG=4-3.9.11
APACHE_TAG=2.4-4.2.6
ATHENAPDF_TAG=2.10.0
DRUPAL_NODE_TAG=1.0-2.0.0
MEMCACHED_TAG=1-2.5.5
OPENSMTPD_TAG=6.0-1.6.5
RSYSLOG_TAG=latest
SELENIUM_CHROME_TAG=3.141
WEBGRIND_TAG=1-1.15.5
XHPROF_TAG=2.2.4
ABGEO commented 4 years ago

I think this problem is not related to docker4drupal. This is because your machine does not know that loc is your loopback (127.0.0.1).

I don’t know how this works in Window, but in *nix systems you can add the following line to your /etc/hosts and it will work 127.0.0.1 loc. So you need to go this way.