Jump to: navigation, search

Difference between revisions of "Setup keystone in Eclipse"

m (add category contribute)
 
(6 intermediate revisions by 4 users not shown)
Line 1: Line 1:
__NOTOC__
+
This page describes how to setup Eclipse [[PyDev]] Dev Env for keystone project.
<!-- ##master-page:[[Category:Template]] -->
+
 
<!-- ##master-date:Unknown-Date -->
+
__TOC__
<!-- #format wiki -->
 
<!-- #language en -->
 
This page describes how to setup Eclipse [[PyDev]] Dev Env for keystone project. Table of contents: <<[[TableOfContents]]()>>
 
  
 
= Assumptions =
 
= Assumptions =
Line 17: Line 14:
 
OS user to use: root
 
OS user to use: root
  
= To setup eclipse =
+
= To setup Eclipse =
1.make sure there is one java available: java -version
+
1. Make sure there is one Java available: java -version.
 +
 
 +
2. Download Eclipse
  
2.download eclipse
+
We preferably download Eclipse IDE for Java EE Developers. Please choose the proper platform version according to the OS used. Unzip it into a dir,  for example /root/eclipse.
  
we had better download Eclipse IDE for Java EE Developers. Please choose proper platform version according to the OS used. Unzip it into a dir,  for example /root/eclipse
+
3. Prepare [[PyDev]]
  
3. prepare [[PyDev]]
+
After start the Eclipse, we install pydev with p2 site http://pydev.org/updates.  To install it, just call out Eclipse's "install" dialogue by menu "help->install new software...".
  
After start the Eclipse, we install pydev with p2 site “http://pydev.org/updates”.  To install it, just call out Eclipse's "install" dialogue by menu "help->install new software...".
+
With [[PyDev]] installed, we need to configure [[PyDev]] preference. call out preference dialogue by menu "window->preferences":
  
with [[PyDev]] installed, we need to configiure [[PyDev]] preference. call out preference dialogue by menu "window->preferences": {{http://wiki.openstack.org/Setup keystone in Eclipse?action=[[AttachFile]]&do=get&target=[[PydevPreferences]].png||height="454px",width="612px"}}
+
[[file:PydevPreferences.png]]
  
4. install EGIT
+
4. Install EGIT
  
install EGIT plugins into Eclipse with site "http://download.eclipse.org/egit/updates"
+
Install EGIT plugins into Eclipse with site http://download.eclipse.org/egit/updates.
  
 
= Play with Keystone =
 
= Play with Keystone =
1. clone the client GIT repo
+
== Clone the client GIT repo ==
 
+
Switch to "Git repository exploring" perspective and clone the keystoneclient Git repo "https://github.com/openstack/python-keystoneclient.git":
switch to "Git repository exploring" perspective and clone the keystoneclient Git repo "https://github.com/openstack/python-keystoneclient.git": {{http://wiki.openstack.org/gongysh@cn.ibm.com?action=[[AttachFile]]&do=get&target=gitkeystone.png||height="538px",width="572px"}}
 
 
 
we can see  where it is cloned on local directory:
 
 
 
[[Media:Setup_keystone_in_Eclipse$gitclientdir.png||height="375px",width="532px"]]
 
 
 
Just shown by above figure, the code is under "/root/test/git/python-keystoneclient"
 
  
2. install keystoneclient
+
[[file:gitkeystone.png]]
  
keystoneclient will be installed on OS since in general we are not interested to have it in eclipse:
+
We can see  where it is cloned on local directory:
  
on a console, run:
+
[[File:gitclientdir.png]]
{| border="1" cellpadding="2" cellspacing="0"
 
|}
 
  
"pip-python install -r tools/pip-require" is used to install pre-requisites
+
Just shown by above figure, the code is under "/root/test/git/python-keystoneclient".
  
3. clone keystone GIT repo
+
== Install Keystoneclient ==
 +
Keystoneclient will be installed on OS since in general we are not interested to have it in Eclipse.
  
clone keystone GIT repo site "https://github.com/openstack/keystone.git"
+
On a console, run:
  
4. import it into Eclipse workspace
+
<pre>pip install -r tools/pip-require </pre> is used to install pre-requisites.
  
we will put keystone into Eclipse workspace and then start it there.
+
== Clone keystone GIT repo ==
 +
Clone keystone GIT repo site "https://github.com/openstack/keystone.git".
  
right click on "working directory" and then choose "import  project..." to import keystone into Eclipse workspace as "general  project" since there is no pydev project metadata in GIT:
+
== Import it into Eclipse workspace ==
 +
We will put keystone into Eclipse workspace and then start it there.
  
[[Media:Setup_keystone_in_Eclipse$keystone.png||height="450px",width="918px"]]
+
Right click on "working directory" and then choose "import  project..." to import keystone into Eclipse workspace as "general  project" since there is no [[PyDev]] project metadata in GIT:
  
5. set keystone project as [[PyDev]] project
+
[[File:keystone.png]]
  
 +
== Set keystone project as [[PyDev]] project ==
 
Switch to [[PyDev]] perspective and set keystone project as [[PyDev]] project:
 
Switch to [[PyDev]] perspective and set keystone project as [[PyDev]] project:
  
[[Media:Setup_keystone_in_Eclipse$pydevkeystone.png||height="579px",width="664px"]]
+
[[File:pydevkeystone.png]]
  
call out project's properties dialogue by right context menu propreties to set project's PYTHONPATH:
+
Call out project's properties dialogue by right context menu properties to set project's PYTHONPATH:
  
[[Media:Setup_keystone_in_Eclipse$keystonepythonpath.png||height="398px",width="553px"]]
+
[[File:keystonepythonpath.png]]
  
6.confiure keystone and setup db
+
== Configure keystone and setup db ==
 +
* '''a)''' Use mysql database
  
* '''a)''' use mysql database
+
* '''b)''' setup keystone db
  
{| border="1" cellpadding="2" cellspacing="0"
+
Run shell scripts below to create keystone db:
|}
 
  
* connection = mysql://root:root@localhost/keystone [identity] driver = keystone.identity.backends.sql.Identity [token] driver = keystone.token.backends.sql.Token # Amount of time a token should remain valid (in seconds) expiration = 86400 [policy] driver = keystone.policy.backends.rules.Policy [ec2]
 
driver = keystone.contrib.ec2.backends.sql.Ec2 ... ||
 
  
b. setup keystone db
+
And Run the shell below to create tables for keystone:
  
run shell scripts below to create keystone db
+
== Play with keystone ==
{| border="1" cellpadding="2" cellspacing="0"
 
|}
 
  
run the shell below to create tables for keystone
+
* '''a)''' Set up a debug configuration for keystone in Eclipse
{| border="1" cellpadding="2" cellspacing="0"
 
|}
 
  
7. play with keystone
+
[[File:keystonedebugconfigure.png]]
  
* '''a)''' set up a debug configuration for keystone in Eclipse
 
  
[[Media:Setup_keystone_in_Eclipse$keystonedebugconfigure.png||height="598px",width="699px"]]
+
* '''b)'''  Setup debug configuration
  
b. setup debug configuration
+
[[File:keystoneworkdir.png]]
  
[[Media:Setup_keystone_in_Eclipse$keystoneworkdir.png||height="448px",width="565px"]]
 
  
c: launch keystone
+
* '''c)''' Launch keystone
  
to run we can click "Debug" button on "Debug Configuration" dialogue or run it from "Debug/Run" pull down tool bar button
+
To run we can click "Debug" button on "Debug Configuration" dialogue or run it from "Debug/Run" pull down tool bar button:
  
[[Media:Setup_keystone_in_Eclipse$runningkeystone.png||height="288px",width="514px"]]
+
[[File:runningkeystone.png]]
  
d: initialize keystone with keystone client
 
  
run the following scripts to do the initiazing to popluate the first user "admin" with password "password":
+
* '''d)''' Initialize keystone with keystone client
  
{| border="1" cellpadding="2" cellspacing="0"
+
Run the following scripts to do the initializing to populate the first user "admin" with password "password":
|}
 
  
 
To check,  we can run keystone client:
 
To check,  we can run keystone client:
{| border="1" cellpadding="2" cellspacing="0"
 
|}
 
 
'''List of pages in this category:'''
 
 
<<[[FullSearchCached]](category:@Eclipse@ @[[PyDev]]@)>>
 
  
----
+
-----
 +
[[Category:Contribute]]

Latest revision as of 00:42, 23 September 2014

This page describes how to setup Eclipse PyDev Dev Env for keystone project.

Assumptions

OS: redhat 6.1 bit64

Libvirtd: libvirtd and libvirt client are installed ( use "virsh -c qemu:///system list" to test its availability)

development env: GCC and related header files (for install needed python modules)

mysql: server and client, with root password for mysql root account ( use "echo "show databases" | mysql -uroot -proot" to test it)

OS user to use: root

To setup Eclipse

1. Make sure there is one Java available: java -version.

2. Download Eclipse

We preferably download Eclipse IDE for Java EE Developers. Please choose the proper platform version according to the OS used. Unzip it into a dir, for example /root/eclipse.

3. Prepare PyDev

After start the Eclipse, we install pydev with p2 site http://pydev.org/updates. To install it, just call out Eclipse's "install" dialogue by menu "help->install new software...".

With PyDev installed, we need to configure PyDev preference. call out preference dialogue by menu "window->preferences":

PydevPreferences.png

4. Install EGIT

Install EGIT plugins into Eclipse with site http://download.eclipse.org/egit/updates.

Play with Keystone

Clone the client GIT repo

Switch to "Git repository exploring" perspective and clone the keystoneclient Git repo "https://github.com/openstack/python-keystoneclient.git":

Gitkeystone.png

We can see where it is cloned on local directory:

Gitclientdir.png

Just shown by above figure, the code is under "/root/test/git/python-keystoneclient".

Install Keystoneclient

Keystoneclient will be installed on OS since in general we are not interested to have it in Eclipse.

On a console, run:

pip install -r tools/pip-require 
is used to install pre-requisites.

Clone keystone GIT repo

Clone keystone GIT repo site "https://github.com/openstack/keystone.git".

Import it into Eclipse workspace

We will put keystone into Eclipse workspace and then start it there.

Right click on "working directory" and then choose "import project..." to import keystone into Eclipse workspace as "general project" since there is no PyDev project metadata in GIT:

Keystone.png

Set keystone project as PyDev project

Switch to PyDev perspective and set keystone project as PyDev project:

Pydevkeystone.png

Call out project's properties dialogue by right context menu properties to set project's PYTHONPATH:

Keystonepythonpath.png

Configure keystone and setup db

  • a) Use mysql database
  • b) setup keystone db

Run shell scripts below to create keystone db:


And Run the shell below to create tables for keystone:

Play with keystone

  • a) Set up a debug configuration for keystone in Eclipse

Keystonedebugconfigure.png


  • b) Setup debug configuration

Keystoneworkdir.png


  • c) Launch keystone

To run we can click "Debug" button on "Debug Configuration" dialogue or run it from "Debug/Run" pull down tool bar button:

Runningkeystone.png


  • d) Initialize keystone with keystone client

Run the following scripts to do the initializing to populate the first user "admin" with password "password":

To check, we can run keystone client: