WHAT IS PAGODA BOX ?
I personally find it easier than using Amazon Web Services . Pagoda Box is a platform. You can think of it as an elastic computing grid designed to deploy, manage and scale your app. Your app does not reside on a single server. Rather, you specify the number of instances of your application, and Pagoda Box distribute them across computing grid. Doing so provides redundancy and guarantees ample computing resources. Pagoda Box simplifies app deployment by using git as a deployment vehicle to push your code live–totally eliminating security risks presented by ssh & ftp . Some of the features it provides are
The Boxfile is optional, but can become the heart of your application. It’s a simple YAML file inside your code that provides advanced users with enhanced functionality. The Boxfile houses the component configurations related to your app’s deployment.
CODE REPO (GIT)
Your code is deployed to pagodabox via a hosted git repository. This allows atomic deploys, instant rollbacks and clean verion management.
Web Components are the entry point for any application. Each Web Component consists of 1 or more “web instances”. Each is an individual web process powered by your application code, run side-by-side to handle a share of the traffic load.
Currently both Memcached and Redis caching components are available on Pagoda Box. Each employs different techniques of cache storage and have different sets of functionality, but both offer tools to drastically increase your app’s performance.
Database Components are exactly what they sound like – databases. Pagoda Box manages scaling, migration and db replication from an intuitive push button dashboard.
Background Workers allow you to offload processes from your web component and run them in the background. They are generally used for heavy or long-running processes like mail, billing, image processing, etc.
SHARED WRITABLE STORAGE
Writable Storage can be tricky in a distributed cloud environment. As each component instance writes to files, they could potentially write themselves out of sync. Sharing centralized writable directories between all instances resolves this issue.
Cron Jobs can be scheduled from either the Dashboard or the Boxfile. It’s important to note that only certain executables are allowed when using Cron Jobs
Adding DNS / SSL to PHP cloud-hosted applications is the easiest it’s ever been: Copy, Paste and Click. Pagoda Box automates the entire process through a simplified dashboard.
Go to pagodabox website and click on “Try for Free” on right-top side if you are a new user or else login to the dashboard . Once you are in you will see dashboard like below .
Click on New Application
In the list on quick install apps click on laravel-4 , on the next page click Launch and wait while everything is downloaded and installed for you .
Once your installation is done click on View Live App and you will be presented with Laravel Welcome screen like below
Click on Manage App to see your App Dashboard
Dashboard – Dashboard shows statistics of your app , cache usage , db usage . you can add extra cache , workers , databases just in one click . Click on web1 and it will slide down and show more options from here you can increase web instances just by using slider .
History – It shows all previous deployed history , you can rollback at any time to your previous commit .
DNS/SSL – Here you can setup DNS Aliases to route to traffic from a real domain to your site on pagodabox , you can also setup SSL certificates just in 2 clicks
Environmental Vars – Here you can setup Environmental variables which will be available to your app .
Cron Jobs – At the time of writing this post cron jobs feature was still in beta . You can easily schedule cron jobs by specifying script , interval , email address to receive results (optional ) .
Billing – You can attach your credit card , setup monthly invoices send to mail , check charges on each feature like web , cache , worker etc
Mail – Pagodabox provides support for Gmail, Hotmail/MSN , Sendgrid , and a custom mail setting .
Admin Menu – Here you can Change app name , add new relic license key , enable ssh to writable directories , add collaborators and delete your app .
CLONING YOUR APP
Before we clone app we need to install git . Click here to download msysGit . Once downloaded double click on setup and install msysGit as Bash , Create a icon on desktop/quick launch for easy access .
Open Git Gui and click on help -> show ssh . If box is blank then create a new key by clicking Generate Key .
After generating a key click on Copy to Clipboard . Now go to settings by clicking settings icon which is beside logout button at top-right .
Click Add a new SSHKey .
Put your Key name and paste your ssh key which was copied from Git GUI and click Create Key .
Now open Git Bash and navigate to web root (htdocs) . Execute command below , you can get your git clone url from admin or click Show git url at right-top .
git clone email@example.com:serious-sha.git
Now you will see a new folder in htdocs with your app name . You have to download all dependencies using composer so now run composer update to download and install all packages .
Since this is fresh installation you need to create a new application secret key . To create new secret key run command shown below
php artisan key:generate
If you encounter below error
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. [tcp://tunnel.pagodabox.com:6379]
Open Boxfile and add below file at the start of the file .
global: env: - LARAVEL_ENV: production
Now your Boxfile will look like below
global: env: - LARAVEL_ENV: production web1: document_root: public php_version: 5.4.14 php_extensions: - mbstring - mcrypt - pdo_mysql - redis - zip - xcache php_session_save_handler: redis php_session_save_path: "tcp://tunnel.pagodabox.com:6379" shared_writable_dirs: - app/storage/cache - app/storage/logs - app/storage/meta - app/storage/sessions - app/storage/views after_build: - "if [ ! -f composer.phar ]; then curl -s http://getcomposer.org/installer | php; fi; php composer.phar install --prefer-source" after_deploy: - "php artisan cache:clear" - "rm -f app/storage/views/*" before_deploy: - "php artisan migrate" cache1: type: redis
Open bootstrap -> start.php and put your-machine-name in local variable , for me machine name was kodeinfo and add a new variable name production and set its value to your-machine-name so it will look like below
'local' => array('KODEINFO'), 'production' => array('your-machine-name') ,
ADD REMOTE AND PUSH
Open Git GUI and click open existing repository click browse and select your app folder and click open . It will show all unstaged(changes which are not yet added to commit) changes to files . First we need to add a remote location to push our changes so in menu click on Remoteand click Add .
Enter a name and paste your git clone url (You can get git clone url from pagodabox admin menu) , select Do Nothing Else Now and click Add .
Now select all files and click Stage Changed . All files will be added to staged files , enter a commit message and click Commit and then click Push .
Change your Remote to remote we just added and Click Push . We are almost done .
CREATING VIRTUAL HOST
Now create a new virtual host and point to your new app’s public folder . You can follow instruction to create virtual host from my previous tutorial – Getting Started with Laravel
Now go to your local/production app , for me it was serious-sha.dev/serious-sha.gopagoda.com/ and output is below