assimtech / tempo
A deployment tool for php projects
Installs: 1 554
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 1
Requires
- php: >=5.3.3
- assimtech/sysexits: ^1.0
- symfony/console: ^2.3|^3.0
- symfony/finder: ^2.3|^3.0
- symfony/process: ^2.3|^3.0
- symfony/yaml: ^2.3|^3.0
Requires (Dev)
- henrikbjorn/phpspec-code-coverage: ^1.0
- phpmd/phpmd: ^2.2
- phpspec/phpspec: ^2.2
- sebastian/phpcpd: ^2.0
- squizlabs/php_codesniffer: ^2.3
This package is auto-updated.
Last update: 2024-12-10 14:42:28 UTC
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 ]