tacitknowledge / aem-cookbook

Chef cookbook for Adobe AEM
79 stars 64 forks source link

Dynamic creation of replication agents does not work on AWS opsworks #41

Closed cru-Luis-Rodriguez closed 7 years ago

cru-Luis-Rodriguez commented 9 years ago

Hi, Wondering if there is a way to get the replication agent configuration to be set up dynamically when using this recipe on AWS Opsworks?

Has anyone tried?

I have been able to build the different instances author/publish/dispatcher on my AWS Opswork stack using this recipe, but for some reason the dynamic discovery does not work.

From what I gather, Opswork offers limited support for chef search, but it should still be able to provide the search with the instance role/layer.

Any thougths?

http://docs.aws.amazon.com/opsworks/latest/userguide/workingcookbook-chef11-10.html#workingcookbook-chef11-10-search

As an example the following search works on Opsworks: author = search(:node, "role:author").first Chef::Log.info("author private IP is '#{author['private_ip']}'") Chef::Log.info("author hostname is '#{author['hostname']}'") log ("Found author host: '#{author['private_dns_name']}'")

Thanks,

-Luis

ptqa commented 8 years ago

@cru-Luis-Rodriguez This cookbook heavy relies on remote node attributes (like remote_node[:aem][:author][:user]) that are not available in opsworks. Check out my fork of this repo (https://github.com/ptqa/aem-cookbook), I'll probably do some PR's to make it work with opsworks. For now discovering nodes can be implemented this way:

publishers = node['opsworks']['layers'][publish_layer]['instances'].map do |_, i|
  {
    ipaddress: i['private_ip'],
    port: node[:aem][:publish][:port],
    user: node[:aem][:publish][:admin_user],
    password: node[:aem][:publish][:admin_password],
    name: i['private_ip']
  }
end
default[:aem][:author][:replication_hosts] = publishers
bignastybryce commented 8 years ago

I think that it will probably become useful to support other discovery methods, as well - like etcd and Consul. That would require nodes to register themselves as they converge.

Not that I still work on this cookbook, or anything. ;P

-Bryce.

On Fri, Oct 30, 2015 at 5:46 AM, ptQa notifications@github.com wrote:

@cru-Luis-Rodriguez https://github.com/cru-Luis-Rodriguez This cookbook heavy relies on remote node attributes (like node[:aem][:author][:user]) that are not available in opsworks. Check out my fork of this repo (https://github.com/ptqa/aem-cookbook), I'll probably do some PR's to make it works with opsworks. For now discovering nodes can be implemented this way:

publishers = node['opsworks']['layers']['YOUR_PUBLISHER_LAYERNAME']['instances'].map do |, i| { ipaddress: i['private_ip'], port: '4503', user: 'admin', password: 'admin', name: i['private_ip'] } end default[:aem][:author][:replication_hosts] = publishers

— Reply to this email directly or view it on GitHub https://github.com/tacitknowledge/aem-cookbook/issues/41#issuecomment-152514034 .