Developer project setup
These instructions should apply to linux, mac os x and windows (modulo some "right-click"s)
Set up tools
- Install Git http://git-scm.com/
- Install Eclipse indigo (3.7) for java developers http://www.eclipse.org/downloads/packages/eclipse-ide-java-developers/indigosr1
- Install eclipse plugins with Help > Install new software
- GWT plugin and SDK http://dl.google.com/eclipse/plugin/3.7
- Maven plugin http://download.eclipse.org/technology/m2e/releases
- Install eclipse plugins with Help > Install new software
- Install PostgreSQL 9.0.x http://www.postgresql.org/
- Install PostGIS extension http://postgis.refractions.net
- Setup pgpass file for your postgresql root user. Location will vary by OS. See http://www.postgresql.org/docs/9.1/static/libpq-pgpass.html
- Install curl http://curl.haxx.se/download.html
Set up project
- clone git repository:
git clone git://github.com/kurie/phyloviewer.git
- Import project into Eclipse
- File > Import
- Maven > Existing Maven Projects
- Next button
- Browse button
- Select root of cloned git repository
- should find 4 pom.xml: /, libraries/phyloviewer-common, libraries/phyloviewer-gwt-client, apps/viewer
- Finish button
- (might need to install some more eclipse plugins here: wtp, mavenarchiver)
- Should now have 4 eclipse projects added to workspace: phyloviewer, phyloviewer-all, phyloviewer-common, phyloviewer-gwt-client
- Initialize database
- follow instructions in phyloviewer\apps\viewer\src\main\sql\readme.txt (where phyloviewer is the root of your git repo)
- Windows users should have had sh installed along with Git. I don't think anything else is required for this step, but I'm not positive about that.
- follow instructions in phyloviewer\apps\viewer\src\main\sql\readme.txt (where phyloviewer is the root of your git repo)
Run the app (debug mode)
- Run the app in debug mode in eclipse
- Right-click phyloviewer in the package explorer and choose Debug As > Web Application
- The Development Mode view should eventually show a URL like http://127.0.0.1:8888/Phyloviewer.html?gwt.codesvr=127.0.0.1:9997
- Double-click the URL to open the app in your default browser.
- Eclipse will compile the project for your browser now, so it might take a while to open
- The console view in eclipse will show server log messages
- The database is currently empty, so you won't see any trees in the "Select a tree to load" dialog box. Don't stop the server, we'll import a tree next.
- Right-click phyloviewer in the package explorer and choose Debug As > Web Application
- Import a tree
- Find (or create) a file containing a tree in either newick or nexml format.
- The following text, for example, is the newick representation of a very small tree with 3 named leaf nodes and two unnamed internal nodes: (foo,(bar,baz));
- Import the tree using curl
- For a file named foo.nwk in the current directory, you would use the following command line:
curl -i -F "newickData=@foo.nwk" -F "name=foo" http://localhost:8888/parseTree
- You should see a response similar to the following:
HTTP/1.1 100 Continue
HTTP/1.1 202 Accepted
Location: http://localhost:8888/view/tree/f2faea8a5b27f8693bd80b6dc5052271
Transfer-Encoding: chunked
Server: Jetty(6.1.x)http://localhost:8888/view/tree/f2faea8a5b27f8693bd80b6dc5052271
- Note that, in debug mode, this URL cannot be used to view the tree
- For a file named foo.nwk in the current directory, you would use the following command line:
- View the imported tree
- Make the tree public
- TODO (I usually just use pgadmin to do
update tree set public=TRUE;
, but I should put a more portable command line here to do that.)
- TODO (I usually just use pgadmin to do
- In the browser, click File > Open and there should be a tree named "foo" in the dropdown list.
- Make the tree public
- Find (or create) a file containing a tree in either newick or nexml format.
Run the app (production mode)
- Stop the server if it's already running
- Open the development mode view in eclipse and click the red square on the right. (A gray square indicates that the server is not running)
- Compile the app
- In eclipse project explorer, right-click the phyloviewer project
- in the pop-up menu, click Google > GWT Compile
- in the resulting dialog, click the Compile button
- After compiling, you should see something in the eclipse console like
Compilation succeeded – 79.609s
- Run the app
- Right-click phyloviewer in the package explorer and choose Run As > Web Application
- The Development Mode view should again show a URL like http://127.0.0.1:8888/Phyloviewer.html?gwt.codesvr=127.0.0.1:9997
- Right-click the url and choose Copy.
- Paste the url into your browser address bar without the ?gwt.codesvr=127.0.0.1:9997 parameter
- The app should start up much more quickly than in debug mode and should be much more responsive
- Right-click phyloviewer in the package explorer and choose Run As > Web Application