Pancake/Setting up a Pancake development environment
Contents
Introduction
This page contains instructions on how to run Pancake locally on your Mac or Linux machine. Pancake is a somewhat complex application; it consists of a web front-end that talks to multiple independent web services that are part of the back-end. It also depends on two Java based services, Elastic Search and Neo4J.
For use in production mode, there are optional dependencies on MySQL and Redis as data storage, logstash, statsd, graphite and sentry for logging and statistics.
We'll do our best to keep it up-to-date, but if this document becomes stale, please ping us on #pancake on irc.mozilla.org
Requirements
Pancake requires the following software to be installed and running on your development machine:
- Python 2.7
- Elastic Search 0.19.0
- Neo4J 1.7
If you use a modern version of OS X or Linux then Python 2.7 will likely be installed already.
Note that the version numbers are important and that you should follow them. Newer or older versions might not function correctly with the Pancake code.
Installing Elastic Search
Pancake has been developed with ElasticSearch version 0.19.0, which you can download here. More recent versions probably work, but are not guaranteed to.
After you install ElasticSearch, please add the schema found here.
These files will tell ElasticSearch how to index data and how it should be retrieved. The default configuration for Pancake expects port 9200 for ElasticSearch.
Installing Neo4j
Pancake is using Neo4j 1.7.0. Later versions probably work, but are not guaranteed to.
You can download Neo4j at http://neo4j.org/download/
Set neo4j up to listen on port 7474 via regular http (non-ssl) and the default configuration should connect to it
Checking out the Pancake code
Code for Pancake lives on Bitbucket. You can check it out using the following command:
hg clone https://bitbucket.org/mozillapancake/pancake
Setting up a Pancake environment
Before you can run any of the Pancake code you need to run the following scripts:
cd pancake scripts/setup-expander.sh scripts/setup-lattice.sh scripts/setup-search.sh scripts/setup-social.sh scripts/setup-user-api.sh scripts/setup-web.sh
The above scripts will setup a Python virtualenv for each of the modules and install all required dependencies.
Configuring pancake
When running in development mode, Pancake expects its configuration files under ~/.pancake. The repository contains samples of these files with sane defaults that you can use for development.
To copy the configuration files templates, execute the following commands:
mkdir ~/.pancake cd pancake cp pancake-expander/etc/expander.json ~/.pancake/ cp pancake-search/etc/search.json ~/.pancake/ cp pancake-social/etc/social.json ~/.pancake/ cp pancake-web/etc/web.json ~/.pancake/ cp pancake-user-apil/etc/user-api.json ~/.pancake/ cp fxhome-lattice/etc/lattice.json ~/.pancake/
Running Pancake
Execute each of the following run-*.sh scripts in a new terminal window:
cd pancake scripts/run-expander.sh scripts/run-lattice.sh scripts/run-search.sh scripts/run-social.sh scripts/run-user-api.sh scripts/run-web.sh
Pancake is now available and running on http://localhost:6543
Updating the project from version control
You can simply run a hg pull / hg update to pull in new code. You don't have to run the setup script again after that.
The servers are started with auto reloading of templates, statics and code but this might not always work. If in doubt just Control-C the script and start it again after changes.