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:
sudo gem install pagoda
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:
sudo nano index.php
Add the following code and save the file.
<?php echo "I am the only php file here and I am in first stage";
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:
sudo nano Boxfile
And place the following code there:
web1: name: my-app-nuhil php_version: 5.3.5 php_extensions: - mysql - simplexml - mcrypt - hash - gd - dom - iconv db1: name: myapp-db type: mysql
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 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:
git init git add . git commit -m 'First commit' git remote add pagoda email@example.com:my-app-nuhil.git git push pagoda --all
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 🙂
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.
cd my-app-nuhil sudo nano index.php
<?php echo "I am the only php file here and I am in second stage";
git commit -am "Second commit" git push pagoda --all
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.