Want your own Cloud API?

Ever considered developing a RESTful API? Ever wondered what is FRAPI and how it works? Well apart from reading the frameworks’s website, there was no real way to assess FRAPI as a RESTful API Framework — Not until recently.

 

In order to ease adoption and make it more accessible for people to evaluate FRAPI, we’ve put an Amazon AMI together. This AMI comes pre-installed with Linux Lucid Lynx (Ubuntu 10.04 LTS), NGINX as the webserver, Memcached — (And no, port 11211 isn’t opened to the public), PHP5-FPM, APC and obviously FRAPI.

 

If you’d like to give this public AMI a spin, just go to Amazon’s instance management section, click on “Launch Instance, go to community AMIs, and search for : “ami-0adf2f63″ . Once you found it, click on “Select” (And make sure to select Port HTTP (80) when asked about which ports to open).

 

It’s running, now what?

You can go directly to the AMI’s host name in a browser and you will get FRAPI’s default invalid action error, or you can follow these steps to customise it a bit more.

 

Now that you see your new shiny FRAPI-AMI instance running in your management console, you have a few options:

 

First option is: Find the “Public DNS” and the “Public IP Address” of the instance you just launched and point your domain-name’s DNS to the IP you found — Your domains could be: api.mydomain.com and admin.api.mydomain.com

 

Second Option is: If you do not currently hold a domain name for your API, edit your /etc/hosts file (Or the equivalent in your OS) to have an entry that points to the IP of your instance

 

10.0.0.1 api.mydomain.com admin.api.mydomain.com.

 

Once you are done with either Option 1 or Option 2, you’ll need to connect to your instance over SSH (ssh ubuntu@hostname-of-the-instance -i your-amazon-cert.pem). Upon connection, you’ll be greeted with a welcome screen giving you some information about FRAPI and the server’s software :

$ ssh ubuntu@hostname-of-the-instance -i your-amazon-cert.pem

 

Linux domU-12-21-38-34-69-D2 2.6.32-305-ec2 #9-Ubuntu SMP Thu Apr 15 04:14:01 UTC 2010 i686 GNU/Linux

Ubuntu 10.04 LTS

Welcome to the FRAPI API Server!

 

 * Documentation: http://wiki.github.com/frapi/frapi/

 * User General Mailing List: http://groups.google.com/group/frapi-general

 * Or you can always reach us on IRC irc://frapi@irc.freenode.org

 

For any information do not hesitate to visit http://getfrapi.com

and if you find bugs, we’d appreciate a little bug report 🙂

 

+—————————————————————————+

| This server comes with the following preinstalled and running software:   |

|                                                                           |

| * nginx                                                                   |

| * php5-fpm                                                                |

| * frapi                                                                   |

| * memcached                                                               |

| * PECL Extensions: apc, pecl_http, memcached                              |

+—————————————————————————+

 

+—————————————————————————+

| Content of interest:                                                      |

|                                                                           |

| In your /home/ubuntu folder, you should have a sites folder and a devel-  |

| development/custom folder. In order to set your live virtual host, edit   |

| the sites/api and sites/admin to have the server names associated to your |

| DNS (Or what’s in /etc/hosts for you to test)                             |

|                                                                           |

| The code generated by the admin and used by the frontend can be found     |

| in the /home/ubuntu/development/custom folder and edited manually there.  |

+—————————————————————————+

 

Thanks and enjoy the FRAPI Experience!

 

Last login: Mon Aug  9 11:29:28 2010 from my-hostname

ubuntu@domU-12-21-38-34-69-D2:~$ ls

view rawgistfile1.txt hosted with ❤ by GitHub

Once you are connected, make sure to “sudo su” and then edit the files that are in /home/ubuntu/sites/. The only thing you have to modify in those files are the “server_name” details. Put either your domain name or your made up domain name that is setup in your /etc/hosts file. The end result should be an admin file with something that contains something along the lines of

server {

    listen   80;

    server_name  admin.api.mydomain.com;

view rawadmin hosted with ❤ by GitHub

and an api configuration file that contains

 

server {

    listen   80;

    server_name  api.mydomain.com;

view rawapi hosted with ❤ by GitHub

Don’t give up, you are nearly there, now you have to run : “/etc/init.d/nginx restart && /etc/init.d/php5-fpm restart” and you are done.

 

If you go to the api.mydomain.com in your browser you should now see FRAPI’s default invalid action XML error. If you go to admin.api.mydomain.com you should be able to login with the username “admin” and password “password” — Hint: You should go to the “configurations -> users” section and modify that password.

 

I want to code something!

SSH into your instance, and go to /home/ubuntu/development/custom/Actions, you will see all your API Controllers there and you can follow the steps here http://wiki.github.com/frapi/frapi/creating-actions (In our case, the generated files go into /home/ubuntu/development/custom/Actions)

 

To get accustomed you can start playing with Testing1.php and Testing2.php

 

Don’t hesitate to jump on IRC or on the mailing list and ask questions!

Share:

Share on facebook
Facebook
Share on twitter
Twitter
Share on pinterest
Pinterest
Share on linkedin
LinkedIn

Leave a comment

Your email address will not be published. Required fields are marked *

Social Media

Most Popular

Get The Latest Updates

Subscribe To Our Weekly Newsletter

No spam, notifications only about new products, updates.

Categories

On Key

Related Posts

Are Hitachi TV’s Good?

Hitachi is a well-known brand in the electronics industry, offering a wide range of products including televisions. When it comes to purchasing a TV, consumers

Are Toshiba TV’s Reliable?

Toshiba is a well-known brand in the world of electronics, and their TVs are no exception. Many consumers may be wondering if Toshiba TVs are

Are Panasonic TVs Good?

Panasonic is a well-known brand in the electronics industry, and their televisions are no exception. However, when it comes to purchasing a new TV, consumers