Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ability to run scripts locally without SSH. #43

Merged
merged 1 commit into from Feb 23, 2015

Conversation

dalabarge
Copy link
Contributor

@taylorotwell This is a first pass at getting this working. I'm sure you could come up with a more elegant way of doing it. The main idea is that I'd like to use Envoy to handle a deploy process and the first step is to run some commands locally before running the deploy commands remotely. We don't want to have Node dependencies or the build process on remote servers so we need to run all those processes on the local machine prior to deploy (which is essentially an rsync operation). This patch just bypasses the SSH process when the $target is a localhost hostname.

Below is an example Envoy.blade.php that will run tasks and macros using this patch. An example run would be something like envoy run installer.

@servers([ 'vagrant' => '127.0.0.1' ])

@task('init')
    git commit -am 'Initial commit.'
    git push origin master
@endtask

@task('install')
    composer install --no-dev
    npm install
    bower install
@endtask

@task('update')
    composer update --no-dev
    npm update
    bower update
@endtask

@task('keygen')
    php artisan key:generate
@endtask

@task('migrate')
    php artisan migrate --package="foo/bar"
    php artisan migrate
@endtask

@task('seed')
    php artisan db:seed
@endtask

@task('build')
    php artisan build
@endtask

@macro('setup')
    install
    keygen
    migrate
    seed
    build
    init
@endmacro

@macro('installer')
    install
    migrate
    build
@endmacro

@macro('updater')
    update
    migrate
    build
@endmacro

@macro('migrator')
    migrate
@endmacro

@macro('seeder')
    seed
@endmacro

@macro('builder')
    build
@endmacro

sebmak added a commit to sebmak/envoy that referenced this pull request May 30, 2014
…until it is accepted or better alternative is in place
@skovachev
Copy link

Is this part of the main Envoy source? I can't seem to get it to work.

@dalabarge
Copy link
Contributor Author

@skovachev this is a pull request and not an official feature as of yet.

If you had a full stack installed on your host machine (your Mac let's say) then this would be your local machine. You could then have a VM (guest machine) or server (remote machine) that you wanted to run certain operations on while running others on your local machine. That's what this patch fixes. It also allows you to run these scripts from within your VM by treating your VM as the local.

That's what I do by running these sort of commands locally from within my "development" VM which then deploys to my "production" VM/server. Since Envoy remotes in every time this patch is needed to bypass the SSHing and just run the commands in the local terminal.

The alternative is to just setup Artisan commands or bash scripts or run envoy from your host machine and have it SSH into your VM but that means you would have to have dependencies running on your host machine too (which I don't want).

@skovachev
Copy link

Thanks you! That makes sense. I guess a solution would be to just use your fork, or make one of my own.

@ryross
Copy link

ryross commented Aug 29, 2014

+1 for this feature

@adamlc
Copy link

adamlc commented Dec 9, 2014

+1 on this too!

@ArthurGuy
Copy link

+1 I would love to see this

@bipinu
Copy link

bipinu commented Jan 12, 2015

Pretty please, @taylorotwell!
This is really needed for our case as well.

@dilipgurung
Copy link

+1 from me too

@huglester
Copy link

This is a nice addition. Sometimes we want to run several commands etc, would be nice place to make them work localy. even nice to make some migrate + seeds + refresh + test combos

taylorotwell added a commit that referenced this pull request Feb 23, 2015
Added ability to run scripts locally without SSH.
@taylorotwell taylorotwell merged commit fd92296 into laravel:master Feb 23, 2015
@freekmurze
Copy link

Fantastic! Great work!

underthecocotree added a commit to underthecocotree/docs that referenced this pull request May 16, 2016
I had to look around a bit to find out that you can use envoy locally. I thought it would be great if it was reference at the docs.

Reference:
laravel/envoy#43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants