Project

General

Profile

AMI Eclipse Quick Start Guide » History » Version 24

Amber Herold, 01/29/2010 05:32 PM

1 1 Amber Herold
h1. AMI Eclipse Quick Start Guide
2
3 5 Amber Herold
{{>toc}}
4 1 Amber Herold
5 22 Amber Herold
h2. 1 Get the Eclipse executable
6 1 Amber Herold
7
# AMI has a preconfigured version available at [  ...  ]
8
# Copy it to ...
9
# Double click the eclipse executable to open. If using a machine that was setup with the AMI kickstart program, you will need to update [...]
10
11 22 Amber Herold
h2. 2 Create a Workspace and get the MyAMI code from Subversion
12 1 Amber Herold
13
# Double click the eclipse executable found in the eclipse directory.
14 2 Amber Herold
# When it opens, it will prompt you to choose a workspace. This workspace will hold a local copy of the myami code for you to work on. A good workspace location is a amiworkspace in your home directory. That is /home/username/amiworkspace.
15 3 Amber Herold
# From the menu, select Window -> Open Perspective -> SVN Repository Exploring. This will open a view labeled SVN Repositories.
16
# Go to File -> New -> Repository Location.
17
# In the URL field type: http://emg.nysbc.org/svn/myami to get the Appion and Leginon code.
18 1 Amber Herold
# Press the Finish button at the bottom of the dialog. A new repository will appear in the SVN Repositories view.
19
# Click on the arrow next to the repository icon to view the trunk, branches and tags associated with the repository.
20
# Click on the trunk to highlight it. Right click and select Checkout. This will get the code from the repo and put it in your workspace. When the operation completes, you will find a myami directory under amiworkspace in your home directory.
21
22 22 Amber Herold
h2. 3 Configure your Development Environment
23 1 Amber Herold
24
There are 2 types of development that you will most often do with the MyAMI code, Python for core processing and PHP for the web interface.
25
 
26 22 Amber Herold
h3. 1 Setup the Python environment
27 1 Amber Herold
28 6 Amber Herold
Go to Window -> Preferences -> PyDev -> Editor -> Interpreter – python. Press the Auto Config button then press OK.
29 1 Amber Herold
30 22 Amber Herold
h3. 2 Setup the PHP environment
31 1 Amber Herold
32 13 Amber Herold
There are two ways to view the web applications that you are developing in your home directory. If you are developing on a machine that does not have a local Apache server, you can use the Cronus3 web server. The advantage of this is that all the image processing plugins are already installed on Cronus3 so you don't have to worry about them and you don't have to worry about making Apache work. If you do run Apache locally, you can take advantage of integrated debugging tools in Eclipse and learn more about how all the pieces of the project fit together since will will have to set more things up. 
33
34
Also note that the directions below will not get project_tools running. It is currently undergoing many changes and directions will be added when that process is complete.
35 1 Amber Herold
36 4 Amber Herold
h4. Use Cronus3 to view your web app
37 1 Amber Herold
38 2 Amber Herold
# Open a terminal and go to your home directory: @$ cd ~@
39
# If is does not exist, create a directory called ami_html/: @$ mkdir ami_html/
40
# Change directories to ami_html:  $cd ami_html@
41
# Create a symbolic link to the web app directory in your workspace: @$ ln -s /home/[username]/amiworkspace/myami/myamiweb@
42 14 Amber Herold
# Try to browse to the project in a web browser ( http://cronus3/~username/myamiweb ). You should see an error because config.php failed to open. Keep reading "Create your config file" to fix this.
43 1 Amber Herold
  
44 9 Amber Herold
h4. Create your config file
45 1 Amber Herold
 
46
*IMPORTANT:* Never check your local copy of the config files into Subversion. We don't want to share our database user information with the world.
47
48 7 Amber Herold
# Change directories to the myamiweb project: $ cd ~/amiworkspace/myami/myamiweb
49
# Copy config.php.template to config.php: $ cp config.php.template config.php
50
# Open config.php for editting: $ vi config.php
51
# Make the following changes to config.php:
52
53
<pre>
54 15 Amber Herold
// --- define dbem web tools base --- //
55
$BASE_PATH = "myamiweb";
56
define('BASE_URL', "/".$BASE_PATH."/");
57
58 7 Amber Herold
// --- Set your leginon MySQL database server parameters
59
60
$DB_HOST        = "cronus4";
61
$DB_USER        = "usr_object";
62
$DB_PASS        = "";
63
$DB             = "dbemdata";
64
65
// --- XML test dataset
66
$XML_DATA = "test/viewerdata.xml";
67
68
// --- Project database URL
69
70 8 Amber Herold
$PROJECT_URL = "http://cronus3.scripps.edu/~[username]/project_tools";
71 7 Amber Herold
$PROJECT_DB_HOST = "cronus4";
72
$PROJECT_DB_USER = "usr_object";
73
$PROJECT_DB_PASS = "";
74
$PROJECT_DB = "project";
75
</pre>
76 1 Amber Herold
77 17 Amber Herold
Also modify config_processing.php:
78
79
<pre>
80 16 Amber Herold
// --- Processing database --- //
81
$PROCESSING_DB_HOST = "cronus4";
82
$PROCESSING_DB_USER = "usr_object";
83
$PROCESSING_DB_PASS = "";
84
$PROCESSING_DB = ""; //--- leave empty,  set by projectdb
85
86
87
// --- Add as many processing hosts as you like --- //
88
$PROCESSING_HOSTS[]="guppy";
89 1 Amber Herold
$PROCESSING_HOSTS[]="";
90 17 Amber Herold
</pre>
91 4 Amber Herold
92 16 Amber Herold
h4. Use your local Apache server to view your web app
93 1 Amber Herold
94
# Make sure you are logged in as root. ($ su)
95 11 Amber Herold
# Make sure Apache is installed. There should be /etc/init.d/httpd on your machine. Start apache with $ /etc/init.d/httpd start. 
96 1 Amber Herold
# Point a web browser to http://localhost/ and make sure you see the apache test page.
97
# Make sure Apache is configured for php
98 11 Amber Herold
# the Apache config file is at /etc/httpd/conf
99
# web files should be at /var/www/html
100
## create  symbolic link to your workspace in /var/www/html
101
## Try to view at http://localhost/myamiweb 
102
## Not working because need the files on phpami
103 1 Amber Herold
### go to phpami in your myamiweb workspace and create symbolic links to each file that remove the .php file extension
104
### put a symbolic link to this folder from user/share ( $ ln -s /home/amber/amiworkspace/myami/phpami php )
105
# To debug PHP issues check http://localhost/myamiweb/info.php
106 17 Amber Herold
# For everything to work, you need to install plugins like the MRC module
107
108 22 Amber Herold
h2. 4 Get a local copy of the databases
109 17 Amber Herold
110
If you want to work on the databases and you would prefer to have a local copy to play with, spend a couple of hours doing the following:
111
112 23 Amber Herold
h3. 1 Make sure MySQL is installed
113 17 Amber Herold
114 22 Amber Herold
Follow the instructions in the "Leginon install guide":http://emg.nysbc.org/documentation/leginon/bk02ch04s07.php.
115
 
116
Also install phpMyAdmin found under "Other Tools" on "this page":http://emg.nysbc.org/documentation/leginon/bk02ch04s08.php.
117 1 Amber Herold
Note that phpMyAdmin version 2.11.10 works with older versions of PHP (that we happen to use).
118 23 Amber Herold
119
h3. 2 Dump tables from cronus4 to a local file
120
121
This will grab the actual data that we use so you can play with it.
122
Log into cronus3 so that you can access cronus4.
123
124
<pre>
125
$ ssh cronus3
126
</pre>
127
128
Use mysqldump to get any table data that you want as in the example below. 
129
Cronus4 is the host. 
130
We do not lock the tables because we don't have permission to. 
131
"project" is the name of the database and "login" is the name of the Table.
132
We make up a file name for the data to dump to.
133
134
<pre>
135
$ mysqldump -h cronus4 -u usr_object --skip-lock-tables project login > ProjectLogin.sql
136
</pre>
137
138
Exit cronus3 when you are done dumping tables and load the dump files into your database.
139
If you followed the instructions for setting up MySQL in the Leginon Install guide, you have already created dbemdata and projectdata databases.
140
If you don't have them, create them first.
141
142
<pre>
143
mysql -u root projectdata < ProjectLogin.sql
144
</pre>
145
146
h3. 3 Modify Config.php
147
148
It should look like this:
149
150
<pre>
151
// --- Set your leginon MySQL database server parameters
152
153
$DB_HOST        = "localhost";
154
$DB_USER        = "usr_object";
155
$DB_PASS        = "";
156
$DB             = "dbemdata";
157
158
// --- XML test dataset
159
$XML_DATA = "test/viewerdata.xml";
160
161
// --- Project database URL
162
163
$PROJECT_URL = "project";
164
$PROJECT_DB_HOST = "localhost";
165
$PROJECT_DB_USER = "usr_object";
166
$PROJECT_DB_PASS = "";
167
$PROJECT_DB = "projectdata";
168
</pre>
169
170
h3. 4 Populate your databases automagically
171 24 Amber Herold
172
Point your web browser to http://localhost/myamiweb/.
173
Navigate to the Administration page and then to the ProjectDB page. 
174
175
Doing this will populate your database with the schema defined in myami/myamiweb/project/defaultprojecttables.xml.