Webmaker/Code/Dev/EnvironmentGuide
Set up a Webmaker Development Environment
Before you can test or make improvements to Webmaker, you need to get it running locally. This involves setting up your OS to host the Webmaker servers and apps, and installing various development tools you'll need. We strongly recommend a Unix-like OS, such as Linux or OS X, but it is also possible to use Windows.
Contents
Dependencies
Webmaker relies on a number of technologies and tools, which must first be installed. The following list needs to be installed and working before you can run or test Webmaker locally:
- node.js and npm
- bower: after you install npm, you can type
npm install -g bower
(may require admin/sudo rights) - grunt: after you install npm, type
npm install -g grunt-cli
(may require admin/sudo rights) - python 2.7
- pip
- MongoDB (NOTE: there is some discussion about dropping MongoDB altogether, but at the time of writing, this hasn't happened yet)
- Java
- Elastic Search
A number of node "modules" (or libraries) that we use also require a working C/C++ toolchain. You should make sure that you have a working build environment for your OS (see the section of the Webmaker Suite docs on this issue).
Setup Option 1: Webmaker Suite
By far the easiest way to get all of Webmaker set up and installed locally, on any platform, is to use Webmaker Suite. This is a set of automation scripts written in node.js by one of our lead developers, and is meant to provide turn-key installation by automatically downloading all the code, and setting default environment variables.
Note that this won't install external dependancies above automatically.
Complete instructions are available in the README for Webmaker Suite on github.
Setup Option 2: Local Native Installation
Each server that makes up a part of the Webmaker.org ecosystem is configured with .env
or environment files. The servers come with a sample version of this file that is fully functional, assuming that the sample files are used for all the servers in the local installation. Instructions on configuring these manually can be found in the Github repository of each server.
Setting up your dev environment in Mac OS X
This is the easiest method of setting up a Webmaker dev environment in Mac OS X, but requires the use of the Homebrew package manager.
- Install Xcode command line tools by running
xcode-select --install
from the terminal - Install the Homebrew package manager by following the instructions at their website.
- Run
brew doctor
to complete Homebrew's installation - Install NodeJs with
brew install node
- Install the JDK (Java Development Kit) from their website
- Install elasticsearch with
brew install elasticsearch
- Install mongodb with
brew install mongodb
Setting up your dev environment in Ubuntu Linux
This is the easiest way to setup a Webmaker dev environment on Ubuntu Linux, but requires that NodeJS be compiled from source.
- Install git and a C/C++ toolchain with
sudo apt-get -y -q install git g++
- Install the Java Development Kit with
sudo apt-get -y -q install openjdk-7-jre-headless
- Install the MongoDB server
- Install the package with
sudo apt-get -y -q install mongodb-server
- Ensure MongoDB is running with
service mongodb status
- Otherwise, start MongoDB with
sudo service mongodb start
- Install the package with
- Install Elasticsearch
- Download Elasticsearch as a
.deb
file and install from the software centre - Ensure Elasticsearch has started with
service elasticsearch status
- Otherwise, start Elasticsearch with
sudo service elasticsearch start
- Download Elasticsearch as a
- Install Nodejs from source
- Clone Node using
git clone git://github.com/ry/node.git`
- Navigate to the new directory with
cd node
- Checkout the latest stable version of Nodejs (currently v0.10.22) with
git checkout v0.10.22
- Run
./configure
- Run
make > output.txt
- Run
sudo make install > output.txt
- Clone Node using
Set up NodeJS dependancies
Once your Development environment is set up, you must install some global NPM packages.
Installing Webmaker Core
Webmaker's core apps are the Login, MakeAPI and Webmaker.org servers. These three must be run together in order to function properly with each other, and the other apps that make up Webmaker. You can find installation instructions in the readme
file in each server's Github repository:
- Login - https://github.com/mozilla/login.webmaker.org/blob/master/README.md
- MakeAPI - https://github.com/mozilla/MakeAPI/blob/master/README.md
- Webmaker.org - https://github.com/mozilla/webmaker.org/blob/master/README.md
Installing Webmaker Tools
Webmaker's tools (Thimble, Goggles and Popcorn Maker) follow similar procedures for installation and configuration. Keep in mind that they won't function properly without the Webmaker Core services running. You can find installation instructions in the readme
file in each server's Github repository:
- Popcorn Maker - https://github.com/mozilla/popcorn.webmaker.org/blob/master/README.md
- Thimble - https://github.com/mozilla/thimble.webmaker.org/blob/master/README.md
- Goggles - https://github.com/mozilla/goggles.webmaker.org/blob/master/README.md
Staying Up-to-date
As we improve features (day-to-day), we release them into the wild almost immediately! For this reason, it's important to keep your servers running the latest code. These commands will use git
to pull the latest updates from the Mozilla repo, and then reinstall the node modules (or libraries). If you followed each server's installation instructions exactly, [mozilla upstream remote]
should be replaced with origin
. Otherwise, replace it with whatever you labeled the Mozilla remote.
- Dirty update (try this first):
git checkout master && git pull [mozilla upstream remote] master && npm install
- Clean update (time intensive)
git checkout master && git pull [mozilla upstream remote] master && rm -rf node_modules && npm cache clear && npm install
Setup Option 3: Using Vagrant (i.e., Ubuntu-based VM)
TODO
Setup Option 4: Heroku
TODO