定制 wearewondrous/psh-toolbelt 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

wearewondrous/psh-toolbelt

最新稳定版本:7.0.2

Composer 安装命令:

composer require wearewondrous/psh-toolbelt

包简介

Platform sh tools for a Drupal 10 and php 8.1.

README 文档

README

Build Status

Make the Drupal 9 installation highly configurable using:

  • Robo
  • Environment Variables

Todos

  • create task to recover a backup
  • allow switching from AWS to Google cloud
  • create packagist entry
  • write documentation for each Task

Installation

  $ composer require wearewondrous/psh-toolbelt

After you configured your environment with a robo.yml (described below). you can run:

  $ vendor/bin/psh-toolbelt

and see all available commands.

Configuration

sites/default/settings.php (required)

Overwrite the sites/default/settings.php with the given two includes.

<?php
// Default Drupal 9 settings.
//
// These are already explained with detailed comments in Drupal's
// default.settings.php file.
//
// See https://api.drupal.org/api/drupal/sites!default!default.settings.php/9
// customized project settings
include $app_root . '/../vendor/wearewondrous/psh-toolbelt/src/site.settings.php';
// Local settings. These come last so that they can override anything.
if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) {
  include $app_root . '/' . $site_path . '/settings.local.php';
}

services

If your project needs to overwrite the default services use a file called local.services.yml

robo.yml.dist (required)

Copy over the default config from the robo.yml.dist in the project root, and name it robo.yml. All paths given are relative to project root. No trailing slashes. File wearewondrous/psh-toolbelt/robo.yml.dist contents:

storage:
  backup:
    max_age: 432000         # 60 * 60 * 24 * 5
  s3:
    version: new-latest
    region: eu-west-1
    upload_bucket: backups
platform:
  host: eu.platform.sh
  domain: my-website.com
  mounts:
    temp: tmp
    config: remote-config
drupal:
  hash_salt: 1234567890abcdefghijklmnopqlmnopqrstuvwxyz12345678
  config_sync_directory: config/drupal/default
  public_files_directory: web/sites/default/files
  private_files_directory: private
  excludes:
    - js
    - css
    - styles
    - translations
    - languages
    - config
  config:
    splits:
      default:
        machine_name: default
        folder: default
      prod:
        machine_name: production
        folder: prod
      dev:
        machine_name: development
        folder: dev
drush:
  alias_group: my-website
  alias: local
  path: vendor/bin/drush
lando:
  disable_cache: true
  host: my-website.lndo.site
  mysql:
    database: drupal
    hostname: 127.0.0.1
    password: drupal
    port: 3306
    user: drupal

Copy it in your root folder and rename it to robo.yml. Adjust to your needs. Normally, you only need to set it like this:

platform:
  domain: drupal-rocks.com
  host: eu.platform.sh
drush:
  alias_group: drupalrocks
lando:
  hash_salt: 1234567890abcdefghijklmnopqlmnopqrstuvwxyz12345678
  host: my-website.lndo.site

sites/default/settings.php (required)

See an example for a sites/default/settings.php, have a look at platformsh-template/drupal9. Before the include of the settings.local.php add the following:

// customized project settings
include $app_root . '/../vendor/wearewondrous/psh-toolbelt/src/site.settings.php';

Platform.sh Variables (required for backup-task)

The following variables are required to have the backup task working:

env:AWS_ACCESS_KEY_ID={aws_access_key_id}
env:AWS_SECRET_KEY_ID={aws_secret_key_id}
env:SENTRY_DSN={sentry_dsn}

Optionally, to backup a branch that is not master, add this to the platform.sh variables of the desired branch.

env:BACKUP_THIS_BRANCH=1

Note: optionally, the variables can live as actual environment variables or as Platform.sh variables.

composer.json and .env (optional)

For local development and tests with env vars, add to your root project composer.json:

{
  "autoload": {
    "files": ["vendor/wearewondrous/psh-toolbelt/load.environment.php"]
  }
}

Then copy wearewondrous/psh-toolbelt/.env.dist to the root of you project and rename it to .env. Exclude this file from your vcs. Do This only, if you want to mock production vars.

### Platform.sh VARS ############
#PLATFORMSH_CLI_TOKEN=
#PLATFORM_APP_DIR=/app
#PLATFORM_PROJECT=
#PLATFORM_ENVIRONMENT=
#PLATFORM_DOCUMENT_ROOT=/app/web
#PLATFORM_BRANCH=master

### Required VARS ###############
# AWS config
AWS_ACCESS_KEY_ID=
AWS_SECRET_KEY_ID=
# Logging
SENTRY_DSN=

Troubleshooting

Make sure to have the following mounts in your platform.app.yaml. Otherwise you will run in errors on the server, like Could not create directory '/app/.ssh'.

mounts:
  '/web/sites/default/files': 'shared:files/files'
  '/tmp': 'shared:files/tmp'
  '/private': 'shared:files/private'
  '/.drush': 'shared:files/.drush'
  '/remote-config': 'shared:files/remote-config'

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 4
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2019-04-24