Setup your Drupal and ftp in the Amazon EC2 micro instance

In this blog i will drive you through setting up Drupal project instance on  Ec2 micro instance of AWS and setting up ftp on your Drupal instance. Before this , of course you have to registered with AWS which is straight forward .

So , what we will understand from this blog :-

  1. Choosing OS and assigning some security rules on our instance .
  2. How to access our instance and play around it ?
  3. Setting up LAMP on our AWS micro instance
  4. Setting up ftp on AWS micro instance
  5. Managing your Drupal project using ftp connection using filezilla

Once you  are registered with AWS you have to login into your account . Among the AWS services just click on EC2 link which is nothing but a virtual server in the cloud . It will redirect you to EC2 dashboard where you can mange all your instance . Now for creating new instance follow below steps:-

  1. Just click on Launch instance select Classical wizard and click continue .
  2. Now you have to select Amazon Machine Image (AMI) from one of the tabbed lists below by clicking its Select button .
    Lets say we select Ubuntu 12.04 LTS .
  3. Next leave default settings except just select micro instance from the instance type because its free to use and click continue .
  4. Next again leave default setting and click continue .
  5. Next again leave default setting and click continue .
  6. Now you have to give name of your key and value . I recommend give key value name more sensible with your project and click continue .
  7. Now select creating a new key pair as we are new we don’t have exist key pair . Give name to your key pair file it should make sense with regards to your project . Download your keypair.pem file and save at a safe place because we need this file later .
  8. Next select create a new security group . Here we will assign some security rule and enable HTTP , ssh and ftp connection to our instance . HTTP port range is 80 , ssh port range is 22 , for ftp select custom TCP rule and give port range 21-22 . About source you can give any IP range as you need or just leave default for now.
  9. Just click continue and launch instance . Your instance will be running in some time as AWS will take some time to run your instance .

Now our EC2 micro instance is running . You can check out from your dashboard .

Now we setup LAMP in our Ubuntu 12.04 LTS instance . For this we access our Ubuntu instance from terminal and setup LAMP in that. Below are the steps to access and setup your LAMP in Ubuntu 12.04 LTS instance .

  1. Open your terminal and go to the directory where you stored your key pair file .pem file then run this command into your terminal sudo ssh -i file_name.pem .
  2. It will give you Ubuntu prompt in your terminal . You can understand like this that now you are logged in into your Ubuntu machine and you can do anything over their . The main thing here is you have to run all commands with “sudo” or as a root user which works on file system directory .
  3. In order to setup LAMP we will install three packages in it . Run these command from terminal :-
  • sudo apt-get install apache2
  • sudo apt-get install mysql-server
  • sudo apt-get php5 php-pear php5-mysql php5-suhosin

That’s it your LAMP environment is ready . You can check it by navigating your instance URL that is for example look like this in browser . It will give you message Localhost is working something like that .

Till here we got our LAMP environment running into our EC2 instance . Now we install our Drupal 7 instance in it . Here in Ubuntu instance we don’t have any ftp connection with ftp client or server. So we can use SCP for taking Drupal tarball from our local instance or we can use wget utility of Linux to download Drupal from its URL . Below are steps to install Drupal 7

  1. cd /var/www/
  2. wget
  3. tar xvf drupal-7.12.tar.gz
  4. mv drupal-7.12 drupal

Below is a link which can tell you how to install Drupal in Linux . Just follow all those steps .

When you setup with your mysql database and Drupal configuration then just browser link like for example :

It will take you to your Drupal site .

Now we will see how to setup ftp on Drupal instance .Why we need ftp for Drupal instance . In order to work on Drupal we have to use many modules ,themes  and libraries . So we have to upload those things on site . we can achieve this with SCP but that will be more difficult because you have to do via command line .  Here we will see how to setup Filezilla ftp on Drupal site which is on AWS EC2 . Below are the steps to setup filezilla as a ftp client .

  1. Install filezilla  into your local system :- sudo apt-get install filezilla
  2. Now open filezilla click on file > site manager
  3. Enter the details of your site here like :-
  • HOST –
  • Port– 22
  • Protocol – SFTP(SSH file transfer protocol )
  • Logon Type – Normal
  • User – ubuntu
  • Password – ubuntu . Then click on ok don’t click on connect this time .
  1. Now click on Edit> Settings > SFTP and addkeyfile . Navigate your .pem file here . It will ask you to convert .pem file just select ok . Now filezilla have your instance credentials to connect and everything is good to connect to your Drupal instance .
  2. Now click on file > site manager > connect

Now you can transfer all files from your local to Drupal instance .

I hope you enjoyed this blog. Please feel free to comment and send queries to me .

Reference :-

Thanks to Sonali , Anirudha , Chetan for reading draft of this 


Doxygen and your project

This blog will give you practical knowledge of why and how you can use Doxygen . You have heard this word Doxygen many times but don’t know what exactly it is ? Or may be majority didn’t hear about this technology. So, now it’s time to get friendly with Doxygen and make your life easier. So let’s start.

Tell me what Doxygen actually is ?
Doxygen is a new and emerging technology. It’s a system which allows you to make documentation of your different projects running on C , C++ , Java , Python , PHP , Objective-C , IDL (Corba and Microsoft flavors) , Fortran, VHDL , C#, D.
Doxygen is open source technology which runs on almost all Unix flavors. Executables for Windows are also available.


Why should I use Doxygen in my project ?

Doxygen has many advantages. Some noted below.

  1. It can generate on-line documentation browser in HTML or an off-line reference manual in LATEX from documented source files.
  2. It also generate your documentation in RTF (MS-Word) , Postscript, hyperlinked PDF ,compressed HTML , and Unix man pages.
  3. You can make documentation of any code structure (including framework , CMS , complex projects ) from its undocumented source files. So instead of googling every time you can directly dive into code structure documentation and understand relationships between classes , methods etc.
  4. You can also visualize relationship between your code elements including dependency graphs, inheritance diagrams , collaboration diagrams . And hey good news is all these things get generated automatically with no pain.
  5. It actually speeds up the development process of your project when you are working on big code architecture like Drupal or Django etc.
  6. Doxygen add plus point in your project when you delivering project to your client by providing technical documentation with project.
  7. I believe Doxygen not only help to clients but in many software development processes (Development, Testing , Maintenance , Implementation , Deployment )
How can i install Doxygen in my linux machine ?

Step 1: Download Doxygen source from here doxygen or you can just write this command in your terminal .

sudo apt-get install doxygen

Note:- Makes sure apt-get is only for Ubuntu and Debian please use as per your Linux distribution.(fedora- yum , opensuse – zipper )
Step 2:After downloading source tar package of Doxygen . Extract it by terminal

tar xf doxygen-$VERSION.src.tar.gz

If you have installed it by “apt-get” then skip this step and directly switch to running and configuring Doxygen with your project.
Step 3: Run the configure script :

cd doxygen-$VERSION

sh ./configure

Step 4:Compile the program by running make:


Step 5:Optional : Generate the user manual

make docs

Step 6: After the compilation of the source code do following to install Doxygen

make install

Note:- Make sure you are in root or maybe it will give you error in making directory or executable in /usr/bin , /usr/bin/x11/

Well done you have installed Doxygen!

Note:- For more advance installation instruction you can check out here : Advance installation

How i can give some oxygen to my project ? :- Configuration

 Step 1: Go into your project directory and run this command

doxygen -g [configfile name]

Note: If you do not give any file name then Doxygen will generate “Doxyfile” by default.
Step 2: Now just open your configuration file and edit as per your project andprogramming language you are using .
Step 3: Tell doxygen about your project configuration

doxygen [configuration file name]

Step 4: check your documentation in /html or /man depends what type of documentationyou are generating .
Here you can download Doxygen config file for PHP project from my Github repository : config file

How can i use Doxygen in understanding Drupal CMS(PHP based) ?

Scenario 1:

I was working on Drupal project and i wanted to know all functions, classes , hooks etc used in Drupal and how exactly i can modify them as per my project requirement. I came to know about API module in Drupal and it’s good but i was not satisfied because of three things :
  1. It was slow . I have to again and again do lots of clicks.
  2. I have to check security updates as it was released again and again .
  3. I didn’t have choices of generating my documentation in different formats whichshould be understandable by my user.
I need some system which actually generate documentation of Drupal source code and able to explain me all relationship between classes etc.So API module and Doxygen both have their own objective and viewpoints. API module let you know what all methods , hooks you can use in Drupal .But Doxygen generated documentation of your undocumented source code of Drupal off-line and give you user friendly docs of source code with various relationship diagrams. This is basically one feature of Doxygen but if you are working on large CMS or frameworks it will make your life easier. you can modify comments as you want and document them.
 So some things i like to include here about what i observed after creating my documentation of drupal source code .
1. My documentation was fancy , structured and understandable .
2. Documentation have Indexes and it was browsable.
3. Doxygen documented all files, namespaces, packages, classes, structs, unions, templates, variables, functions, typedefs, enums and defines.
4. It generated all my class and collaboration diagram in HTML and LATEX.
5.It grouped all my entities in modules and created hierarchy of modules.
6.Generated all list of members of a class along with their protection level.
7.Automatically generated references to documented classes , files , members and namespaces , global variables , functions typedefs , defines and enumerations .
8. References to my base/super classes and inherited/overridden members are generated automatically.
After getting all this information my development process became easy.This is how
Doxygen gave me oxygen in this scenario and it was really cool.
You can check out my documentation of source code of Drupal 7 created using Doxygen 

Drupal documentation

Scenario 2:

How i used Doxygen after documenting my project?

  1. I have used dot tool of the Graphviz tool kit to generate include dependency graphs, collaboration diagrams, call graphs, directory structure graphs, and graphical class hierarchy graphs and it was beautiful .
  2. I configured references to documentation generated for other projects in a location independent way. So let say if i’m working on big and complex project and i created many documents for different components of project. At last i need to merge those documents in one documentation. Here Doxygen gave me flexibility by allowing integration of all documents together .
  3. I wanted to transfered my documentation from my office laptop to my personal laptop. In this thing Doxygen allow me to transfer all my documentation and search engine to my personal laptop without regenerating the documentation.
I hope this blog will help to folks who want some information for start using Doxygen .

I hope it will also help to project managers in making decision to use Doxygen in their projects .


Note: I will add Doxygen configuration files of different projects running on different programming languages in my github repository as i will do some more R&D on Doxygen working with other technologies.


Thanks to Sonali sambhus for reading draft of this.
References :-