You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stratos.apache.org by Chamila De Alwis <ch...@wso2.com> on 2014/08/14 13:10:38 UTC

The role of puppet agent in the spawned instance

Hi,

When creating a cartridge we set up the base image by specifying the
stratos service name and installing the packages needed for that service
using puppet. For example if we specify "php" as the service name PHP
packages and its dependencies will be installed.

When a new instance is created from a PHP cartridge init.sh is run at the
start. This also triggers the puppet agent.

What is the purpose of triggering puppet agent at instance start up? Is it
only to find any manifest updates?

Regards,
Chamila de Alwis
Software Engineer | WSO2 | +94772207163
Blog: code.chamiladealwis.com

Re: The role of puppet agent in the spawned instance

Posted by Udara Liyanage <ud...@wso2.com>.
Hi,

AFAIK in generic cartridge scenario, service name is passed as user data
into the instance. Then scripts inside instance set instance's host name to
"someText.SERVICE_NAME". Then puppet master identifies this instance as of
type SERVICE_NAME.
I thought puppet master identifies instance type from the host name of the
instance which puppet client may passes when talking to the master.


On Thu, Aug 14, 2014 at 6:12 PM, Chamila De Alwis <ch...@wso2.com> wrote:

> Hi Dinesh,
>
> Thanks for the reply.
>
> As far as I understand puppet master will identify the node based on the
> cert name of the puppet agent. In the case of a generic base image, does
> puppet agent pass any additional parameters when communicating with the
> puppet master to request the node catalogue?
>
>
> Regards,
> Chamila de Alwis
> Software Engineer | WSO2 | +94772207163
> Blog: code.chamiladealwis.com
>
>
>
>
> On Thu, Aug 14, 2014 at 5:11 PM, Dinesh Bandara <di...@wso2.com> wrote:
>
>> Hi Chamila,
>>
>> Please find my comment inline.
>>
>> On Thu, Aug 14, 2014 at 4:40 PM, Chamila De Alwis <ch...@wso2.com>
>> wrote:
>>
>>> Hi,
>>>
>>> When creating a cartridge we set up the base image by specifying the
>>> stratos service name and installing the packages needed for that service
>>> using puppet. For example if we specify "php" as the service name PHP
>>> packages and its dependencies will be installed.
>>>
>> If we used "default" as service name it will install cartridge agent,
>> java and basic dependencies. So base cartridge is not bound to any service
>> type. it is a generic one.
>>
>>
>>> When a new instance is created from a PHP cartridge init.sh is run at
>>> the start. This also triggers the puppet agent.
>>>
>> Yes.
>>
>>
>>> What is the purpose of triggering puppet agent at instance start up? Is
>>> it only to find any manifest updates?
>>>
>> If use a generic cartridge image as "imageId" when deploying, puppet
>> agent will install required packages and dependencies. If use a service
>> bound cartridge image (PHP, MySQL, etc.), it will not update any packages
>> or dependencies but update the manifest updates as you mentioned such as
>> ips and ports of message broker and cep
>>
>>
>>> Regards,
>>> Chamila de Alwis
>>> Software Engineer | WSO2 | +94772207163
>>> Blog: code.chamiladealwis.com
>>>
>>>
>>>
>> --
>> *Dinesh Bandara*
>> Software Engineer
>> WSO2 Inc.; http://wso2.com
>> lean.enterprise.middleware
>>
>>
>


-- 

Udara Liyanage
Software Engineer
WSO2, Inc.: http://wso2.com
lean. enterprise. middleware

web: http://udaraliyanage.wordpress.com
phone: +94 71 443 6897

Re: The role of puppet agent in the spawned instance

Posted by Chamila De Alwis <ch...@wso2.com>.
On Thu, Aug 14, 2014 at 9:51 PM, Manula Waidyanatha <ma...@wow.com> wrote:

> I think you are asking about "node /php/ " part as defined in php.pp file.
> In that node definition /php/ is a regex. It will match all the
> hostnames/certnames that has php part.
>

Thanks Manula! That was the answer I was looking for. Seems I missed it in
the code.


Regards,
Chamila de Alwis
Software Engineer | WSO2 | +94772207163
Blog: code.chamiladealwis.com

Re: The role of puppet agent in the spawned instance

Posted by Chamila De Alwis <ch...@wso2.com>.
Hi Udara,


On Thu, Aug 14, 2014 at 10:18 PM, Udara Liyanage <ud...@wso2.com> wrote:

> configuring puppet master to read service type from that facter


With a brief search I found a puppetlabs doc[1] which dives in to facter.
It seems what you're suggesting is possible, but it would require changing
from node resource to case statements.

case $service_name {
  'php' : { include php }
  ...
}

[1] - http://puppetlabs.com/blog/facter-part-1-facter-101


Regards,
Chamila de Alwis
Software Engineer | WSO2 | +94772207163
Blog: code.chamiladealwis.com

Re: The role of puppet agent in the spawned instance

Posted by Udara Liyanage <ud...@wso2.com>.
Hi Chamila,

As Manula mentioned there is a regex for identification.
You can just play around by setting hostname as something like "mysql.php"
to see what happens.

To get more control this can be also done by adding a facter with service
type and configuring puppet master to read service type from that facter.
@Manula do you have any opinion on this ?

Touched, not typed. Erroneous words are a feature, not a typo.

Re: The role of puppet agent in the spawned instance

Posted by Manula Waidyanatha <ma...@wow.com>.
Hi Chamila,

I think you are asking about "node /php/ " part as defined in php.pp 
file. In that node definition /php/ is a regex. It will match all the 
hostnames/certnames that has phppart.
On 08/14/2014 08:32 PM, Chamila De Alwis wrote:
>
> On Thu, Aug 14, 2014 at 6:41 PM, Dinesh Bandara <dineshb@wso2.com 
> <ma...@wso2.com>> wrote:
>
>     This will use to request the node catalog from puppet maste
>
>
> An example hostname of a spawned instance would be 
> *872389473.deployment1.php.someorg.org 
> <http://872389473.deployment1.php.someorg.org>* where "php" is the 
> node name. How does puppet master extract the node name from this? I'm 
> not clear on the details of the node name extraction from the hostname 
> itself.
>
>
> Regards,
> Chamila de Alwis
> Software Engineer | WSO2 | +94772207163
> Blog: code.chamiladealwis.com <http://code.chamiladealwis.com>
>
>

-- 
Regards,
Manula Waidyanatha
http://blog.manula.org


Re: The role of puppet agent in the spawned instance

Posted by chris snow <ch...@gmail.com>.
This is useful stuff, shall I add it to the wiki?
On 14 Aug 2014 16:03, "Chamila De Alwis" <ch...@wso2.com> wrote:

>
> On Thu, Aug 14, 2014 at 6:41 PM, Dinesh Bandara <di...@wso2.com> wrote:
>
>> This will use to request the node catalog from puppet maste
>
>
> An example hostname of a spawned instance would be *872389473.deployment1.php.someorg.org
> <http://872389473.deployment1.php.someorg.org>* where "php" is the node
> name. How does puppet master extract the node name from this? I'm not clear
> on the details of the node name extraction from the hostname itself.
>
>
> Regards,
> Chamila de Alwis
> Software Engineer | WSO2 | +94772207163
> Blog: code.chamiladealwis.com
>
>
>

Re: The role of puppet agent in the spawned instance

Posted by Chamila De Alwis <ch...@wso2.com>.
Furthermore the puppetlabs documentation mentions that an agent's node name
is "almost always read from its cert name setting"[1]. The cert name is set
to fully qualified domain name of the agent at the install time.

We define nodes as "php", "mysql" etc. Where does the conversion from the
domain name "*872389473.deployment1.php.someorg.org
<http://872389473.deployment1.php.someorg.org>" *to node name "php" occur?
If it is on the puppet master is stratos dependant on the way puppet
operates?


[1] - https://docs.puppetlabs.com/learning/agent_master_basic.html


Regards,
Chamila de Alwis
Software Engineer | WSO2 | +94772207163
Blog: code.chamiladealwis.com




On Thu, Aug 14, 2014 at 8:32 PM, Chamila De Alwis <ch...@wso2.com> wrote:

>
> On Thu, Aug 14, 2014 at 6:41 PM, Dinesh Bandara <di...@wso2.com> wrote:
>
>> This will use to request the node catalog from puppet maste
>
>
> An example hostname of a spawned instance would be *872389473.deployment1.php.someorg.org
> <http://872389473.deployment1.php.someorg.org>* where "php" is the node
> name. How does puppet master extract the node name from this? I'm not clear
> on the details of the node name extraction from the hostname itself.
>
>
> Regards,
> Chamila de Alwis
> Software Engineer | WSO2 | +94772207163
> Blog: code.chamiladealwis.com
>
>
>

Re: The role of puppet agent in the spawned instance

Posted by Chamila De Alwis <ch...@wso2.com>.
On Thu, Aug 14, 2014 at 6:41 PM, Dinesh Bandara <di...@wso2.com> wrote:

> This will use to request the node catalog from puppet maste


An example hostname of a spawned instance would be
*872389473.deployment1.php.someorg.org
<http://872389473.deployment1.php.someorg.org>* where "php" is the node
name. How does puppet master extract the node name from this? I'm not clear
on the details of the node name extraction from the hostname itself.


Regards,
Chamila de Alwis
Software Engineer | WSO2 | +94772207163
Blog: code.chamiladealwis.com

Re: The role of puppet agent in the spawned instance

Posted by Dinesh Bandara <di...@wso2.com>.
On Thu, Aug 14, 2014 at 6:12 PM, Chamila De Alwis <ch...@wso2.com> wrote:

> Hi Dinesh,
>
> Thanks for the reply.
>
> As far as I understand puppet master will identify the node based on the
> cert name of the puppet agent. In the case of a generic base image, does
> puppet agent pass any additional parameters when communicating with the
> puppet master to request the node catalogue?
>
Yes. when subscribing to cartridge service name is passed as a payload
parameter (values passed in payload can be found at spawned instance's
/tmp/payload directory) , then it will update instance's hostname according
to that [1]. This will use to request the node catalog from puppet master

[1]
https://github.com/apache/stratos/blob/master/tools/puppet3-agent/init.sh#L119

>
>
> Regards,
> Chamila de Alwis
> Software Engineer | WSO2 | +94772207163
> Blog: code.chamiladealwis.com
>
>
>
>
> On Thu, Aug 14, 2014 at 5:11 PM, Dinesh Bandara <di...@wso2.com> wrote:
>
>> Hi Chamila,
>>
>> Please find my comment inline.
>>
>> On Thu, Aug 14, 2014 at 4:40 PM, Chamila De Alwis <ch...@wso2.com>
>> wrote:
>>
>>> Hi,
>>>
>>> When creating a cartridge we set up the base image by specifying the
>>> stratos service name and installing the packages needed for that service
>>> using puppet. For example if we specify "php" as the service name PHP
>>> packages and its dependencies will be installed.
>>>
>> If we used "default" as service name it will install cartridge agent,
>> java and basic dependencies. So base cartridge is not bound to any service
>> type. it is a generic one.
>>
>>
>>> When a new instance is created from a PHP cartridge init.sh is run at
>>> the start. This also triggers the puppet agent.
>>>
>> Yes.
>>
>>
>>> What is the purpose of triggering puppet agent at instance start up? Is
>>> it only to find any manifest updates?
>>>
>> If use a generic cartridge image as "imageId" when deploying, puppet
>> agent will install required packages and dependencies. If use a service
>> bound cartridge image (PHP, MySQL, etc.), it will not update any packages
>> or dependencies but update the manifest updates as you mentioned such as
>> ips and ports of message broker and cep
>>
>>
>>> Regards,
>>> Chamila de Alwis
>>> Software Engineer | WSO2 | +94772207163
>>> Blog: code.chamiladealwis.com
>>>
>>>
>>>
>> --
>> *Dinesh Bandara*
>> Software Engineer
>> WSO2 Inc.; http://wso2.com
>> lean.enterprise.middleware
>>
>>
>


-- 
*Dinesh Bandara*
Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

Re: The role of puppet agent in the spawned instance

Posted by Chamila De Alwis <ch...@wso2.com>.
Hi Dinesh,

Thanks for the reply.

As far as I understand puppet master will identify the node based on the
cert name of the puppet agent. In the case of a generic base image, does
puppet agent pass any additional parameters when communicating with the
puppet master to request the node catalogue?


Regards,
Chamila de Alwis
Software Engineer | WSO2 | +94772207163
Blog: code.chamiladealwis.com




On Thu, Aug 14, 2014 at 5:11 PM, Dinesh Bandara <di...@wso2.com> wrote:

> Hi Chamila,
>
> Please find my comment inline.
>
> On Thu, Aug 14, 2014 at 4:40 PM, Chamila De Alwis <ch...@wso2.com>
> wrote:
>
>> Hi,
>>
>> When creating a cartridge we set up the base image by specifying the
>> stratos service name and installing the packages needed for that service
>> using puppet. For example if we specify "php" as the service name PHP
>> packages and its dependencies will be installed.
>>
> If we used "default" as service name it will install cartridge agent, java
> and basic dependencies. So base cartridge is not bound to any service type.
> it is a generic one.
>
>
>> When a new instance is created from a PHP cartridge init.sh is run at the
>> start. This also triggers the puppet agent.
>>
> Yes.
>
>
>> What is the purpose of triggering puppet agent at instance start up? Is
>> it only to find any manifest updates?
>>
> If use a generic cartridge image as "imageId" when deploying, puppet agent
> will install required packages and dependencies. If use a service bound
> cartridge image (PHP, MySQL, etc.), it will not update any packages or
> dependencies but update the manifest updates as you mentioned such as ips
> and ports of message broker and cep
>
>
>> Regards,
>> Chamila de Alwis
>> Software Engineer | WSO2 | +94772207163
>> Blog: code.chamiladealwis.com
>>
>>
>>
> --
> *Dinesh Bandara*
> Software Engineer
> WSO2 Inc.; http://wso2.com
> lean.enterprise.middleware
>
>

Re: The role of puppet agent in the spawned instance

Posted by Dinesh Bandara <di...@wso2.com>.
Hi Chamila,

Please find my comment inline.

On Thu, Aug 14, 2014 at 4:40 PM, Chamila De Alwis <ch...@wso2.com> wrote:

> Hi,
>
> When creating a cartridge we set up the base image by specifying the
> stratos service name and installing the packages needed for that service
> using puppet. For example if we specify "php" as the service name PHP
> packages and its dependencies will be installed.
>
If we used "default" as service name it will install cartridge agent, java
and basic dependencies. So base cartridge is not bound to any service type.
it is a generic one.


> When a new instance is created from a PHP cartridge init.sh is run at the
> start. This also triggers the puppet agent.
>
Yes.


> What is the purpose of triggering puppet agent at instance start up? Is it
> only to find any manifest updates?
>
If use a generic cartridge image as "imageId" when deploying, puppet agent
will install required packages and dependencies. If use a service bound
cartridge image (PHP, MySQL, etc.), it will not update any packages or
dependencies but update the manifest updates as you mentioned such as ips
and ports of message broker and cep


> Regards,
> Chamila de Alwis
> Software Engineer | WSO2 | +94772207163
> Blog: code.chamiladealwis.com
>
>
>
-- 
*Dinesh Bandara*
Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware