dpi/drupal-local 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dpi/drupal-local

Composer 安装命令:

composer create-project dpi/drupal-local

包简介

README 文档

README

Local Drupal Development

This setup is exclusively for local development only.

Setup

This setup has been tested with :

  • Apple Silicon M1
  • macOS Monterey
  • Local clone
  • Git
  • Docker for Mac
  • Composer
  • Brew

Usage

  1. composer create-project dpi/drupal-local
  2. cp .env.dist .env and add values.
  3. composer install
  4. Install Certificates, see Local TLS section below.
  5. Optionally copy and remove dist. prefix from settings files.
  6. docker-compose up -d

Drupal

Drupal is accessible at https://localhost/

Installation

docker-compose exec php-cli bash
drush si standard -y

Common tasks

# Set Claro as admin theme:
drush theme:enable claro && drush config:set system.theme admin claro -y && drush cr

Alternative hostnames

Want to use a hostname other than localhost, such as DOMAIN.localhost? (automat- ically works with Firefox / Chrome) Or any others with editing host file?

  1. Update URLs and hostnames in .env file.
  2. Generate certificates for new hostname (See Local TLS).
  3. docker-compose up -d

Redis

# Enable Redis before copying files because new services depend on Redis.module.
drush en redis
cp ./app/sites/default/dist.settings.redis.php ./app/sites/default/settings.redis.php
cp ./app/sites/default/dist.services.redis.yml ./app/sites/default/services.redis.php
drush cr

Configuration Export/Import

Config YAML will be exported to ./config/, alternatively use MySQL dump and auto restoration per below.

drush config:export
drush config:import

Local TLS

Why local HTTPS? Just because! Also Secure Cookies! And other things probably.

brew install mkcert nss
# Replace 'localhost' with alternative hostname, if desired.
mkcert -cert-file=certificates/primary.pem -key-file=certificates/primary-key.pem localhost
mkcert -install

More certificates can be defined in traefik/config/certificates.yaml.

MySQL Dump

Dump the MySQL database from the PHPCLI container so the setup can be restarted.

drush sql-dump --result-file=../sql/init/dump.sql

The dump will be automatically imported if you docker-compose down then restart the application. The app will take a few extra seconds to be ready. Tail the database log with docker-compose logs -f db to track progress.

Mailhog

Mailhog will capture emails sent by Drupal. There is no need to configure Drupal as sendmail_path is configured.

Mailhog is accessible at https://localhost/mailhog/

Traefik

Dashboard is accessible at https://localhost/traefik/

Development

PHPStan

Optionally customise PHPStan configuration with cp phpstan.neon.dist phpstan.neon. The .dist file will be used by default.

phpstan analyse

PHPCS

Optionally customise PHPCS configuration with cp phpcs.xml.dist phpcs.xml. The .dist file will be used by default.

phpcs

PHPUnit

Optionally customise PHPUnit configuration with cp phpunit.xml.dist phpunit.xml. The .dist file will be used by default.

phpunit

Blackfire

Define client and server ID and tokens in .env.

Web profiling

Browser extension

Enable the browser extension as normal.

Navigate to the page you wish to profile, and click 'Profile!' button.

Note: does not work properly if you're using Firefox container tabs. Use a container-less tab when profiling in Firefox.

Docker compose

docker-compose exec blackfire blackfire curl http://nginx:8080/

Blackfire CLI app

Blackfire client (blackfire) is built into the PHP CLI container (Dockerfile-php-cli):

docker-compose exec php-cli bash
blackfire curl http://nginx:8080/

CLI app profiling

docker-compose exec php-cli bash
blackfire run drush foo

dpi/drupal-local 适用场景与选型建议

dpi/drupal-local 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 7, 最近一次更新时间为 2021 年 11 月 13 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 dpi/drupal-local 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 dpi/drupal-local 我们能提供哪些服务?
定制开发 / 二次开发

基于 dpi/drupal-local 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2021-11-13