简体   繁体   中英

AWS Elastic Beanstalk for PHP uploading a ZIP off app through CLI

I'm wondering if it is possible fo upload a zip of my entire application to Elastic Beanstalk through CLI? Currently I'm using git aws.push, but the problem is that my app has vendor dependencies I need to install after deploy. If I could directly upload a zip from CLI I could get my jenkins build server to install all the vendors, zip up the entire app then upload to EBS.

You have this tagged as "Elastic Beanstalk", so I'm going to assume that you're trying to push your app to S3, not EBS. App versions are stored in a S3 bucket and the Beanstalk deployment script then downloads the .zip from the bucket to the EBS volume, extracts it in /tmp , and then copies over the code to /var/www/html . You don't actually ever upload anything directly to the EBS volume (well, I mean, you shouldn't).

If your dependencies are PHP libraries, just include them with your application source bundle. However, if your dependencies include files that are installed in a location other than /var/www/html (like Apache modules or other binaries), then no, you can't (easily) do that with Elastic Beanstalk and PHP during deployment. You'll have to SSH in, install your dependencies, "burn" a custom AMI of the instance, and then specify that custom AMI in your Beanstalk environment config.

This is somewhat of an ugly workaround because you now have the responsibility of maintaining this custom AMI, whereas using the stock Amazon-provided images means you can rely on them to periodically release new versions with security fixes, etc. Keep in mind though that the AWS product development teams move at breakneck speed. Just a couple weeks ago the Beanstalk team introduced Puppet-like configuration scripts for provisioning. This is likely exactly what you'd need, but unfortunately it only supports Java and Python environments. I expect them to release PHP support soon though, so keep an eye on it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM