我正在尝试创建多站点docker配置,但是我不确定如何继续使用我使用的现有docker-compose.yml。我已经准备好了,以便可以使用网络启动尽可能多的站点。这是共享的docker-compose.yml供参考。
version: "3.3"
services:
photon:
image: "chriszarate/photon:latest"
mysql:
image: "mariadb:10.2"
container_name: "mysql-database"
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
MYSQL_DATABASE: "wordpress"
MYSQL_ROOT_PASSWORD: ""
ports:
- "3306:3306"
restart: always
volumes:
- type: volume
source: dbdata
target: "/var/lib/mysql"
volume:
nocopy: true
#- "./sql:/docker-entrypoint-initdb.d"
adminer:
image: adminer
restart: always
ports:
- 8080:8080
proxy:
image: "jwilder/nginx-proxy:alpine"
container_name: "proxy"
environment:
HSTS: "off"
HTTPS_METHOD: "nohttps"
ports:
- "80:80"
- "443:443"
volumes:
- "//var/run/docker.sock:/tmp/docker.sock:ro"
- "./certs/self-signed:/etc/nginx/certs:ro"
- "./conf/nginx-proxy.conf:/etc/nginx/conf.d/proxy.conf:ro"
networks:
default:
external:
name: shared
volumes:
dbdata: {}
这是我用于网站的那个。
version: "3.3"
services:
wordpress:
container_name: "wp"
image: "wordpress:${WP_VERSION:-4.9.7}-php${PHP_VERSION:-7.2}-apache"
environment:
VIRTUAL_HOST: "${DOCKER_DEV_DOMAIN:-project.test}"
WORDPRESS_DB_HOST: "mysql"
WORDPRESS_DB_NAME: "wordpress"
WORDPRESS_DB_PASSWORD: ""
WORDPRESS_DB_USER: "root"
external_links:
- mysql
volumes:
- "wp:/var/www/html:rw"
- "./certs/ca-root/ca.crt:/tmp/certs/root.crt:ro"
- "./conf/php-local.ini:/usr/local/etc/php/conf.d/local.ini:ro"
- "./conf/wp-local-config.php:/usr/local/etc/php/autoprepend.php:ro"
- "./src/vip-go-mu-plugins:/var/www/html/wp-content/mu-plugins"
- "./src/site1/client-mu-plugins:/var/www/html/wp-content/client-mu-plugins"
- "./src/site1/images:/var/www/html/wp-content/images"
- "./src/site1/languages:/var/www/html/wp-content/languages"
- "./src/site1/plugins:/var/www/html/wp-content/plugins"
- "./src/site1/private:/var/www/html/wp-content/private"
- "./src/site1/themes:/var/www/html/wp-content/themes"
- "./src/site1/vip-config:/var/www/html/wp-content/vip-config"
wp-cli:
container_name: "wp-cli"
image: "wordpress:cli-php${PHP_VERSION:-7.2}"
environment:
- APACHE_RUN_USER="www-data"
- APACHE_RUN_GROUP="www-data"
external_links:
- mysql
volumes:
- "wp:/var/www/html:rw"
- "./bin/install-wp.sh:/usr/local/bin/install-wp:ro"
- "./conf/php-local.ini:/usr/local/etc/php/conf.d/local.ini:ro"
- "./conf/wp-local-config.php:/usr/local/etc/php/autoprepend.php:ro"
- "./src/vip-go-mu-plugins:/var/www/html/wp-content/mu-plugins"
- "./src/site1/client-mu-plugins:/var/www/html/wp-content/client-mu-plugins"
- "./src/site1/images:/var/www/html/wp-content/images"
- "./src/site1/languages:/var/www/html/wp-content/languages"
- "./src/site1/plugins:/var/www/html/wp-content/plugins"
- "./src/site1/private:/var/www/html/wp-content/private"
- "./src/site1/themes:/var/www/html/wp-content/themes"
- "./src/site1/vip-config:/var/www/html/wp-content/vip-config"
networks:
default:
external:
name: shared
volumes:
wp: {}
此设置对于一个站点(当我制作文件夹副本时旋转的其他任何站点)都可以正常使用,并且可以复制VIP Go所具有的环境。但是我不确定要在多站点环境中使用该功能需要进行哪些更改,因为在启动docker时每个站点将具有不同的文件夹。 有什么想法吗?
TIA
注意:在生产环境中设置多站点时,它们将是不同的站点,而不是子域,因此我需要保持这种状态,而不要设置子域