Amazon Simple Storage Service(S3) was used to take care of all the bottlenecks that a new Social Network faces. Storing and managing all the media like avatar pictures, photo gallery images, videos quickly becomes a problem in case a good management solution is not applied. After trying out a separate FTP server to store all the media, we decided to go for Amazon S3 to tackle this issue.
While working on this new Social Network website, it was realised that the media should be server from a separate server, otherwise we'll quickly end up taxing the webserver for petty tasks like rendering images and streaming videos. While going about tackling the issue, we identified 2 main areas that we needed to take care of -
1. Storing the uploaded files to Amazon S3
2. Make the necessary changes so that the frontend honours the Amazon S3 file paths and does not refer to local files
Tackling the first problem was tedious, since each component makes use of it's own routines to store files, and there's no common way this could be done.We identified the main components that needed to be modified initially -
- Community Builder (Avatar)
- Community Builder (Profile Gallery Plugin)
- Community Builder (MP3 player plugin)
The first two used a common image handling routine and were dealt with simultaneously. Community Builder's imageToolbox class was the place where all changes were made.
The profile MP3 player is a 3rd party extension for CB which had it's own file handling routines. These needed to be modified to store the MP3 files on Amazon. The player functions which used to fetch the files were modified too, so that they refered to the Amazon path rather than local files.
Seyret is a Video player extension for Joomla. This proved to be easy to modify since the file handling routines were quickly found and replaced. Both, the video and it's thumbnail are now rendered from Amazon rather than the webserver.
The second problem, though not tedious proved a bit lengthy since we had to hunt all the modules that made use of the Avatar images and other thumbnails and modify all of them
A last measure was to add a CNAME record pointing to the Amazon media location to that the media locations are consistent with the website's domain.
All in all this was an exciting project in spite of the fact that due to so many modifications, the possibility of upgrading was next to zero. The next phase of development will be to convert this site to be Joomla 1.5 so that the framework can be utilised to take care of storing data to Amazon and individual components will be modified to the least.