zen of coding

CakePHP and Aptana Cloud = Love at First Sight

Before I write a post, I usually test the code I write about… and try to copy/paste it the best I can… so I don’t look like an ass later on.

This post, however, I simply cannot prepare for…

I’m just way too excited (yes, even more than Pacquiao’s dismantling of De La Hoya last week) about the topic, which deals with CakePHP in a littler manner, but mostly focuses on my new found love: “Aptana Cloud”.

Aptana IDE has been my choice in web development for a little while now (Eclipse users take note, all other IDE users… at least give it a shot ;)). It has solid support for JS, CSS and PHP. Thankfully, I don’t care about Java anymore, thus it works out perfectly well. Just the ability to insert a color hex value from a tiny built-in pallet, while working on a CSS file… puts a smile on my face every time.

I do love such attention to detail, but just to make things a little better, it also has support (i.e. auto-complete, proper highlighting and other time-saving features for coders) for jQuery (which I use) as well as top popular JS frameworks such as ExtJS, Prototype, … etc., so it appears like the Aptana team is “on top of web dev things” ;)

Alright, that seems like a few good-enough reasons to make Aptana my top IDE.

Well… all of a sudden (to me, which means I’m way behind the trends) Aptana folks introduced a cloud computing service, that kicks major ass as far as I can see… while testing it for about two days.

So this post will be just about my ventures into Aptana Cloud, setting up a cake app and being all happy about the potential with such a service.

(… guess I should have prefaced this post by saying that I’m not a paid actor :))

Alright… so first, if you’d like, you can read about Aptana Cloud (and watch a nice little video) here: http://www.aptana.com/cloud.

Now, I’m pretty much going to outline my baby-steps with Aptana Cloud + CakePHP and what I did (and learned a little) to launch a CakePHP application on Aptana Cloud.

1.Why bother and what is this all about?

To me, when working with multiple clients or multiple developers (or even on a single project), management of deployment/synchronization and consistency between development, staging and production somehow always caused a little pain. (I hope most people follow dev->stage->production release cycle ;)) Of course, if you have IT guys, or your are an admin systems guru, managing servers becomes a lot easier, but even still… if one is focused on web development, is it worth the time and effort to somehow worry about the state of your server (Email, Database, SVN, this, that, etc.)? (To me, at least, it always seemed like a boring and mundane task, sorry to all the geeky sysops ;) ).

There had to be a better way…

2.Creating a cloud… and whatta f… is this “cloud”?

Somehow I found out about the Aptana Cloud in my IDE…

After reading up on the service… I thought something along the lines of: “Well, that might address my pain just mentioned above… why not give it a shot?”.

Without boring you with anymore details in the IDE it’s basically 3 clicks and your cloud is setup…

… Which means, you’ve got a fully working:

Staging Server, Production Server and Private Server.

They are all up and running with SVN, SSH access, Postfix (for outgoing emails only, as far as I know). Oh yeah, all up and ready in *real-time*… and $0 for you to spend. (GTFO, you might think)… well, you get a 21 day free-trial. (Don’t even have to pull out a CC… that’s people thinking about doing things right… another smile).

3.So how to get my app running?

Well, I SSH’d into the “virtual” (cloud) server (right from the IDE too;)) and probably did a bunch of things wrong, clicked around here and there and after deliberation decided to do the following…

Obviously I need the cake core up there, and the default doc root is:


/home/aptana/homes/teknoid/staging/web/htdocs

I thought the “right” way to install an app in this scenario was to put the cake core in the “web” directory and then *sync* my app into htdocs.

After that, I’d set the doc root (which is easily changed right in IDE) to:


/home/aptana/homes/teknoid/staging/web/htdocs/webroot

4.Getting the cake core installed

After kicking around some ideas for a while, I decided to use the latest SVN repo from CakePHP. Thankfully, the SVN is already good to go in the cloud so in my:


/home/aptana/homes/teknoid/staging/web/

I did:


svn checkout https://svn.cakephp.org/repo/branches/1.2.x.x/cake/

Alright, I get the cake core in the place where I hope it should be.

5.Syncing up the app from Aptana

Now I need to get my project (app) uploaded to the staging server. That’s what I think I did next…

Right click the project name in my IDE’s project browser, went to “Synchronize” (you can decide if you wish to sync up your local or development project to public or staging server).

The IDE takes a “minute to think” and then it creates a sync-up dialog. Since it was my first time uploading the project, all files had to be created and after some “syncing up” my app was ready to run on the test server. And it did! :)

6.Following up

I realized that syncing-up app/config and app/tmp directories (as some other folders/files) probably isn’t a good idea, and thankfully you can easily add such exceptions in the IDE.

….

Well, that covers my little venture into CakePHP and Aptana Cloud. As you can guess so far it has been a very positive experience.

7.Some random notes

  1. First and foremost, to me, is the “team” option… Say, I have a project that I cannot finish due to laziness or whatever other strange reasons. I can easily “delegate” the coding to someone else with a simple SVN account setup and possibly some free beer. That type of “delegation and collaboration” pain is simply removed from the equation.
  2. I found that Apatna team is very responsive and open to suggestions, so if you feel like sharing some ideas on how it could benefit the community and CakePHP (but more importantly, your exciting life as a web developer), throw them on the Aptana forums or even here.
  3. I’m still very early in my testing, there are probably lots of things I miss or don’t know yet.
  4. The service is improving daily, so I think following the solid growth patterns of CakePHP, these kinds of projects I do really enjoy because it’s an amazing learning experience.
  5. I’ve tested the “sync” option numerously and it works quite well, I’ve not found a single problem… other than that it’s a bit slow (at least for me) and I could see about 3 UI improvements :)
  6. Give it a shot!
  7. Git support should be there any day now ;)
  8. I think the “Private” server is meant for your own stats and overall cloud management (i.e. don’t sync your CakePHP projects there).
  9. Yep, you get tools like phpMyAdmin to manage your DB (or internal IDE DB browser), all the obvious that you need to use the terminal… and well so far that’s all I’ve needed :)
  10. And I hear that there are some very interesting things coming down the line in Aptana… concerning some PHP frameworks, the IDE and the app deployment ;)
  • Yay++ for #7. Thanks for the introductory rundown of this newly (?) offered cloud computing service. So far, this seems more viable than Google’s or Amazon’s to me.

  • @Brendon Kozlowski

    Yep, it seems to be undergoing constant (and consistent) development, so hopefully there will be more posts related to this topic. At least it’s something that I’ve become very very interested in :)

  • I’d been looking at this, and liked the look of it except for the fact it seems to tie you into their IDE. However, from the sound of your experience, the level of integration offered is worth learning a new system for. I look forward to hearing your continued experience with this.

  • @ianmcnaught

    Yes, to reap the full benefits of the service you really do need to use their IDE (this may or may not be a bad thing :)). Considering that it can run on top of Eclipse, which from informal surveys, seems to be a very popular IDE among CakePHP dev’s, I think the overall availability of such a service is a very powerful feature that many can benefit from.

    Well, there is still a lot to learn and see, so I’ll continue my exploration and report as time goes on.

  • Matt Weg

    Based on your post, I decided to see if I would like Aptana better than Eclipse PDT. I just got done with a fresh install of Aptana. It took some tinkering, but my references to cake in my projects are all set up. I can use “Open Declaration” at get to cake files in a separate project. So far. So good.

    Now I am trying to get the Cake Helpers to work with code assist in Aptana. In PDT you just create a file the declares all of the helpers (i.e. $html = new HtmlHelper(); ). Any idea how to get this to work with Aptana?

  • @Matt Weg

    Honestly… no idea, since I’ve never done that :)
    I’d post this question on the Aptana forums, I find that the people there are very responsive…

    Btw, did you install Aptana as stand-alone or as a plug-in to Eclipse?

  • Matt Weg

    @tekniod

    I did a stand alone install and then added Aptana PHP and Subclipse from the “My Aptana -> Plugins” page. They definitely took some of the pain out of installing eclipse plugins. I’ll let you know if I get the Code Assist to work with Cake Helpers.

    -Matt

  • @Matt Weg

    Sounds good, thanks.

  • I have been developing with the Aptana IDE and deploying to their cloud for 2 days and I couldn’t be happier. They have streamlined development and taken Eclipse to another level.

    Thanks for the article on integrating CakePHP, it was very helpful.

  • @HonkeyD

    Glad it helped ;)

  • Ishbir Singh

    @teknoid

    I downloaded and installed Aptana successfuly but it didn’t do me any good. Unfortunately, I couldn’t get the code asist to work with CakePHP. I don’t know what am doing wrong. Maybe you could help me?

    I have added CakePHP directory in the PHP libraries box. Although proper class extensions show but code assist does not work.

  • Ishbir Singh

    Okay, sorry for the previous comment. Basic code assist for controller functions is working but it still doesn’t work with $this->Component variables as it used to work in Eclipse.

  • @Ishbir Singh

    Sorry, I’m not sure… the basic settings should be no different than Eclipse.
    Please try to ask at the Aptana forums, they are pretty helpful.

    P.S. If you do find out, please share the solution with us here ;)

  • Ishbir Singh

    @teknoid

    Nah, I will stick with Eclipse for now until I find the need to deploy anything to cloud. The modded version of Eclipse which I am using is comparable to Aptana with Spket for JS, SVN control and more. PHP code assist already works wonders in Eclipse.

    So, there is no real need for Aptana. I just happened to stumble upon your blog and thought, “Why not give it a try?”. But, it proved out to be a bane for me.

    Expect me to be on your blog daily. Lots of useful tips and tricks have been covered by you.

  • @Ishbir Singh

    Alright, fair enough… thanks to some good people we have wonderful tools to progress web development. (I remember the days of Netscape vs. IE4)….eh…
    Anyways, thank you for the nice words, and now that the jolly holiday season is over, hopefully there will be plenty of goodies coming from this blog.

    Cheers.

  • Great article! …it would still be nice to have some info here (maybe if just in the comments lol) about getting code assist to work with Cake. Seems to be a common problem with all PHP libs and Aptana. It’s seems doable through Project Natures and whatnot, but has some problems. Solutions anyone?

  • I personally have done this: http://forums.aptana.com/viewtopic.php?f=14&t=8519 …as well as modified the Project Nature and PHP Buildpath of my project via it’s properties page menu. It didn’t work.

  • @James from FaceySpacey.com

    I would love to get proper code-completion working as well, however I’ve not found a solution that was suitable for my needs.

  • I use free PHP IDE Codelobster PHP Edition with special CakePHP plug-in.
    It has very good autocomplete and context help.

%d bloggers like this: