Recommended Workflow

Last Updated October 2014

Pagoda Box takes the pain out of deploying and hosting your web applications by streamlining your development and deployment workflow. This doc walks through the recommended workflow for managing apps on Pagoda Box. After reading it, you should be familiar with:

  • The best workflow for working with apps on Pagoda Box
  • Cruising through what would usually take hours of frustration

Come to Know & Love Git

Git is an incredibly powerful version control system that allows you to easily and collaboratively develop code. There is a bit of a learning curve, but once you wrap your head around Git, it'll be hard to use anything else. Using Git allows you to make changes to your code and deploy those changes all from the command line, with a few simple commands.

If you're new to Git, check out the Basics of Using Git with Pagoda Box doc. For the deep dive into Git, check out the Official Git Documentation.

Develop Locally

Pagoda Box is a read-only environment, so you can't modify code directly on the server. Nor should you. Updating live code is almost like playing russian roulette with your app's uptime and if something does go wrong, correcting those mistakes can be a painstaking process.

All code development should be done locally. Whenever your code is at a state where you're ready to push it live, simply commit your changes and push to Pagoda Box. Local development should be a staple of your development workflow.

Pulling Apps Deployed from Quickstarts or Forked Repos

When you have an app that was created from a Quickstart or forked from a repo hosted on a 3rd party Git provider, you'll need to pull the code down from Pagoda Box in order to modify it. This can be done in a few simple steps.

The first thing you will need is your app's clone URL, which can be found in your App Dashboard. Click the "Clone URL" link under the deploy controls. Or you can find it under the "Admin" Tab in "Basics".

Once you have your clone URL, from the command line, cd into where you'd like to store your app and run the following commands:

Cloning a Repo from Pagoda Box Terminal

  # clone the repo locally
  $ git clone git@git.pagodabox.io:apps/app_name.git
   
  # change directories into the root of your project
  $ cd app_name
   
  # rename your remote repo from 'origin' to 'pagoda'
  $ git remote rename origin pagoda

Push to Pagoda Box

Now that you've made changes locally, you'll need to push those changes up to Pagoda Box. To keep your workflow as seamless as possible, we recommend using the auto-deploy functionality. This allows you to automatically deploy changes to your application whenever you push to Pagoda Box. By default, auto-deploy is enabled and set to use your master branch.

To push your code changes to Pagoda Box, simply add, commit, and push to your Pagoda Box git remote:

Adding, Committing, and Pushing to Pagoda Box Terminal

  # add your changes
  $ git add .
   
  # commit your changes
  $ git commit -am "commit message"
   
  # push your changes to Pagoda Box
  $ git push pagoda

Rolling Back

If for some reason a bug is introduced when you push, you can quickly and easily rollback to your last deploy. Simply click the "Undo Last Deploy" button in your app dashboard:

Collaboration

If you're collaborating with other developers to build your app, the workflow is mostly the same. There's just one added step to the process. Before you push to Pagoda Box, you'll want to pull down any changes your collaborators have pushed.

Pulling and Pushing to Pagoda Box Terminal

  # add your changes
  $ git add .
   
  # commit your changes
  $ git commit -am "commit message"
   
  # pull your collaborator changes
  $ git pull pagoda
   
  # push your changes to Pagoda Box
  $ git push pagoda

Summing Up

To sum everything up, the streamlined workflow for developing apps for pagoda box is developing locally, using Git for version control, collaboration, and pushing & pulling to & from Pagoda Box.

If you have any questions, suggestions, or corrections, let us know.