nutshell-framework/deployer-recipes 问题修复 & 功能扩展

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

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

nutshell-framework/deployer-recipes

最新稳定版本:1.2.4

Composer 安装命令:

composer require nutshell-framework/deployer-recipes

包简介

The Deployer recipes used at Erdmann & Freunde

README 文档

README

The Deployer recipes used at Erdmann & Freunde.

Intended to work with Contao version 4.13+ and Deployer 7. An opinionated extension of the default Contao recipe.

Install

composer require --dev 'nutshell-framework/deployer-recipes:^1.0'

Usage

Install Deployer globally or per project.

Create a deploy.php inside the project. Either use single recipes or the simplified project.php recipe.

<?php

// deploy.php

namespace Deployer;

import(__DIR__.'/vendor/nutshell-framework/deployer-recipes/recipe/project.php');
import('contrib/cachetool.php');

set('rsync_src', __DIR__);

host('DEV')
    ->setHostname('www.example.org')
    ->set('remote_user', 'acme')
    ->set('http_user', 'acme')
    ->set('deploy_path', '/home/www/{{hostname}}')
    ->set('bin/php', 'php8.1')
    ->set('bin/composer', '{{bin/php}} /home/composer.phar')
    ->set('cachetool_args', '--web=SymfonyHttpClient --web-path=./{{public_path}} --web-url=https://{{hostname}}')
;

after('deploy:success', 'cachetool:clear:opcache');

// Project-specific exclude
add('exclude', [
    '.githooks',
]);

// Project-specific tasks
task('yarn:build', function () {
    runLocally('yarn run prod');
});

before('deploy', 'yarn:build');

after('contao:manager:download', 'contao:manager:lock');

When not using public as the web directory, please set it respectively:

{
  "extra": {
    "public-dir": "web"
  }
}

Deploy

  • dep deploy [host]

Custom .htaccess file per host

Create a .htaccess file in your project, e.g., .htaccess_prod, then configure it for the host:

host('www.example.org')
    ->set('htaccess_filename', '.htaccess_prod')

Files sync

  • dep files:retrieve [host] syncs the remote /files folder with the local /files folder

Database helpers

These tasks restore/release the database local <-> remote unidirectionally.

  • dep database:retrieve [host] downloads a database dump from remote and overwrites the local database
  • dep database:release [host] overwrites the remote database with the local one

Other

Upgrading from Deployer 6

First, it is easiest to create the deploy.php from scratch since it is much simplified now and the host config changed.

Second, since the release history numbering is not compatible between v6 and v7, you need to specify the release name manually for the first time. Otherwise, you start with release 1.

  • Find out the latest release (SSH onto the remote machine, look into the releases folder), e.g., "42".
  • dep deploy -o release_name=43

Note: Old releases from Deployer 6 won't be cleaned up automatically. Delete the old release manually. (Actually, you can also start with release 1, that's no big deal.)

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-03-07