I am deploying my laravel project on server with deploy bot. These below commands i run on server after pull request
chmod -R 777 $RELEASE/storage
composer install --no-progress --optimize-autoloader
php artisan config:cache php artisan migrate
php artisan passport:install
php artisan passport:client --personal
Then my project works smoothly but problem is because i have to run php artisan passport:install always then it generate keys again then current users have to logout to proceed further. if i remove php artisan passport:install from these commands then it generate an error keys on found
Composer.json:
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.1.3",
"barryvdh/laravel-cors": "^0.11.3",
"bosnadev/repositories": " 0.*",
"fideloper/proxy": "^4.0",
"laravel/framework": "5.8.*",
"laravel/passport": "^7.2",
"laravel/tinker": "^1.0",
"laravelcollective/html": "^5.7",
"orangehill/iseed": "^2.6",
"spatie/laravel-menu": "^3.3",
"spatie/laravel-permission": "^2.32"
},
"require-dev": {
"beyondcode/laravel-dump-server": "^1.0",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^2.0",
"phpunit/phpunit": "^7.0",
"user11001/eloquent-model-generator": "^2.0",
"xethron/migrations-generator": "^2.0"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
}
}
Error in log file if php artisan install:passport is not there:
local.ERROR: Key path "/public_html/releases/1556096621/storage/oauth-private.key" does not exist or is not readable {"userId":1,"exception":"[object] (LogicException(code: 0): Key path \"file:///folderName/public_html/releases/1556096621/storage/oauth-private.key\" does not exist or is not readable at /home/folderName/public_html/shared/vendor/league/oauth2-server/src/CryptKey.php:48)
passport:install command. This command will create the encryption keys needed to generate secure access tokens. In addition, the command will create "personal access" and "password grant" clients which will be used to generate access tokens:
Passport generates these keys from your APP_KEY in .env . After composer install this key is changed, so existing keys generated by passport won't work: local.ERROR: Key path "/public_html/releases/1556096621/storage/oauth-private.key" does not exist or is not readable
. Because it is generated with the old APP_KEY