So my application installs and deploys fine as long as I put it on an instance bigger than micro.
when I deploy on micro when composer tries to install I get a php error about not being able to allocate enough memory. so I did some googling and it seems that you can create a swap file/disk on boot/ creating of the instance here are two tutorials one two
these might be dated so first question is can this still be done?
Second question is how do I create a .ebextensions file to make this happen on deploy?
Here is my attempt but its not working unsurprisingly enough as I know very little about this.
command:dd if=/dev/zero of=/swapfile bs=1M count=3072
Running Composer on a machine requires quite a bit of resources, especially RAM.
I have learned that it is counterproductive to use swap space on a EC2 micro instance because a) it is slow swap space and b) using it counts against IO which has also to be paid, allowing for an unexpected bill the next month.
The correct way to deploy anything that uses Composer is to install all dependencies prior to deploying the code onto the machine, then sync it in one go. That way you are independent from the limited resources of the instance because you can use some powerful deployment machine (I bet your dev machine can do it). You also prevent ending up with a broken site because some required library's hosting is down (ever experienced Github downtimes?), because you'd detect this on the deploying server, not the live machine. Additionally, Composer will cache anything downloaded, which also might exceed the limited resources on a micro instance - or at least use it for something non-productive.