Azilhan
Azilhan

Reputation: 369

Migrations in production Laravel

I'm working on a personal website, and i try to find a solution to a problem and any help would be welcome.

I work with Github because I'm working from several places (work, home...), and I'm wondering about migrations when I transfer my application in production. Locally, I don't have any problem, I do my migrations, and run artisan migrate, but then when i put this online, I HAVE to log in to my server, run the migration from the command-line, and then edit the migrations file online again. I know this is not the good solution to do this, it's really not good for long term usage and bigger applications than mine.

And little other question, what would you advise me to use to push automatically my master branch from git to my server, I have heard about Heroku, is it easy to get working with it ?

Thank you

Upvotes: 2

Views: 677

Answers (1)

Sh1d0w
Sh1d0w

Reputation: 9520

If you are using Laravel 5 you can take advantage of Envoy. It is exactly what you want. You can set tasks for many servers (basically you can write any commands you want like updating from git or running migrations). Taylor wrote the documentation very good, so you can get started very easy.

A quick example for SSH in a server, update form git and run migrations:

@servers(['web' => '192.168.1.1'])

@task('deploy', ['on' => 'web'])
    cd site
    git pull origin {{ $branch }}
    php artisan migrate
@endtask

For Laravel 4, you also have Envoy task runner.

Upvotes: 2

Related Questions