Pancake/Setting up a Pancake development environment: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
Line 24: Line 24:
After you install ElasticSearch, please add the schema found at https://bitbucket.org/mozillapancake/pancake/src/2b037de0971c/fxhome-lattice/etc/elasticsearch/config
After you install ElasticSearch, please add the schema found at https://bitbucket.org/mozillapancake/pancake/src/2b037de0971c/fxhome-lattice/etc/elasticsearch/config


These files will tell ElasticSearch how to index data, and how it should be retrieved.
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 ==
== Installing Neo4J ==

Revision as of 19:08, 17 July 2012

Introduction

This page containsinstructions on how to run pancake locally on your Mac or Linux machine. Note that Pancake is a somewhat complex application; it consists of a web frontend that talks to multiple independent web services that are part of the backend. 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.

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 at http://www.elasticsearch.org/download/2012/03/01/0.19.0.html More recent versions probably work, but are not guaranteed to.

After you install ElasticSearch, please add the schema found at https://bitbucket.org/mozillapancake/pancake/src/2b037de0971c/fxhome-lattice/etc/elasticsearch/config

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 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

Configuring Pancake

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.