Kirsten Jones, Technical Leader at Cisco SystemsWorking with APIs, creating mashups for longer than I care to admitFascinated with taking different web services and combining them to give users a new way to interact with their information and networksOne challenge of creating prototypes or applications is getting them onto a public server – cloud providers have made that a lot easierRecently they’ve started adding frameworks to speed application development even moreFacebook has a great SDK for PHP development, and combining that with a cloud provider who sets it up for you means you can get right to the meat of your application.I really appreciate you taking the time to listen to my talk on this, I’m going to take just a minute to give you an overview of what I’m going to cover so you can decide if it’s useful for you.
One of the things I’ve learned in talking to developers… very talented and skilled developers who have made really cool shit… is that they’re intimidated by the thought of learning “yet another framework” to add cloud development into their toolbox. I’m here to tell you, and show you, that it’s actually really easy. The cloud providers I’m going to cover here – Heroku and PHPFog – both have excellent toolkits based around the source code management tool git. So you develop locally on your own system, then push your changes to the cloud. It’s really no different than any other release process you might be familiar with – and the other end is set up for you, your own system. Both of these cloud providers are free to get started with, and they both include the Facebook SDK, which means that whatever you write is portable to other cloud providers, or to your own hosted system when you’re ready for that. I’m going to start with Heroku.
Heroku is a cloud provider that was originally designed as a Ruby on Rails cloud provider, but recently they’ve branched out to a very large list of languages and frameworks – Python, Java, Scala, Clojure… and PHP. Most of their PHP support is around Facebook applications, but you can use the same setup, really, for any PHP application. For today I’m going to walk through their tutorial so you can understand how easy it is to get started using their system. I know it’s a little annoying to I’ve created a cheat sheet for this talk which is available on my website at princesspolymath.com – from there you can get to the links I mention in the talk.
The default application is a little… boring.
Talk about authentication model, supported by the Facebook SDK, good to specify the pieces you want. Facebook may get a lot of shit for bad privacy practices, but they do make it easy for developers to communicate to their users exactly which pieces of the facebook pie their application is going to touch.
*describe page*Wow, that’s really cool! Now there’s an application… somewhere… with code that’s making this page. I guess that’s pretty cool, but it seems kind of abstract since you don’t really have a way to touch, see and edit the code. Let’s think of this as the “front end”, or UI of your application, and figure out how to get at the bits that are making it go. The first thing you’ll need to do is get set up with Heroku.
If you already have a Heroku account, you can just log in to continue here. If not, they’ll have sent you an email with a link to get started, which is pretty much the standard stuff. Pick a password, log in, and you’re ready to get started on the backend side of your application
Once you’ve logged in, you can jump to the toolbelt to get your system set up to work with Heroku. As I mentioned before, Heroku started as a RoR cloud provider, and their toolkit is based on Ruby. You’ll need to have ruby on your system in order to make this go. It comes standard on most unix based systems (like OSX and Ubuntu) but for Windows you may end up installing a larger set of files to get your application going.
Once thetoolbelt is set up, you need to login to heroku from the toolbelt so it knows who you are and has the necessary credentials for getting to the repository with your source code. The first time you log in you’ll need to set up an SSH key so you don’t need to enter your credentials every time – if you don’t already have one set up on your system the Heroku tutorial has instructions for getting one generated.Now that you’ve got your toolkit set up, you need to find out where Heroku has stashed the code for you.
While the integration between Facebook and Heroku is pretty slick, figuring out how to identify your repository takes a bit of work. On the Facebook application information page, your “Site Domain” will be set up with your heroku-assigned domain. This is a haiku-based name with a random number on the end, and this is your application’s home in the Heroku cloud. This is also how you identify your repository when interacting with your code on Heroku.
Once you’ve logged in and have the toolkit, you can see all of the applications associated with your login. As you can see, I have a lot of Heroku instances because it’s really easy to make one whenever I have an idea I want to try out. From the list of your applications you can view the general information for the instance or set up resources – if you want to change the scale, or add a plugin, or add scaling or database resources. For now, we’ll just check out the general information. As you can see, my Facebook application is listed here, with the memorable name/URL floating-sunset-9217
Here it is, in all its glory. Your instance information. Name, URL, collaborator. You can add other heroku users as collaborators on your repo so you can, you know, collaborate. The git repo information is listed here, although it’s relatively easy to build once you have the name for your application. The repo will always be reached as firstname.lastname@example.org:appname.git It’s nice to have it here, though, for reference and copy-and-pasting, so you don’t have to remember the right information to build it later.All right, we’ve got the information we need to actually get the source code now. Awesome
PHPFog! These guys are great, and they’re a cloud provider dedicated to PHP. All of their systems are designed to optimize PHP performance. If you’re a PHP developer looking to deploy multiple different types of applications to the cloud, they’re probably your guys. As you can see, they provide a wide range of PHP frameworks.Their Facebook integration is a little more work than Heroku, but it’s still quick to get set up and running.
Again, if you’ve got a PHPFog account already you’re one step ahead. Otherwise you’ll need to sign up for a free PHPFog account to get started.
You’re going to start out in the same place this time, but you’ll need to do a little more work to get everything set up how you want. Set up your application, but this time don’t click the Heroku button.
Pick a unique application identifier for your application to be used as part of the PHPFog domain. You need to input that domain into the “App Domains” section of the page. You’ll also want to open the “Website with Facebook Login” section and input it as your site URL, so the Facebook system knows where to send the users after they’ve authenticated – these pieces were set up for you magically with the Heroku version, but as you can see it’s really not difficult to get it working manually.You’ll need your app ID and secret for the PHPFog configuration side, so copy those somewhere, or just keep this browser window open while you set up the PHPFog end of your application.
Now that you’ve set up the Facebook side, you need to actually create the application on PHPFog so that it’ll actually do something. Click “New App” to get started, and select “Facebook” as the application type you want.
Here’s where you need to put in your application key and secret from the facebook application. You’ll also put in that unique application ID you created so that the domain Facebook expects is where phpfog puts the application. Click “Create app”
Once your application is created PHPFog will present you with a dashboard of information. Like Heroku, the startup/default configuration is free, but this is where you can add more storage, plugins, or other goodies for your site. Additionally, there’s a wealth of analytical and configuration management tools on the dashboard. We’ll come back here in a minute, but for now let’s go ahead and view the application, since we’ve set up both sides and they should be ready to go.
Yep, pretty much exactly the same thing. The Facebook SDK examples are a great place to work from. I’ve already covered how the code works (at the end if you want I can show you more, but really it’s best to poke around yourself.
You can use your local web server to serve the Facebook application You need to create a “development” version of the application on Facebook with your localhost URL Configure your key and secret in the .env file
Free to get started Not strong PHP Cloud provider Facebook integration extremely easy Examples from Facebook SDK make it easy to get started
PHP dedicated cloud service Supports PHP applications and frameworks such as WordPress, Drupal, Joomla, Zend, Cake and Kohana Tuned for PHP performance, scaling Facebook Jumpstart http://blog.phpfog.com/2012/03/19/a-closer- look-at-the-php-fog-facebook-jumpstart/
Git based Toolkit available ‘pf’ for macintosh Other O/Ss use git directly “Source Code” link on the dashboard to get started
PHPFog also uses Facebook SDK example source code Apps are portable between systems – copy the code over to use a different system
The Facebook SDK can be downloaded locally and deployed to any cloud provider – Engineyard, PHPCloud Creating the application and tying the URLs together needs to be done manually Engineyard has a webcast covering this process (creating the app locally then deploying)
Free startup Try multiple providers to see what works best PHP-only developers may find PHPFog a better choice Polyglots can work on Heroku Other PHP cloud providers to check out: EngineYard (Orchestra) and PHPCloud (Zend)
A particular slide catching your eye?
Clipping is a handy way to collect important slides you want to go back to later.