Deploying Symfony app on micro instance of aws – Amazon EC2

The major issue you would face is memory. Yeah, the instance comes with small memory allocation and anything memory intensive task might not work there. Your composer install command might not do anything as well.

The major one would be Composer install just hangs and even aborts the process
When you are issuing

composer install

It will eat a bit of memory and doing it on the instance might not work as expected.

Here are the methods I used to overcome it.

1. Incremental install
On you composer.json file, you can try to list only one or two packages at a time and issue composer update vendor/package and if your individual packages are small enough you might get away with it. In my case this didn’t work

2. Ship your vendor from your local machine to the instance
yeah, just have all your composer install where you will be comforted by memory in Gigabytes and just zip and ship it to your instance.
On your local machine

tar -cf vendor.tar.gz /path/to/vendor/folder

Once you have the tar or zip of any of your favorite compressed file

scp -i /path/to/your/pem/file vendor.tar.gz ec2-user@ec2-domain-goes-here:/path/on/instance

This is assuming this will transfer your vendor file to instance.
Then log into your instance and just uncompress the file and put it on the root directory of your application.
This would be just the half of the work.
Then you will need to generate the bootstrap cache file

composer run-script post-update-cmd

yeah.. this will take care of creating the cache file of the bootstrap along with other stuffs that you put on your composer.json post-update-cmd part.
Sometimes you might want to give the write access to the app/cache and app/logs folders as well


Updating Git on Mac showing previous version

Was trying to pull something to github and noticed I was using a bit old Git version.
Then I went to and downloaded for mac.
After installing, I checked if I have the latest version by doing

git --version

and it showed

git version

Then I suspected the previous one is not updated and checked which git binary is being used

which git

And it replied as


The new one is being save on another directory – /usr/local/git

Then I checked how my path is setup

echo $PATH

it was something like


As you can see the poor mac would see the /usr/bin first to check if command binary is inside it and it would continue.. so it was not checking the /usr/local/git..

Just putting the proper path infront of the path would solve the problem

export PATH=/usr/local/git/bin/:/usr/local/sbin/:$PATH

That would fix the problem. In the mean time, doing some cleanup on the existing git files would help also..

datatable/component not updated after deleting and adding new one

During working on tabular data, it is common to have edit and delete command buttons for each row.

And, after we update or delete we want the table to be updated. Let’s looks some simple example.

The table on the JSF might look like

<form id="tablularForm">
<h:datatable id="tabularData" value="#{someBean.list}"
binding="#{someBean.htmlDataTable}" var="data">
<h:outputText id="colum1" value="#{data.column}" />
<h:CommandLink id="edit" value="Edit" action="#{someBean.editAction}" reRender="tabularData"/>
<h:CommandLink id="delete" value="Delete" action="#{someBean.deleteAction}" reRender="tabularData"/>
<h:CommandButton id="add" value="add" action="#{someBean.addAction}" />

The above ideal table would work fine.

The datatable would store values by reading from bean and would be updated on Edit and Delete actions accordingly.

This is b/c of the reRender attribute of the components.

The glitch comes when there is no any data in the table. Say you daleted all the data and you want to add a new one.

Or it is the brand new table to be added.

The row would be added but it wont be shown on the table. In short the table would not be updated.

The thing is when we use reRender, we have to use the enclosing component not the component to be safe!.

When it tries to rerender if the component was not there initially, it wont rerender it.
So, here we can use the id of the form for rerendering the datatable and we would be OK.

See why jsf apps are slow in cases