flowingis / idephix Goto Github PK
View Code? Open in Web Editor NEW๐ฅ Automation and deploy tool - ALPHA release - things can catch fire in any moment!
Home Page: http://getidephix.com/
๐ฅ Automation and deploy tool - ALPHA release - things can catch fire in any moment!
Home Page: http://getidephix.com/
The configuration defined in $target inside an idxfile.php is now available inside idephix as an array. It could be useful to wrap the configuration settings in a class which:
$config->get('ssh_params.user', 'kea')
vs
if (isset($config['ssh_params'] && isset($config['ssh_params']['user'])
Managing code and docs in two different branches is a pain in the a**. Releasing a new idephix phar is unnecessary complicated as it involves:
I have some solution in mind
And in general, automating the release process with a Idephix script
Shippable is broken for all PR. The problem is on php 5.3.3 build.
I think that problem is on phpenv-install.
https://app.shippable.com/builds/552c3d4e6206490c0097364f
How we could fix it ?
generated idxfile has some issues:
Actually when I run test with idephix the exit status is always successful even when the tests fail.
This causes problem with jenkins that cannot undestand when the build fails or not.
The workaround found by @dymissy is to force the exit status in the task:
$idx->add('asdasda',
function ($message = null, $go = false) use ($idx) {
try {
$idx->doSomething();
} catch(\Exception $e) {
$idx->output->writeln(sprintf("<error>Exception: \n%s</error>", $e->getMessage()));
exit(1);
}
})->
Maybe we could find a way to do it automatically.
As discussed in #71 we're going to remove from the extension library all the stuff that is highly related to the user's project, like Deploy. Instead of providing an Extension that tries (and fails) to do everything we'll provide some recipes to use as customizable boilerplate code in every project.
A recipe is easily adaptable to the user's specific need, but still provide a quick and reliable starting point.
This is my proposal for a deploy recipe (will be part of cookbook #78):
function prepareDeploy(\Idephix\IdephixInterface $idx)
{
$remoteBaseDir = "/var/www/testidx";
//prepare remote structure, if needed
$idx->remote("
mkdir -p {$remoteBaseDir}/releases && \\
mkdir -p {$remoteBaseDir}/shared
");
}
function deploy(Idephix\IdephixInterface $idx)
{
$shared = [
'app/config/parameters.yml',
'cache',
'logs',
'web/assets'
];
$sshHost = "labs.ideato.it";
$remoteBaseDir = "/var/www/testidx";
$nextRelease = "$remoteBaseDir/releases/" . time();
$linkedRelease = "$remoteBaseDir/current";
$rsyncExclude = "./rsync_exclude.txt";
$rsyncInclude = "./rsync_include.txt";
$localArtifact = ".deploy";
$repository = "file:///Users/ftassi/workspace/testidx";
//prepare the deployable release (locally)
$idx->local(
"
rm -Rf {$localArtifact} && \\
git clone {$repository} {$localArtifact} && \\
cd {$localArtifact} && \\
git fetch && \\
git checkout --force origin/master && \\
composer install --no-dev --prefer-dist --no-progress --optimize-autoloader --no-interaction
"
);
//copy the current release into the next release so rsync will not transfer unmodified file
try{
$idx->remote("cd $remoteBaseDir && cp -pPR `readlink {$linkedRelease}` $nextRelease");
}catch (\Exception $e){
$idx->output()->writeln("<info>First deploy, sending the whole project</info>");
}
//sync next release
$idx->local(
"rsync -rlpDvcz --delete --exclude-from={$rsyncExclude} --include-from={$rsyncInclude} {$localArtifact}/ {$sshHost}:{$nextRelease}"
);
//prepare shared items for next release
foreach ($shared as $item) {
$idx->remote("ln -nfs $remoteBaseDir/shared/$item $nextRelease/$item");
}
//link next release as current release
$idx->remote("
cd $remoteBaseDir && \\
ln -nfs $nextRelease current
");
}
It is not final yet, there is some logic that we may want to extract to a Deploy
extension. What I need now is a feedback about the overall procedure.
description : is missing and it is required
Posted from SensioLabsInsight
When showing the command line help user defined tasks are mixed with default idephix tasks such ad "selfupdate", "list", "init-id-file".
Showing user defined tasks in a separate section could add clarity, what do you guys think?
We have StyleCi enabled on this project but I think is not properly configured, for instance https://styleci.io/analyses/zY6p9A (we cannot use short array syntax unless we drop php 5.3)
I think we have 2 choices:
enforce coding standard ad a build step (dropping styleci)
configure styleci properly
what do you guys think?
I could be useful to get autocompletion for task names (and maybe options) on the command line. I did a quick research and there are few ways we can achieve that
https://github.com/stecman/symfony-console-completion
https://github.com/bamarni/symfony-console-autocomplete
https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/symfony2/symfony2.plugin.zsh
https://raw.githubusercontent.com/jaytaph/SFConsole/master/console_completion.sh
what do you guys think?
With the current settings the developer is in charge of creating an idephix object inside the idxfile. While this solution is very effective is has some downsides:
Idxfile should be only about specifing configuration and task, all the heavy lifting should be done outside it
My proposal is to inject $idx object in the idxfile a la codeception
Looking forward to feedback
cache:clear is invoked after migrations execution, this means that if install and configure the doctrine migration bundle after the first installation the new config.yml file is not loaded until the cache is cleared and the parameters describing migration paths are not accessibile resulting in a runtime error, this could happen on any command relying on configuration parameters that are loaded from cache.
When I istall idephix.phar globally (ie. in /usr/bin/), and I run "idephix.phar serlfupdate" it asks me to generate the idxfile.php file.
To get this to work I have to be in a folder where there is a idxfile.php.
I try to use
'ssh_params' => array( 'user' => 'my_user', 'port' => 8888 ),
but ssh connection is always on port 22.
We should pick one :D
Right now we have an Extension
namespace and a \Idephix\IdephixInterface::addLibrary
method.
I prefer Extension over Library, what do you thing @kea ?
As for now the whole idephix configuration is managed by a plain array eg.
$targets = array(
'test' => array(
'hosts' => array('127.0.0.1'),
'ssh_params' => array('user' => 'kea')
),
);
which is fine as long you don't need to modify dinamically one of the entries. One use case would be finding hosts ip dinamically by invoking aws api. One approach to solve this could be wrapping all the configurations in a Config
o Context
class which can ben injected in task a al symfony controllers
$idx-> add('idephix:test-params', function (Context $ctx, $go = false) use ($idx) {
$ctx->setHosts('192.168.56.101');
});
waiting for feedback @francescotrucchia @ftassi @ricfrank @kea
In a CI/CD environment splitting build files by stage is a common practice. In idephix this is not possible atm since filename is hardcoded.
I propose to add a new option -f / --file
in order do specify a given idxfile. The syntax would be something like that
idx -f myidxfile.php [args]
what do you think? @kea @ftassi @ricfrank @francescotrucchia
โ Idephix git:(master) bin/idx --go
PHP Fatal error: Uncaught exception 'RuntimeException' with message 'The "--go" option does not exist.' in /Users/ftassi/workspace/Idephix/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php:213
Stack trace:
#0 /Users/ftassi/workspace/Idephix/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php(154): Symfony\Component\Console\Input\ArgvInput->addLongOption('go', NULL)
#1 /Users/ftassi/workspace/Idephix/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php(86): Symfony\Component\Console\Input\ArgvInput->parseLongOption('--go')
#2 /Users/ftassi/workspace/Idephix/vendor/symfony/console/Symfony/Component/Console/Input/Input.php(61): Symfony\Component\Console\Input\ArgvInput->parse()
#3 /Users/ftassi/workspace/Idephix/src/Idephix/bootstrap.php(14): Symfony\Component\Console\Input\Input->bind(Object(Symfony\Component\Console\Input\InputDefinition))
#4 /Users/ftassi/workspace/Idephix/bin/idx(21): Idephix\run()
#5 {main}
thrown in /Users/ftassi/workspace/Idephix/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php on line 213
Fatal error: Uncaught exception 'RuntimeException' with message 'The "--go" option does not exist.' in /Users/ftassi/workspace/Idephix/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php on line 213
RuntimeException: The "--go" option does not exist. in /Users/ftassi/workspace/Idephix/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php on line 213
Call Stack:
0.0016 236040 1. {main}() /Users/ftassi/workspace/Idephix/bin/idx:0
0.0183 526168 2. Idephix\run() /Users/ftassi/workspace/Idephix/bin/idx:21
0.0438 1840440 3. Symfony\Component\Console\Input\Input->bind() /Users/ftassi/workspace/Idephix/src/Idephix/bootstrap.php:14
0.0438 1840168 4. Symfony\Component\Console\Input\ArgvInput->parse() /Users/ftassi/workspace/Idephix/vendor/symfony/console/Symfony/Component/Console/Input/Input.php:61
0.0439 1840528 5. Symfony\Component\Console\Input\ArgvInput->parseLongOption() /Users/ftassi/workspace/Idephix/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php:86
0.0439 1841096 6. Symfony\Component\Console\Input\ArgvInput->addLongOption() /Users/ftassi/workspace/Idephix/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php:154```
We should define a set of recipes for common tasks such as deployment or build.
This is even more importante given that on #71 we discussed about dropping some extensions
There are few settings which could be tweaked via conf like:
local
invocationmakes sense? I'm for creating a single array with all the needed configuration
If you start doing releases without shared_folders and then you add something to it you get Exception.
[Exception]
Unable to link shared directory "/[...]/app/logs". Destination file or directory exists.
We are using the new array syntax that is breaking the compatibility with php 5.3:
https://travis-ci.org/ideatosrl/Idephix/jobs/132074103
In the actual implementation of "idx->local()" (see https://github.com/ideatosrl/Idephix/blob/master/src/Idephix/Idephix.php#L263 ), and exception is thrown when a command fails. This happens even for command like "rm <not_existing_filename>".
What do you think of adding a parameter to the local method to skip the exception in case of command failure?
Symfony's doc refers to SymfonyStyle as $io because it can be used both for input and output, shouldn't we do the same?
The method rsyncProject() contained within the Idephix/Extension/Project/Project.php class accepts as third parameter a file used for exclude patterns from the sync.
It would be useful to look up the file even from the target settings if the parameter is not explicitly declared.
Something like that:
if( !$exclude ) {
$exclude = $target->get('deploy.rsync_exclude_file');
}
Why not inject a config assoc array (containg targets) instead an arrray of tagets? Sometime you need to set configuration keys for tasks that play with the local environment only... for example.
Now that http://getidephix.com/idephix.phar is updated, my continuous integration fail because:
PHP Catchable fatal error: Argument 1 passed to Idephix\Idephix::__construct() must be an instance of Idephix\Config, array given, called in /..../idxfile.php on line 18 and defined in phar:///..../idephix.phar/src/Idephix/Idephix.php on line 42
We can choose to stay compatible or not, but maybe we should add some documentation on how to migrate to the new format, or even better a hint inside idephix when is called in the wrong way.
I think we should try to be more coherent on naming.
We ask the user to define targets
in his configuration file, but then we ask him to specify a --env
parameter to select one.
What do you think?
The problem that has been shown in #62 (comment) is that idx commands with arguments are broken, actually the tests fail with error similar to:
Fatal error: Uncaught exception 'RuntimeException' with message 'Too many arguments.' in /home/travis/build/ideatosrl/Idephix/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php on line 181
RuntimeException: Too many arguments. in /home/travis/build/ideatosrl/Idephix/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php on line 181
Call Stack:
0.0001 239520 1. {main}() /home/travis/build/ideatosrl/Idephix/bin/idx:0
0.0032 645272 2. Idephix\run() /home/travis/build/ideatosrl/Idephix/bin/idx:21
0.0148 2254016 3. Symfony\Component\Console\Input\Input->bind() /home/travis/build/ideatosrl/Idephix/src/Idephix/bootstrap.php:14
0.0148 2253472 4. Symfony\Component\Console\Input\ArgvInput->parse() /home/travis/build/ideatosrl/Idephix/vendor/symfony/console/Symfony/Component/Console/Input/Input.php:61
0.0149 2255712 5. Symfony\Component\Console\Input\ArgvInput->parseArgument() /home/travis/build/ideatosrl/Idephix/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php:90
idephix version is identified by the commit hash eg:
Idephix version d123fb7faa23338918bd84f6c0aceff51ed72ced released 2016-07-13 09:16:31
since now we are tagging releases we can also add this reference using the placeholder git-tag
Right now we're pushing the archive (each deployed release) to the website repo. This will make it heavy.
Shall we store phars on S3 instead?
I don't know if it is a feature or a joke, but after $releasesToKeep +1 subsequent failing deploys, the current directory will be erased.
Ciao, I was just playing a bit with Idephix. I wanted to see if I could deploy my project on 2 remote servers.
So I set hosts for my environment like this
'hosts' => array('4.5.6.7', '1.2.3.4'),
but didn't work, the code was sent only to the first server.
After a bit of debugging I've noticed that Application is, by default, set to exit after run (see property autoExit ) so the script was always stopping at this line https://github.com/ideatosrl/Idephix/blob/master/src/Idephix/Idephix.php#L175
A couple of questions:
Thank
We need to ease contributions from our users, this is very important.
We should write a brief introduction on how to contribute, which comprises tech stuff like coding standards but also info about our waffle kanban board, gitter chat and all the ways they can communivate with the @Ideato team.
even if the name sounds obvious let's add a description showed in the help
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.