Magento

Last Updated December 2014

Getting Magento up and running is pretty simple. There are a few things to be aware of when launching Magento on Pagoda Box. After reading this, you should be able to:

  • Create a local instance of Magento
  • Take your local instance of Magento and deploy it to Pagoda Box
  • Create a Pagoda database and access it from your Magento app
  • Bask in the combined awesomeness of Magento and Pagoda Box

Magento Core Patches

Duplicate Headers Fix (All Versions)

In Magento Community & Enterprise editions, there is a bug with running PHP as a (fast) CGI with FPM. Because FPM does not accept dual status or Content-Type header, the server returns a duplicate header error.

In Community Edition this can cause problems with using the SOAP API, which will also result in broken dashboard graphs. In Enterprise Edition it results in 500 errors when Full Page Caching is enabled.

The problem lies in the file:

app/code/core/Mage/Core/Controller/Response/Http.php

This can be patched by downloading this file and using it to override the core file.

See this Magento Forum Post for more details.

Change Location of Cache File (Versions 1.3.3.0 and Earlier)

Magento versions 1.3.3.0 and earlier store information related to your cache in the app/etc/ directory. In order to write files to the app/etc/ directory, it would need to be made writable which would mean that it would no longer be tracked in your git repo. Any changes made to app/etc/ would then not be committed or deployed. A simple fix for this is to change where the cache file is written. Make the following change to line 1102 of app/code/core/Mage/Core/Model/App.php.

Patch for Magento Versions 1.3.3.0 and Earlier PHP

app/code/core/Mage/Core/Model/App.php

Magento Boxfile

For a basic Magento install on Pagoda Box, the Boxfile is pretty simple, but there are some things you should note. The following Boxfile includes a build hook that overwrites your local local.xml with a local.xml that is used on Pagoda Box. This technique is covered in more detail below. The Boxfile also contains a web service with necessary PHP extensions and network directories, a network storage service to house network directories, and a MySQL database.

Magento Boxfile Example YAML

/Boxfile

Identifying media as a network directory will allow you to upload images, video, and other media to your live Magento app. The PHP extensions are those required by the Magento System Requirements. The "database1" service will automatically create an empty database for your application.

Also, refer to our Magento Optimization doc for optional Boxfile settings your app may benefit from.

If you want to know more about writing or customizing your own Boxfile, check out Boxfile doc. Any settings you define in your own Boxfile will override settings defined in the default Boxfile.

Create a Local Instance of Magento

Get your Magento app up and running locally. We’re assuming that you’ve already done this. If you haven’t and don’t know how, here’s a link for you: Create a local Magento instance

No Auto-Installers on Pagoda Box

You are not able to run auto-installers on Pagoda Box. If you use Magento's auto-installer, run it locally to generate all the necessary configuration files, then deploy your app to Pagoda Box.

Create a 2nd local.xml

Magento houses it's database connection details in the local.xml file. Typically, you could just include the auto-generated environment variables created when your database is deployed, but xml doesn't support server variables. The deploy hook included in the example Boxfile above replaces the local.xml that connects your local instance of Magento to your local database with the local.xml that will connect your live Magento site to your Pagoda Box database. This technique will allow you to work seamlessly between your local and live environments without having to modify your local.xml between deploys.

Create a pagoda directory in the root of your Magento app and copy the local.xml stored in app/etc/ into your pagoda directory. Once your app is deployed on Pagoda Box and your database is created, you'll be able to input the correct database connection details in your pagoda/local.xml. This can only be done after your app has been deployed for the first time.

Display Errors

During development, we recommend configuring Magento to display errors by making the following change in your index.php file.

Display Errors PHP

/index.php

Create a Git Repo for Your Magento App

If you haven’t used Git before, the Basics of Using Git with Pagoda Box is a great place to start. If you're looking for a deeper dive into Git, Getting Started with Git is a great free online resource.

Launch Your Magento App on Pagoda Box

Just go through the normal process of launching an app. If you aren’t sure what the process is, the Launching an App doc covers the different options.

Once your app has been successfully created, if you view it live, you'll see an error page that looks something like the following:

This is because the database connection details in your local.xml are still configured your app to connect the new Pagoda database instead of your local database.

No Error, Just a Number?

If you get just screen with an error number, it’s probably because errors haven't been configured to display.

Put the Correct Connection Details in pagoda/local.xml

Once your app has been launched and you database has been created, you can get the correct database connection credentials to put in your pagoda/local.xml. In your App Dashboard, click on your database service to expands its details. Then click on the "Credentials" tab.

Replace the database connection details in pagoda/local.xml with the credentials found in your App Dashboard.

Database Credentials in pagoda/local.xml XML

  // NOTE : These are not your credentials.
  // Use your database's credentials found in your dashboard

  <![CDATA[192.168.0.2]]>
  <![CDATA[jasmine]]>
  <![CDATA[RvebdoLF]]>
  <![CDATA[gopagoda]]>
pagoda/local.xml

Save your changes and push them to Pagoda Box. Once deployed, both your local and live apps will be able to connect to the correct databases without any further changes.

Migrate Your Data

Chances are you have an existing product database that needs to be migrated to your new app. The Migrating Existing Data doc walks through the different options.

Your App is Up & Running on Pagoda Box

Once your data is migrated, your Magento app should be up and running and ready to rock on Pagoda Box. There are still a few things you may need to do to get your app fully functional. They are covered in these docs:

Sending Mail from Your App
Using Custom Domains
Adding SSL
How & When to Scale


Disable Display Errors

If you set errors to display, now would be a good time to turn it off. Unless of course you're still debugging your Magento app.

Magento Optimizations

This doc has only covered the minimum requirements for getting Magento up and running. Check out our Magento Optimizations doc for additional suggestions and configuration options.

Post Launch Workflow

Pagoda Box makes managing and updating your Magento app really easy, but there’s some things you should know.

  1. Any updates, plugins, themes, or any other code changes need to be done on your local instance first, then pushed to your repo and deployed through your app dashboard.

  2. Remember that your local database and your live database are two completely separate databases. Anytime you want to publish a new post or add media to your Magento app, it needs to be done through your live admin, not your local admin. Your Magento content is not stored in your repo so any content you add locally will not be pushed live with your repo.

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