Project

General

Profile

AMI Eclipse Quick Start Guide » History » Version 56

Sargis Dallakyan, 12/08/2011 12:51 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 51 Amber Herold
First, you can try the executable that already has the plugins installed. Get "eclipse.tar.gz":http://emg.nysbc.org/attachments/download/8/eclipse.tar.gz. 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 56 Sargis Dallakyan
# 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. 
19
20
See also: "PHP: Debugging with Eclipse":http://www.youtube.com/watch?v=zlHUCAf7oSk 
21 1 Amber Herold
22 22 Amber Herold
h2. 2 Create a Workspace and get the MyAMI code from Subversion
23 1 Amber Herold
24
# Double click the eclipse executable found in the eclipse directory.
25 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.
26 3 Amber Herold
# From the menu, select Window -> Open Perspective -> SVN Repository Exploring. This will open a view labeled SVN Repositories.
27
# Go to File -> New -> Repository Location.
28
# In the URL field type: http://emg.nysbc.org/svn/myami to get the Appion and Leginon code.
29 1 Amber Herold
# Press the Finish button at the bottom of the dialog. A new repository will appear in the SVN Repositories view.
30
# Click on the arrow next to the repository icon to view the trunk, branches and tags associated with the repository.
31
# 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.
32
33 55 Amber Herold
h2. 2.1 Import an existing project into a workspace 
34
35
# open the PHP or pydev view
36
# right click and select import
37
# under General select Existing Projects into Workspace
38
# select the project
39
# after the workspace is loaded, if the project is not linked to SVN, select Team->Share Project and select the repository
40
41 22 Amber Herold
h2. 3 Configure your Development Environment
42 1 Amber Herold
43
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.
44
 
45 22 Amber Herold
h3. 1 Setup the Python environment
46 1 Amber Herold
47 6 Amber Herold
Go to Window -> Preferences -> PyDev -> Editor -> Interpreter – python. Press the Auto Config button then press OK.
48 1 Amber Herold
49 22 Amber Herold
h3. 2 Setup the PHP environment
50 1 Amber Herold
51 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. 
52
53
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.
54 1 Amber Herold
55 41 Amber Herold
h4. Use Cronus3 or Fly to view your web app
56 1 Amber Herold
57 49 Amber Herold
Follow [[Use Cronus3 or Fly to view your web app]]
58 1 Amber Herold
59 14 Amber Herold
60 1 Amber Herold
  
61 9 Amber Herold
h4. Create your config file
62 46 Amber Herold
63 54 Amber Herold
Use the setup wizard to create the config file by browsing to myamiweb/setup. 
64
At AMI, you would go to cronus3/~YOUR_HOME_DIR/myamiweb/setup.
65 1 Amber Herold
 
66
*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.
67
68 52 Amber Herold
# To edit the config file by hand:
69
## Change directories to the myamiweb project: *$ cd ~/amiworkspace/myami/myamiweb*
70 1 Amber Herold
## Copy config.php.template to config.php: *$ cp config.php.template config.php*
71 52 Amber Herold
## Open config.php for editting: *$ vi config.php*
72 54 Amber Herold
## Make changes similar to this [[example config file]], replacing "amber" with your home directory. 
73 1 Amber Herold
74 17 Amber Herold
75 4 Amber Herold
76 35 Amber Herold
h4. Use your local Apache server to view your web app (optional)
77 1 Amber Herold
78
# Make sure you are logged in as root. ($ su)
79 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. 
80 1 Amber Herold
# Point a web browser to http://localhost/ and make sure you see the apache test page.
81
# Make sure Apache is configured for php
82 11 Amber Herold
# the Apache config file is at /etc/httpd/conf
83
# web files should be at /var/www/html
84
## create  symbolic link to your workspace in /var/www/html
85
## Try to view at http://localhost/myamiweb 
86
## Not working because need the files on phpami
87 1 Amber Herold
### go to phpami in your myamiweb workspace and create symbolic links to each file that remove the .php file extension
88
### put a symbolic link to this folder from user/share ( $ ln -s /home/amber/amiworkspace/myami/phpami php )
89
# To debug PHP issues check http://localhost/myamiweb/info.php
90 17 Amber Herold
# For everything to work, you need to install plugins like the MRC module
91
92 34 Amber Herold
h2. 4 Get a local copy of the databases (optional)
93 17 Amber Herold
94 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]].
95 40 Amber Herold
96 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.
97 41 Amber Herold
98 43 Amber Herold
h2. 5 Run a Python Script
99 42 Amber Herold
100
# Change perspective to PyDev. (Window->Open Perspective)
101
# Right click on the myami project and choose Properties
102
# Select PyDev - PYTHONPATH
103
# Under Source Folders select Add source folder
104
# Make sure myami is selected and press OK
105
# Build numextension
106
## Right click on numextension/setup.py and select Properties
107
## Select Run/Debug settings
108
## Select Edit
109
## Select the Arguments tab
110
## Under program arguments type _build_
111
## Select OK
112
## Right click on setup.py and select Run As->Python Run
113
# Run Leginon 
114
## Make sure the config files are set correctly (leginon.cfg, sinedon.cfg)
115
## Run leginon/syscheck.py by right clicking and selecting Run As->Python Run
116
## Right click on leginon/start.py and select Run As->Python Run
117 44 Amber Herold
118
h2. 6 Merge a revision to another branch
119
120
# Commit your change and note the revision number.
121
# Go to the branch that you want to merge the code into and select Team->Merge.
122
# Under URL click Browse and select the trunk or branch that you already committed your changes to.
123
# In the revisions area, select the radio button next to Revisions: and click the Browse button.
124
# Select the revision that you wish to merge AND the revision immediately preceding yours.
125
# Select OK to close out the revision browser.
126
# Select the Preview Button to see what files will be merged.
127
# If it looks like the correct files, select the Ok button the close the preview and select OK again to execute the Merge.
128
# When it completes, Eclipse will open a synchronizing window where you can see the differences between your local, merged version of the files and the version held by SVN.
129
# If all the changes look correct, you may Commit the changes. Please include a comment in the commit message similar to the following:
130 45 Amber Herold
131 44 Amber Herold
bq. Merge from trunk r14376 and r14383 to 2.0 branch, Fix for Post-processing does not work with FREALIGN jobs , refs #657
132 47 Amber Herold
133
h2. 7 How to commit a change to svn
134
135
# In the Pydev Explorer or PHP explorer view, right click on the file, folder or project that you want to commit and select Team->Synchronize with repository. This will show you what files have been changed in your local sandbox.
136
# You may click on the changed files to view the specific differences that you will be checking in to ensure they are what you intended.
137
# Then right click and select Commit. Add a comment that references the redmine issue number (ex. refs #123). This will automatically link the revision number to the issue in redmine.