GithubHelp home page GithubHelp logo

tamagokun / pomander Goto Github PK

View Code? Open in Web Editor NEW
202.0 202.0 18.0 571 KB

Deploy your PHP with PHP. Inspired by Capistrano and Vlad.

Home Page: http://tamagokun.github.io/pomander/

License: MIT License

PHP 100.00%

pomander's People

Contributors

asanger avatar jyrkij avatar kostaspt avatar leopoiroux avatar max-voloshin avatar mekras avatar nlemoine avatar sasezaki avatar tamagokun avatar th3fallen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pomander's Issues

Support for SSH2 extension

PHP has terrible shell support, but if we can use the SSH2 extension, we should be able to work with a much nicer shell and do things like write to STDIN with an interactive terminal.

If the user doesn't have the extension installed, just fallback to using passthru

known_hosts auto "yes"

When server responds with add to known_hosts prompt, pomander should be able to answer "yes"

Respond to password prompts

If remote deployments require passwords after the initial SSH connection, Pomander is currently unable to handle them.

It would be great if Pomander could auto-respond to these prompts with a password or key_password from the environment config, or if the prompt could be presented to the user to provide input.

How to upload on several servers?

I have code like this:
$env->user('user');
$env->repository('repo');
$env->scm('svn');
$env->deploy_to('/var/web');
$env->key_path("key");
$env->app(array('server1.com','server2.com'));

When i run deploy:update this command perform deploy only on the first server in the list. It there some additional options that enables deploying process on multiple servers?

get(), put(), and rsync

Sometimes rsync does totally weird stuff.

Also, currently Pomander does not utilize key_path or key_pass when using rsync, so those commands would fail even though ssh connections elsewhere would be successful.

It might be better to straight up use phpseclib's SCP implementation, or just hunker down and get this rsync thing working like a champ.

SIGTERM rollbacks

If Pomander catches a SIGTERM during a deployment and things can be rolled back, it should!

Version stable ?

Hi, thks for the merge ;)
Do you consider that this version is stable enough to be tag ?
I prefer to link my plugin to a stable version.
++

Move DB tasks into pomander

basic database tasks should be a part of Pomander, with the Wordpress specific bits belonging to the plugin.

Analog of Capistrano :linked_dirs

Hello!

Sorry, if I have missed something, but is there in Pomander feature like :linked_dirs in Capistrano? This feature allows to put directories to shared folder and creates symlinks to these directories in the releases dirs.

There is a shared folder in Pomander, but I didn't find any option to create symlinks neigher in the docs, nor in the code.

Best regards

Windows Support

Working support for Windows would be awesome.

Things that need to be taken care of:

  • - How to handle unix-y commands: There are a few ways to approach this, though I am in favor of the lightest solution. Can it be done with PHP functions? Or can we require libs on the Windows side of things to make this work as-is? For example, you probably already have git-shell or something like that installed.
  • - Taking care of file paths: Probably just a matter of going through and replacing "/" with DIRECTORY_SEPARATOR.

@msschwartz whatchu think? Have any thoughts?

method instead of scm

I'd rather change the scm option to method, so that users can use alternative deploy methods (read: rsync) since sometimes the remote will not be fully configured to handle git or svn.

Methods to include:

  • git (default)
  • svn
  • rsync

Getting hung up at :setup

I have setup my first pomander deploy and after running :setup it seems to get hung on

* info deploy setting up environment

It looks like it has created the shared and releases directories, but nothing happens after that.

Also, if I remove $env->releases('true') it deletes the parent directory (one that I created, not pomander). Not sure if that's the intended action, seems off.

Deploying a tag based on a semver constrait

Being able to deploy a specific tag based on semantic versioning constraint similarly to Composer would be awesome. Along the lines of:

$env->version('3.2.*');

Where it then clones and checks out the latest tag from 3.2.x, e.g. tags/3.2.14.

PHP has few semver parsers that implements the full spec and allow constraints, making resolving pretty easy; run git tags, $tags = explode("\n", $output) and find the highest satisfying version from the array, along the lines of:

use vierbergenlars\SemVer\expression;
$expression = new expression($env->version);
$version = $expression->maxSatisfying($tags);

Then checkout the tag in the $version, e.g. git checkout tags/$version.

Better rollback mechanism

Rollback are... well, weird. Need to support the following:

  • $app->env->releases == true?
    • false
      • checkout previously deployed hash
    • true
      • remove current/failed release
      • if finalize was called, re-set the symlink
  • db:merge has run and backup exists?
    • true
      • restore the latest backup.

PHP7 support

Hi, I faced a problem when updated my local server to PHP7.
I've got an error in console:
Methods with the same name as their class will not be constructors in a future version of PHP; Net_SSH2 has a deprecated constructor

Perfecting the deploy:update

A few scenarios to discuss to try and perfect the update command:

Currently, the command is something along the lines of:

git reset --hard --quiet && git checkout branch --quiet && git pull --quiet

depending upon whether or not you specify a branch or revision.

Here is where some issues start to arise:

  • You are deploying some code that is on a new remote branch that hasn't been fetched yet. update will fail because it can't checkout a branch it doesn't know about. The same would go for tags and commit SHAs.
  • You specify your branch as remote/branch_name. This will move HEAD to a remote branch rather than a local branch and git pull will fail since you can't merge into a remote branch.

@leopoiroux does this make sense? I think it may be best to go back to using git fetch, but incorporate your additional checks for branch/revision.

Something like:

for branches:

git fetch --all --quiet && git reset --hard --quiet && git checkout branch --quiet

for revisions/versions:

git fetch --all --quiet && get reset --hard --quiet revision

Cleanup old releases

Currently there is no way to automatically remove old releases.

The idea is sort of already implemented when you set the releases option (true or any number), just need to implement the finding and removal of releases in the task itself.

All environment scripts loaded on deploy

When deploying an environment any "after" blocks within any deploy config will be executed. Possibly resolve this by creating a new file named _after.php, then letting pom load the file based on the environment being deployed to.

$task_name can be undefined in Cli.php

In Cli.php TaskNotFoundException can be thrown by print_tasks method, so here variable $task_name will be undefined.

Unfortunately at this time no way to get missed task name here, but I've create PR to Phake in order to solve this.

Ignore exit code > 0

There is no option to ignore exit code > 0 in the run. Please add it or create a run_silent or so.

Thanks.

Using SVN getting: bash: git: command not found

I'm trying out pomander, but I can't get it function. My config:

<?php 
$env->repository('http://<svn-repository>')
    ->releases(true)
    ->keep_releases(5)
    ->user('<me>')
    ->scm('svn')
    ->revision('trunk')
    //
    ->backup(true)
;

//
// If you are deploying your application to a remote server:
//
$env->deploy_to('/usr/src/build/pom/track');
$env->app('<internal ip>');

When trying to check the setup, I get the following error:

hermes:pom gp$ pom deploy:setup
(in <my dir>)
 * info target <host ip>
 * info deploy setting up environment
bash: git: command not found
 * abort fail aborted!

I'm not using git. git isn't on the server. But SVN is. And I am trying to use SVN.

SSH connection

Hi,
I'm used to Capistrano and deployers and really enjoy you built one made of PHP.

But I'm having an issue : the script can't connect through ssh to my server.
I tried to set the key path with $env->key_path('/System/Users/Username/.ssh/id_rsa') but I'm still getting the "Unable to load RSA key" message.
I digged a little in the source code. The loadKey method from phpseclib is always returning false, I can't figure out why.

How do you manage to make it work ? I'm having no trouble connecting through my console.

Detect composer.json

Should be able to detect composer.json and attempt to install vendor libs.

This requires composer to be installed on the remote end of the deployment, but there will be an option to turn this off:

$env->composer(false);

Rollback to other releases

pom production rollback - This will rollback to the previous release.

It would be nice if we could do something to rollback to other releases:

pom production rollback releases=2 # go back 2 releases.

Heroku Deployments

Cataloging notes and ideas about being able to manage deployments to Heroku via Pomander.

This should be a straightforward process as Heroku takes care of nearly everything for us. Pomander just really needs to run the key deploy tasks with empty commands so that before/after hooks can be triggered, and anything special can be taken care of.

Notes:

Example Capistrano task for deploying to Heroku:

namespace :deploy do
  desc 'Deploy the app'
  task :production do
    app = "my-amazing-heroku-app-name"
    remote = "[email protected]:#{app}.git"

    system "heroku maintenance:on --app #{app}"
    system "git push #{remote} master"
    system "heroku run rake db:migrate --app #{app}"
    system "heroku maintenance:off --app #{app}"
  end
end

Using a Composer plugin to trigger pom heroku

Just rely on heroku run: heroku run vendor/bin/pom heroku

CLI basics

Need some basics flag options like:

--version, -v
--help, -h

deploy.lock

While a deploy is running, create a deploy.lock file so that subsequent deploys cannot be happening at the same time.

Things to look out for:

If a deploy fails, will it always be able to remove the deploy.lock file? If it cannot, people will be stuck without being able to deploy.

SSH Error: "Unable to load RSA key."

I tried to deploy with pomander, but it fails with my working SSH Key. A plain ssh login works.

Error message:

 * abort ssh Unable to load RSA key.

Tried against ǜersion "pomander/pomander": "dev-master".

The head of my private key:

$ cat .ssh/id_rsa
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: AES-128-CBC,E731CBEFD26F9C7560C79A3E7C53C516

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.