Friday, May 12, 2017

How to make an Ambari service support https only

I have already set up a new Ambari Service MyDemo which provides a quick link supporting http only. Here is the quicklink.json for it:


{
 "name": "default",
 "description": "default quick links configuration",
 "configuration": {
  "protocol": {
   "type": "http_only",
  },

  "links": [
   {
    "name": "mydemo_ui",
    "label": "MyDemo UI",
    "requires_user_name": "false",
    "component_name": "MYDEMO_SERVER",
    "url": "%@://%@:%@",
    "port":{
     "http_property": "mydemo.http.port",
     "http_default_port": "18042",
     "regex": "^(\\d+)$",
     "site":"mydemo-site"
    }
   }
  ]
 }
}

The quick link now points to http://sandbox.hortonworks.com:18042

Next, there is new request to make MyDemo support https only. I think the change should be quite straightforward - just replace all "http" in the configuration file with "https". But, a big BUT here, it does NOT work as expected. the quick link points to:
    http://sandbox.hortonworks.com
The protocol is incorrect and the port number is missing.

Based on the documentation from Ambari:
    https://cwiki.apache.org/confluence/display/AMBARI/Quick+Links
The protocol type can be "https_only" if the 'checks' are empty. But it just dose not work.

After several trials, here is the working version:


{
 "name": "default",
 "description": "default quick links configuration",
 "configuration": {
  "protocol": {
   "type": "https",
   "checks":[
    {
     "site":"mydemo-site"
    }
   ]
  },

  "links": [
   {
    "name": "mydemo_ui",    "label": "MYDEMO UI",
    "requires_user_name": "false",
    "component_name": "MYDEMO_SERVER",
    "url": "%@://%@:%@",
    "port":{
     "https_property": "mydemo.https.port",
     "https_default_port": "18043",
     "regex": "^(\\d+)$",
     "site":"mydemo-site"
    }
   }
  ]
 }
}

Note that the major change is to add the "checks" with only 'site' which is always true.
Now the quick link is pointing to https://sandbox.hortonworks.com:18043

No bug is NOT fixed eventually!


BTW:  Service log directory: /var/lib/ambari-agent/data

No comments: