AMI Eclipse Quick Start Guide » History » Version 42
Amber Herold, 04/13/2010 11:10 AM
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 | 33 | Amber Herold | First, you can try the executable that already has the plugins installed. Get *eclipse.tar.gz* from the Files tab here in Redmine. Just copy it to your machine, uncompress it and the executable is available within the eclipse directoy. No further installation steps are required. |
8 | 31 | Amber Herold | |
9 | 28 | Amber Herold | If you want to install things yourself, this is what you need: |
10 | |||
11 | 30 | Amber Herold | # Download eclipse from "here":http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/galileo/SR1/eclipse-jee-galileo-SR1-linux-gtk-x86_64.tar.gz. |
12 | 28 | Amber Herold | # Get the plugins: |
13 | ## Subversion |
||
14 | ## PHP |
||
15 | ## Subversion connector |
||
16 | ## pydev |
||
17 | # Copy it to somewhere on your local machine. |
||
18 | # Double click the eclipse executable to open. If using a machine that was setup with the AMI kickstart program, you will need to update java to use the 64 bit version. (Ask Christopher) |
||
19 | 1 | Amber Herold | |
20 | 22 | Amber Herold | h2. 2 Create a Workspace and get the MyAMI code from Subversion |
21 | 1 | Amber Herold | |
22 | # Double click the eclipse executable found in the eclipse directory. |
||
23 | 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. |
24 | 3 | Amber Herold | # From the menu, select Window -> Open Perspective -> SVN Repository Exploring. This will open a view labeled SVN Repositories. |
25 | # Go to File -> New -> Repository Location. |
||
26 | # In the URL field type: http://emg.nysbc.org/svn/myami to get the Appion and Leginon code. |
||
27 | 1 | Amber Herold | # Press the Finish button at the bottom of the dialog. A new repository will appear in the SVN Repositories view. |
28 | # Click on the arrow next to the repository icon to view the trunk, branches and tags associated with the repository. |
||
29 | # 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. |
||
30 | |||
31 | 22 | Amber Herold | h2. 3 Configure your Development Environment |
32 | 1 | Amber Herold | |
33 | 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. |
||
34 | |||
35 | 22 | Amber Herold | h3. 1 Setup the Python environment |
36 | 1 | Amber Herold | |
37 | 6 | Amber Herold | Go to Window -> Preferences -> PyDev -> Editor -> Interpreter – python. Press the Auto Config button then press OK. |
38 | 1 | Amber Herold | |
39 | 22 | Amber Herold | h3. 2 Setup the PHP environment |
40 | 1 | Amber Herold | |
41 | 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. |
42 | |||
43 | 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. |
||
44 | 1 | Amber Herold | |
45 | 41 | Amber Herold | h4. Use Cronus3 or Fly to view your web app |
46 | 1 | Amber Herold | |
47 | 41 | Amber Herold | (Fly is a good choice since it is not a production server. You can create your own databases on Fly as well.) |
48 | 1 | Amber Herold | |
49 | 41 | Amber Herold | |
50 | 39 | Amber Herold | # Open a terminal and go to your home directory: *$ cd ~* |
51 | # Create a directory called "ami_html" if it does not exist: *$ mkdir ami_html/* |
||
52 | # Change directories to ami_html: *$ cd ami_html* |
||
53 | # Create a symbolic link to the web app directory in your workspace: *$ ln -s /home/[username]/amiworkspace/myami/myamiweb* |
||
54 | 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. |
55 | 1 | Amber Herold | |
56 | 9 | Amber Herold | h4. Create your config file |
57 | 1 | Amber Herold | |
58 | *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. |
||
59 | |||
60 | 39 | Amber Herold | # Change directories to the myamiweb project: *$ cd ~/amiworkspace/myami/myamiweb* |
61 | # Copy config.php.template to config.php: *$ cp config.php.template config.php* |
||
62 | # Open config.php for editting: *$ vi config.php* |
||
63 | 7 | Amber Herold | # Make the following changes to config.php: |
64 | |||
65 | <pre> |
||
66 | 15 | Amber Herold | // --- define dbem web tools base --- // |
67 | $BASE_PATH = "myamiweb"; |
||
68 | define('BASE_URL', "/".$BASE_PATH."/"); |
||
69 | |||
70 | 7 | Amber Herold | // --- Set your leginon MySQL database server parameters |
71 | |||
72 | $DB_HOST = "cronus4"; |
||
73 | $DB_USER = "usr_object"; |
||
74 | $DB_PASS = ""; |
||
75 | $DB = "dbemdata"; |
||
76 | |||
77 | // --- XML test dataset |
||
78 | $XML_DATA = "test/viewerdata.xml"; |
||
79 | |||
80 | // --- Project database URL |
||
81 | |||
82 | 8 | Amber Herold | $PROJECT_URL = "http://cronus3.scripps.edu/~[username]/project_tools"; |
83 | 7 | Amber Herold | $PROJECT_DB_HOST = "cronus4"; |
84 | $PROJECT_DB_USER = "usr_object"; |
||
85 | $PROJECT_DB_PASS = ""; |
||
86 | $PROJECT_DB = "project"; |
||
87 | </pre> |
||
88 | 1 | Amber Herold | |
89 | 17 | Amber Herold | Also modify config_processing.php: |
90 | |||
91 | <pre> |
||
92 | 16 | Amber Herold | // --- Processing database --- // |
93 | $PROCESSING_DB_HOST = "cronus4"; |
||
94 | $PROCESSING_DB_USER = "usr_object"; |
||
95 | $PROCESSING_DB_PASS = ""; |
||
96 | $PROCESSING_DB = ""; //--- leave empty, set by projectdb |
||
97 | |||
98 | |||
99 | // --- Add as many processing hosts as you like --- // |
||
100 | $PROCESSING_HOSTS[]="guppy"; |
||
101 | 1 | Amber Herold | $PROCESSING_HOSTS[]=""; |
102 | 17 | Amber Herold | </pre> |
103 | 4 | Amber Herold | |
104 | 35 | Amber Herold | h4. Use your local Apache server to view your web app (optional) |
105 | 1 | Amber Herold | |
106 | # Make sure you are logged in as root. ($ su) |
||
107 | 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. |
108 | 1 | Amber Herold | # Point a web browser to http://localhost/ and make sure you see the apache test page. |
109 | # Make sure Apache is configured for php |
||
110 | 11 | Amber Herold | # the Apache config file is at /etc/httpd/conf |
111 | # web files should be at /var/www/html |
||
112 | ## create symbolic link to your workspace in /var/www/html |
||
113 | ## Try to view at http://localhost/myamiweb |
||
114 | ## Not working because need the files on phpami |
||
115 | 1 | Amber Herold | ### go to phpami in your myamiweb workspace and create symbolic links to each file that remove the .php file extension |
116 | ### put a symbolic link to this folder from user/share ( $ ln -s /home/amber/amiworkspace/myami/phpami php ) |
||
117 | # To debug PHP issues check http://localhost/myamiweb/info.php |
||
118 | 17 | Amber Herold | # For everything to work, you need to install plugins like the MRC module |
119 | |||
120 | 34 | Amber Herold | h2. 4 Get a local copy of the databases (optional) |
121 | 17 | Amber Herold | |
122 | 27 | Amber Herold | If you want to work on the databases and you would prefer to have a local copy to play with, read [[Setup Local Databases | How to set up a local copy of AMI databases]]. |
123 | 40 | Amber Herold | |
124 | 1 | Amber Herold | You also have an option of creating a copy of the database that you wish to work with on the fly server. You will name your DB with your name prepended to the name of the DB that is copied. You will need to update your Config file accordingly. You can work with your DB without affecting formal testing on fly or the production databases. |
125 | 41 | Amber Herold | |
126 | h2. Run a Python Script |
||
127 | 42 | Amber Herold | |
128 | # Change perspective to PyDev. (Window->Open Perspective) |
||
129 | # Right click on the myami project and choose Properties |
||
130 | # Select PyDev - PYTHONPATH |
||
131 | # Under Source Folders select Add source folder |
||
132 | # Make sure myami is selected and press OK |
||
133 | # Build numextension |
||
134 | ## Right click on numextension/setup.py and select Properties |
||
135 | ## Select Run/Debug settings |
||
136 | ## Select Edit |
||
137 | ## Select the Arguments tab |
||
138 | ## Under program arguments type _build_ |
||
139 | ## Select OK |
||
140 | ## Right click on setup.py and select Run As->Python Run |
||
141 | # Run Leginon |
||
142 | ## Make sure the config files are set correctly (leginon.cfg, sinedon.cfg) |
||
143 | ## Run leginon/syscheck.py by right clicking and selecting Run As->Python Run |
||
144 | ## Right click on leginon/start.py and select Run As->Python Run |