tacitknowledge / aem-cookbook

Chef cookbook for Adobe AEM
79 stars 64 forks source link

AEM 6.3 Java 8 #69

Closed gregorskii closed 6 years ago

gregorskii commented 6 years ago

Hi there,

Has anyone tried using AEM 6.3, Centos 7.3, and Java 8 with this package?

I'm using test Kitchen to test out the build before using Packer to build it on AWS. In both cases, I get an extreme memory leak that crashes either the AWS instance or my local machine when using test kitchen.

I would like to ignore the Packer side of it for this inquiry and focus on the test Kitchen side as it's more standard.

I am using Berks with my cookbook which relies on version 2.2.0:

depends 'aem', '~> 2.2.0'

My kitchen.yml defines a Vagrant box using chef-solo as its provisioner I wanted to use solo because that's what Packer uses:

---
driver:
  name: vagrant
  customize:
    memory: 1024

provisioner:
  name: chef_solo
  require_chef_omnibus: 12

platforms:
  - name: centos-7.3

suites:
  - name: default
    driver:
      name: vagrant
      customize:
        memory: 12228
      network:
        - [ 'forwarded_port', { guest: 4502, host: 4502 } ]
    run_list:
      - recipe[aem_author::default]

My attributes are:

#
## Base AEM
#

default['aem']['aem_options'] = {
  'JAVA_HOME' => '/usr/java/default',
  'RUNAS_USER' => 'crx',
  'CQ_HEAP_MIN' => '8192',
  'CQ_HEAP_MAX' => '10240',
  'CQ_PERMGEN' => '3072'
}

default['aem']['download_url'] = 'S3_BUCKET/aem/aem-quickstart-6.3.0.jar'
default['aem']['version'] = '6.3.0'

default['aem']['author']['uid'] = 1001
default['aem']['author']['gid'] = 1001

#
## Base Java
#

default['java']['jdk_version'] = '8'
default['java']['install_flavor'] = 'oracle'
default['java']['jdk']['7']['x86_64']['url'] = 'S3_BUCKET/java/jdk-8u144-linux-x64.tar.gz'
default['java']['jdk']['7']['x86_64']['checksum'] = 'e8a341ce566f32c3d06f6d0f0eeea9a0f434f538d22af949ae58bc86f2eeaae4'
default['java']['oracle']['accept_oracle_download_terms'] = true

And my recipe:

aem_user = node['aem']['aem_options']['RUNAS_USER']

#
## User
#

group aem_user do
  gid node['aem']['author']['gid']
end

user aem_user do
  comment 'AEM author user'
  system true
  uid node['aem']['author']['uid']
  gid node['aem']['author']['gid']
  shell '/bin/bash'
  home "/home/#{aem_user}"
  manage_home true
end

#
## Opts
#

jar_opts = []
jar_opts << 'author'
jar_opts << node['d-aem']['default_jar_opts']

node.default['aem']['jar_opts'] = ["-r #{jar_opts.flatten.compact.uniq.join(',')}"]

include_recipe 'aem::author'

The Chef output is all correct, it hangs at the last step when trying to query the AEM URL:

 ▲ chef/cookbooks/aem_author kitchen list                                                                                                                                                                            
Instance           Driver   Provisioner  Verifier  Transport  Last Action    Last Error
default-centos-73  Vagrant  ChefSolo     Busser    Ssh        <Not Created>  <None>

 ▲ chef/cookbooks/aem_author kitchen create default-centos-73
-----> Starting Kitchen (v1.16.0)
-----> Creating <default-centos-73>...
       Bringing machine 'default' up with 'virtualbox' provider...
       ==> default: Importing base box 'bento/centos-7.3'...
==> default: Matching MAC address for NAT networking...
       ==> default: Checking if box 'bento/centos-7.3' is up to date...
       ==> default: Setting the name of the VM: default-centos-73_default_1504805662222_24833
       ==> default: Clearing any previously set network interfaces...
       ==> default: Preparing network interfaces based on configuration...
           default: Adapter 1: nat
       ==> default: Forwarding ports...
           default: 4502 (guest) => 4502 (host) (adapter 1)
           default: 22 (guest) => 2222 (host) (adapter 1)
       ==> default: Running 'pre-boot' VM customizations...
       ==> default: Booting VM...
       ==> default: Waiting for machine to boot. This may take a few minutes...
           default: SSH address: 127.0.0.1:2222
           default: SSH username: vagrant
           default: SSH auth method: private key
           default:
           default: Vagrant insecure key detected. Vagrant will automatically replace
           default: this with a newly generated keypair for better security.
           default:
           default: Inserting generated public key within guest...
           default: Removing insecure key from the guest if it's present...
           default: Key inserted! Disconnecting and reconnecting using new SSH key...
       ==> default: Machine booted and ready!
       ==> default: Checking for guest additions in VM...
       ==> default: Setting hostname...
       ==> default: Mounting shared folders...
           default: /tmp/omnibus/cache =><HOME>/.kitchen/cache
       ==> default: Machine not provisioned because `--no-provision` is specified.
       [SSH] Established
       Vagrant instance <default-centos-73> created.
       Finished creating <default-centos-73> (0m45.32s).
-----> Kitchen is finished. (0m45.76s)

 ▲ chef/cookbooks/aem_author kitchen converge default-centos-73

... all good here

 * bash[wait for URL: http://localhost:4502/libs/cq/core/content/login.html] action run[2017-09-07T17:39:43+00:00] INFO: Processing bash[wait for URL: http://localhost:4502/libs/cq/core/content/login.html] action run (/tmp/kitchen/cache/cookbooks/aem/providers/url_watcher.rb line 39)

           [execute]  is running.
              Waiting for URL...
               is running.
              Waiting for URL...
               is running.
              Waiting for URL...
               is running.
              Waiting for URL...
               is running.
              Waiting for URL...
               is running.
              Waiting for URL...
               is running.
              Waiting for URL...
               is running.
              Waiting for URL...

Memory usage goes up from here and consumes the machine.

Logging in:

 ▲ chef/cookbooks/aem_author kitchen login default-centos-73
Last login: Thu Sep  7 17:35:07 2017 from 10.0.2.2
[vagrant@default-centos-73 ~]$ curl localhost:4502
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 404 </title>
</head>
<body>
<h2>HTTP ERROR: 404</h2>
<p>Problem accessing /. Reason:
<pre>    Not Found</pre></p>
<hr /><i><small>Powered by Jetty://</small></i>
</body>
</html>
gregorskii commented 6 years ago

Looks like this might just be AEM taking a ton of memory to boot up. I'll follow up if I find anything, but the cookbook is getting AEM to the point where it starts running.

gregorskii commented 6 years ago

Ya still getting it. Seems like AEM tries to start but never does. After 15 mins or so.

Looking further it looks like it never starts the AEM quickstart. The login URL is not resolvable, I increased the delay and retry count to connect to the login URL to ensure the AEM startup had enough time to run then I see this in the error.log of AEM:

 △ chef/cookbooks/aem_author kitchen converge default-centos-73                                                                                                                                   
-----> Starting Kitchen (v1.16.0)
-----> Creating <default-centos-73>...

             Waiting for URL...

...

In another tab:

[vagrant@default-centos-73 logs]$ tail -f error.log
/libs/cq/core/content/login.html HTTP/1.1] org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Resource /libs/cq/core/content/login.html not found
gregorskii commented 6 years ago

This is working... seemed to be a looooooonnnnggg wait for it to come on.

gregorskii commented 6 years ago

I did have to update the validation urls:

default['aem']['author']['validation_urls'] = [
  'http://localhost:4502/libs/granite/core/content/login.html',
  'http://localhost:4502/damadmin',
  'http://localhost:4502/miscadmin',
  'http://localhost:4502/system/console/bundles'
]