assimtech/tempo
Composer 安装命令:
composer require assimtech/tempo
包简介
A deployment tool for php projects
README 文档
README
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
assimtech/tempo 适用场景与选型建议
assimtech/tempo 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.59k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2015 年 05 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 assimtech/tempo 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 assimtech/tempo 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.59k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 27
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-05-13