mysql - Laravel 5: run migrations on server environment, not local -
i have simple set of database migrations created within laravel 5 application, , run nicely on local development environment.
now time run run migration on new production server environment. have configured db connection , deployed app, , app sees database, there no tables - migrations need run.
the following command, believe, should run migrations using "production" environment, set remote db connection details:
php artisan --env=production migrate
the migration works, runs on local environment! here environment file production environment(using amazon elastic beanstalk service) :
.elasticbeanstalk.env
app_env=production app_debug=true app_url=<myappname.elasticbeanstalk.com> db_host=<myapp.amazonserveraddress.amazonaws.com:3306> db_database=<mydbname> db_username=<mydbusername> db_password=<mydbpassword>
so either environment file not configured correctly, or artisan not able switch environment. change .env file (local development environment, named "local") connect remote, production db, want use laravels environments.
what missing? why migration run on "local"?
thanks.
you can't run remote commands on local artisan
. run there work locally (even if set env
variable).
setting env
variable tell application behave if in environment. doesn't tell artisan use remote production environment.
if want run commands on production server, suggest envoy. standalone project (and not have used laravel projects) , deployment.
it thin wrapper around sshing remote server , running commands. example envoy.blade.php
file on sites might this:
@servers(['web' => 'account@server']) @task('deploy') cd ~/src php artisan down git pull origin master composer install --no-dev --no-progress --prefer-dist php artisan migrate --force --no-interaction php artisan optimize php artisan @endtask
this sshes in, puts application in maintenance mode, pulls new code, various 'new code' setups composer install, migrate, etc. , pulls application out of maintenance mode.
Comments
Post a Comment