I use to have a working deployment system to amazon beanstalk with EC2 servers and recently I added some optimization post commmands to my scripts such as
composer dump-autoload
sudo php artisan optimize --force
sudo php artisan route:cache
Now on one of my API endpoints it's strange I get half of the data then 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's causing this and how do I fix this in the ec2 deployment setup?
EDIT
I just found out something! If on the server thats giving me the error I run this command below to clear the config cache my error dissapears. So how exactly do I fix this so that I can still run php artisan config:cache and not have it break?
php artisan config:clear
The reason why you're having this issue is because you're running artisan config:cache before the "release" - on /var/app/ondeck
if you run eb ssh, you'll see that your app is living inside /var/www
You need to run config:cache using a post deploy hook - however it seems that this isn't officially supported yet. Here's a workaround:
http://junkheap.net/blog/2013/05/20/elastic-beanstalk-post-deployment-scripts/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With