docker4drupal icon indicating copy to clipboard operation
docker4drupal copied to clipboard

Provided Mutagen configuration doesn't work

Open rafatwork opened this issue 2 years ago • 2 comments

OS type macOS

Drupal version 9

Codebase Mounted codebase

Describe the bug I followed the documentation @ https://wodby.com/docs/1.0/stacks/drupal/local/#docker-for-mac but can't get Mutagen to work properly. It appears to copy all the files in the web directory to the mutagen directory when executing the commands:

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        mutagen/.editorconfig
        mutagen/.env.example
        mutagen/.gitattributes
        mutagen/.gitignore
        mutagen/LICENSE
        mutagen/Makefile
        mutagen/composer.json
        mutagen/composer.lock
        mutagen/config.yml.lock
        mutagen/docker-compose.yml
        mutagen/drush/
        mutagen/load.environment.php
        mutagen/mutagen/
        mutagen/phpunit.xml.dist
        mutagen/scripts/
        mutagen/traefik.yml
        mutagen/web/
        mutagen/wodby.yml

Output of docker info

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.7.1)
  compose: Docker Compose (Docker Inc., v2.2.1)
  scan: Docker Scan (Docker Inc., v0.11.0)

Server:
 Containers: 8
  Running: 7
  Paused: 0
  Stopped: 1
 Images: 10
 Server Version: 20.10.11
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 2
 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: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 7b11cfaabd73bb80907dd23182b9347b4245eb5d
 runc version: v1.0.2-0-g52b36a2
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.10.76-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: aarch64
 CPUs: 5
 Total Memory: 1.942GiB
 Name: docker-desktop
 ID: UJXX:VEBP:MFQN:JRX2:GEJH:YH5A:UVSG:IKMN:FN66:NRSY:NUMD:GZ3F
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Contents of your docker-compose.yml

version: "3.7"

services:
  mariadb:
    image: wodby/mariadb:$MARIADB_TAG
    container_name: "${PROJECT_NAME}_mariadb"
    stop_grace_period: 30s
    environment:
      MYSQL_ROOT_PASSWORD: $DB_ROOT_PASSWORD
      MYSQL_DATABASE: $DB_NAME
      MYSQL_USER: $DB_USER
      MYSQL_PASSWORD: $DB_PASSWORD

  php:
    image: wodby/drupal-php:$PHP_TAG
    container_name: "${PROJECT_NAME}_php"
    environment:
      PHP_SENDMAIL_PATH: /usr/sbin/sendmail -t -i -S mailhog:1025
      PHP_FPM_USER: wodby
      PHP_FPM_GROUP: wodby
      COLUMNS: 80 # Set 80 columns for docker exec -it.
      PHP_XDEBUG: 1
      PHP_XDEBUG_MODE: debug
      PHP_XDEBUG_START_WITH_REQUEST: "yes"
      PHP_XDEBUG_CLIENT_HOST: host.docker.internal # Docker 18.03+ Mac/Win
      DRUSH_OPTIONS_URI: $PROJECT_BASE_URL:8000
    volumes:
      - ./:/var/www/html:cached
      - mutagen:/var/www/html

  crond:
    image: wodby/drupal-php:$PHP_TAG
    container_name: "${PROJECT_NAME}_crond"
    environment:
      CRONTAB: "0 * * * * drush -r /var/www/html/web cron"
    command: sudo -E LD_PRELOAD=/usr/lib/preloadable_libiconv.so crond -f -d 0
    volumes:
      - ./:/var/www/html:cached

  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
    volumes:
      - ./:/var/www/html:cached
      - mutagen:/var/www/html

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

  adminer:
    container_name: "${PROJECT_NAME}_adminer"
    image: wodby/adminer:$ADMINER_TAG
    environment:
      ADMINER_DEFAULT_DB_HOST: $DB_HOST
      ADMINER_DEFAULT_DB_NAME: $DB_NAME
    labels:
      - "traefik.http.routers.${PROJECT_NAME}_adminer.rule=Host(`adminer.${PROJECT_BASE_URL}`)"

  traefik:
    image: traefik:v2.0
    container_name: "${PROJECT_NAME}_traefik"
    command: --api.insecure=true --providers.docker
    ports:
      - '8000:80'
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

  mutagen:
    build:
      context: .
      dockerfile: mutagen/Dockerfile
    init: true
    container_name: "mutagen"
    volumes:
      - mutagen:/var/www/html

volumes:
  mutagen:

Contents of your .env

### PROJECT SETTINGS

PROJECT_NAME=mysite
PROJECT_BASE_URL=mysite.docker.localhost

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

### --- MARIADB ----

MARIADB_TAG=10.5-3.13.20

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

DRUPAL_TAG=9-4.36.3

### --- PHP ----

# Linux (uid 1000 gid 1000)

# macOS (uid 501 gid 20)

PHP_TAG=7.4-dev-macos-4.29.3

### --- NGINX ----

NGINX_TAG=1.21-5.16.0

NGINX_VHOST_PRESET=drupal9

### --- SOLR ---

SOLR_CONFIG_SET="search_api_solr_4.1.6"

SOLR_TAG=8-4.12.2

### --- ELASTICSEARCH ---

ELASTICSEARCH_TAG=7-5.13.11

### --- KIBANA ---

KIBANA_TAG=7-5.13.11

### --- REDIS ---

REDIS_TAG=6-3.9.5

### --- NODE ---

NODE_TAG=16-dev-0.87.0

### --- VARNISH ---

VARNISH_TAG=6.0-4.7.6
#VARNISH_TAG=4.1-4.7.6

### --- POSTGRESQL ----

POSTGRES_TAG=13-1.23.2

### OTHERS

ADMINER_TAG=4-3.15.1
APACHE_TAG=2.4-4.6.3
ATHENAPDF_TAG=2.16.0
DRUPAL_NODE_TAG=1.0-2.0.0
MEMCACHED_TAG=1-2.9.4
OPENSMTPD_TAG=6.0-1.10.3
RSYSLOG_TAG=latest
SELENIUM_CHROME_TAG=3.141
WEBGRIND_TAG=1-1.22.0
XHPROF_TAG=3.0.5

rafatwork avatar Dec 21 '21 13:12 rafatwork

it seems a lot of things have changed since our initial mutagen integration, now there's mutagen compose that requires mutagen 0.13 which is still in beta. See https://mutagen.io/documentation/orchestration/compose

csandanov avatar Dec 22 '21 04:12 csandanov

I've updated instructions on how to use Mutagen Compose https://wodby.com/docs/1.0/stacks/drupal/local/#mutagen

In short:

  • stop mutagen daemon
  • brew unlink your current (stable) mutagen (if 0.13 is still in beta)
  • brew install mutagen from beta channel
  • brew install mutagen-compose from beta channel
  • delete mutagen directory, we don't need those
  • copy x-mutagen: extension fields to your docker-compose.yml, see latest in master branch
  • I renamed mutagen volume to drupal in case more volumes need to be sync to differ
  • also mutagen volume was missing from crond service
  • make sure uid/gid in x-mutagen matches your image ids, by default it's set for macos (501/20)
  • run mutagen-compose up, it's like a wrapper for docker-compose up

csandanov avatar Dec 23 '21 09:12 csandanov