Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multisite configuration does not work across restarts #180

Open
rytmis opened this issue Apr 8, 2021 · 0 comments
Open

Multisite configuration does not work across restarts #180

rytmis opened this issue Apr 8, 2021 · 0 comments

Comments

@rytmis
Copy link

rytmis commented Apr 8, 2021

Overview

  • I have MULTISITE: 'true' defined in my docker-compose.yml. On the first start, multisite is enabled correctly. On subsequent starts I get a "The network already exists" message in the output, but wp-config.php is generated without the multisite constants, so WordPress admin tells me multisite support is not enabled.
  • Windows 10 20H2 (OS Build 19042.867)
  • Docker version 20.10.5
  • Workaround: run docker-compose down -v and start with a blank database every time (not ideal).

docker-compose.yml

version: '3'
services:
  wordpress:
    cap_add:
      - SYS_ADMIN
    devices:
      - /dev/fuse
    image: visiblevc/wordpress:latest
    ports:
      - 9000:80
      - 44300:443
    volumes:
      - ./plugins:/app/wp-content/plugins
      - ./install-dev-plugins:/docker-entrypoint-initwp.d/install-dev-plugins
      - ./custom-block-types:/app/wp-content/plugins/custom-block-types
    environment:
      DB_HOST: db # must match db service name below
      DB_NAME: wordpress
      DB_PASS: root # must match below
      URL_REPLACE: localhost:9000
      WP_DEBUG: 'true'
      MULTISITE: 'true'
        
    extends:
      service: localConfig
      file: docker-compose.local.yml
  db:
    image: mysql:5.7 # or mariadb:10
    volumes:
      - data:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: root
volumes:
  data: {}

docker-compose.local.yml

version: '3'
services:
  localConfig:
    environment:
      EXTRA_PHP: |
        define('WP_MEMORY_LIMIT', '128M');
        define('<plugin-specific-constant>', '<secret>');

docker-compose up output

wordpress_1  | ======================================================================
wordpress_1  |                     Begin WordPress Installation
wordpress_1  | ======================================================================
wordpress_1  | ==> Waiting for MySQL to initialize...
wordpress_1  | ==> Configuring WordPress
wordpress_1  | Success: Generated 'wp-config.php' file.
wordpress_1  | ==> Checking database
wordpress_1  | ==> Enabling Multisite
wordpress_1  |          The network already exists.
wordpress_1  | ==> Checking themes
wordpress_1  | ==> Checking plugins
wordpress_1  | ==> Finalizing
wordpress_1  | ==> Executing user init scripts
wordpress_1  | ======================================================================
wordpress_1  |                   WordPress Installation Complete!
wordpress_1  | ======================================================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants