Added ability to run scripts locally without SSH. #43

Merged
merged 1 commit into from Feb 23, 2015

Conversation

Projects
None yet
10 participants
@dalabarge
Contributor

dalabarge commented May 8, 2014

@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

Added pull request #43 in order to use it on my local machine until i…
…t is accepted or better alternative is in place
@skovachev

This comment has been minimized.

Show comment
Hide comment
@skovachev

skovachev Aug 12, 2014

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

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

@dalabarge

This comment has been minimized.

Show comment
Hide comment
@dalabarge

dalabarge Aug 12, 2014

Contributor

@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).

Contributor

dalabarge commented Aug 12, 2014

@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

This comment has been minimized.

Show comment
Hide comment
@skovachev

skovachev Aug 12, 2014

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

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

@ryross

This comment has been minimized.

Show comment
Hide comment
@ryross

ryross Aug 29, 2014

+1 for this feature

ryross commented Aug 29, 2014

+1 for this feature

@adamlc

This comment has been minimized.

Show comment
Hide comment
@adamlc

adamlc Dec 9, 2014

+1 on this too!

adamlc commented Dec 9, 2014

+1 on this too!

@ArthurGuy

This comment has been minimized.

Show comment
Hide comment
@ArthurGuy

ArthurGuy Jan 8, 2015

+1 I would love to see this

+1 I would love to see this

@bipinu

This comment has been minimized.

Show comment
Hide comment
@bipinu

bipinu Jan 12, 2015

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

bipinu commented Jan 12, 2015

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

@dilipgurung

This comment has been minimized.

Show comment
Hide comment
@dilipgurung

dilipgurung Feb 9, 2015

+1 from me too

+1 from me too

@huglester

This comment has been minimized.

Show comment
Hide comment
@huglester

huglester Feb 17, 2015

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

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

Merge pull request #43 from bexarcreative/master
Added ability to run scripts locally without SSH.

@taylorotwell taylorotwell merged commit fd92296 into laravel:master Feb 23, 2015

@freekmurze

This comment has been minimized.

Show comment
Hide comment
@freekmurze

freekmurze Feb 23, 2015

Fantastic! Great work!

Fantastic! Great work!

underthecocotree added a commit to underthecocotree/docs that referenced this pull request May 16, 2016

Adds localhost server reference to envoy.md
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