Laravel storage / framework / sessions on EC2 do not allow opening stream
I am using a working deployment system for amazon beanstalk with EC2 servers and I recently added some post optimization posts to my scripts like
composer dump-autoload
sudo php artisan optimize --force
sudo php artisan route:cache
Now it is strange on one of my API endpoints that I am getting half the data and at the end I have an error
file_put_contents(/var/app/ondeck/storage/framework/sessions/34325rfeq4324qfgr4): failed to open stream: No such file or directory
What is causing this and how to fix it in the ec2 deployment setup?
EDIT
I learned something! If on the server that is giving me the error, I run this command below to clear the config cache, my error goes away. So how exactly can I fix this so that I can still run php artisan: cache config and not interrupt it?
php artisan config:clear
source to share
The reason you are having this problem is because you run artisan config:cache
before "release" - on/var/app/ondeck
if you run eb ssh
you will see your application lives inside/var/www
You need to run config:cache
with post deployment, but it doesn't seem to be officially supported. Here's a workaround:
http://junkheap.net/blog/2013/05/20/elastic-beanstalk-post-deployment-scripts/
source to share