wodby / docker4drupal

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

base url can't be updated after first docker-compose up #376

Open naingoted opened 5 years ago

naingoted commented 5 years ago

Codebase mounted codebase

Describe your issue I tried to change baseurl after run docker-compose up for the first time. It works for the first baseurl but subsequent urls that i changed won't work unless i change the very first url back. Is there any docker command that i can clear cache or something. because i tried docker-compose down already. do i have to remove db or something ?

Output of docker info

Containers: 6
 Running: 6
 Paused: 0
 Stopped: 0
Images: 7
Server Version: 18.09.2
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host 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: 9754871865f7fe2f4e74d43e2fc7ccd237edcbce
runc version: 09c8266bf2fcf9519a651b04ae54c967b9ab86ec
init version: fec3683
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.125-linuxkit
Operating System: Docker for Mac
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.952GiB
Name: linuxkit-025000000001
ID: O7FZ:QKVX:US5F:QQRR:FKJW:I4IO:DP6I:HKUO:7W3C:XGLK:LWU2:CJNZ
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 117
 Goroutines: 140
 System Time: 2019-04-21T04:54:24.9703353Z
 EventsListeners: 4
HTTP Proxy: gateway.docker.internal:3128
HTTPS Proxy: gateway.docker.internal:3129
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine

Contents of your docker-compose.yml

version: "3"

services:
  mariadb:
    image: wodby/mariadb:$MARIADB_TAG
    container_name: "${PROJECT_NAME}_mariadb"
    stop_grace_period: 30s
    ports:
      - "3368:3306"
    environment:
      MYSQL_ROOT_PASSWORD: $DB_ROOT_PASSWORD
      MYSQL_DATABASE: $DB_NAME
      MYSQL_USER: $DB_USER
      MYSQL_PASSWORD: $DB_PASSWORD
    volumes:
#      - ./mariadb-init:/docker-entrypoint-initdb.d # Place init .sql file(s) here.
      - ./db/data:/var/lib/mysql # Use bind mount

  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_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.
## Read instructions at https://wodby.com/stacks/drupal/docs/local/xdebug/
#      PHP_XDEBUG: 1
#      PHP_XDEBUG_DEFAULT_ENABLE: 1
#      PHP_XDEBUG_REMOTE_CONNECT_BACK: 0
#      PHP_IDE_CONFIG: serverName=my-ide
#      PHP_XDEBUG_REMOTE_HOST: host.docker.internal # Docker 18.03+ Mac/Win
#      PHP_XDEBUG_REMOTE_HOST: 172.17.0.1 # Linux
#      PHP_XDEBUG_REMOTE_HOST: 10.254.254.254 # macOS, Docker < 18.03
#      PHP_XDEBUG_REMOTE_HOST: 10.0.75.1 # Windows, Docker < 18.03
#      PHP_XDEBUG_REMOTE_LOG: /tmp/php-xdebug.log
    volumes:
      - ./:/var/www/html
## For macOS users (https://wodby.com/stacks/drupal/docs/local/docker-for-mac/)
#      - ./:/var/www/html:cached # User-guided caching
#      - docker-sync:/var/www/html # Docker-sync
## For XHProf and Xdebug profiler traces
#      - files:/mnt/files

  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/html/web
      NGINX_VHOST_PRESET: $NGINX_VHOST_PRESET
#      NGINX_DRUPAL_FILE_PROXY_URL: http://example.com
    volumes:
      - ./:/var/www/html
# For macOS users (https://wodby.com/stacks/drupal/docs/local/docker-for-mac/)
#      - ./:/var/www/html:cached # User-guided caching
#      - docker-sync:/var/www/html # Docker-sync
    labels:
      - 'traefik.backend=${PROJECT_NAME}_nginx'
      - 'traefik.port=80'
      - 'traefik.frontend.rule=Host:${PROJECT_BASE_URL}'

  mailhog:
    image: mailhog/mailhog
    container_name: "${PROJECT_NAME}_mailhog"
    labels:
      - 'traefik.backend=${PROJECT_NAME}_mailhog'
      - 'traefik.port=8025'
      - 'traefik.frontend.rule=Host:mailhog.${PROJECT_BASE_URL}'

  portainer:
    image: portainer/portainer
    container_name: "${PROJECT_NAME}_portainer"
    command: --no-auth -H unix:///var/run/docker.sock
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    labels:
      - 'traefik.backend=${PROJECT_NAME}_portainer'
      - 'traefik.port=9000'
      - 'traefik.frontend.rule=Host:portainer.${PROJECT_BASE_URL}'

  traefik:
    image: traefik
    container_name: "${PROJECT_NAME}_traefik"
    command: -c /dev/null --web --docker --logLevel=INFO
    ports:
      - '80:80'
#      - '8080:8080' # Dashboard
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

Contents of your .env

PROJECT_NAME=a1v2
PROJECT_BASE_URL=drupal.docker.localhost

DB_NAME=drupal
DB_USER=drupal
DB_PASSWORD=drupal
DB_ROOT_PASSWORD=password
DB_HOST=mariadb
DB_DRIVER=mysql

### --- MARIADB ----

MARIADB_TAG=10.1-3.4.0
#MARIADB_TAG=10.3-3.4.0
#MARIADB_TAG=10.2-3.4.0

### --- VANILLA DRUPAL ----

DRUPAL_TAG=8-4.12.4
#DRUPAL_TAG=7-4.12.4

### --- PHP ----

# Linux (uid 1000 gid 1000)

# PHP_TAG=7.2-dev-4.12.2
#PHP_TAG=7.3-dev-4.12.2
#PHP_TAG=7.1-dev-4.12.2
#PHP_TAG=5.6-dev-4.12.2

# macOS (uid 501 gid 20)

PHP_TAG=7.3-dev-macos-4.12.2
#PHP_TAG=7.2-dev-macos-4.12.2
#PHP_TAG=7.1-dev-macos-4.12.2
#PHP_TAG=5.6-dev-macos-4.12.2

### --- NGINX ----

NGINX_TAG=1.15-5.3.2
#NGINX_TAG=1.14-5.3.2

NGINX_VHOST_PRESET=drupal8
#NGINX_VHOST_PRESET=drupal7
#NGINX_VHOST_PRESET=drupal6

### --- SOLR ---

SOLR_CONFIG_SET="search_api_solr_8.x-2.3"
#SOLR_CONFIG_SET="search_api_solr_8.x-1.2"
#SOLR_CONFIG_SET="search_api_solr_7.x-1.14"

SOLR_TAG=7.5-3.0.7
#SOLR_TAG=7.4-3.0.7
#SOLR_TAG=7.3-3.0.7
#SOLR_TAG=7.2-3.0.7
#SOLR_TAG=7.1-3.0.7
#SOLR_TAG=6.6-3.0.7
#SOLR_TAG=5.5-3.0.7
#SOLR_TAG=5.4-3.0.7

### --- ELASTICSEARCH ---

ELASTICSEARCH_TAG=6.2-3.0.4
#ELASTICSEARCH_TAG=6.1-3.0.4
#ELASTICSEARCH_TAG=6.0-3.0.4
#ELASTICSEARCH_TAG=5.6-3.0.4
#ELASTICSEARCH_TAG=5.5-3.0.4
#ELASTICSEARCH_TAG=5.4-3.0.4

### --- KIBANA ---

KIBANA_TAG=6.2-3.0.4
#KIBANA_TAG=6.1-3.0.4
#KIBANA_TAG=6.0-3.0.4
#KIBANA_TAG=5.6-3.0.4
#KIBANA_TAG=5.5-3.0.4
#KIBANA_TAG=5.4-3.0.4

### --- REDIS ---

REDIS_TAG=4-3.0.4
#REDIS_TAG=5-3.0.4

### --- NODE ---

NODE_TAG=10-0.10.1
#NODE_TAG=8-0.10.1
#NODE_TAG=6-0.10.1

### --- VARNISH ---

VARNISH_TAG=4.1-4.2.3
#VARNISH_TAG=6.0-4.2.3

### --- POSTGRESQL ----

POSTGRES_TAG=11-1.6.0
#POSTGRES_TAG=10-1.6.0
#POSTGRES_TAG=9.6-1.6.0
#POSTGRES_TAG=9.5-1.6.0
#POSTGRES_TAG=9.4-1.6.0

### OTHERS

ADMINER_TAG=4-3.5.2
APACHE_TAG=2.4-4.0.4
ATHENAPDF_TAG=2.10.0
DRUPAL_NODE_TAG=1.0-2.0.0
MEMCACHED_TAG=1-2.2.1
OPENSMTPD_TAG=6.0-1.4.0
RSYSLOG_TAG=latest
WEBGRIND_TAG=1.5-1.9.2
XHPROF_TAG=1.3.2

Logs output docker-compose logs

i don't have any error.
edmargomes commented 5 years ago

Do you want to change the url environment or in your application?

if you are trying to change this url PROJECT_BASE_URL=drupal.docker.localhost you need run make up again

If you are trying to change in your application you need use settings.php

sylven commented 4 years ago

To be sure config changes are picked up I always do:

docker-compose up --build

to be sure they are rebuilt if needed.

make up does:

docker-compose pull
docker-compose up -d --remove-orphans

and pull retrieves docker images defined in docker-compose.yml, so it will pick your config changes there.

usmanjutt84 commented 1 year ago

edmargomes

I am trying to update PROJECT_BASE_URL but it's working. I have tried as mentioned in the above comments. For make up, it says Command 'make' not found.