mglaman/platform-docker

此包已废弃,不再维护。未建议替代包。

基于Docker Compose的Drupal平台堆栈

v1.0.12 2017-06-14 16:03 UTC

README

Platform Docker是一个用于为PHP项目搭建docker-compose配置的CLI工具,目前主要针对PHP项目。在目录中运行platform-docker将创建一个用于本地开发的多个容器应用环境。

目前支持主要集中在Drupal 7和Drupal 8。但是也提供了基本的WordPress支持。通用PHP应用应易于实现。

要求

安装

首先,如果您没有Docker,请访问他们的文档了解如何在您的机器上安装。对于OSX和Windows用户,请确保已安装Virtual Box并配置了docker-machine,按照这些说明进行操作,并确保已运行docker-machine create --driver virtualbox default

composer global require mglaman/platform-docker

用法

在任何目录中使用。直到应用本身可以搭建文件夹,它期望的文件夹结构为

  • /shared(如果不存在,将创建)
  • /www(必需,这是您的构建)
  • /repository(非必需,但建议这是构建内容的源。)
  • /tests(默认目录,它将查找Behat测试,但也会检查shared和www)

如果您在Mac OS X上,请使用您的Docker机器名称导出PLATFORM_DOCKER_MACHINE_NAME。工具将根据需要自动启动机器或导出其环境信息。例如,在您的.bash_profile中放置12 export PLATFORM_DOCKER_MACHINE_NAME="vmname"

特性

Redis

有一个redis容器可用。目前可以通过在项目的根目录下的.platform-project中添加以下内容来添加它

services:
  - redis

Solr

有一个Apache Solr容器可用,默认服务器URI为http://solr:8983/solr。目前可以通过在项目的根目录下的.platform-project中添加以下内容来添加它

services:
  - solr

Flamegraphs

有一个辅助命令可以修补Drupal以记录xhprof项目,并将其转换为flamegraph。

Behat测试

搜索behat.yml文件,启动Selenium(Firefox)容器并执行测试。

命令

Available commands:
  drush                              Runs a Drush command for environment.
  help                               Displays help for a command
  init                               Setup Platform and Docker Compose files
  link                               Displays link to local environment, with port.
  list                               Lists commands
 docker
  docker:logs                        Tails the logs of a specific service container
  docker:proxy (proxy)               Starts the nginx proxy container
  docker:rebuild                     Rebuild configurations and containers
  docker:restart (reboot)            Restarts the docker containers
  docker:ssh                         Allows for quick SSH into a service container.
  docker:stop (stop)                 Stops the docker containers
  docker:up (start)                  Starts the docker containers
 flamegraph
  flamegraph:create                  Creates a flamegraph from xhprof folder contents.
  flamegraph:setup                   Sets the project up for generating flamegrapghs.
  flamegraph:unpatch                 Unpatches index.php to stop xhprof logging.
 project
  project:behat (behat)              Runs behat test suite for project. Checks ./tests, ./www, ./shared and ./repository by default.
  project:db-sync                    Syncs database from environment to local
 provider
  provider:platformsh (platformsh)   Sets up a Platform.sh project