Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 413102

Summary: Start/Stop/Restart functionality for HIPP instances
Product: Community Reporter: Denis Roy <denis.roy>
Component: CI-JenkinsAssignee: Eclipse Webmaster <webmaster>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: chris.guindon, dennis.huebner, mknauer, nathan, stepper, wayne.beaton, webmaster
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Bug Depends on: 420317, 421847, 421867, 421990    
Bug Blocks: 403843    
Attachments:
Description Flags
Screenshot none

Description Denis Roy CLA 2013-07-16 14:23:38 EDT
Let's craft a basic mechanism that will allow committers to start/stop/restart their HIPP instance.

Assuming we have a central mapping of:
user-id:hipp-server:port

We should be able to craft some UI that will allow this.  The PMI would be a logical place.

The workflow I can imagine (for security purposes) would use a dispatcher similar to the ldap_community_creator we employ to prevent the web server from writing directly to LDAP.  A start/stop/restart request from PMI could be written to a database table.  genie, armed with SSH keys for all the hipp user accounts, could poll the table every 2 seconds to then then ssh -c "command" hipp-server and perform the action without ever becoming root.
Comment 1 Denis Roy CLA 2013-11-06 16:22:23 EST
Created attachment 237247 [details]
Screenshot

Basic UI of what I'm working on.  It's not pretty, but it will work.

Thanh, the current "services" text file will be moved to a database table on the Foundation database.  I'll also add some UI to manipulate it, but you can also access it via SQL for automation.
Comment 2 Denis Roy CLA 2013-11-12 14:30:38 EST
First pass at what I'm working on.

https://git.eclipse.org/r/#/c/18311/

Anyone want to review it?
Comment 3 Denis Roy CLA 2013-11-12 14:33:02 EST
Chris, please see comment 2.
Comment 4 Christopher Guindon CLA 2013-11-12 17:01:07 EST
(In reply to Denis Roy from comment #3)
> Chris, please see comment 2.

Hi Denis,

we've discussed that I am unable to replicate this on my local environment (for now) but I will do my best to review your patch with what I can see.

1. site_login/sitelogin.css
You can remove the <style></style> within the css file

2. committers/bugs/bugz_manager.php, eclipse.org-common/classes/projects/hipp.class.php & eclipse.org-common/classes/projects/projectList.class.php

Not critical but when using MySQL versions 4.1.3 or later it is recommended that we use the mysqli extension.

The mysql extension is deprecated as of PHP 5.5.0, and will be removed in the future. 

http://php.net/manual/en/function.mysql-query.php
http://us1.php.net/mysql_fetch_array

3. site_login/content/en_committer.php
3.1 I would move the inline css in a css style sheet. It will make your life easier if you need to fix the UI in the future.

3.2 Links with the fnToggle() needs a mouse pointer when doing a mouse over, similar to what you are doing with the .control_icon css class.

3.3 I believe you are writing a .click() function for each project and for each state. You should be able to do all of this with 1 single function. If you do that, you could add your JavaScript in a js file and make your code re-usable.

For example, instead of:
$("#' . $_project_short_name . '_' . $_cntl . '").click(function() 

You could use the same class for all of your buttons instead of an id. 

The project information could be stored in a html5 data- attributes.
http://api.jquery.com/data/#data-html5

For example:

<img id="project_xqy_stop" class="control_icon" src="//dev.eclipse.org/small_icons/actions/process-stop.png" alt="Stop" 
title="Stop" data-project-short-name="projectname"  data-button-state="stop" data-project-id="theid_3242023" />

You could then do this with jQuery:

<script>
$(".control_icon").click(function() {
  alert($( this ).data('project-id'));
  alert($( this ).data('button-state'));
});
</script>

4. site_login/content/en_welcomeback2.php
You could use $app to add the css in <head>
$App->AddExtraHtmlHeader('<link rel="stylesheet" type="text/css" href="sitelogin.css" media="screen" />');

I hope I was not too picky. Please let me know if you have any questions.
Comment 5 Christopher Guindon CLA 2013-11-12 17:54:15 EST
> I hope I was not too picky. Please let me know if you have any questions.

I am definitely picky, especially regarding mysql/mysqli but wanted to do my best to help you by giving you as much feedback as I could.
Comment 6 Denis Roy CLA 2013-11-13 10:46:59 EST
Thanks, Chris.  Some comments below:


(In reply to Christopher Guindon from comment #4)
> 1. site_login/sitelogin.css
> You can remove the <style></style> within the css file
Done.

> 
> 2. committers/bugs/bugz_manager.php,
> eclipse.org-common/classes/projects/hipp.class.php &
> eclipse.org-common/classes/projects/projectList.class.php
> 
> Not critical but when using MySQL versions 4.1.3 or later it is recommended
> that we use the mysqli extension.
> 
> The mysql extension is deprecated as of PHP 5.5.0, and will be removed in
> the future. 

This is a much bigger problem.  I suggest we open a bug against Community/Website since we'll have to update all of eclipse.org-common.

> 3. site_login/content/en_committer.php
> 3.1 I would move the inline css in a css style sheet. It will make your life
> easier if you need to fix the UI in the future.

Yes, absolutely.


> 3.2 Links with the fnToggle() needs a mouse pointer when doing a mouse over,
> similar to what you are doing with the .control_icon css class.
Great catch, thanks.

I've also added this to my CSS:
body {
	overflow-y:scroll;
}

It eliminated the page jitter when a section is expanded and collapsed.

 
> 3.3 I believe you are writing a .click() function for each project and for
> each state.

Yeah, I know there's a better way, but this is my first venture with jQuery, so please be gentle with me  :) . That page will contain zero to, at most, six states for some committers, so I don't see this as being a problem now for the foreseeable future.


> 4. site_login/content/en_welcomeback2.php
> You could use $app to add the css in <head>
> $App->AddExtraHtmlHeader('<link rel="stylesheet" type="text/css"
> href="sitelogin.css" media="screen" />');

Indeed.  I've added the call to _projectCommon.php so that CSS will be included on all pages.

> I hope I was not too picky. Please let me know if you have any questions.
Picky is good.


I've amended my previous commit.

https://git.eclipse.org/r/#/c/18342/
Comment 7 Denis Roy CLA 2013-11-14 15:16:08 EST
At this time, Start/Stop/Restart is functional, but needs some testing to ensure the Hudson environment is sane when a HIPP instance is started & restarted this way.

The tool is available from Site Login:
https://dev.eclipse.org/site_login/myaccount.php

Some notes:
- Only Committers will see the Committer Tools (obviously)

- We'll have to change/rename those Hudson instances that do not match a project name.  MEXX comes to mind.

- All committers on a project will see the Start/Stop/Restart functionality.  I'll assume that projects will work out the usage conventions amongst themselves.

- To avoid potential denial-of-service, the number of start/stop/restart requests is limited in a specific period of time.
Comment 8 Denis Roy CLA 2013-11-14 15:16:25 EST
> This is a much bigger problem.  I suggest we open a bug against
> Community/Website since we'll have to update all of eclipse.org-common.

I've opened bug 421727 for that.
Comment 9 Denis Roy CLA 2013-11-20 14:22:11 EST
This is rolled out:

http://dev.eclipse.org/site_login/myaccount.php
Comment 10 Eike Stepper CLA 2013-11-20 23:44:03 EST
That's awesome Denis. Thank you!