定制 assimtech/tempo 二次开发

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

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

assimtech/tempo

最新稳定版本:0.3.1

Composer 安装命令:

composer require assimtech/tempo

包简介

A deployment tool for php projects

README 文档

README

Build Status Scrutinizer Code Quality Code Coverage

A deployment tool for php projects. Execute commands on local and remote nodes using php.

Quick start

Install tempo into your project with composer:

composer require assimtech/tempo

Create a tempo.php file in the root of your project containing the following:

<?php

use Assimtech\Tempo;
use MyProject\Tempo\Command;

// Infrastructure
$infrastructureLoader = Tempo\Factory\InfrastructureLoaderFactory::create();
$infrastructure = $infrastructureLoader->load(__DIR__ . '/infrastructure.yml');

// Commands
$definition = new Tempo\Definition();
foreach ($infrastructure->getEnvironments() as $env) {
    $definition->addCommand(new Command\WhereAmI($env));
}

return $definition;

Then create a infrastructure.yml file containing the following:

nodes:
    server1:
        ssh:
            host: server1.example.com

environments:
    -
        name: test
        nodes: [ server1 ]

Change "server1.example.com" to a server you have ssh access to. If you need to change username / port etc, please see the documentation on how to setup a Node

Then create a MyProject\Tempo\Command\WhereAmI class containing the following:

<?php

namespace MyProject\Tempo\Command;

use Assimtech\Sysexits;
use Assimtech\Tempo\Command\AbstractCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class WhereAmI extends AbstractCommand
{
    /**
     * {@inheritdoc}
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        foreach ($this->env->getNodes() as $node) {
            $output->write("<comment>Checking uname of $node: </comment>");
            $uname = $node->run('uname -a');
            $output->writeln("<info>$uname</info>");
        }

        return Sysexits::EX_OK;
    }
}

Run tempo from within the root of your project:

tempo test:whereami

Try adding more environments / servers / commands etc

Known issues

Running tempo from a docker container may cause connection problems

Due to an issue with the latest ssh version not playing nicely with overlayfs you may experience a connection sharing issue like: Control socket connect(...): Connection refused

If the script you are running seems to be authenticating again for each remote command or if you see the MOTD coming back in the response for each command this may also be the cause.

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1262287

If you have this issue, you could specify your control master path as a standard filesystem location in your infrastructure.yml (anywhere in your container outside of a host directory volume):

nodes:
    server1:
        ssh:
            host: server1.example.com
            control:
                ControlPath: /tmp/%r@%h:%p

environments:
    -
        name: test
        nodes: [ server1 ]

Documentation

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-05-13