Deploy apps on pagodabox with git version controlling

In the very last two posts we saw how to deploy apps in appfog. Today we will see how to deploy such apps in pagodabox. pagodabox is another deployment platform/framework like appfog. I found something good feature here such as you can have a free SSL certificate for your instance under the free scheme and you can see all your git commits under you app’s dashboard and simply deploy any version from your commit history just by clicking a button. Their punch line is “An Object Oriented Hosting Framework”

To start deploying your app on the cloud, just sign up in pagodabox obviously without any requirement of valid payment method as like appfog 🙂

Step A: You need to install the pagodabox command line tool just like you did for appfog according to the last post. For this, type the following command on Mac terminal:

Ruby and RubyGems come pre-installed on Mac OSX. As long as you are running v10.6 or later. For windows or any other issue you can check here. Also you should add an SSH key of your local machine to your pagodabox account. Just follow this simple process.

Step B: Prepare your local repository. Create and go to your local app repository/directory for example “my-app-nuhil”:

Create a php file in it:

Add the following code and save the file.

Our simple local app/repo is done!

Step Optional: You can Create a Boxfile in the root of this app, I mean just inside the directory “my-app-nuhil”. On Pagoda Box, a YAML Boxfile can be included in the root of your code repository. Though Boxfile is optional, it does provide advanced features, like manipulating your hosted environment on each deploy. Open up a new Boxfile by:

And place the following code there:

And save the file. It creates a “web1” component, then names it “my-app-nuhil”. Also declares which PHP version and extensions will be included in your web instances as they deploy. Even create a database “db1” for the instance. To know what Boxfile does actually check this link. As I named this step as optional, simply you can avoid this step 🙂

Step C: You were in the “my-app-nuhil” repository on the terminal right? Then go to pagodabox  dashboard and click “New Application” button

Step D: Select “Empty Repo” as we are going to upload our app/files on it from our local machine few minutes later. Name the app “my-app-nuhil”. Name must be available one.

Step E: On the next screen it will show what to do with your local machine’s repository. You should choose “GIT” as we titled the post for learning deployment with git version controlling.

You know, you made an empty repository/app here in your account and want to push you local repository in it. So, you need to first git initiate your local repository, then to add necessary files to it, then commit and add the pagoda remote repository for this one. For all of these enter these commands in your terminal one after another:

When you are done all these in your local repo, you can continue to the next by clicking the button that is waiting for you on the browser. Next screen will be something like:

You can see the live app and also go to the management panel of this newly created app by clicking any of the buttons. You are done partially 🙂

Step F: If you clicked “View Live App” you might see the following in your browser.

Or if you clicked the “Mange Your App” button then you should see:

Here you can see which committed version of your app is deployed currently. We had only one commit with the message “First commit”. Now we will change source code in our local app and will commit and update the changes to our pagodabox app repository. For that, open your terminal and do the following one by one to change the index.php file a bit and to commit and update.

After completion of terminal activity you can again see your app dashboard like the following screen shot:

See the difference? Your second commit has been deployed in the live instance. Also can check if the changed has been deployed or not by clicking the “View Live App” button and now it will show the output of edited php file.

An amazing feature of it is: you can click “Pick a Git Commit to Deploy” link to see all your commit history and can deploy any version of them.

For additional, you can create a Database, get its credentials, add a cache, increase resources on the dashboard by clicking some buttons. Further more you can use “Sequel Pro” tool for Mac to import database from local machine to remote instance by creating a secured tunnel to pagodabox by entering a command on terminal.