├── .gitignore ├── .kitchen.cloud.yml ├── .kitchen.yml ├── .rubocop.yml ├── Berksfile ├── CHANGELOG.md ├── Gemfile ├── README.md ├── Rakefile ├── TESTING.md ├── Thorfile ├── VERSION ├── Vagrantfile ├── attributes └── default.rb ├── chefignore ├── libraries └── aem_helpers.rb ├── metadata.rb ├── providers ├── dispatcher.rb ├── farm.rb ├── group.rb ├── init.rb ├── jar_installer.rb ├── jcr_node.rb ├── ldap.rb ├── package.rb ├── port_watcher.rb ├── replicator.rb ├── url_watcher.rb ├── user.rb └── website.rb ├── recipes ├── _base_aem_setup.rb ├── author.rb ├── dispatcher.rb └── publish.rb ├── resources ├── dispatcher.rb ├── farm.rb ├── group.rb ├── init.rb ├── jar_installer.rb ├── jcr_node.rb ├── ldap.rb ├── package.rb ├── port_watcher.rb ├── replicator.rb ├── url_watcher.rb ├── user.rb └── website.rb ├── templates └── default │ ├── aem_dispatcher.conf.erb │ ├── aem_pkg_version.erb │ ├── dispatcher.any.erb │ ├── farm.any.erb │ ├── init.erb │ ├── iptables.erb │ ├── ldap_login.conf.erb │ ├── license.properties.erb │ ├── mods │ └── dispatcher.conf.erb │ └── web.xml.erb └── test └── integration ├── author-5.5.0-oraclejdk6 └── serverspec │ └── cq_author_daemon_spec.rb ├── author-5.6.0-oraclejdk6 └── serverspec │ └── cq_author_daemon_spec.rb ├── author-5.6.1-oraclejdk7 └── serverspec │ └── cq_author_daemon_spec.rb ├── author-6.0.0-oraclejdk7 └── serverspec │ └── cq_author_daemon_spec.rb ├── author-publish-5.5.0-oraclejdk6 └── serverspec │ ├── cq_author_daemon_spec.rb │ └── cq_publish_daemon_spec.rb ├── author-publish-5.6.0-oraclejdk6 └── serverspec │ ├── cq_author_daemon_spec.rb │ └── cq_publish_daemon_spec.rb ├── author-publish-5.6.1-oraclejdk7 └── serverspec │ ├── cq_author_daemon_spec.rb │ └── cq_publish_daemon_spec.rb ├── author-publish-6.0.0-oraclejdk7 └── serverspec │ ├── cq_author_daemon_spec.rb │ └── cq_publish_daemon_spec.rb ├── publish-5.5.0-oraclejdk6 └── serverspec │ └── cq_publish_daemon_spec.rb ├── publish-5.6.0-oraclejdk6 └── serverspec │ └── cq_publish_daemon_spec.rb ├── publish-5.6.1-oraclejdk7 └── serverspec │ └── cq_publish_daemon_spec.rb └── publish-6.0.0-oraclejdk7 └── serverspec └── cq_publish_daemon_spec.rb /.gitignore: -------------------------------------------------------------------------------- 1 | .vagrant 2 | Berksfile.lock 3 | *~ 4 | *# 5 | .#* 6 | \#*# 7 | .*.sw[a-z] 8 | *.un~ 9 | /cookbooks 10 | 11 | # Bundler 12 | Gemfile.lock 13 | bin/* 14 | .bundle/* 15 | .kitchen/ 16 | 17 | .DS_Store 18 | -------------------------------------------------------------------------------- /.kitchen.cloud.yml: -------------------------------------------------------------------------------- 1 | --- 2 | driver_config: 3 | google_client_email: <%= ENV['GOOGLE_CLIENT_EMAIL'] %> 4 | google_key_location: <%= ENV['GOOGLE_KEY_LOCATION'] %> 5 | google_project: <%= ENV['GOOGLE_PROJECT'] %> 6 | 7 | provisioner: 8 | name: chef_zero 9 | 10 | platforms: 11 | - name: centos-6.5 12 | driver_plugin: gce 13 | driver_config: 14 | # GCE 15 | image_name: 'centos-6-v20140415' 16 | area: <%= ENV['GCE_AREA'] %> 17 | public_key_path: <%= ENV['GCE_PUBLIC_KEY_PATH'] %> 18 | 19 | suites: 20 | - name: author-6.0.0-oraclejdk7 21 | driver_config: 22 | machine_type: 'n1-standard-1' 23 | run_list: 24 | - recipe[aem::author] 25 | attributes: 26 | aem: 27 | version: '6.0.0' 28 | download_url: <%= ENV['AEM_DOWNLOAD_URL_600'] %> 29 | license_url: <%= ENV['AEM_LICENSE_URL_600'] %> 30 | author: 31 | startup: 32 | max_attempts: 40 33 | wait_between_attempts: 30 34 | java: 35 | install_flavor: 'oracle' 36 | jdk_version: '7' 37 | oracle: 38 | accept_oracle_download_terms: true 39 | - name: publish-6.0.0-oraclejdk7 40 | driver_config: 41 | machine_type: 'n1-standard-1' 42 | run_list: 43 | - recipe[aem::publish] 44 | attributes: 45 | aem: 46 | version: '6.0.0' 47 | download_url: <%= ENV['AEM_DOWNLOAD_URL_600'] %> 48 | license_url: <%= ENV['AEM_LICENSE_URL_600'] %> 49 | publish: 50 | startup: 51 | max_attempts: 40 52 | wait_between_attempts: 30 53 | java: 54 | install_flavor: 'oracle' 55 | jdk_version: '7' 56 | oracle: 57 | accept_oracle_download_terms: true 58 | - name: author-publish-6.0.0-oraclejdk7 59 | driver_config: 60 | machine_type: 'n1-standard-2' 61 | run_list: 62 | - recipe[aem::author] 63 | - recipe[aem::publish] 64 | attributes: 65 | aem: 66 | version: '6.0.0' 67 | download_url: <%= ENV['AEM_DOWNLOAD_URL_600'] %> 68 | license_url: <%= ENV['AEM_LICENSE_URL_600'] %> 69 | author: 70 | startup: 71 | max_attempts: 40 72 | wait_between_attempts: 30 73 | publish: 74 | startup: 75 | max_attempts: 40 76 | wait_between_attempts: 30 77 | java: 78 | install_flavor: 'oracle' 79 | jdk_version: '7' 80 | oracle: 81 | accept_oracle_download_terms: true 82 | 83 | 84 | - name: author-5.6.1-oraclejdk7 85 | driver_config: 86 | machine_type: 'n1-standard-1' 87 | run_list: 88 | - recipe[aem::author] 89 | attributes: 90 | aem: 91 | version: '5.6.1' 92 | download_url: <%= ENV['AEM_DOWNLOAD_URL_561'] %> 93 | license_url: <%= ENV['AEM_LICENSE_URL_561'] %> 94 | author: 95 | startup: 96 | max_attempts: 40 97 | wait_between_attempts: 30 98 | java: 99 | install_flavor: 'oracle' 100 | jdk_version: '7' 101 | oracle: 102 | accept_oracle_download_terms: true 103 | - name: publish-5.6.1-oraclejdk7 104 | driver_config: 105 | machine_type: 'n1-standard-1' 106 | run_list: 107 | - recipe[aem::publish] 108 | attributes: 109 | aem: 110 | version: '5.6.1' 111 | download_url: <%= ENV['AEM_DOWNLOAD_URL_561'] %> 112 | license_url: <%= ENV['AEM_LICENSE_URL_561'] %> 113 | publish: 114 | startup: 115 | max_attempts: 40 116 | wait_between_attempts: 30 117 | java: 118 | install_flavor: 'oracle' 119 | jdk_version: '7' 120 | oracle: 121 | accept_oracle_download_terms: true 122 | - name: author-publish-5.6.1-oraclejdk7 123 | driver_config: 124 | machine_type: 'n1-standard-2' 125 | run_list: 126 | - recipe[aem::author] 127 | - recipe[aem::publish] 128 | attributes: 129 | aem: 130 | version: '5.6.1' 131 | download_url: <%= ENV['AEM_DOWNLOAD_URL_561'] %> 132 | license_url: <%= ENV['AEM_LICENSE_URL_561'] %> 133 | author: 134 | startup: 135 | max_attempts: 40 136 | wait_between_attempts: 30 137 | publish: 138 | startup: 139 | max_attempts: 40 140 | wait_between_attempts: 30 141 | java: 142 | install_flavor: 'oracle' 143 | jdk_version: '7' 144 | oracle: 145 | accept_oracle_download_terms: true 146 | 147 | 148 | - name: author-5.6.0-oraclejdk6 149 | driver_config: 150 | machine_type: 'n1-standard-1' 151 | run_list: 152 | - recipe[aem::author] 153 | attributes: 154 | aem: 155 | version: '5.6.0' 156 | download_url: <%= ENV['AEM_DOWNLOAD_URL_560'] %> 157 | license_url: <%= ENV['AEM_LICENSE_URL_560'] %> 158 | author: 159 | startup: 160 | max_attempts: 40 161 | wait_between_attempts: 30 162 | java: 163 | install_flavor: 'oracle' 164 | jdk_version: '6' 165 | oracle: 166 | accept_oracle_download_terms: true 167 | - name: publish-5.6.0-oraclejdk6 168 | driver_config: 169 | machine_type: 'n1-standard-1' 170 | run_list: 171 | - recipe[aem::publish] 172 | attributes: 173 | aem: 174 | version: '5.6.0' 175 | download_url: <%= ENV['AEM_DOWNLOAD_URL_560'] %> 176 | license_url: <%= ENV['AEM_LICENSE_URL_560'] %> 177 | publish: 178 | startup: 179 | max_attempts: 40 180 | wait_between_attempts: 30 181 | java: 182 | install_flavor: 'oracle' 183 | jdk_version: '6' 184 | oracle: 185 | accept_oracle_download_terms: true 186 | - name: author-publish-5.6.0-oraclejdk6 187 | driver_config: 188 | machine_type: 'n1-standard-2' 189 | run_list: 190 | - recipe[aem::author] 191 | - recipe[aem::publish] 192 | attributes: 193 | aem: 194 | version: '5.6.0' 195 | download_url: <%= ENV['AEM_DOWNLOAD_URL_560'] %> 196 | license_url: <%= ENV['AEM_LICENSE_URL_560'] %> 197 | author: 198 | startup: 199 | max_attempts: 40 200 | wait_between_attempts: 30 201 | publish: 202 | startup: 203 | max_attempts: 40 204 | wait_between_attempts: 30 205 | java: 206 | install_flavor: 'oracle' 207 | jdk_version: '6' 208 | oracle: 209 | accept_oracle_download_terms: true 210 | 211 | 212 | - name: author-5.5.0-oraclejdk6 213 | driver_config: 214 | machine_type: 'n1-standard-1' 215 | run_list: 216 | - recipe[aem::author] 217 | attributes: 218 | aem: 219 | version: '5.5.0' 220 | download_url: <%= ENV['AEM_DOWNLOAD_URL_550'] %> 221 | license_url: <%= ENV['AEM_LICENSE_URL_550'] %> 222 | author: 223 | startup: 224 | max_attempts: 40 225 | wait_between_attempts: 30 226 | java: 227 | install_flavor: 'oracle' 228 | jdk_version: '6' 229 | oracle: 230 | accept_oracle_download_terms: true 231 | - name: publish-5.5.0-oraclejdk6 232 | driver_config: 233 | machine_type: 'n1-standard-1' 234 | run_list: 235 | - recipe[aem::publish] 236 | attributes: 237 | aem: 238 | version: '5.5.0' 239 | download_url: <%= ENV['AEM_DOWNLOAD_URL_550'] %> 240 | license_url: <%= ENV['AEM_LICENSE_URL_550'] %> 241 | publish: 242 | startup: 243 | max_attempts: 40 244 | wait_between_attempts: 30 245 | java: 246 | install_flavor: 'oracle' 247 | jdk_version: '6' 248 | oracle: 249 | accept_oracle_download_terms: true 250 | - name: author-publish-5.5.0-oraclejdk6 251 | driver_config: 252 | machine_type: 'n1-standard-2' 253 | run_list: 254 | - recipe[aem::author] 255 | - recipe[aem::publish] 256 | attributes: 257 | aem: 258 | version: '5.5.0' 259 | download_url: <%= ENV['AEM_DOWNLOAD_URL_550'] %> 260 | license_url: <%= ENV['AEM_LICENSE_URL_550'] %> 261 | author: 262 | startup: 263 | max_attempts: 40 264 | wait_between_attempts: 30 265 | publish: 266 | startup: 267 | max_attempts: 40 268 | wait_between_attempts: 30 269 | java: 270 | install_flavor: 'oracle' 271 | jdk_version: '6' 272 | oracle: 273 | accept_oracle_download_terms: true 274 | 275 | 276 | - name: dispatcher 277 | driver_config: 278 | machine_type: 'f1-micro' 279 | run_list: 280 | - recipe[aem::dispatcher] 281 | attributes: 282 | aem: 283 | dispatcher: 284 | mod_dispatcher_url: <%= ENV['AEM_DISPATCHER_URL'] %> 285 | version: '4.1.0' 286 | -------------------------------------------------------------------------------- /.kitchen.yml: -------------------------------------------------------------------------------- 1 | --- 2 | driver: 3 | name: vagrant 4 | customize: 5 | memory: '2048' 6 | 7 | provisioner: 8 | name: chef_zero 9 | 10 | platforms: 11 | - name: centos-6.5 12 | 13 | suites: 14 | - name: author-6.1.0-oraclejdk8 15 | driver: 16 | customize: 17 | memory: '2560' 18 | run_list: 19 | - recipe[aem::author] 20 | attributes: 21 | aem: 22 | version: '6.1.0' 23 | download_url: <%= ENV['AEM_DOWNLOAD_URL_610'] %> 24 | license_url: <%= ENV['AEM_LICENSE_URL_610'] %> 25 | aem_options: 26 | CQ_HEAP_MAX: '1024' 27 | java: 28 | install_flavor: 'oracle' 29 | jdk_version: '8' 30 | oracle: 31 | accept_oracle_download_terms: true 32 | - name: publish-6.1.0-oraclejdk8 33 | driver: 34 | customize: 35 | memory: '2560' 36 | run_list: 37 | - recipe[aem::publish] 38 | attributes: 39 | aem: 40 | version: '6.1.0' 41 | download_url: <%= ENV['AEM_DOWNLOAD_URL_610'] %> 42 | license_url: <%= ENV['AEM_LICENSE_URL_610'] %> 43 | aem_options: 44 | CQ_HEAP_MAX: '1024' 45 | java: 46 | install_flavor: 'oracle' 47 | jdk_version: '8' 48 | oracle: 49 | accept_oracle_download_terms: true 50 | - name: author-publish-6.1.0-oraclejdk8 51 | driver: 52 | customize: 53 | memory: '5120' 54 | run_list: 55 | - recipe[aem::author] 56 | - recipe[aem::publish] 57 | attributes: 58 | aem: 59 | version: '6.1.0' 60 | download_url: <%= ENV['AEM_DOWNLOAD_URL_610'] %> 61 | license_url: <%= ENV['AEM_LICENSE_URL_610'] %> 62 | aem_options: 63 | CQ_HEAP_MAX: '1024' 64 | author: 65 | startup: 66 | max_attempts: 40 67 | wait_between_attempts: 30 68 | publish: 69 | startup: 70 | max_attempts: 40 71 | wait_between_attempts: 30 72 | java: 73 | install_flavor: 'oracle' 74 | jdk_version: '8' 75 | oracle: 76 | accept_oracle_download_terms: true 77 | - name: author-6.0.0-oraclejdk7 78 | driver: 79 | customize: 80 | memory: '2560' 81 | run_list: 82 | - recipe[aem::author] 83 | attributes: 84 | aem: 85 | version: '6.0.0' 86 | download_url: <%= ENV['AEM_DOWNLOAD_URL_600'] %> 87 | license_url: <%= ENV['AEM_LICENSE_URL_600'] %> 88 | java: 89 | install_flavor: 'oracle' 90 | jdk_version: '7' 91 | oracle: 92 | accept_oracle_download_terms: true 93 | - name: publish-6.0.0-oraclejdk7 94 | driver: 95 | customize: 96 | memory: '2560' 97 | run_list: 98 | - recipe[aem::publish] 99 | attributes: 100 | aem: 101 | version: '6.0.0' 102 | download_url: <%= ENV['AEM_DOWNLOAD_URL_600'] %> 103 | license_url: <%= ENV['AEM_LICENSE_URL_600'] %> 104 | java: 105 | install_flavor: 'oracle' 106 | jdk_version: '7' 107 | oracle: 108 | accept_oracle_download_terms: true 109 | - name: author-publish-6.0.0-oraclejdk7 110 | driver: 111 | customize: 112 | memory: '5120' 113 | run_list: 114 | - recipe[aem::author] 115 | - recipe[aem::publish] 116 | attributes: 117 | aem: 118 | version: '6.0.0' 119 | download_url: <%= ENV['AEM_DOWNLOAD_URL_600'] %> 120 | license_url: <%= ENV['AEM_LICENSE_URL_600'] %> 121 | author: 122 | startup: 123 | max_attempts: 40 124 | wait_between_attempts: 30 125 | publish: 126 | startup: 127 | max_attempts: 40 128 | wait_between_attempts: 30 129 | java: 130 | install_flavor: 'oracle' 131 | jdk_version: '7' 132 | oracle: 133 | accept_oracle_download_terms: true 134 | 135 | 136 | - name: author-5.6.1-oraclejdk7 137 | driver: 138 | customize: 139 | memory: '2048' 140 | run_list: 141 | - recipe[aem::author] 142 | attributes: 143 | aem: 144 | version: '5.6.1' 145 | download_url: <%= ENV['AEM_DOWNLOAD_URL_561'] %> 146 | license_url: <%= ENV['AEM_LICENSE_URL_561'] %> 147 | java: 148 | install_flavor: 'oracle' 149 | jdk_version: '7' 150 | oracle: 151 | accept_oracle_download_terms: true 152 | - name: publish-5.6.1-oraclejdk7 153 | driver: 154 | customize: 155 | memory: '2048' 156 | run_list: 157 | - recipe[aem::publish] 158 | attributes: 159 | aem: 160 | version: '5.6.1' 161 | download_url: <%= ENV['AEM_DOWNLOAD_URL_561'] %> 162 | license_url: <%= ENV['AEM_LICENSE_URL_561'] %> 163 | java: 164 | install_flavor: 'oracle' 165 | jdk_version: '7' 166 | oracle: 167 | accept_oracle_download_terms: true 168 | - name: author-publish-5.6.1-oraclejdk7 169 | driver: 170 | customize: 171 | memory: '4096' 172 | run_list: 173 | - recipe[aem::author] 174 | - recipe[aem::publish] 175 | attributes: 176 | aem: 177 | version: '5.6.1' 178 | download_url: <%= ENV['AEM_DOWNLOAD_URL_561'] %> 179 | license_url: <%= ENV['AEM_LICENSE_URL_561'] %> 180 | java: 181 | install_flavor: 'oracle' 182 | jdk_version: '7' 183 | oracle: 184 | accept_oracle_download_terms: true 185 | 186 | 187 | - name: author-5.6.0-oraclejdk6 188 | driver: 189 | customize: 190 | memory: '2048' 191 | run_list: 192 | - recipe[aem::author] 193 | attributes: 194 | aem: 195 | version: '5.6.0' 196 | download_url: <%= ENV['AEM_DOWNLOAD_URL_560'] %> 197 | license_url: <%= ENV['AEM_LICENSE_URL_560'] %> 198 | java: 199 | install_flavor: 'oracle' 200 | jdk_version: '6' 201 | oracle: 202 | accept_oracle_download_terms: true 203 | - name: publish-5.6.0-oraclejdk6 204 | driver: 205 | customize: 206 | memory: '2048' 207 | run_list: 208 | - recipe[aem::publish] 209 | attributes: 210 | aem: 211 | version: '5.6.0' 212 | download_url: <%= ENV['AEM_DOWNLOAD_URL_560'] %> 213 | license_url: <%= ENV['AEM_LICENSE_URL_560'] %> 214 | java: 215 | install_flavor: 'oracle' 216 | jdk_version: '6' 217 | oracle: 218 | accept_oracle_download_terms: true 219 | - name: author-publish-5.6.0-oraclejdk6 220 | driver: 221 | customize: 222 | memory: '4096' 223 | run_list: 224 | - recipe[aem::author] 225 | - recipe[aem::publish] 226 | attributes: 227 | aem: 228 | version: '5.6.0' 229 | download_url: <%= ENV['AEM_DOWNLOAD_URL_560'] %> 230 | license_url: <%= ENV['AEM_LICENSE_URL_560'] %> 231 | java: 232 | install_flavor: 'oracle' 233 | jdk_version: '6' 234 | oracle: 235 | accept_oracle_download_terms: true 236 | 237 | 238 | - name: author-5.5.0-oraclejdk6 239 | driver: 240 | customize: 241 | memory: '2048' 242 | run_list: 243 | - recipe[aem::author] 244 | attributes: 245 | aem: 246 | version: '5.5.0' 247 | download_url: <%= ENV['AEM_DOWNLOAD_URL_550'] %> 248 | license_url: <%= ENV['AEM_LICENSE_URL_550'] %> 249 | java: 250 | install_flavor: 'oracle' 251 | jdk_version: '6' 252 | oracle: 253 | accept_oracle_download_terms: true 254 | - name: publish-5.5.0-oraclejdk6 255 | driver: 256 | customize: 257 | memory: '2048' 258 | run_list: 259 | - recipe[aem::publish] 260 | attributes: 261 | aem: 262 | version: '5.5.0' 263 | download_url: <%= ENV['AEM_DOWNLOAD_URL_550'] %> 264 | license_url: <%= ENV['AEM_LICENSE_URL_550'] %> 265 | java: 266 | install_flavor: 'oracle' 267 | jdk_version: '6' 268 | oracle: 269 | accept_oracle_download_terms: true 270 | - name: author-publish-5.5.0-oraclejdk6 271 | driver: 272 | customize: 273 | memory: '4096' 274 | run_list: 275 | - recipe[aem::author] 276 | - recipe[aem::publish] 277 | attributes: 278 | aem: 279 | version: '5.5.0' 280 | download_url: <%= ENV['AEM_DOWNLOAD_URL_550'] %> 281 | license_url: <%= ENV['AEM_LICENSE_URL_550'] %> 282 | java: 283 | install_flavor: 'oracle' 284 | jdk_version: '6' 285 | oracle: 286 | accept_oracle_download_terms: true 287 | 288 | 289 | - name: dispatcher 290 | run_list: 291 | - recipe[aem::dispatcher] 292 | attributes: 293 | aem: 294 | dispatcher: 295 | mod_dispatcher_url: <%= ENV['AEM_DISPATCHER_URL'] %> 296 | version: '4.1.0' 297 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | AllCops: 2 | Exclude: 3 | - vendor/**/* 4 | 5 | AlignParameters: 6 | Enabled: false 7 | ClassLength: 8 | Enabled: false 9 | CyclomaticComplexity: 10 | Enabled: false 11 | Documentation: 12 | Enabled: false 13 | Encoding: 14 | Enabled: false 15 | Style/FileName: 16 | Enabled: false 17 | LineLength: 18 | Enabled: false 19 | MethodLength: 20 | Enabled: false 21 | Metrics/AbcSize: 22 | Enabled: false 23 | PerceivedComplexity: 24 | Enabled: false 25 | SingleSpaceBeforeFirstArg: 26 | Enabled: false 27 | Style/ClassAndModuleChildren: 28 | Enabled: false 29 | Style/FileName: 30 | Enabled: false 31 | -------------------------------------------------------------------------------- /Berksfile: -------------------------------------------------------------------------------- 1 | source 'https://supermarket.chef.io' 2 | 3 | metadata 4 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | #2.4.0 2 | * Enhancement 3 | * Added command for AEM 6.4 for listing replication agents 4 | 5 | #2.3.1 6 | * Enhancement/Fix 7 | * Added ability to override the curb gem version as the latest no longer works, if fixed in the future we can override this to nil in the wrapper cookbook 8 | 9 | #2.3.0 10 | * Enhancements 11 | * Added ability to override farm_any template 12 | 13 | #2.2.0 14 | * Enhancements 15 | * Add new group provider. 16 | * For AEM 6.1+, use group provider within user provider to add user to a group (if provided). 17 | 18 | #2.1.0 19 | * Refactor 20 | * Rubocop and other minor improvements 21 | 22 | #2.0.0 23 | * Refactor 24 | * Refactor node[:aem][:commands] and providers to allow commands for various AEM versions to be driven by attributes. 25 | 26 | #1.1.17 27 | * Enhancements 28 | * Allow cluster search to be more flexible. Defaults to existing role search, but allows for search via recipes/roles within a nodes run_list. 29 | 30 | #1.1.16 31 | * Fixes 32 | * Revert back to old mechanism of updating admin password, since the existing way does not converge on the first Chef run. 33 | 34 | #1.1.15 35 | * Fixes 36 | * Fix agent removal curl command. 37 | 38 | #1.1.14 39 | * Fixes 40 | * Fix the curl command for setting user password in AEM 5.6 41 | 42 | # 1.1.13 43 | * Enhancements 44 | * Add support for changing user passwords in AEM 5.6 45 | 46 | #1.1.12 47 | * Fixes 48 | * Modified apache_libexecdir dispatcher resource to support both new and old attribute name 49 | 50 | # 1.1.11 51 | * Enhancements 52 | * Add support for changing user passwords in AEM 6.1 53 | * Add AEM 6.1 test kitchen configuration 54 | 55 | # 1.1.10 56 | * Enhancements 57 | * Run and store admin password if new_admin_password is set and does not match the current admin password 58 | 59 | # 1.1.9 60 | * Enhancements 61 | * Fixed issue with curb gem failing to be included during compile time 62 | 63 | # 1.1.8 64 | * Enhancements 65 | * Mark license.properties file as sensitive 66 | * Fixes 67 | * Fix deprecation warning for chef_gem 68 | 69 | # 1.1.7 70 | * Enhancements 71 | * Add support for Ignore URL Params for farm.any configuration template 72 | 73 | # 1.1.6 74 | * Enhancements 75 | * parameterized jar unpack path 76 | 77 | # 1.1.5 78 | * Enhancements 79 | * Adding support for Header derictive in Apache 80 | 81 | # 1.1.4 82 | * Fixes 83 | * fix for aem_jcr_node provider - check for 201 on node creation, check for content of binary instead of path 84 | 85 | # 1.1.3 86 | * Fixes 87 | * add support to change password in AEM6 88 | 89 | # 1.1.2 90 | * Fixes 91 | * replicator provider now creates cache flush agents 92 | * default dispatcher vhost now handles mime-types 93 | 94 | # 1.1.1 95 | 96 | * Fixes 97 | * Updated changelog. 98 | 99 | # 1.1.0 100 | 101 | * Enhancements 102 | * [#13](https://github.com/tacitknowledge/aem-cookbook/pull/13) Added aem_jcr_node provider. 103 | 104 | # 1.0.3 105 | 106 | * Enhancements 107 | * [#9](https://github.com/tacitknowledge/aem-cookbook/pull/9) Updated build dependencies. 108 | 109 | # 1.0.2 110 | 111 | * Fixes 112 | * [#7](https://github.com/tacitknowledge/aem-cookbook/pull/7) Update jar_installer provider to significantly reduce memory utilization. 113 | 114 | # 1.0.1 115 | 116 | * Enhancements 117 | * [#4](https://github.com/tacitknowledge/aem-cookbook/pull/4) Added support for AEM 6.0.0. 118 | 119 | # 1.0.0 120 | 121 | * Initial release to Github. 122 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem 'berkshelf', '= 3.3.0' 4 | gem 'chefspec', '= 4.3.0' 5 | gem 'foodcritic', '= 5.0.0' 6 | gem 'kitchen-gce', '= 0.1.2' 7 | gem 'kitchen-vagrant', '= 0.19.0' 8 | gem 'rake', '= 10.3.2' 9 | gem 'rubocop', '= 0.34.2' 10 | gem 'stove', '= 3.2.3' 11 | gem 'thor-scmversion', '= 1.7.0' 12 | gem 'test-kitchen', '= 1.4.2' 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # aem-cookbook 2 | 3 | This cookbook installs and configures [Adobe Experience Manager (AEM)](http://www.adobe.com/solutions/web-experience-management.html). (NOTE: CQ versions 5.4 and 5.5 should work as well -- CQ was renamed to AEM as of version 5.6). Included are recipes to install an author or publish instance as well as the dispatcher module for Apache HTTP server. 4 | 5 | ## Supported Platforms 6 | 7 | * CentOS 8 | 9 | ## Supported Versions 10 | 11 | * AEM 6.0.0 12 | * AEM 5.6.1 13 | * AEM 5.6.0 14 | * CQ 5.5.0 15 | 16 | ## Featured Functionality 17 | 18 | * Unattended installation of aem author, publish, and dispatcher nodes. 19 | * Automatically search for and configure aem cluster members (dispatcher, author, publish) using chef searches. 20 | * Configure replication agents using the replicator provider. 21 | * Configure dispatcher farms with the farm provider. 22 | * Deploy and remove aem packages with the package provider (recommended for development purposes only). 23 | 24 | ## Attributes 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 |
KeyTypeDescriptionDefault
['aem']['version']StringAEM versionnil
['aem']['download_url']StringURL to AEM jar filenil
['aem']['license_url']StringURL to AEM license filenil
['aem']['dispatcher']['mod_dispatcher_url']StringURL to AEM dispatcher (.tar.gz or .so)nil
['aem']['dispatcher']['version']Stringdispatcher module versionnil
64 | 65 | ## Usage 66 | 67 | ### aem::author 68 | 69 | Include `aem::author` in your node's `run_list`: 70 | 71 | ```json 72 | { 73 | "run_list": [ 74 | "recipe[aem::author]" 75 | ] 76 | } 77 | ``` 78 | 79 | ### aem::publish 80 | 81 | Include `aem::publish` in your node's `run_list`: 82 | 83 | ```json 84 | { 85 | "run_list": [ 86 | "recipe[aem::publish]" 87 | ] 88 | } 89 | ``` 90 | 91 | ### aem::dispatcher 92 | 93 | Include `aem::dispatcher` in your node's `run_list`: 94 | 95 | ```json 96 | { 97 | "run_list": [ 98 | "recipe[aem::dispatcher]" 99 | ] 100 | } 101 | ``` 102 | 103 | ## Contributing 104 | 105 | 1. Fork the repository on Github 106 | 2. Create a named feature branch (i.e. `add-new-recipe`) 107 | 3. Write your change 108 | 4. Write tests for your change (if applicable) 109 | 5. Run the tests, ensuring they all pass 110 | 6. Submit a Pull Request 111 | 112 | ## License and Authors 113 | 114 | - Author:: Bryce Lynn () 115 | - Author:: Alex Dunn () 116 | - Author:: Paul Dunnavant () 117 | 118 | ```text 119 | Copyright 2012-2016, Tacit Knowledge, Inc. 120 | 121 | Licensed under the Apache License, Version 2.0 (the "License"); 122 | you may not use this file except in compliance with the License. 123 | You may obtain a copy of the License at 124 | 125 | http://www.apache.org/licenses/LICENSE-2.0 126 | 127 | Unless required by applicable law or agreed to in writing, software 128 | distributed under the License is distributed on an "AS IS" BASIS, 129 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 130 | See the License for the specific language governing permissions and 131 | limitations under the License. 132 | ``` 133 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require 'rspec/core/rake_task' 2 | require 'rubocop/rake_task' 3 | require 'foodcritic' 4 | require 'kitchen' 5 | 6 | # Style tests. RuboCop and Foodcritic 7 | namespace :style do 8 | desc 'Run Ruby style checks' 9 | RuboCop::RakeTask.new(:ruby) 10 | 11 | desc 'Run Chef style checks' 12 | FoodCritic::Rake::LintTask.new(:chef) do |t| 13 | t.options = { 14 | fail_tags: ['any'], 15 | tags: ['~FC005'] 16 | } 17 | end 18 | end 19 | 20 | desc 'Run all style checks' 21 | task style: ['style:chef', 'style:ruby'] 22 | 23 | # Integration tests. Kitchen.ci 24 | namespace :integration do 25 | desc 'Run Test Kitchen with Vagrant' 26 | task :vagrant do 27 | Kitchen.logger = Kitchen.default_file_logger 28 | Kitchen::Config.new.instances.each do |instance| 29 | instance.test(:always) 30 | end 31 | end 32 | end 33 | 34 | # Default 35 | task default: ['style', 'integration:vagrant'] 36 | -------------------------------------------------------------------------------- /TESTING.md: -------------------------------------------------------------------------------- 1 | Cookbook TESTING doc 2 | ==================== 3 | 4 | Bundler 5 | ------- 6 | A ruby environment with Bundler installed is a prerequisite for using 7 | the testing harness shipped with this cookbook. At the time of this 8 | writing, it works with Ruby 1.9.3 and Bundler 1.6.2. All programs 9 | involved, with the exception of Vagrant, can be installed by cd'ing 10 | into the parent directory of this cookbook and running "bundle install" 11 | 12 | Rakefile 13 | -------- 14 | The Rakefile ships with a number of tasks, each of which can be ran 15 | individually, or in groups. Typing "rake" by itself will perform style 16 | checks with Rubocop and Foodcritic, ChefSpec with rspec, and 17 | integration with Test Kitchen using the Vagrant driver by 18 | default.Alternatively, integration tests can be ran with Test Kitchen 19 | cloud drivers. 20 | 21 | ``` 22 | $ rake -T 23 | rake integration:vagrant # Run Test Kitchen with Vagrant 24 | rake style # Run all style checks 25 | rake style:chef # Lint Chef cookbooks 26 | rake style:ruby # Run Ruby style checks 27 | ``` 28 | 29 | Style Testing 30 | ------------- 31 | Ruby style tests can be performed by Rubocop by issuing either 32 | ``` 33 | bundle exec rubocop 34 | ``` 35 | or 36 | ``` 37 | rake style:ruby 38 | ``` 39 | 40 | Chef style tests can be performed with Foodcritic by issuing either 41 | ``` 42 | bundle exec foodcritic 43 | ``` 44 | or 45 | ``` 46 | rake style:chef 47 | ``` 48 | 49 | Integration Testing 50 | ------------------- 51 | Integration testing is performed by Test Kitchen. After a 52 | successful converge, tests are uploaded and ran out of band of 53 | Chef. Tests should be designed to ensure that a recipe has 54 | accomplished its goal. 55 | 56 | Integration Testing using Vagrant 57 | --------------------------------- 58 | Integration tests can be performed on a local workstation using 59 | Virtualbox or VMWare. Detailed instructions for setting this up can be 60 | found at the [Bento](https://github.com/opscode/bento) project web site. 61 | 62 | Integration tests using Vagrant can be performed with either 63 | ``` 64 | bundle exec kitchen test 65 | ``` 66 | or 67 | ``` 68 | rake integration:vagrant 69 | ``` 70 | -------------------------------------------------------------------------------- /Thorfile: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | 3 | require 'bundler' 4 | require 'bundler/setup' 5 | require 'berkshelf/thor' 6 | require 'foodcritic' 7 | require 'thor/rake_compat' 8 | require 'thor/scmversion' 9 | 10 | begin 11 | require 'kitchen/thor_tasks' 12 | Kitchen::ThorTasks.new 13 | rescue LoadError 14 | puts '>>>>> Kitchen gem not loaded, omitting tasks' unless ENV['CI'] 15 | end 16 | 17 | class Default < Thor 18 | include Thor::RakeCompat 19 | 20 | desc 'foodcritic', 'Lint Chef cookbooks' 21 | def foodcritic 22 | FoodCritic::Rake::LintTask.new 23 | say 'Running foodcritic...', :white 24 | Rake::Task['foodcritic'].execute 25 | end 26 | 27 | desc 'rubocop', 'Run Rubocop on all Ruby files' 28 | def rubocop 29 | say 'Performing linting and style checking with rubocop...', :white 30 | success = system 'rubocop' 31 | exit(10) unless success 32 | end 33 | 34 | desc 'kitchen', 'Run test-kitchen' 35 | def kitchen 36 | # TODO 37 | end 38 | 39 | desc 'publish', 'Publish cookbook to supermarket.getchef.com' 40 | method_options username: :string, required: true, desc: 'Chef Supermarket username' 41 | method_options client_pem: :string, required: true, desc: 'Path to client.pem associated with Chef Supermarket' 42 | def publish 43 | require 'stove/cli' 44 | 45 | # Make sure that the VERSION file exists and is accurate. 46 | ThorSCMVersion::Tasks.new.current 47 | 48 | unless options[:username] 49 | say '--username is required', :red 50 | exit 10 51 | end 52 | unless options[:client_pem] 53 | say '--client_pem is required', :red 54 | exit 20 55 | end 56 | 57 | stove_opts = [ 58 | '--no-git', 59 | '--username', 60 | options[:username], 61 | '--key', 62 | options[:client_pem] 63 | ] 64 | Stove::Cli.new(stove_opts).execute! 65 | end 66 | 67 | desc 'ci', '' 68 | def ci 69 | # Make sure that the VERSION file exists and is accurate. 70 | ThorSCMVersion::Tasks.new.current 71 | 72 | # invoke :foodcritic 73 | # invoke :rubocop 74 | # invoke :kitchen 75 | 76 | ThorSCMVersion::Tasks.new.bump('patch') 77 | end 78 | 79 | desc 'minor', 'bump minor version number' 80 | def minor 81 | # Make sure that the VERSION file exists and is accurate. 82 | ThorSCMVersion::Tasks.new.current 83 | 84 | # invoke :foodcritic 85 | # invoke :rubocop 86 | # invoke :kitchen 87 | 88 | ThorSCMVersion::Tasks.new.bump('minor') 89 | end 90 | end 91 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 2.4.0 2 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | Vagrant.configure('2') do |config| 5 | # All Vagrant configuration is done here. The most common configuration 6 | # options are documented and commented below. For a complete reference, 7 | # please see the online documentation at vagrantup.com. 8 | 9 | config.vm.hostname = 'aem-berkshelf' 10 | 11 | # Every Vagrant virtual environment requires a box to build off of. 12 | config.vm.box = 'opscode-centos-6.5' 13 | 14 | # The url from where the 'config.vm.box' box will be fetched if it 15 | # doesn't already exist on the user's system. 16 | config.vm.box_url = 'http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-6.5_chef-provisionerless.box' 17 | 18 | # Assign this VM to a host-only network IP, allowing you to access it 19 | # via the IP. Host-only networks can talk to the host machine as well as 20 | # any other machines on the same network, but cannot be accessed (through this 21 | # network interface) by any external networks. 22 | config.vm.network :private_network, ip: '33.33.33.10' 23 | 24 | # Create a public network, which generally matched to bridged network. 25 | # Bridged networks make the machine appear as another physical device on 26 | # your network. 27 | 28 | # config.vm.network :public_network 29 | 30 | # Create a forwarded port mapping which allows access to a specific port 31 | # within the machine from a port on the host machine. In the example below, 32 | # accessing "localhost:8080" will access port 80 on the guest machine. 33 | 34 | # Share an additional folder to the guest VM. The first argument is 35 | # the path on the host to the actual folder. The second argument is 36 | # the path on the guest to mount the folder. And the optional third 37 | # argument is a set of non-required options. 38 | # config.vm.synced_folder "../data", "/vagrant_data" 39 | 40 | # Provider-specific configuration so you can fine-tune various 41 | # backing providers for Vagrant. These expose provider-specific options. 42 | # Example for VirtualBox: 43 | # 44 | # config.vm.provider :virtualbox do |vb| 45 | # # Don't boot with headless mode 46 | # vb.gui = true 47 | # 48 | # # Use VBoxManage to customize the VM. For example to change memory: 49 | # vb.customize ["modifyvm", :id, "--memory", "1024"] 50 | # end 51 | # 52 | # View the documentation for the provider you're using for more 53 | # information on available options. 54 | 55 | # The path to the Berksfile to use with Vagrant Berkshelf 56 | # config.berkshelf.berksfile_path = "./Berksfile" 57 | 58 | # Enabling the Berkshelf plugin. To enable this globally, add this configuration 59 | # option to your ~/.vagrant.d/Vagrantfile file 60 | config.berkshelf.enabled = true 61 | 62 | # An array of symbols representing groups of cookbook described in the Vagrantfile 63 | # to exclusively install and copy to Vagrant's shelf. 64 | # config.berkshelf.only = [] 65 | 66 | # An array of symbols representing groups of cookbook described in the Vagrantfile 67 | # to skip installing and copying to Vagrant's shelf. 68 | # config.berkshelf.except = [] 69 | 70 | # Enabling the Omnibus plugin. 71 | config.omnibus.chef_version = :latest 72 | 73 | config.vm.provision :chef_solo do |chef| 74 | chef.json = { 75 | mysql: { 76 | server_root_password: 'rootpass', 77 | server_debian_password: 'debpass', 78 | server_repl_password: 'replpass' 79 | } 80 | } 81 | 82 | chef.run_list = [ 83 | 'recipe[aem::author]' 84 | ] 85 | end 86 | end 87 | -------------------------------------------------------------------------------- /attributes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: aem 3 | # Attributes:: default 4 | # 5 | # Copyright 2012, Tacit Knowledge, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | 20 | include_attribute 'apache2' 21 | 22 | default[:aem][:version] = nil 23 | default[:aem][:jvm_opts] = {} 24 | default[:aem][:jar_opts] = [] 25 | default[:aem][:enable_webdav] = false 26 | default[:aem][:jar_name] = nil 27 | default[:aem][:use_yum] = false 28 | default[:aem][:download_url] = nil 29 | default[:aem][:license_url] = nil 30 | default[:aem][:license_customer_name] = nil 31 | default[:aem][:license_download_id] = nil 32 | default[:aem][:license_product_name] = 'Adobe CQ5' 33 | default[:aem][:base_dir] = '/opt/aem' 34 | default[:aem][:cluster_name] = nil 35 | default[:aem][:geometrixx_priv_users] = [ 36 | 'author', 'jdoe@geometrixx.info', 'aparker@geometrixx.info' 37 | ] 38 | default[:aem][:aem_options] = { 39 | 'JAVA_HOME' => '/usr/java/default', 40 | 'RUNAS_USER' => 'crx', 41 | 'CQ_HEAP_MIN' => '128', 42 | 'CQ_HEAP_MAX' => '384', 43 | 'CQ_PERMGEN' => '128' 44 | } 45 | 46 | # These work in such a way that the providers will find the closest matching command using the provided 47 | # node[:aem][:version]. The command matching the given version without going over will be used. 48 | # For example, if node[:aem][:version] is 5.5, then node[:aem][:commands][:replicators][:publish][:add]['5.4'] 49 | # would be used, since the same command from 5.4 still works. This allows these command to be completely 50 | # attribute-driven (assuming that there's no other logic needed). 51 | default[:aem][:commands] = { 52 | replicators: { 53 | publish: { 54 | add: { 55 | '5.4' => 'curl -u <%=local_user%>:<%=local_password%> -X POST http://localhost:<%=local_port%>/etc/replication/agents.<%=server%>/<%=aem_instance%><%=instance%>/_jcr_content -d jcr:title="<%=type%> Agent <%=instance%>" -d transportUri=http://<%=h[:ipaddress]%>:<%=h[:port]%>/bin/receive?sling:authRequestLogin=1 -d enabled=true -d transportUser=<%=h[:user]%> -d transportPassword=<%=h[:password]%> -d cq:template="/libs/cq/replication/templates/agent" -d retryDelay=60000 -d logLevel=info -d serializationType=durbo -d jcr:description="<%=type%> Agent <%=instance%>" -d sling:resourceType="cq/replication/components/agent"', 56 | '5.6' => 'curl -u <%=local_user%>:<%=local_password%> -X POST http://localhost:<%=local_port%>/etc/replication/agents.<%=server%>/<%=aem_instance%><%=instance%> -F "jcr:primaryType=cq:Page" -F "jcr:content/jcr:primaryType=nt:unstructured" -F "jcr:content/jcr:title=<%=type%> Agent <%=instance%>" -F "jcr:content/transportUri=http://<%=h[:ipaddress]%>:<%=h[:port]%>/bin/receive?sling:authRequestLogin=1" -F "jcr:content/enabled=true" -F "jcr:content/transportUser=<%=h[:user]%>" -F "jcr:content/transportPassword=<%=h[:password]%>" -F "jcr:content/cq:template=/libs/cq/replication/templates/agent" -F "jcr:content/retryDelay=60000" -F "jcr:content/logLevel=info" -F "jcr:content/serializationType=durbo" -F "jcr:content/jcr:description=<%=type%> Agent <%=instance%>" <%=agent_id_param%> -F "jcr:content/sling:resourceType=cq/replication/components/agent"' 57 | } 58 | }, 59 | flush: { 60 | add: { 61 | '5.4' => 'curl -u <%=local_user%>:<%=local_password%> -X POST http://localhost:<%=local_port%>/etc/replication/agents.<%=server%>/flush<%=instance%>/_jcr_content -d transportUri=http://<%=h[:ipaddress]%>/dispatcher/invalidate.cache -d enabled=true -d transportUser=<%=h[:user]%> -d transportPassword=<%=h[:password]%> -d jcr:title=flush<%=instance%> -d jcr:description=flush<%=instance%> -d serializationType=flush -d cq:template=/libs/cq/replication/templates/agent -d sling:resourceType="cq/replication/components/agent" -d retryDelay=60000 -d logLevel=info -d triggerSpecific=true -d triggerReceive=true', 62 | '5.6' => 'curl -u <%=local_user%>:<%=local_password%> -X POST http://localhost:<%=local_port%>/etc/replication/agents.<%=server%>/flush<%=instance%>/_jcr_content -d transportUri=http://<%=h[:ipaddress]%>/dispatcher/invalidate.cache -d enabled=true -d transportUser=<%=h[:user]%> -d transportPassword=<%=h[:password]%> -d jcr:title=flush<%=instance%> -d jcr:description=flush<%=instance%>' 63 | } 64 | }, 65 | flush_agent: { 66 | add: { 67 | '5.4' => 'curl -F "jcr:primaryType=cq:Page" -F "jcr:content=" -u <%=local_user%>:<%=local_password%> http://localhost:<%=local_port%>/etc/replication/agents.<%=server%>/<%=agent%><%=instance%>' 68 | } 69 | }, 70 | agent: { 71 | add: { 72 | '5.4' => 'curl -F "jcr:primaryType=cq:Page" -F "jcr:content=" -u <%=local_user%>:<%=local_password%> http://localhost:<%=local_port%>/etc/replication/agents.<%=server%>/<%=agent%><%=instance%>' 73 | }, 74 | remove: { 75 | '5.4' => 'curl -u <%=local_user%>:<%=local_password%> -X DELETE http://localhost:<%=local_port%>/etc/replication/agents.<%=server%>/<%=h%>' 76 | }, 77 | list: { 78 | '5.4' => 'curl -u <%=local_user%>:<%=local_password%> http://localhost:<%=local_port%>/etc/replication.infinity.json', 79 | '6.4' => 'curl -u <%=local_user%>:<%=local_password%> http://localhost:<%=local_port%>/etc/replication/agents.<%=agent%>.infinity.json' 80 | } 81 | } 82 | }, 83 | password: { 84 | '5.4' => 'curl -f --data rep:password=<%= password %> --user <%= admin_user %>:<%= admin_password %> http://localhost:<%= port %><%= path %>/<%= user %>', 85 | '5.5' => 'curl -f --user <%= admin_user %>:<%= admin_password %> -F rep:password="<%= password %>" http://localhost:<%= port %><%= path %>/<%= user %>.rw.html', 86 | '5.6' => 'curl -u <%= admin_user %>:<%= admin_password %> -F rep:password="<%= password %>" -F :currentPassword="<%= admin_password %>" http://localhost:<%= port %><%= path %>/<%= user %>.rw.html', 87 | '6.0' => 'curl -u <%= admin_user %>:<%= admin_password %> -Fplain=<%= password %> -Fverify=<%= password %> -Fold=<%= admin_password %> -FPath=<%= path %>/<%= admin_user %> http://localhost:<%= port %>/crx/explorer/ui/setpassword.jsp', 88 | '6.1' => 'curl -u <%= admin_user %>:<%= admin_password %> -Fplain=<%= password %> -Fverify=<%= password %> -Fold=<%= admin_password %> -FPath=<%= path %> http://localhost:<%= port %>/crx/explorer/ui/setpassword.jsp' 89 | }, 90 | remove_user: { 91 | '5.5' => 'curl -u <%= admin_user %>:<%= admin_password %> -FdeleteAuthorizable= http://localhost:<%= port %><%= path %>/<%= user %>', 92 | '6.1' => 'curl -u <%= admin_user %>:<%= admin_password %> -FdeleteAuthorizable=<%= user %> http://localhost:<%= port %><%= path %>' 93 | }, 94 | add_user: { 95 | '5.5' => 'curl -u <%= admin_user %>:<%= admin_password %> -FcreateUser= -FauthorizableId=<%= user %> -Frep:password=<%= password %> -Fmembership=<%= group %> http://localhost:<%= port %>/libs/granite/security/post/authorizables', 96 | '6.1' => 'curl -u <%= admin_user %>:<%= admin_password %> -FcreateUser=1 -FauthorizableId=<%= user %> -Frep:password=<%= password %> http://localhost:<%= port %>/libs/granite/security/post/authorizables.html' 97 | }, 98 | add_user_to_group: { 99 | # Note that prior to 6.1 (possibly 6.0), the add_user command could add both the user AND add the user to a group. 100 | # That's no longer the case. 101 | '6.1' => 'curl -u <%= admin_user %>:<%= admin_password %> -FaddMembers=<%= user %> http://localhost:<%= port %><%= path %>.rw.userprops.html' 102 | }, 103 | remove_user_from_group: { 104 | '6.1' => 'curl -u <%= admin_user %>:<%= admin_password %> -FremoveMembers=<%= user %> http://localhost:<%= port %><%= path %>.rw.userprops.html' 105 | }, 106 | add_group: { 107 | '6.1' => 'curl -u <%= admin_user %>:<%= admin_password %> -FauthorizableId=<%= group %> -FcreateGroup=1 http://localhost:<%= port %>/libs/granite/security/post/authorizables.html' 108 | }, 109 | remove_group: { 110 | '6.1' => 'curl -u <%= admin_user %>:<%= admin_password %> -FdeleteAuthorizable=1 http://localhost:<%= port %><%= path %>.rw.html' 111 | } 112 | } 113 | 114 | # used in the aem_jar_installer to allow for a more fine grain check to determine if an unpack is necessary or not 115 | default[:aem][:unpack_jar_dir] = 'crx-quickstart' 116 | 117 | default[:aem][:author] = { 118 | default_context: '/opt/aem/author', 119 | port: '4502', 120 | runnable_jar: 'aem-author-p4502.jar', 121 | base_dir: '/opt/aem/author/crx-quickstart', 122 | jvm_opts: {}, 123 | ldap: { 124 | enabled: false, 125 | options: {} 126 | }, 127 | validation_urls: [ 128 | 'http://localhost:4502/libs/cq/core/content/login.html', 129 | 'http://localhost:4502/damadmin', 130 | 'http://localhost:4502/miscadmin', 131 | 'http://localhost:4502/system/console/bundles' 132 | ], 133 | deploy_pkgs: [ 134 | # { :name => "your package name here", 135 | # :version => "your version here", 136 | # :url => "url to download this package", 137 | # :update => true or false - mostly useful for version "LATEST", 138 | # :group_id => "the AEM group id for the package", 139 | # :recursive => true or false - install embedded packages?, 140 | # :properties_file => "path to file that contains the package version - 141 | # if necessary 142 | # :version_pattern => "regexp to find version" - version should be in first 143 | # captured group. This is a string; it will get converted to a regexp. 144 | # :action => [ :upload, :install, :activate ] 145 | # } 146 | ], 147 | # You changed these, right? 148 | admin_user: 'admin', 149 | admin_password: 'admin', 150 | new_admin_password: nil, 151 | replication_hosts: [ 152 | # { :ipaddress => "the IP or hostname where you want to replicate", 153 | # :port => "the port of the publish server there", 154 | # :user => "the admin user on the remote", 155 | # :password => "the admin password on the remote" 156 | # } 157 | ], 158 | find_replication_hosts_dynamically: false 159 | } 160 | default[:aem][:author][:startup][:max_attempts] = 20 161 | default[:aem][:author][:startup][:wait_between_attempts] = 30 162 | 163 | default[:aem][:publish] = { 164 | default_context: '/opt/aem/publish', 165 | port: '4503', 166 | runnable_jar: 'aem-publish-p4503.jar', 167 | base_dir: '/opt/aem/publish/crx-quickstart', 168 | jvm_opts: {}, 169 | ldap: { 170 | enabled: false, 171 | options: {} 172 | }, 173 | validation_urls: [ 174 | 'http://localhost:4503/libs/cq/core/content/login.html', 175 | 'http://localhost:4503/damadmin', 176 | 'http://localhost:4503/miscadmin', 177 | 'http://localhost:4503/system/console/bundles' 178 | ], 179 | deploy_pkgs: [ 180 | # See the format in author, above 181 | ], 182 | admin_user: 'admin', 183 | admin_password: 'admin', 184 | new_admin_password: nil, 185 | cache_hosts: [ 186 | # { :ipaddress => "the IP or hostname of the caching dispatcher", 187 | # :port => "the port of the http server there", 188 | # :user => "the admin user on the remote", 189 | # :password => "the admin password on the remote" 190 | # } 191 | ], 192 | find_cache_hosts_dynamically: false 193 | } 194 | default[:aem][:publish][:startup][:max_attempts] = 20 195 | default[:aem][:publish][:startup][:wait_between_attempts] = 30 196 | 197 | # array of "n.n.n.n/n" subnets to allow connections from. nil = all. 198 | default[:aem][:dispatcher][:allow_connections] = nil 199 | default[:aem][:dispatcher][:dynamic_cluster] = false 200 | default[:aem][:dispatcher][:version] = nil 201 | default[:aem][:dispatcher][:dispatcher_file_cookbook] = nil 202 | default[:aem][:dispatcher][:webserver_type] = 'apache2.2' 203 | default[:aem][:dispatcher][:conf_file] = 'conf/dispatcher.any' 204 | default[:aem][:dispatcher][:log_file] = 'logs/dispatcher.log' 205 | default[:aem][:dispatcher][:log_level] = '1' 206 | default[:aem][:dispatcher][:farm_dir] = 'aem-farms' 207 | default[:aem][:dispatcher][:farm_files] = ['farm_*.any'] 208 | default[:aem][:dispatcher][:no_server_header] = '0' 209 | default[:aem][:dispatcher][:decline_root] = '0' 210 | default[:aem][:dispatcher][:use_processed_url] = '0' 211 | default[:aem][:dispatcher][:pass_error] = '0' 212 | default[:aem][:dispatcher][:farm_name] = nil 213 | default[:aem][:dispatcher][:cache_root] = '/opt/communique/dispatcher/cache' 214 | default[:aem][:dispatcher][:client_headers] = ['*'] 215 | default[:aem][:dispatcher][:virtual_hosts] = ['*'] 216 | default[:aem][:dispatcher][:renders] = [{ name: 'publish_rend', hostname: '127.0.0.1', 217 | port: '4503', timeout: '0' }] 218 | default[:aem][:dispatcher][:filter_rules] = { 219 | '0001' => '/type "deny" /glob "*"', 220 | '0002' => '/type "deny" /glob "GET *.*[0-9].json*"', 221 | '0041' => '/type "allow" /glob "* *.css *"', 222 | '0042' => '/type "allow" /glob "* *.gif *"', 223 | '0043' => '/type "allow" /glob "* *.ico *"', 224 | '0044' => '/type "allow" /glob "* *.js *"', 225 | '0045' => '/type "allow" /glob "* *.png *"', 226 | '0046' => '/type "allow" /glob "* *.swf *"', 227 | '0047' => '/type "allow" /glob "* *.jpg *"', 228 | '0061' => '/type "allow" /glob "POST /content/[.]*.form.html"', 229 | '0062' => '/type "allow" /glob "* /libs/cq/personalization/*"', 230 | '0081' => '/type "deny" /glob "GET *.infinity.json*"', 231 | '0082' => '/type "deny" /glob "GET *.tidy.json*"', 232 | '0083' => '/type "deny" /glob "GET *.sysview.xml*"', 233 | '0084' => '/type "deny" /glob "GET *.docview.json*"', 234 | '0085' => '/type "deny" /glob "GET *.docview.xml*"', 235 | '0087' => '/type "deny" /glob "GET *.feed.xml*"', 236 | '0090' => '/type "deny" /glob "* *.query.json*"' 237 | } 238 | default[:aem][:dispatcher][:cache_rules] = { 239 | '0000' => { glob: '*', type: 'allow' } 240 | } 241 | default[:aem][:dispatcher][:cache_opts] = [] 242 | default[:aem][:dispatcher][:invalidation_rules] = { 243 | '0000' => { glob: '*', type: 'deny' }, 244 | '0001' => { glob: '*.html', type: 'allow' } 245 | } 246 | default[:aem][:dispatcher][:allowed_clients] = {} 247 | default[:aem][:dispatcher][:ignore_url_params] = {} 248 | default[:aem][:dispatcher][:statistics] = [ 249 | { name: 'html', glob: '*.html' }, 250 | { name: 'others', glob: '*' } 251 | ] 252 | default[:aem][:dispatcher][:site_name] = '00Dispatcher' 253 | default[:aem][:dispatcher][:server_name] = node[:fqdn] 254 | default[:aem][:dispatcher][:server_aliases] = [] 255 | default[:aem][:dispatcher][:aem_locations] = ['/'] 256 | default[:aem][:dispatcher][:enabled] = true 257 | default[:aem][:dispatcher][:rewrites] = [] 258 | default[:aem][:dispatcher][:listen_port] = '80' 259 | default[:aem][:dispatcher][:ssl_enabled] = false 260 | default[:aem][:dispatcher][:ssl_cert_file] = '/etc/httpd/ssl/server.crt' 261 | default[:aem][:dispatcher][:ssl_key_file] = '/etc/httpd/ssl/server.key' 262 | default[:aem][:dispatcher][:expire_dirs] = [] 263 | default[:aem][:dispatcher][:enable_etag] = false 264 | default[:aem][:dispatcher][:enable_ie_header] = true 265 | default[:aem][:dispatcher][:session_mgmt] = { 266 | 'directory' => "#{node[:apache][:dir]}/dispatcher/sessions", 267 | 'header' => 'Cookie:login-token' 268 | } 269 | default[:aem][:dispatcher][:enable_session_mgmt] = false 270 | default[:aem][:dispatcher][:mod_dispatcher_url] = nil 271 | default[:aem][:dispatcher][:mod_dispatcher_checksum] = nil 272 | default[:aem][:dispatcher][:deflate_enabled] = true 273 | default[:aem][:dispatcher][:header] = [] 274 | 275 | default[:aem][:curb_version] = '0.9.4' #default this to nil in your wrapper for the latest 276 | -------------------------------------------------------------------------------- /chefignore: -------------------------------------------------------------------------------- 1 | # Put files/directories that should be ignored in this file when uploading 2 | # or sharing to the community site. 3 | # Lines that start with '# ' are comments. 4 | 5 | # OS generated files # 6 | ###################### 7 | .DS_Store 8 | Icon? 9 | nohup.out 10 | ehthumbs.db 11 | Thumbs.db 12 | 13 | # SASS # 14 | ######## 15 | .sass-cache 16 | 17 | # EDITORS # 18 | ########### 19 | \#* 20 | .#* 21 | *~ 22 | *.sw[a-z] 23 | *.bak 24 | REVISION 25 | TAGS* 26 | tmtags 27 | *_flymake.* 28 | *_flymake 29 | *.tmproj 30 | .project 31 | .settings 32 | mkmf.log 33 | 34 | ## COMPILED ## 35 | ############## 36 | a.out 37 | *.o 38 | *.pyc 39 | *.so 40 | *.com 41 | *.class 42 | *.dll 43 | *.exe 44 | */rdoc/ 45 | 46 | # Testing # 47 | ########### 48 | .watchr 49 | .rspec 50 | spec/* 51 | spec/fixtures/* 52 | test/* 53 | features/* 54 | examples/* 55 | Guardfile 56 | Procfile 57 | test/* 58 | spec/* 59 | 60 | # SCM # 61 | ####### 62 | .git 63 | */.git 64 | .gitignore 65 | .gitmodules 66 | .gitconfig 67 | .gitattributes 68 | .svn 69 | */.bzr/* 70 | */.hg/* 71 | */.svn/* 72 | 73 | # Berkshelf # 74 | ############# 75 | Berksfile 76 | Berksfile.lock 77 | cookbooks/* 78 | tmp 79 | 80 | # Cookbooks # 81 | ############# 82 | CONTRIBUTING 83 | CHANGELOG* 84 | 85 | # Strainer # 86 | ############ 87 | Colanderfile 88 | Strainerfile 89 | .colander 90 | .strainer 91 | 92 | # Vagrant # 93 | ########### 94 | .vagrant 95 | Vagrantfile 96 | 97 | # Travis # 98 | ########## 99 | .travis.yml 100 | -------------------------------------------------------------------------------- /libraries/aem_helpers.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: aem 3 | # Library:: helpers 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | class AEM 18 | module Helpers 19 | class << self 20 | # Builds a portion of the search criteria for finding related AEM nodes in Chef server. 21 | # 22 | # The old way required a role, and assumed a search criteria that started with "role:#{role}". 23 | # This now also supports role with a value of "role[]" or "recipe[recipe_name]" as 24 | # well. Chef requires the brackets to be escaped with a backslash, but that's not required 25 | # in the parameter (this module takes care of that). 26 | def build_cluster_search_criteria(role_name, cluster_name) 27 | # If role_name contains brackets, escape them (Chef server search requires this): 28 | # role == 'role[dispatcher]' will get converted to 'role\[dispatcher\]' 29 | # Values without brackets will remain unchanged. 30 | # For future reference, lucene has the following special characters (which all must be escaped): 31 | # + - && || ! ( ) { } [ ] ^ " ~ * ? : \ 32 | # See http://lucene.apache.org/core/2_9_4/queryparsersyntax.html#Escaping Special Characters 33 | role = role_name.gsub(/\[(.*)\]/, '\[\1\]').gsub(/:/, '\:') 34 | role_search = role.include?('[') ? %(run_list:"#{role}") : %(role:"#{role}") 35 | %(#{role_search} AND aem_cluster_name:"#{cluster_name}") 36 | end 37 | 38 | # This method will return the command that corresponds to the closest matching version number as long as a 39 | # command exists with a version that is at least lower than the passed running_aem_version. 40 | # 41 | # commands should end up being a hash containing a 1:1 list of version => command 42 | # See node[:aem][:commands] in attributes/default.rb. 43 | def retrieve_command_for_version(commands, running_aem_version) 44 | current_aem_version = Gem::Version.new(running_aem_version) 45 | Chef::Log.info("Finding correct command for provided version: [#{running_aem_version}]") 46 | 47 | matching_version = nil 48 | matching_command = nil 49 | commands.each do |version, command| 50 | potential_version = Gem::Version.new(version) 51 | if current_aem_version >= potential_version && (matching_version.nil? || potential_version > matching_version) 52 | matching_version = potential_version 53 | matching_command = command 54 | end 55 | end 56 | Chef::Log.info("Closest matching version: [#{matching_version}], command: [#{matching_command}]") 57 | 58 | matching_command 59 | end 60 | end 61 | end 62 | end 63 | -------------------------------------------------------------------------------- /metadata.rb: -------------------------------------------------------------------------------- 1 | maintainer 'Tacit Knowledge, Inc.' 2 | maintainer_email 'aem-cookbook-dev@googlegroups.com' 3 | license 'Apache 2.0' 4 | name 'aem' 5 | description 'Installs/Configures Adobe AEM' 6 | long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) 7 | version IO.read(File.join(File.dirname(__FILE__), 'VERSION')) 8 | 9 | recipe 'aem::author', 'Installs AEM Author instance.' 10 | recipe 'aem::publish', 'Installs AEM Publish instance.' 11 | recipe 'aem::dispatcher', 'Installs AEM dispatcher Apache module.' 12 | 13 | supports 'centos' 14 | 15 | depends 'apache2' 16 | depends 'ark', '~> 0.8.2' 17 | depends 'iptables' 18 | depends 'java' 19 | -------------------------------------------------------------------------------- /providers/dispatcher.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: aem 3 | # Provider:: dispatcher 4 | # 5 | # Copyright 2014, Tacit Knowledge, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | action :install do 20 | dispatcher_mod_name = new_resource.dispatcher_mod_name 21 | package_install = new_resource.package_install 22 | dispatcher_uri = new_resource.dispatcher_uri 23 | dispatcher_checksum = new_resource.dispatcher_checksum 24 | dispatcher_version = new_resource.dispatcher_version 25 | dispatcher_file_cookbook = new_resource.dispatcher_file_cookbook 26 | webserver_type = new_resource.webserver_type 27 | apache_libexecdir = new_resource.apache_libexecdir 28 | 29 | if package_install 30 | dispatcher_pkg = "aem-dispatcher-#{webserver_type}" 31 | package dispatcher_pkg do 32 | version dispatcher_version 33 | end 34 | else 35 | dispatcher_file_path = "dispatcher-#{webserver_type}-#{dispatcher_version}.so" 36 | local_file_path = "#{apache_libexecdir}/#{dispatcher_file_path}" 37 | service_name = 'service[apache2]' 38 | 39 | unless dispatcher_uri.nil? 40 | require 'uri' 41 | uri = URI.parse(dispatcher_uri) 42 | filename = ::File.basename(uri.path) 43 | 44 | case ::File.extname(filename) 45 | when '.so' 46 | remote_file local_file_path do 47 | source dispatcher_uri 48 | checksum dispatcher_checksum 49 | mode 0644 50 | owner 'root' 51 | group 'root' 52 | action :create 53 | notifies :restart, service_name 54 | end 55 | else 56 | # extract out the module.so 57 | ark filename do 58 | url dispatcher_uri 59 | checksum dispatcher_checksum 60 | creates "modules/dispatcher-#{webserver_type}-*#{dispatcher_version}.so" 61 | path apache_libexecdir 62 | action :cherry_pick 63 | end 64 | end 65 | 66 | else 67 | cookbook_file local_file_path do 68 | source "#{dispatcher_file_path}" 69 | mode 0644 70 | owner 'root' 71 | group 'root' 72 | cookbook dispatcher_file_cookbook 73 | action :create 74 | notifies :restart, service_name 75 | end 76 | end 77 | 78 | link "#{apache_libexecdir}/mod_dispatcher.so" do 79 | to local_file_path 80 | notifies :restart, service_name 81 | end 82 | end 83 | end 84 | -------------------------------------------------------------------------------- /providers/farm.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: aem 3 | # Provider:: farm 4 | # 5 | # Copyright 2012, Tacit Knowledge, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | # This provider creates or removes a farm_*.any file for AEM dispatcher 20 | 21 | action :add do 22 | farm_name = new_resource.farm_name 23 | vars = {} 24 | # need the right kind of "empty" 25 | var_list = { client_headers: :array, virtual_hosts: :array, 26 | renders: :array, statistics: :array, 27 | filter_rules: :hash, cache_rules: :hash, 28 | invalidation_rules: :hash, allowed_clients: :hash, 29 | ignore_url_params: :hash, 30 | cache_root: :scalar, farm_dir: :scalar, 31 | farm_name: :scalar, cache_opts: :array, 32 | session_mgmt: :hash, enable_session_mgmt: :scalar } 33 | empty = { array: [], hash: {}, scalar: nil } 34 | 35 | # take value passed to provider, or node attribute, or empty 36 | var_list.keys.each do |var| 37 | type = var_list[var] 38 | nothing = empty[type] 39 | vars[var] = new_resource.send(var) || node[:aem][:dispatcher][var] || nothing 40 | end 41 | 42 | fail 'farm_dir attribute is required to create a farm.' unless vars[:farm_dir] 43 | 44 | # If this is a dynamic cluster, search the chef database for the members 45 | if new_resource.dynamic_cluster 46 | vars[:renders] = [] 47 | role = new_resource.cluster_role 48 | cluster_name = new_resource.cluster_name 49 | cluster_type = new_resource.cluster_type 50 | timeout = new_resource.render_timeout 51 | 52 | search_criteria = AEM::Helpers.build_cluster_search_criteria(role, cluster_name) 53 | renders = search(:node, search_criteria) 54 | 55 | # Don't want to rely on what order the search results come back in 56 | renders.sort! { |a, b| a[:hostname] <=> b[:hostname] } 57 | renders.each do |r| 58 | unless r[:aem][cluster_type] 59 | fail "Node #{r[:fqdn]} attribute :aem=>:#{cluster_type}=>:port does not exist" 60 | end 61 | vars[:renders] << { 62 | name: r[:fqdn], 63 | hostname: r[:ipaddress], 64 | port: r[:aem][cluster_type][:port], 65 | timeout: timeout 66 | } 67 | end 68 | # Don't ever return an empty renders list, or apache won't start and 69 | # subsequent chef runs will fail. 70 | if vars[:renders].empty? 71 | vars[:renders] << { 72 | name: 'NoClusterMembersFound', 73 | hostname: 'localhost', 74 | port: '4503', 75 | timeout: '1' 76 | } 77 | end 78 | end 79 | 80 | template "#{vars[:farm_dir]}/farm_#{farm_name}.any" do 81 | cookbook new_resource.farm_template_cookbook 82 | source new_resource.farm_template_source 83 | group node[:apache][:root_group] 84 | mode '0664' 85 | variables(vars) 86 | notifies :restart, resources(service: 'apache2') 87 | end 88 | end 89 | 90 | action :remove do 91 | farm_name = new_resource.farm_name || node[:aem][:dispatcher][:farm_name] 92 | farm_dir = new_resource.farm_dir || node[:aem][:dispatcher][:farm_dir] 93 | file "#{farm_dir}/farm_#{farm_name}.any" do 94 | action :delete 95 | notifies :restart, resources(service: 'apache2') 96 | end 97 | end 98 | -------------------------------------------------------------------------------- /providers/group.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: aem 3 | # Provider:: group 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require 'erb' 18 | 19 | def set_vars 20 | group = new_resource.group 21 | admin_user = new_resource.admin_user 22 | admin_password = new_resource.admin_password 23 | port = new_resource.port 24 | aem_version = new_resource.aem_version 25 | #By default, AEM will put groups in a folder named for their first letter (prior to AEM 6.x) 26 | path = new_resource.path || "/home/groups/#{group[0]}" 27 | [ group, admin_user, admin_password, port, aem_version, path ] 28 | end 29 | 30 | def curl(url, user, password) 31 | c = Curl::Easy.new(url) 32 | c.http_auth_types = :basic 33 | c.username = user 34 | c.password = password 35 | c.perform 36 | c 37 | end 38 | 39 | def get_group_path(port, group, admin_user, admin_password) 40 | url = "http://localhost:#{port}/bin/querybuilder.json?path=/home/groups&1_property=rep:authorizableId&1_property.value=#{group}&p.limit=-1" 41 | c = curl(url, admin_user, admin_password) 42 | group_json = JSON.parse(c.body_str) 43 | 44 | path = nil 45 | hits = group_json['hits'] 46 | if hits.empty? 47 | Chef::Log.warn("Unable to find path for group [#{group}]. Does this group exist?") 48 | else 49 | path = hits.first['path'] 50 | Chef::Log.info("Found path for group [#{group}]: [#{path}]") 51 | end 52 | path 53 | end 54 | 55 | action :remove do 56 | group, admin_user, admin_password, port, aem_version, path = set_vars 57 | 58 | perform_action = true 59 | case 60 | when aem_version.to_f >= 6.1 61 | path = get_group_path(port, group, admin_user, admin_password) 62 | 63 | if path.nil? 64 | Chef::Log.warn("Group [#{group}] doesn't exist; cannot remove group.") 65 | perform_action = false 66 | end 67 | else 68 | perform_action = false 69 | Chef::Log.warn('The aem_group provider only works with AEM 6.1 and higher.') 70 | end 71 | 72 | if perform_action 73 | aem_command = AEM::Helpers.retrieve_command_for_version(node[:aem][:commands][:remove_group], aem_version) 74 | cmd = ERB.new(aem_command).result(binding) 75 | 76 | runner = Mixlib::ShellOut.new(cmd) 77 | runner.run_command 78 | runner.error! 79 | end 80 | end 81 | 82 | action :add do 83 | group, admin_user, admin_password, port, aem_version, path = set_vars 84 | 85 | perform_action = true 86 | case 87 | when aem_version.to_f >= 6.1 88 | perform_action = true 89 | else 90 | perform_action = false 91 | Chef::Log.warn('The aem_group provider only works with AEM 6.1 and higher.') 92 | end 93 | 94 | if perform_action 95 | aem_command = AEM::Helpers.retrieve_command_for_version(node[:aem][:commands][:add_group], aem_version) 96 | cmd = ERB.new(aem_command).result(binding) 97 | 98 | runner = Mixlib::ShellOut.new(cmd) 99 | runner.run_command 100 | runner.error! 101 | end 102 | end 103 | 104 | action :add_user do 105 | group, admin_user, admin_password, port, aem_version, path = set_vars 106 | user = new_resource.user 107 | 108 | perform_action = true 109 | case 110 | when aem_version.to_f >= 6.1 111 | path = get_group_path(port, group, admin_user, admin_password) 112 | 113 | if path.nil? 114 | Chef::Log.warn("Group [#{group}] doesn't exist; cannot add user [#{user}] to group.") 115 | perform_action = false 116 | end 117 | else 118 | perform_action = false 119 | Chef::Log.warn('The aem_group provider only works with AEM 6.1 and higher.') 120 | end 121 | 122 | if perform_action 123 | aem_command = AEM::Helpers.retrieve_command_for_version(node[:aem][:commands][:add_user_to_group], aem_version) 124 | cmd = ERB.new(aem_command).result(binding) 125 | 126 | runner = Mixlib::ShellOut.new(cmd) 127 | runner.run_command 128 | runner.error! 129 | end 130 | end 131 | 132 | action :remove_user do 133 | group, admin_user, admin_password, port, aem_version, path = set_vars 134 | user = new_resource.user 135 | 136 | perform_action = true 137 | case 138 | when aem_version.to_f >= 6.1 139 | path = get_group_path(port, group, admin_user, admin_password) 140 | 141 | if path.nil? 142 | Chef::Log.warn("Group [#{group}] doesn't exist; cannot remove user [#{user}] from group.") 143 | perform_action = false 144 | end 145 | else 146 | perform_action = false 147 | Chef::Log.warn('The aem_group provider only works with AEM 6.1 and higher.') 148 | end 149 | 150 | if perform_action 151 | aem_command = AEM::Helpers.retrieve_command_for_version(node[:aem][:commands][:remove_user_from_group], aem_version) 152 | cmd = ERB.new(aem_command).result(binding) 153 | 154 | runner = Mixlib::ShellOut.new(cmd) 155 | runner.run_command 156 | runner.error! 157 | end 158 | end 159 | -------------------------------------------------------------------------------- /providers/init.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: aem 3 | # Provider:: init 4 | # 5 | # Copyright 2012, Tacit Knowledge, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | # This provider creates an init script for AEM 20 | 21 | action :add do 22 | vars = {} 23 | service_name = new_resource.service_name 24 | var_list = [ 25 | :aem_options, :default_context, :runnable_jar, :base_dir, :jvm_opts, :jar_opts 26 | ] 27 | 28 | # take value passed to provider, or node attribute 29 | var_list.each do |var| 30 | vars[var] = new_resource.send(var) || node[:aem][var] 31 | end 32 | template "/etc/init.d/#{service_name}" do 33 | cookbook 'aem' 34 | source 'init.erb' 35 | mode '0755' 36 | variables(vars) 37 | notifies :restart, resources(service: "#{service_name}") 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /providers/jar_installer.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: aem 3 | # Provider:: jar_installer 4 | # 5 | # Copyright 2012, Tacit Knowledge, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | # This provider installs AEM from a jar file at a URL 20 | 21 | action :install do 22 | vars = {} 23 | service_name = new_resource.name 24 | var_list = [:download_url, :base_dir, :default_context, :port] 25 | 26 | # take value passed to provider, or node attribute 27 | var_list.each do |var| 28 | vars[var] = new_resource.send(var) || node[:aem][var] 29 | end 30 | 31 | jar_name = "aem-#{service_name}-p#{vars[:port]}.jar" 32 | 33 | directory vars[:base_dir] do 34 | owner 'crx' 35 | mode '0755' 36 | end 37 | 38 | directory vars[:default_context] do 39 | owner 'crx' 40 | mode '0755' 41 | end 42 | 43 | remote_jar_name = "aem-quickstart-#{node[:aem][:version]}.jar" 44 | r = remote_file "#{Chef::Config[:file_cache_path]}/#{remote_jar_name}" do 45 | source "#{vars[:download_url]}" 46 | mode '0755' 47 | action :nothing 48 | end 49 | r.run_action(:create_if_missing) 50 | 51 | remote_file "#{vars[:base_dir]}/#{service_name}/#{jar_name}" do 52 | source "file://#{Chef::Config[:file_cache_path]}/#{remote_jar_name}" 53 | mode '0755' 54 | action :create_if_missing 55 | end 56 | 57 | bash 'unpack jar' do 58 | user 'crx' 59 | cwd vars[:default_context] 60 | code "java -jar #{jar_name} -unpack" 61 | end unless Object::File.exists?("#{vars[:default_context]}/#{node[:aem][:unpack_jar_dir]}") 62 | end 63 | -------------------------------------------------------------------------------- /providers/jcr_node.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: aem 3 | # Provider:: jcr_node 4 | # 5 | # Copyright 2015, Tacit Knowledge, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | # This provider manages an AEM JCR node 20 | 21 | def curl(url, user, password) 22 | c = Curl::Easy.new(url) 23 | c.http_auth_types = :basic 24 | c.username = user 25 | c.password = password 26 | c.perform 27 | c 28 | end 29 | 30 | def curl_form(url, user, password, fields) 31 | c = Curl::Easy.http_post(url, *fields) 32 | c.http_auth_types = :basic 33 | c.username = user 34 | c.password = password 35 | c.multipart_form_post = true 36 | c.perform 37 | c 38 | end 39 | 40 | def check_node(url, user, password, name) 41 | url = "#{url}/#{name}" 42 | c = curl(url, user, password) 43 | case c.response_code 44 | when 200, 201 45 | c.body_str 46 | when 404 47 | false 48 | else 49 | fail "Unable to read JCR node at #{url}. response_code: #{c.response_code} response: #{c.body_str}" 50 | end 51 | end 52 | 53 | def make_url(new_resource) 54 | url = "http://#{new_resource.host}:#{new_resource.port}/#{new_resource.path}" 55 | end 56 | 57 | action :create do 58 | url = make_url(new_resource) 59 | # How to create the node depends on the type. I'm only supporting type 'file' right now. 60 | case new_resource.type 61 | when 'file' 62 | unless check_node(url, new_resource.user, new_resource.password, new_resource.name) == new_resource.contents 63 | fields = [ 64 | Curl::PostField.file(new_resource.name, new_resource.contents), 65 | Curl::PostField.content("#{new_resource.name}@TypeHint", 'Binary') 66 | ] 67 | c = curl_form(url, new_resource.user, new_resource.password, fields) 68 | if c.response_code == 200 || c.response_code == 201 69 | new_resource.updated_by_last_action(true) 70 | Chef::Log.debug("New jcr_node was created at #{new_resource.path}") 71 | else 72 | fail "JCR Node Creation failed. HTTP code: #{c.response_code}" 73 | end 74 | end 75 | else 76 | fail "Node type '#{new_resource.type}' is unsupported for creation. If you need this type, please file an issue, or better yet, a pull request." 77 | end 78 | end 79 | 80 | action :delete do 81 | url = make_url(new_resource) 82 | if check_node(url, new_resource.user, new_resource.password, new_resource.name) 83 | # If the node exists, delete it 84 | fields = [Curl::PostField.content(':operation', 'delete')] 85 | c = curl_form(url, new_resource.user, new_resource.password, fields) 86 | if c.response_code == 200 || c.response_code == 201 87 | new_resource.updated_by_last_action(true) 88 | else 89 | fail "JCR Node Deletion failed. HTTP code: #{c.response_code}" 90 | end 91 | end 92 | end 93 | -------------------------------------------------------------------------------- /providers/ldap.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: aem 3 | # Provider:: ldap 4 | # 5 | # Copyright 2012, Tacit Knowledge, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | # This provider enables or disables ldap auth for an AEM instance 20 | 21 | action :enable do 22 | vars = {} 23 | instance_name = new_resource.instance_name 24 | base_dir = node[:aem][instance_name][:base_dir] 25 | user = node[:aem][:aem_options]['RUNAS_USER'] 26 | 27 | # take value passed to provider, or node attribute 28 | vars[:options] = new_resource.send(:options) || 29 | node[:aem][instance_name][:ldap][:options] 30 | 31 | directory "#{base_dir}/conf" do 32 | owner user 33 | group user 34 | mode '0755' 35 | action :create 36 | recursive true 37 | end 38 | 39 | template "#{base_dir}/conf/ldap_login.conf" do 40 | cookbook 'aem' 41 | source 'ldap_login.conf.erb' 42 | mode '0644' 43 | variables(vars) 44 | notifies :restart, resources(service: "aem-#{instance_name}") 45 | end 46 | 47 | # add the JVM option to use ldap, it will get added to startup script. 48 | opt = '-Djava.security.auth.login.config=crx-quickstart/conf/ldap_login.conf' 49 | node.default[:aem][instance_name][:jvm_opts][opt] = true 50 | end 51 | 52 | action :disable do 53 | instance_name = new_resource.instance_name 54 | file "#{node[:aem][instance_name][:base_dir]}/conf/ldap_login.conf" do 55 | action :delete 56 | end 57 | opt = '-Djava.security.auth.login.config=crx-quickstart/conf/ldap_login.conf' 58 | 59 | node.default[:aem][instance_name][:jvm_opts].delete(opt) 60 | end 61 | -------------------------------------------------------------------------------- /providers/package.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: aem 3 | # Provider:: package 4 | # 5 | # Copyright 2012, Tacit Knowledge, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | # This provider manages AEM packages. It is not intended for production use, 20 | # though it can be useful for standing-up developer environments. If you 21 | # really want to use this for production, you should add some real error 22 | # checking on the output of the curl commands. 23 | 24 | def set_vars 25 | # Set up vars with AEM package manager urls, etc. 26 | vars = {} 27 | vars[:recursive] = new_resource.recursive ? '\\&recursive=true' : '' 28 | vars[:file_name] = "#{new_resource.name}-#{new_resource.version}" \ 29 | "#{new_resource.file_extension}" 30 | vars[:download_url] = new_resource.package_url 31 | vars[:file_path] = "#{Chef::Config[:file_cache_path]}/#{vars[:file_name]}" 32 | vars[:user] = new_resource.user 33 | vars[:password] = new_resource.password 34 | vars[:port] = new_resource.port 35 | vars[:group_id] = new_resource.group_id 36 | vars[:upload_cmd] = "curl -s -S -u #{vars[:user]}:#{vars[:password]} -F" \ 37 | " package=@#{vars[:file_path]} http://localhost:" \ 38 | "#{vars[:port]}/crx/packmgr/service/.json?cmd=upload" 39 | vars[:delete_cmd] = "curl -s -S -u #{vars[:user]}:#{vars[:password]} -X" \ 40 | " POST http://localhost:#{vars[:port]}/crx/packmgr/" \ 41 | "service/.json/etc/packages/#{vars[:group_id]}/" \ 42 | "#{vars[:file_name]}?cmd=delete" 43 | vars[:install_cmd] = "curl -s -S -u #{vars[:user]}:#{vars[:password]} -X" \ 44 | " POST http://localhost:#{vars[:port]}/crx/packmgr/" \ 45 | "service/.json/etc/packages/#{vars[:group_id]}/" \ 46 | "#{vars[:file_name]}?cmd=install#{vars[:recursive]}" 47 | vars[:activate_cmd] = "curl -s -S -u #{vars[:user]}:#{vars[:password]} -X" \ 48 | " POST http://localhost:#{vars[:port]}/crx/packmgr/" \ 49 | "service/.json/etc/packages/#{vars[:group_id]}/" \ 50 | "#{vars[:file_name]}?cmd=replicate" 51 | vars[:uninstall_cmd] = "curl -s -S -u #{vars[:user]}:#{vars[:password]} -X" \ 52 | " POST http://localhost:#{vars[:port]}/crx/packmgr/" \ 53 | "service/.json/etc/packages/#{vars[:group_id]}/" \ 54 | "#{vars[:file_name]}?cmd=uninstall" 55 | 56 | vars 57 | end 58 | 59 | def get_package_version(zip_file_path, properties_file_path, pattern) 60 | # The package versions inside the zip file may have no relationship to the 61 | # version on the file. 62 | cmd = "unzip -p #{zip_file_path} #{properties_file_path}" 63 | get_version = Mixlib::ShellOut.new(cmd) 64 | get_version.run_command 65 | get_version.error! 66 | puts "PROPERTIES FILE:\n #{get_version.stdout}" 67 | puts "PATTERN: #{pattern}" 68 | match = pattern.match(get_version.stdout) 69 | fail "Failed to find AEM package version in #{zip_file_path}." unless match 70 | puts "Found AEM package version: #{match[1]}" 71 | # return the captured text 72 | match[1] 73 | end 74 | 75 | action :upload do 76 | # I only wish there was a way to get AEM to tell you what packages are already 77 | # installed. The Hack follows. 78 | 79 | vars = set_vars 80 | unless ::File.exist?(vars[:file_path]) && !new_resource.update 81 | r = remote_file vars[:file_path] do 82 | source vars[:download_url] 83 | mode 0755 84 | action :nothing 85 | end 86 | r.run_action(:create) 87 | 88 | # If we're going to do the upload, make sure the package is not already there 89 | delete = Mixlib::ShellOut.new(vars[:delete_cmd]) 90 | upload = Mixlib::ShellOut.new(vars[:upload_cmd]) 91 | log "Deleting AEM package with command: #{vars[:delete_cmd]}" 92 | delete.run_command 93 | delete.error! 94 | log delete.stdout 95 | log "Uploading AEM package with command: #{vars[:upload_cmd]}" 96 | upload.run_command 97 | upload.error! 98 | log upload.stdout 99 | 100 | end 101 | end 102 | 103 | action :delete do 104 | vars = set_vars 105 | delete = Mixlib::ShellOut.new(vars[:delete_cmd]) 106 | log "Deleting AEM package with command: #{vars[:delete_cmd]}" 107 | delete.run_command 108 | delete.error! 109 | log delete.stdout 110 | file vars[:file_path] do 111 | action :delete 112 | end 113 | end 114 | 115 | action :install do 116 | vars = set_vars 117 | 118 | # If we're using something like "latest", the version of the packages won't 119 | # match, so we need to get the real version. 120 | if new_resource.properties_file && new_resource.version_pattern 121 | pat = Regexp.new(new_resource.version_pattern) 122 | package_version = get_package_version(vars[:file_path], 123 | new_resource.properties_file, pat) 124 | vars[:install_cmd].sub!(new_resource.version, package_version) 125 | puts "NEW VERSION: #{package_version}" 126 | end 127 | 128 | puts "INSTALL COMMAND: #{vars[:install_cmd]}" 129 | install = Mixlib::ShellOut.new(vars[:install_cmd]) 130 | 131 | # We need to figure out what version is currently installed, if any. 132 | # AEM won't tell us this, so we leave ourselves breadcrumbs. 133 | version_dir = "#{node[:aem][new_resource.aem_instance][:default_context]}/" \ 134 | 'packages' 135 | version_file = "#{version_dir}/#{new_resource.name}" 136 | current_version = nil 137 | if ::File.exist?(version_file) 138 | current_version = ::File.readlines(version_file).last.chomp 139 | end 140 | # Need to uninstall the current version - AEM just overlays a new install 141 | if (current_version != new_resource.version) || new_resource.update 142 | old = "#{new_resource.name}-#{current_version}#{new_resource.file_extension}" 143 | uninstall_cmd = vars[:uninstall_cmd].sub(vars[:file_name], old) 144 | uninstall = Mixlib::ShellOut.new(uninstall_cmd) 145 | log "Uninstalling AEM package with command: #{uninstall_cmd}" 146 | uninstall.run_command 147 | uninstall.error! 148 | log uninstall.stdout 149 | log "Installing AEM package with command: #{vars[:install_cmd]}" 150 | install.run_command 151 | install.error! 152 | log install.stdout 153 | end 154 | # Now to leave the breadcrumb 155 | params = { version: new_resource.version } 156 | directory version_dir do 157 | owner 'root' 158 | group 'root' 159 | mode '0755' 160 | end 161 | template version_file do 162 | owner 'root' 163 | group 'root' 164 | mode '0644' 165 | source 'aem_pkg_version.erb' 166 | variables(params: params) 167 | end 168 | end 169 | 170 | action :activate do 171 | vars = set_vars 172 | if new_resource.properties_file && new_resource.version_pattern 173 | pat = Regexp.new(new_resource.version_pattern) 174 | package_version = get_package_version(vars[:file_path], 175 | new_resource.properties_file, pat) 176 | vars[:activate_cmd].sub!(new_resource.version, package_version) 177 | end 178 | activate = Mixlib::ShellOut.new(vars[:activate_cmd]) 179 | log "Activating AEM package with command: #{vars[:activate_cmd]}" 180 | activate.run_command 181 | activate.error! 182 | log activate.stdout 183 | end 184 | 185 | action :uninstall do 186 | vars = set_vars 187 | uninstall = Mixlib::ShellOut.new(vars[:uninstall_cmd]) 188 | log "Uninstalling AEM package with command: #{vars[:uninstall_cmd]}" 189 | uninstall.run_command 190 | uninstall.error! 191 | log uninstall.stdout 192 | end 193 | -------------------------------------------------------------------------------- /providers/port_watcher.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: aem 3 | # Provider:: port_watcher 4 | # 5 | # Copyright 2012, Tacit Knowledge, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | # This provider creates a resource that monitors a network port, blocking until 20 | # the port is listening, the service that is supposed to listen on the port has 21 | # died, or the timeout expires. 22 | 23 | action :wait do 24 | timeout = new_resource.timeout 25 | expire_time = timeout ? Time.now.to_i + timeout : nil 26 | date_cmd = '' # do nothing if timeout is nil 27 | expire_time && date_cmd = 28 | "if [ \`date +%s\` -gt #{expire_time} ]; then " \ 29 | "echo 'Timeout exceeded'; exit 2; fi" 30 | status_cmd = 31 | "if ! #{new_resource.status_command}; then " \ 32 | "echo 'Service has died'; exit 1; fi" 33 | netstat_opts = new_resource.protocol == 'udp' ? '-uln' : '-tln' 34 | 35 | bash 'wait_for_port' do 36 | user 'root' 37 | code <<-EOH 38 | while ! netstat #{netstat_opts} | grep ":#{new_resource.port} " 39 | do 40 | #{status_cmd} 41 | #{date_cmd} 42 | sleep 10 43 | done 44 | EOH 45 | end 46 | end 47 | -------------------------------------------------------------------------------- /providers/replicator.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: aem 3 | # Provider:: replicator 4 | # 5 | # Copyright 2012, Tacit Knowledge, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | # This provider adds or removes replication agents from an AEM instance 20 | 21 | require 'erb' 22 | 23 | action :add do 24 | hosts = new_resource.remote_hosts 25 | local_user = new_resource.local_user 26 | local_password = new_resource.local_password 27 | local_port = new_resource.local_port 28 | hosts = new_resource.remote_hosts 29 | role = new_resource.cluster_role 30 | cluster_name = new_resource.cluster_name 31 | type = new_resource.type 32 | server = new_resource.server || 'author' 33 | aem_version = new_resource.aem_version 34 | 35 | fail "No command specified for replicator type: #{type}. See node attribute :aem->" \ 36 | ':commands->:replicators.' unless node[:aem][:commands][:replicators][type][:add] 37 | 38 | case type 39 | when :publish 40 | agent = aem_instance = :publish 41 | when :flush 42 | aem_instance = :dispatcher 43 | agent = 'flush' 44 | # these are usually on publishers 45 | server = new_resource.server || 'publish' 46 | when :flush_agent 47 | aem_instance = :dispatcher 48 | agent = 'flush' 49 | # these are usually on publishers 50 | server = new_resource.server || 'publish' 51 | when :agent 52 | agent = aem_instance = :publish 53 | end 54 | 55 | if new_resource.dynamic_cluster 56 | log 'Finding replication hosts dynamically...' 57 | hosts = [] 58 | search_criteria = AEM::Helpers.build_cluster_search_criteria(role, cluster_name) 59 | search(:node, search_criteria) do |n| 60 | log "Found host: #{n[:fqdn]}" 61 | hosts << { 62 | ipaddress: n[:ipaddress], 63 | port: n[:aem][aem_instance][:port], 64 | user: n[:aem][aem_instance][:admin_user], 65 | password: n[:aem][aem_instance][:admin_password], 66 | name: n[:fqdn] 67 | } 68 | end 69 | hosts.sort! { |a, b| a[:name] <=> b[:name] } 70 | end 71 | 72 | counter = 0 73 | hosts.each do |h| 74 | instance = counter > 0 ? counter.to_s : '' 75 | 76 | if h[:agent_id].nil? 77 | log "No agent id found, don't populate the userId value for the replication agent" 78 | agent_id_param = '' 79 | else 80 | log "Agent id found #{h[:agent_id]}, populate the userId value for the replication agent with it" 81 | agent_id_param = "-F \"jcr:content/userId=#{h[:agent_id]}\"" 82 | end 83 | 84 | aem_command = AEM::Helpers.retrieve_command_for_version(node[:aem][:commands][:replicators][type][:add], aem_version) 85 | cmd = ERB.new(aem_command).result(binding) 86 | 87 | log "Adding replication agent with command: #{cmd}" 88 | runner = Mixlib::ShellOut.new(cmd) 89 | runner.run_command 90 | runner.error! 91 | counter += 1 92 | end 93 | end 94 | 95 | action :remove do 96 | hosts = new_resource.remote_hosts 97 | local_user = new_resource.local_user 98 | local_password = new_resource.local_password 99 | local_port = new_resource.local_port 100 | hosts = new_resource.remote_hosts 101 | role = new_resource.cluster_role 102 | cluster_name = new_resource.cluster_name 103 | type = new_resource.type 104 | server = new_resource.server || 'author' 105 | aem_version = new_resource.aem_version 106 | 107 | fail "No command specified for replicator type: #{type}. See node attribute :aem->" \ 108 | ':commands->:replicators.' unless node[:aem][:commands][:replicators][type][:remove] 109 | 110 | case type 111 | when :publish 112 | aem_instance = :publish 113 | agent = 'publish' 114 | when :flush 115 | aem_instance = :dispatcher 116 | agent = 'flush' 117 | server = new_resource.server || 'publish' 118 | when :flush_agent 119 | aem_instance = :dispatcher 120 | agent = 'flush' 121 | server = new_resource.server || 'publish' 122 | when :agent 123 | aem_instance = :publish 124 | agent = 'author' 125 | end 126 | 127 | if new_resource.dynamic_cluster 128 | log 'Finding replication hosts dynamically...' 129 | hosts = [] 130 | search_criteria = AEM::Helpers.build_cluster_search_criteria(role, cluster_name) 131 | search(:node, search_criteria) do |n| 132 | log "Found host: #{n[:fqdn]}" 133 | hosts << { 134 | ipaddress: n[:ipaddress], 135 | port: n[:aem][aem_instance][:port], 136 | user: n[:aem][aem_instance][:admin_user], 137 | password: n[:aem][aem_instance][:admin_password], 138 | name: n[:fqdn] 139 | } 140 | end 141 | hosts.sort! { |a, b| a[:name] <=> b[:name] } 142 | 143 | if type == :agent || type == :flush_agent 144 | aem_command = AEM::Helpers.retrieve_command_for_version(node[:aem][:commands][:replicators][type][:list], aem_version) 145 | cmd = ERB.new(aem_command).result(binding) 146 | 147 | log "Creating list of agents wth command: #{cmd}" 148 | runner = Mixlib::ShellOut.new(cmd) 149 | runner.run_command 150 | runner.error! 151 | 152 | node_hash = JSON.parse(runner.stdout) 153 | list = {} 154 | all_agents = [] 155 | # AEM 6.4 makes the agents.xxx not children of replication, so a little hackery 156 | aem_version >= '6.4' ? list["agents.#{agent}"] = node_hash : list = node_hash 157 | 158 | list["agents.#{agent}"].keys.each do |key| 159 | all_agents << key unless key =~ /jcr/ 160 | end 161 | 162 | counter = 0 163 | agents = [] 164 | hosts.each do |h| 165 | instance = counter > 0 ? counter.to_s : '' 166 | agents << "#{agent}#{instance}" 167 | counter += 1 168 | end 169 | 170 | hosts = all_agents - agents 171 | end 172 | end 173 | 174 | counter = 0 175 | hosts.each do |h| 176 | instance = counter > 0 ? counter.to_s : '' 177 | 178 | aem_command = AEM::Helpers.retrieve_command_for_version(node[:aem][:commands][:replicators][type][:remove], aem_version) 179 | cmd = ERB.new(aem_command).result(binding) 180 | 181 | log "Removing replication agent with command: #{cmd}" 182 | runner = Mixlib::ShellOut.new(cmd) 183 | runner.run_command 184 | runner.error! 185 | counter += 1 186 | end 187 | end 188 | -------------------------------------------------------------------------------- /providers/url_watcher.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: aem 3 | # Provider:: url_watcher 4 | # 5 | # Copyright 2012, Tacit Knowledge, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | # This provider creates a resource that monitors an httpd url, blocking until 20 | # the url loads correctly, the service that is supposed to serve the url has 21 | # died, or the timeout expires. 22 | action :wait do 23 | wait_between_attempts = new_resource.wait_between_attempts 24 | validation_url = new_resource.validation_url 25 | max_attempts = new_resource.max_attempts 26 | creds = '' 27 | status_cmd = 28 | "if ! #{new_resource.status_command}; then " \ 29 | "echo 'Service has died'; exit 1; fi" 30 | if new_resource.user && new_resource.password 31 | creds = "-u #{new_resource.user}:#{new_resource.password}" 32 | end 33 | if new_resource.match_string 34 | curl_validation_command = %(curl #{creds} --silent #{validation_url} | grep "#{new_resource.match_string}") 35 | else 36 | curl_validation_command = "curl #{creds} -o /dev/null --silent --head --write-out '%{http_code}' #{validation_url} | grep 200" 37 | end 38 | 39 | bash "wait for URL: #{validation_url}" do 40 | code <<-EOH 41 | #{status_cmd} 42 | ATTEMPTS=0 43 | while ! #{curl_validation_command} ; do 44 | 45 | echo "Waiting for URL..." 46 | sleep #{wait_between_attempts} 47 | #{status_cmd} 48 | ATTEMPTS=$(expr ${ATTEMPTS} + 1) 49 | 50 | if [ ${ATTEMPTS} -gt #{max_attempts} ] ; then 51 | echo "Max attempts reached... exiting with failure status." 52 | exit 100 53 | fi 54 | done 55 | EOH 56 | end 57 | end 58 | -------------------------------------------------------------------------------- /providers/user.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: aem 3 | # Provider:: password 4 | # 5 | # Copyright 2012-2013, Tacit Knowledge, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | # This provider changes a users password for an AEM instance 20 | 21 | require 'erb' 22 | 23 | def set_vars 24 | user = new_resource.user 25 | password = new_resource.password 26 | admin_user = new_resource.admin_user 27 | admin_password = new_resource.admin_password 28 | port = new_resource.port 29 | aem_version = new_resource.aem_version 30 | # By default, AEM will put users in a folder named for their first letter (prior to AEM 6.x) 31 | path = new_resource.path || "/home/users/#{user[0]}" 32 | group = new_resource.group 33 | [user, password, admin_user, admin_password, port, aem_version, path, group] 34 | end 35 | 36 | def curl(url, user, password) 37 | c = Curl::Easy.new(url) 38 | c.http_auth_types = :basic 39 | c.username = user 40 | c.password = password 41 | c.perform 42 | c 43 | end 44 | 45 | def get_usr_path(port, user, admin_user, admin_password) 46 | url_user = "http://localhost:#{port}/bin/querybuilder.json?path=/home/users&1_property=rep:authorizableId&1_property.value=#{user}&p.limit=-1" 47 | c = curl(url_user, admin_user, admin_password) 48 | usr_json = JSON.parse(c.body_str) 49 | 50 | path = nil 51 | hits = usr_json['hits'] 52 | if hits.empty? 53 | Chef::Log.warn("Unable to find path for user [#{user}]. Does this user exist?") 54 | else 55 | path = hits.first['path'] 56 | Chef::Log.info("Found path for user [#{user}]: [#{path}]") 57 | end 58 | path 59 | end 60 | 61 | action :set_password do 62 | user, password, admin_user, admin_password, port, aem_version, path, group = set_vars 63 | 64 | perform_action = true 65 | 66 | case 67 | when aem_version.to_f >= 6.1 68 | path = get_usr_path(port, user, admin_user, admin_password) 69 | 70 | if path.nil? 71 | Chef::Log.warn("User [#{user}] doesn't exist; cannot set password.") 72 | perform_action = false 73 | end 74 | end 75 | 76 | if perform_action 77 | aem_command = AEM::Helpers.retrieve_command_for_version(node[:aem][:commands][:password], aem_version) 78 | cmd = ERB.new(aem_command).result(binding) 79 | 80 | runner = Mixlib::ShellOut.new(cmd) 81 | runner.run_command 82 | runner.error! 83 | end 84 | end 85 | 86 | action :remove do 87 | user, password, admin_user, admin_password, port, aem_version, path, group = set_vars 88 | 89 | perform_action = true 90 | 91 | case 92 | when aem_version.to_f >= 6.1 93 | path = get_usr_path(port, user, admin_user, admin_password) 94 | 95 | if path.nil? 96 | Chef::Log.warn("User [#{user}] doesn't exist; cannot remove user.") 97 | perform_action = false 98 | end 99 | end 100 | 101 | if perform_action 102 | aem_command = AEM::Helpers.retrieve_command_for_version(node[:aem][:commands][:remove_user], aem_version) 103 | cmd = ERB.new(aem_command).result(binding) 104 | 105 | runner = Mixlib::ShellOut.new(cmd) 106 | runner.run_command 107 | runner.error! 108 | end 109 | end 110 | 111 | action :add do 112 | user, password, admin_user, admin_password, port, aem_version, path, group = set_vars 113 | 114 | aem_command = AEM::Helpers.retrieve_command_for_version(node[:aem][:commands][:add_user], aem_version) 115 | cmd = ERB.new(aem_command).result(binding) 116 | 117 | runner = Mixlib::ShellOut.new(cmd) 118 | runner.run_command 119 | runner.error! 120 | 121 | case 122 | when aem_version.to_f >= 6.1 123 | unless group.nil? 124 | aem_group group do 125 | admin_user admin_user 126 | admin_password admin_password 127 | port port 128 | aem_version aem_version 129 | user user 130 | action :add_user 131 | end 132 | end 133 | end 134 | 135 | end 136 | -------------------------------------------------------------------------------- /providers/website.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: aem 3 | # Provider:: website 4 | # 5 | # Copyright 2012, Tacit Knowledge, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | # This provider creates or removes an apache virtual host containing locations 20 | # served by dispatcher. 21 | 22 | action :add do 23 | site_name = new_resource.site_name 24 | vars = {} 25 | var_list = [ 26 | :site_name, :server_name, :server_aliases, :aem_locations, :cache_root, 27 | :enabled, :rewrites, :listen_port, :ssl_enabled, :ssl_cert_file, 28 | :ssl_key_file, :expire_dirs, :enable_etag, :enable_ie_header, 29 | :template_cookbook, :template_name, :deflate_enabled, :local_vars, :header 30 | ] 31 | var_list.each do |var| 32 | vars[var] = new_resource.send(var) || node[:aem][:dispatcher][var] 33 | end 34 | 35 | directory vars[:cache_root] do 36 | owner 'apache' 37 | group 'apache' 38 | mode '0755' 39 | action :create 40 | recursive true 41 | end 42 | 43 | # from apache2/definitions 44 | web_app site_name do 45 | template vars[:template_name] 46 | server_name vars[:server_name] 47 | server_aliases vars[:server_aliases] 48 | docroot vars[:cache_root] 49 | aem_locations vars[:aem_locations] 50 | rewrites vars[:rewrites] 51 | listen_port vars[:listen_port] 52 | ssl_enabled vars[:ssl_enabled] 53 | ssl_cert_file vars[:ssl_cert_file] 54 | ssl_key_file vars[:ssl_key_file] 55 | expire_dirs vars[:expire_dirs] 56 | enable_etag vars[:enable_etag] 57 | enable_ie_header vars[:enable_ie_header] 58 | cookbook vars[:template_cookbook] 59 | deflate_enabled vars[:deflate_enabled] 60 | local_vars vars[:local_vars] 61 | enable vars[:enabled] 62 | header vars[:header] 63 | end 64 | end 65 | 66 | action :remove do 67 | apache_site "#{new_resource.site_name}.conf" do 68 | enable false 69 | end 70 | end 71 | -------------------------------------------------------------------------------- /recipes/_base_aem_setup.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: aem 3 | # Recipe:: _base_aem_setup 4 | # 5 | # Copyright 2012, Tacit Knowledge, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | # Platform specific package names 20 | case node['platform'] 21 | when 'debian', 'ubuntu' 22 | curl_package = 'libcurl4-openssl-dev' 23 | when 'redhat', 'centos', 'fedora' 24 | curl_package = 'libcurl-devel' 25 | end 26 | 27 | # We need these for the jcr_node provider 28 | package curl_package do 29 | action :nothing 30 | end.run_action(:install) 31 | 32 | package 'gcc' do 33 | action :nothing 34 | end.run_action(:install) 35 | 36 | chef_gem 'curb' do 37 | compile_time false if Chef::Resource::ChefGem.method_defined?(:compile_time) 38 | action :nothing 39 | version node[:aem][:curb_version] 40 | end.run_action(:install) 41 | 42 | require 'curb' 43 | 44 | unless node['aem']['license_url'] || node['aem']['license_customer_name'] && node['aem']['license_download_id'] 45 | Chef::Application.fatal! 'At lest one of aem.license_url or aem.license_customer_name && aem.license_download_id attribute should not be nil. Please populate that attribute.' 46 | end 47 | 48 | unless node['aem']['download_url'] 49 | Chef::Application.fatal! 'aem.download attribute cannot be nil. Please populate that attribute.' 50 | end 51 | 52 | # See if we can get this value early enough from AEM itself so we don't have to ask for it. 53 | unless node['aem']['version'] 54 | Chef::Application.fatal! 'aem.version attribute cannot be nil. Please populate that attribute.' 55 | end 56 | 57 | include_recipe 'java' 58 | package 'unzip' 59 | 60 | if node[:aem][:use_yum] 61 | package 'aem' do 62 | version node[:aem][:version] 63 | action :install 64 | end 65 | else 66 | user 'crx' do 67 | comment 'crx/aem role user' 68 | system true 69 | shell '/bin/bash' 70 | home '/home/crx' 71 | supports manage_home: true 72 | action :create 73 | end 74 | end 75 | 76 | directory '/home/crx/.ssh' do 77 | owner 'crx' 78 | group 'crx' 79 | mode 0700 80 | end 81 | -------------------------------------------------------------------------------- /recipes/author.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: aem 3 | # Recipe:: author 4 | # 5 | # Copyright 2012, Tacit Knowledge, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | include_recipe 'aem::_base_aem_setup' 20 | 21 | unless node[:aem][:use_yum] 22 | aem_jar_installer 'author' do 23 | download_url node[:aem][:download_url] 24 | default_context node[:aem][:author][:default_context] 25 | port node[:aem][:author][:port] 26 | action :install 27 | end 28 | end 29 | 30 | unless node[:aem][:license_customer_name].nil? && node[:aem][:license_download_id].nil? 31 | template "#{node[:aem][:author][:default_context]}/license.properties" do 32 | source 'license.properties.erb' 33 | sensitive true 34 | mode 0644 35 | end 36 | end 37 | 38 | unless node[:aem][:license_url].nil? 39 | remote_file "#{node[:aem][:author][:default_context]}/license.properties" do 40 | source "#{node[:aem][:license_url]}" 41 | sensitive true 42 | mode 0644 43 | end 44 | end 45 | 46 | if node[:aem][:version].to_f > 5.4 47 | node.set[:aem][:author][:runnable_jar] = "aem-author-p#{node[:aem][:author][:port]}.jar" 48 | end 49 | 50 | aem_init 'aem-author' do 51 | service_name 'aem-author' 52 | default_context node[:aem][:author][:default_context] 53 | runnable_jar node[:aem][:author][:runnable_jar] 54 | base_dir node[:aem][:author][:base_dir] 55 | jvm_opts node[:aem][:author][:jvm_opts] 56 | jar_opts node[:aem][:author][:jar_opts] 57 | action :add 58 | end 59 | 60 | service 'aem-author' do 61 | # init script returns 0 for status no matter what 62 | status_command 'service aem-author status | grep running' 63 | supports status: true, stop: true, start: true, restart: true 64 | action [:enable, :start] 65 | end 66 | 67 | if node[:aem][:version].to_f > 5.4 68 | node[:aem][:author][:validation_urls].each do |url| 69 | aem_url_watcher url do 70 | validation_url url 71 | status_command 'service aem-author status | grep running' 72 | max_attempts node[:aem][:author][:startup][:max_attempts] 73 | wait_between_attempts node[:aem][:author][:startup][:wait_between_attempts] 74 | user node[:aem][:author][:admin_user] 75 | password node[:aem][:author][:admin_password] 76 | action :wait 77 | end 78 | end 79 | else 80 | aem_port_watcher '4502' do 81 | status_command 'service aem-author status | grep running' 82 | action :wait 83 | end 84 | end 85 | 86 | unless node[:aem][:author][:new_admin_password].nil? 87 | # Change admin password 88 | aem_user node[:aem][:author][:admin_user] do 89 | password node[:aem][:author][:new_admin_password] 90 | admin_user node[:aem][:author][:admin_user] 91 | admin_password node[:aem][:author][:admin_password] 92 | port node[:aem][:author][:port] 93 | aem_version node[:aem][:version] 94 | action :set_password 95 | end 96 | 97 | node.set[:aem][:author][:admin_password] = node[:aem][:author][:new_admin_password] 98 | node.set[:aem][:author][:new_admin_password] = nil 99 | end 100 | 101 | # delete the privileged users from geometrixx, if they're still there. 102 | node[:aem][:geometrixx_priv_users].each do |user| 103 | aem_user user do 104 | admin_user node[:aem][:author][:admin_user] 105 | admin_password lazy { node[:aem][:author][:admin_password] } 106 | port node[:aem][:author][:port] 107 | aem_version node[:aem][:version] 108 | path '/home/users/geometrixx' 109 | action :remove 110 | end 111 | end 112 | 113 | aem_ldap 'author' do 114 | options node[:aem][:author][:ldap][:options] 115 | action node[:aem][:author][:ldap][:enabled] ? :enable : :disable 116 | end 117 | 118 | if node[:aem][:version].to_f < 5.5 119 | web_inf_dir = "#{node[:aem][:author][:base_dir]}/server/runtime/0/_crx/WEB-INF" 120 | user = node[:aem][:aem_options]['RUNAS_USER'] 121 | directory web_inf_dir do 122 | owner user 123 | group user 124 | mode '0755' 125 | action :create 126 | recursive true 127 | end 128 | template "#{web_inf_dir}/web.xml" do 129 | source 'web.xml.erb' 130 | owner user 131 | group user 132 | mode '0644' 133 | action :create 134 | notifies :restart, 'service[aem-author]' 135 | end 136 | end 137 | 138 | # If we're using the aem_package provider to deploy, do it now 139 | node[:aem][:author][:deploy_pkgs].each do |pkg| 140 | aem_package pkg[:name] do 141 | version pkg[:version] 142 | aem_instance 'author' 143 | package_url pkg[:url] 144 | update pkg[:update] 145 | user node[:aem][:author][:admin_user] 146 | password lazy { node[:aem][:author][:admin_password] } 147 | port node[:aem][:author][:port] 148 | group_id pkg[:group_id] 149 | recursive pkg[:recursive] 150 | properties_file pkg[:properties_file] 151 | version_pattern pkg[:version_pattern] 152 | action pkg[:action] 153 | end 154 | end 155 | 156 | # Remove author agents that aren't listed 157 | aem_replicator 'delete_extra_replication_agents' do 158 | local_user node[:aem][:author][:admin_user] 159 | local_password lazy { node[:aem][:author][:admin_password] } 160 | local_port node[:aem][:author][:port] 161 | remote_hosts node[:aem][:author][:replication_hosts] 162 | dynamic_cluster node[:aem][:author][:find_replication_hosts_dynamically] 163 | cluster_name node[:aem][:cluster_name] 164 | cluster_role node[:aem][:publish][:cluster_role] 165 | aem_version node[:aem][:version] 166 | type :agent 167 | action :remove 168 | end 169 | 170 | # Set up author agents 171 | aem_replicator 'create_replication_agents_for_publish_servers' do 172 | local_user node[:aem][:author][:admin_user] 173 | local_password lazy { node[:aem][:author][:admin_password] } 174 | local_port node[:aem][:author][:port] 175 | remote_hosts node[:aem][:author][:replication_hosts] 176 | dynamic_cluster node[:aem][:author][:find_replication_hosts_dynamically] 177 | cluster_name node[:aem][:cluster_name] 178 | cluster_role node[:aem][:publish][:cluster_role] 179 | aem_version node[:aem][:version] 180 | type :agent 181 | action :add 182 | end 183 | 184 | # Set up replication agents 185 | aem_replicator 'replicate_to_publish_servers' do 186 | local_user node[:aem][:author][:admin_user] 187 | local_password lazy { node[:aem][:author][:admin_password] } 188 | local_port node[:aem][:author][:port] 189 | remote_hosts node[:aem][:author][:replication_hosts] 190 | dynamic_cluster node[:aem][:author][:find_replication_hosts_dynamically] 191 | cluster_name node[:aem][:cluster_name] 192 | cluster_role node[:aem][:publish][:cluster_role] 193 | aem_version node[:aem][:version] 194 | type :publish 195 | action :add 196 | end 197 | -------------------------------------------------------------------------------- /recipes/dispatcher.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: aem 3 | # Recipe:: dispatcher 4 | # 5 | # Copyright 2012, Tacit Knowledge, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | node.default[:apache][:enable_default_site] = false 20 | 21 | include_recipe 'apache2' 22 | include_recipe 'apache2::mod_ssl' 23 | include_recipe 'apache2::mod_expires' 24 | 25 | aem_dispatcher 'mod_dispatcher.so' do 26 | package_install node[:aem][:use_yum] 27 | dispatcher_uri node[:aem][:dispatcher][:mod_dispatcher_url] 28 | dispatcher_checksum node[:aem][:dispatcher][:mod_dispatcher_checksum] 29 | dispatcher_version node[:aem][:dispatcher][:version] 30 | dispatcher_file_cookbook node[:aem][:dispatcher][:dispatcher_file_cookbook] 31 | webserver_type node[:aem][:dispatcher][:webserver_type] 32 | apache_libexecdir node[:apache][:libexec_dir] || node[:apache][:libexecdir] 33 | action :install 34 | end 35 | 36 | # if we want to support non-apache, we'll need to do some more work here 37 | apache_module 'dispatcher' do 38 | # this will use the template mods/dispatcher.conf.erb 39 | conf true 40 | end 41 | 42 | # this is where our provider will put the farm config files 43 | farm_dir = "#{node[:apache][:dir]}/conf/aem-farms" 44 | node.default[:aem][:dispatcher][:farm_dir] = farm_dir 45 | 46 | directory farm_dir do 47 | owner 'root' 48 | group node[:apache][:root_group] 49 | mode '0775' 50 | action :create 51 | end 52 | 53 | # directory for sessionmanagement 54 | directory "#{node[:apache][:dir]}/dispatcher/sessions" do 55 | owner node[:apache][:user] 56 | group node[:apache][:root_group] 57 | mode '0775' 58 | recursive true 59 | action :create 60 | end 61 | 62 | template "#{node[:apache][:dir]}/conf/dispatcher.any" do 63 | source 'dispatcher.any.erb' 64 | owner 'root' 65 | group node[:apache][:root_group] 66 | mode '0664' 67 | action :create 68 | notifies :restart, 'service[apache2]' 69 | end 70 | 71 | # if we are including from another cookbook, we likely want to configure our own. 72 | default_farm = node[:aem][:dispatcher][:farm_name] 73 | aem_farm default_farm do 74 | action :add 75 | end if default_farm 76 | 77 | include_recipe 'iptables' 78 | 79 | iptables_rule '10apache' do 80 | source 'iptables.erb' 81 | end 82 | -------------------------------------------------------------------------------- /recipes/publish.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: aem 3 | # Recipe:: publish 4 | # 5 | # Copyright 2012, Tacit Knowledge, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | include_recipe 'aem::_base_aem_setup' 20 | 21 | unless node[:aem][:use_yum] 22 | aem_jar_installer 'publish' do 23 | download_url node[:aem][:download_url] 24 | default_context node[:aem][:publish][:default_context] 25 | port node[:aem][:publish][:port] 26 | action :install 27 | end 28 | end 29 | 30 | unless node[:aem][:license_url].nil? 31 | remote_file "#{node[:aem][:publish][:default_context]}/license.properties" do 32 | source "#{node[:aem][:license_url]}" 33 | sensitive true 34 | mode 0644 35 | end 36 | end 37 | 38 | unless node[:aem][:license_customer_name].nil? && node[:aem][:license_download_id].nil? 39 | template "#{node[:aem][:publish][:default_context]}/license.properties" do 40 | source 'license.properties.erb' 41 | sensitive true 42 | mode 0644 43 | end 44 | end 45 | 46 | if node[:aem][:version].to_f > 5.4 47 | node.set[:aem][:publish][:runnable_jar] = "aem-publish-p#{node[:aem][:publish][:port]}.jar" 48 | end 49 | 50 | aem_init 'aem-publish' do 51 | service_name 'aem-publish' 52 | default_context node[:aem][:publish][:default_context] 53 | runnable_jar node[:aem][:publish][:runnable_jar] 54 | base_dir node[:aem][:publish][:base_dir] 55 | jvm_opts node[:aem][:publish][:jvm_opts] 56 | jar_opts node[:aem][:publish][:jar_opts] 57 | action :add 58 | end 59 | 60 | service 'aem-publish' do 61 | # init script returns 0 for status no matter what 62 | status_command 'service aem-publish status | grep running' 63 | supports status: true, stop: true, start: true, restart: true 64 | action [:enable, :start] 65 | end 66 | 67 | if node[:aem][:version].to_f > 5.4 68 | node[:aem][:publish][:validation_urls].each do |url| 69 | aem_url_watcher url do 70 | validation_url url 71 | status_command 'service aem-publish status | grep running' 72 | max_attempts node[:aem][:publish][:startup][:max_attempts] 73 | wait_between_attempts node[:aem][:publish][:startup][:wait_between_attempts] 74 | user node[:aem][:publish][:admin_user] 75 | password node[:aem][:publish][:admin_password] 76 | action :wait 77 | end 78 | end 79 | else 80 | aem_port_watcher '4503' do 81 | status_command 'service aem-publish status | grep running' 82 | action :wait 83 | end 84 | end 85 | 86 | unless node[:aem][:publish][:new_admin_password].nil? 87 | # Change admin password 88 | aem_user node[:aem][:publish][:admin_user] do 89 | password node[:aem][:publish][:new_admin_password] 90 | admin_user node[:aem][:publish][:admin_user] 91 | admin_password node[:aem][:publish][:admin_password] 92 | port node[:aem][:publish][:port] 93 | aem_version node[:aem][:version] 94 | action :set_password 95 | end 96 | 97 | node.set[:aem][:publish][:admin_password] = node[:aem][:publish][:new_admin_password] 98 | node.set[:aem][:publish][:new_admin_password] = nil 99 | end 100 | 101 | # delete the privileged users from geometrixx, if they're still there. 102 | node[:aem][:geometrixx_priv_users].each do |user| 103 | aem_user user do 104 | admin_user node[:aem][:publish][:admin_user] 105 | admin_password lazy { node[:aem][:publish][:admin_password] } 106 | port node[:aem][:publish][:port] 107 | aem_version node[:aem][:version] 108 | path '/home/users/geometrixx' 109 | action :remove 110 | end 111 | end 112 | 113 | aem_ldap 'publish' do 114 | options node[:aem][:publish][:ldap][:options] 115 | action node[:aem][:publish][:ldap][:enabled] ? :enable : :disable 116 | end 117 | 118 | if node[:aem][:version].to_f < 5.5 119 | web_inf_dir = "#{node[:aem][:publish][:base_dir]}/server/runtime/0/_crx/WEB-INF" 120 | log "ABOUT TO CREATE DIR: #{web_inf_dir}" 121 | user = node[:aem][:aem_options]['RUNAS_USER'] 122 | directory web_inf_dir do 123 | owner user 124 | group user 125 | mode '0755' 126 | action :create 127 | recursive true 128 | end 129 | template "#{web_inf_dir}/web.xml" do 130 | source 'web.xml.erb' 131 | owner user 132 | group user 133 | mode '0644' 134 | action :create 135 | notifies :restart, 'service[aem-publish]' 136 | end 137 | end 138 | 139 | # If we're using the aem_package provider to deploy, do it now 140 | node[:aem][:publish][:deploy_pkgs].each do |pkg| 141 | aem_package pkg[:name] do 142 | version pkg[:version] 143 | aem_instance 'publish' 144 | package_url pkg[:url] 145 | update pkg[:update] 146 | user node[:aem][:publish][:admin_user] 147 | password lazy { node[:aem][:publish][:admin_password] } 148 | port node[:aem][:publish][:port] 149 | group_id pkg[:group_id] 150 | recursive pkg[:recursive] 151 | properties_file pkg[:properties_file] 152 | version_pattern pkg[:version_pattern] 153 | action pkg[:action] 154 | end 155 | end 156 | 157 | # Create cache flush agents 158 | aem_replicator 'create_flush_agents' do 159 | local_user node[:aem][:publish][:admin_user] 160 | local_password lazy { node[:aem][:publish][:admin_password] } 161 | local_port node[:aem][:publish][:port] 162 | remote_hosts node[:aem][:publish][:cache_hosts] 163 | dynamic_cluster node[:aem][:publish][:find_cache_hosts_dynamically] 164 | cluster_name node[:aem][:cluster_name] 165 | cluster_role node[:aem][:dispatcher][:cluster_role] 166 | aem_version node[:aem][:version] 167 | type :flush_agent 168 | action :add 169 | end 170 | 171 | # Set up cache flush agents 172 | aem_replicator 'flush_cache' do 173 | local_user node[:aem][:publish][:admin_user] 174 | local_password lazy { node[:aem][:publish][:admin_password] } 175 | local_port node[:aem][:publish][:port] 176 | remote_hosts node[:aem][:publish][:cache_hosts] 177 | dynamic_cluster node[:aem][:publish][:find_cache_hosts_dynamically] 178 | cluster_name node[:aem][:cluster_name] 179 | cluster_role node[:aem][:dispatcher][:cluster_role] 180 | aem_version node[:aem][:version] 181 | type :flush 182 | action :add 183 | end 184 | -------------------------------------------------------------------------------- /resources/dispatcher.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: aem 3 | # Resource:: dispatcher 4 | # 5 | # Copyright 2014, Tacit Knowledge, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | actions :install 20 | 21 | attribute :dispatcher_mod_name, kind_of: String, name_attribute: true 22 | attribute :package_install, kind_of: [TrueClass, FalseClass], default: false 23 | attribute :dispatcher_uri, kind_of: String, default: nil 24 | attribute :dispatcher_checksum, kind_of: String, default: nil 25 | attribute :dispatcher_version, kind_of: String, default: nil 26 | attribute :dispatcher_file_cookbook, kind_of: String, default: nil 27 | attribute :webserver_type, kind_of: String, default: nil 28 | attribute :apache_libexecdir, kind_of: String, default: nil 29 | -------------------------------------------------------------------------------- /resources/farm.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: aem 3 | # Resource:: farm 4 | # 5 | # Copyright 2012, Tacit Knowledge, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | actions :add, :remove 20 | 21 | attribute :farm_name, kind_of: String, name_attribute: true 22 | attribute :client_headers, kind_of: Array, default: nil 23 | attribute :virtual_hosts, kind_of: Array, default: nil 24 | attribute :renders, kind_of: Array, default: nil 25 | attribute :filter_rules, kind_of: Hash, default: nil 26 | attribute :cache_root, kind_of: String, default: nil 27 | attribute :farm_dir, kind_of: String, default: nil 28 | attribute :cache_rules, kind_of: Hash, default: nil 29 | attribute :invalidation_rules, kind_of: Hash, default: nil 30 | attribute :allowed_clients, kind_of: Hash, default: nil 31 | attribute :ignore_url_params, kind_of: Hash, default: nil 32 | attribute :statistics, kind_of: Array, default: nil 33 | attribute :cache_opts, kind_of: Array, default: nil 34 | attribute :session_mgmt, kind_of: Hash, default: nil 35 | attribute :enable_session_mgmt, kind_of: [TrueClass, FalseClass], default: false 36 | attribute :dynamic_cluster, kind_of: [TrueClass, FalseClass], default: false 37 | attribute :cluster_name, kind_of: String, default: nil 38 | attribute :cluster_role, kind_of: String, default: nil 39 | attribute :cluster_type, kind_of: String, default: nil 40 | attribute :render_timeout, kind_of: Integer, default: 0 41 | attribute :farm_template_cookbook, kind_of: String, default: 'aem' 42 | attribute :farm_template_source, kind_of: String, default: 'farm.any.erb' 43 | -------------------------------------------------------------------------------- /resources/group.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: aem 3 | # Resource:: group 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | actions :add, :remove, :add_user, :remove_user 18 | 19 | attribute :group, :kind_of => String, :name_attribute => true 20 | attribute :admin_user, :kind_of => String, :default => nil 21 | attribute :admin_password, :kind_of => String, :default => nil 22 | attribute :port, :kind_of => String, :default => nil 23 | attribute :aem_version, :kind_of => String, :default => node[:aem][:version] 24 | attribute :path, :kind_of => String, :default => nil # the path to the group in AEM 25 | attribute :user, :kind_of => String, :default => nil 26 | -------------------------------------------------------------------------------- /resources/init.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: aem 3 | # Resource:: init 4 | # 5 | # Copyright 2012, Tacit Knowledge, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | # This resource creates an init script for AEM 20 | 21 | actions :add 22 | 23 | attribute :service_name, kind_of: String, name_attribute: true, required: true 24 | attribute :aem_options, kind_of: Hash, default: nil 25 | attribute :default_context, kind_of: String, default: nil 26 | attribute :runnable_jar, kind_of: String, default: nil 27 | attribute :base_dir, kind_of: String, default: nil 28 | attribute :jvm_opts, kind_of: Hash, default: nil 29 | attribute :jar_opts, kind_of: Array, default: nil 30 | -------------------------------------------------------------------------------- /resources/jar_installer.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: aem 3 | # Resource:: jar_installer 4 | # 5 | # Copyright 2012, Tacit Knowledge, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | # This resource creates an init script for AEM 20 | 21 | actions :install, :remove 22 | 23 | attribute :name, kind_of: String, name_attribute: true, required: true 24 | attribute :download_url, kind_of: String, default: nil 25 | attribute :base_dir, kind_of: String, default: nil 26 | attribute :default_context, kind_of: String, default: nil 27 | attribute :port, kind_of: String, default: nil 28 | -------------------------------------------------------------------------------- /resources/jcr_node.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: aem 3 | # Resource:: jcr_node 4 | # 5 | # Copyright 2015, Tacit Knowledge, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | # This resource manages an AEM JCR node 20 | 21 | actions :create, :delete 22 | default_action :create 23 | 24 | attribute :name, kind_of: String, name_attribute: true 25 | attribute :path, kind_of: String, required: true 26 | attribute :type, kind_of: String, default: nil 27 | attribute :contents, kind_of: String, required: true 28 | attribute :host, kind_of: String, required: true 29 | attribute :port, kind_of: String, required: true 30 | attribute :user, kind_of: String, required: true 31 | attribute :password, kind_of: String, required: true 32 | -------------------------------------------------------------------------------- /resources/ldap.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: aem 3 | # Resource:: ldap 4 | # 5 | # Copyright 2012, Tacit Knowledge, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | # This resource creates an ldap config file for a AEM instance and enables it. 20 | 21 | actions :enable, :disable 22 | 23 | attribute :instance_name, kind_of: String, name_attribute: true 24 | attribute :options, kind_of: Hash, default: nil 25 | -------------------------------------------------------------------------------- /resources/package.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: aem 3 | # Resource:: package 4 | # 5 | # Copyright 2012, Tacit Knowledge, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | # This resource manages AEM packages 20 | 21 | actions :upload, :install, :activate, :uninstall, :delete 22 | 23 | attribute :name, kind_of: String, name_attribute: true, required: true 24 | attribute :aem_instance, kind_of: String, required: true 25 | attribute :pkg_mgr_url, kind_of: String, default: nil 26 | attribute :package_url, kind_of: String, default: nil 27 | attribute :version, kind_of: String, default: nil 28 | attribute :file_extension, kind_of: String, default: '.zip' 29 | attribute :update, kind_of: [TrueClass, FalseClass], default: false 30 | attribute :user, kind_of: String, required: true 31 | attribute :password, kind_of: String, required: true 32 | attribute :port, kind_of: String, required: true 33 | attribute :group_id, kind_of: String, default: nil 34 | attribute :recursive, kind_of: [TrueClass, FalseClass], default: false 35 | attribute :properties_file, kind_of: String, default: nil 36 | attribute :version_pattern, kind_of: String, default: nil 37 | -------------------------------------------------------------------------------- /resources/port_watcher.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: services 3 | # Resource:: port_watcher 4 | # 5 | # Copyright 2012, Tacit Knowledge, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | actions :wait 20 | 21 | attribute :port, kind_of: String, name_attribute: true 22 | attribute :protocol, kind_of: String, default: 'tcp' 23 | attribute :status_command, kind_of: String, default: nil, required: true 24 | # timeout is in seconds 25 | attribute :timeout, kind_of: Integer, default: nil 26 | -------------------------------------------------------------------------------- /resources/replicator.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: aem 3 | # Resource:: replicator 4 | # 5 | # Copyright 2012, Tacit Knowledge, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | actions :add, :remove 20 | 21 | attribute :name, kind_of: String, name_attribute: true 22 | attribute :local_user, kind_of: String, required: true 23 | attribute :local_password, kind_of: String, required: true 24 | attribute :local_port, kind_of: String, required: true 25 | attribute :remote_hosts, kind_of: Array, default: [] 26 | attribute :dynamic_cluster, kind_of: [TrueClass, FalseClass], default: false 27 | attribute :cluster_name, kind_of: String, default: nil 28 | attribute :cluster_role, kind_of: String, default: nil 29 | attribute :type, kind_of: Symbol, default: nil 30 | attribute :server, kind_of: String, default: nil 31 | attribute :aem_version, kind_of: String, default: nil 32 | -------------------------------------------------------------------------------- /resources/url_watcher.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: services 3 | # Resource:: url_watcher 4 | # 5 | # Copyright 2012, Tacit Knowledge, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | actions :wait 20 | 21 | attribute :name, kind_of: String, name_attribute: true 22 | attribute :validation_url, kind_of: String, default: nil, required: true 23 | attribute :status_command, kind_of: String, default: nil, required: true 24 | attribute :max_attempts, kind_of: Integer, default: nil, required: true 25 | attribute :wait_between_attempts, kind_of: Integer, default: nil, required: true 26 | attribute :user, kind_of: String, default: nil 27 | attribute :password, kind_of: String, default: nil 28 | attribute :match_string, kind_of: String, default: nil 29 | -------------------------------------------------------------------------------- /resources/user.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: aem 3 | # Resource:: password 4 | # 5 | # Copyright 2012, Tacit Knowledge, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | # This resource sets a users password for AEM 20 | 21 | actions :add, :remove, :set_password 22 | 23 | attribute :user, kind_of: String, name_attribute: true 24 | attribute :password, kind_of: String, default: nil 25 | attribute :admin_user, kind_of: String, default: nil 26 | attribute :admin_password, kind_of: String, default: nil 27 | attribute :port, kind_of: String, default: nil 28 | attribute :aem_version, kind_of: String, default: node[:aem][:version] 29 | attribute :path, kind_of: String, default: nil # the path to the user in AEM 30 | attribute :group, kind_of: String, default: nil 31 | -------------------------------------------------------------------------------- /resources/website.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: aem 3 | # Resource:: website 4 | # 5 | # Copyright 2012, Tacit Knowledge, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | # This resource will add or remove an apache virtual host containing locations 20 | # that will be served by dispatcher 21 | 22 | actions :add, :remove 23 | 24 | attribute :site_name, kind_of: String, name_attribute: true 25 | attribute :server_name, kind_of: String, default: nil 26 | attribute :server_aliases, kind_of: Array, default: nil 27 | attribute :aem_locations, kind_of: Array, default: nil 28 | attribute :cache_root, kind_of: String, default: nil 29 | attribute :enabled, kind_of: String, default: nil 30 | attribute :rewrites, kind_of: Array, default: nil 31 | attribute :listen_port, kind_of: String, default: nil 32 | attribute :ssl_enabled, kind_of: [TrueClass, FalseClass], default: false 33 | attribute :ssl_cert_file, kind_of: String, default: nil 34 | attribute :ssl_key_file, kind_of: String, default: nil 35 | attribute :expire_dirs, kind_of: Array, default: nil 36 | attribute :enable_etag, kind_of: [TrueClass, FalseClass], default: false 37 | attribute :enable_ie_header, kind_of: [TrueClass, FalseClass], default: false 38 | attribute :template_cookbook, kind_of: String, default: 'aem' 39 | attribute :template_name, kind_of: String, default: 'aem_dispatcher.conf.erb' 40 | attribute :deflate_enabled, kind_of: [TrueClass, FalseClass], default: false 41 | attribute :local_vars, kind_of: Hash, default: nil 42 | attribute :header, kind_of: Array, default: nil 43 | -------------------------------------------------------------------------------- /templates/default/aem_dispatcher.conf.erb: -------------------------------------------------------------------------------- 1 | # Generated by Chef for <%= node[:fqdn] %> 2 | # Local modifications will be overwritten. 3 | > 4 | ServerName <%= @params[:server_name] %> 5 | ServerAlias <% @params[:server_aliases].each do |a| %><%= "#{a}" %> <% end %> 6 | DocumentRoot <%= @params[:docroot] %> 7 | UseCanonicalName Off 8 | RewriteEngine On 9 | ExpiresActive On 10 | TraceEnable Off 11 | 12 | <% if @params[:deflate_enabled] %> 13 | 14 | SetOutputFilter DEFLATE 15 | 16 | 17 | # Netscape 4.x has some problems 18 | BrowserMatch ^Mozilla/4 gzip-only-text/html 19 | 20 | # Netscape 4.06-4.08 have some more problems 21 | BrowserMatch ^Mozilla/4\.0[678] no-gzip 22 | 23 | # MSIE masquerades as Netscape, but it is fine 24 | BrowserMatch \bMSIE !no-gzip !gzip-only-text/html 25 | 26 | # Don't compress already-compressed files 27 | SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary 28 | SetEnvIfNoCase Request_URI .(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary 29 | SetEnvIfNoCase Request_URI .(?:avi|mov|mp3|mp4|rm|flv|swf|mp?g)$ no-gzip dont-vary 30 | SetEnvIfNoCase Request_URI .pdf$ no-gzip dont-vary 31 | 32 | 33 | 34 | # Make sure proxies don't deliver the wrong content 35 | Header append Vary User-Agent env=!dont-vary 36 | 37 | 38 | <% end %> 39 | 40 | <% if @params[:ssl_enabled] %> 41 | SSLEngine on 42 | SSLOptions +StrictRequire 43 | 44 | 45 | SSLRequireSSL 46 | 47 | 48 | SSLProtocol -all +TLSv1 +SSLv3 49 | SSLCipherSuite HIGH:MEDIUM:!aNULL:+SHA1:+MD5:+HIGH:+MEDIUM 50 | 51 | SSLCertificateFile <%= @params[:ssl_cert_file] %> 52 | SSLCertificateKeyFile <%= @params[:ssl_key_file] %> 53 | SSLVerifyClient none 54 | SSLProxyEngine off 55 | 56 | 57 | AddType application/x-x509-ca-cert .crt 58 | AddType application/x-pkcs7-crl .crl 59 | 60 | <% end %> 61 | 62 | <% unless @params[:enable_etag] %> 63 | 64 | Header unset ETag 65 | 66 | FileETag None 67 | <% end %> 68 | 69 | <% if @params[:enable_ie_header] %> 70 | 71 | 72 | Header set X-UA-Compatible "IE=9; IE=8; IE=7; IE=EDGE" 73 | 74 | 75 | <% end %> 76 | 77 | <% @params[:rewrites].each do |rule| %> 78 | <%= rule %> 79 | <% end %> 80 | 81 | <% @params[:aem_locations].each do |dir| %> 82 | > 83 | 84 | SetHandler dispatcher-handler 85 | ModMimeUsePathInfo On 86 | 87 | 88 | 89 | <% end %> 90 | "> 91 | Options Indexes FollowSymLinks 92 | AllowOverride None 93 | Order allow,deny 94 | Allow from all 95 | 96 | 97 | <% @params[:expire_dirs].each do |dir| %> 98 | > 99 | <% dir[:rules].each do |rule| %> 100 | <%= rule %> 101 | <% end %> 102 | 103 | 104 | <% end %> 105 | 106 | 107 | SetHandler server-status 108 | 109 | Order Deny,Allow 110 | Deny from all 111 | Allow from 127.0.0.1 112 | 113 | 114 | DirectoryIndex index.html index.html.var 115 | 116 | LogLevel info 117 | ErrorLog <%= node[:apache][:log_dir] %>/<%= @params[:name] %>-error.log 118 | CustomLog <%= node[:apache][:log_dir] %>/<%= @params[:name] %>-access.log combined 119 | 120 | RewriteEngine On 121 | RewriteLog <%= node[:apache][:log_dir] %>/<%= @application_name %>-rewrite.log 122 | RewriteLogLevel 0 123 | 124 | <% @params[:header].each do |head| %> 125 | <%= head %> 126 | <% end %> 127 | 128 | 129 | -------------------------------------------------------------------------------- /templates/default/aem_pkg_version.erb: -------------------------------------------------------------------------------- 1 | # Generated by Chef for <%= node[:fqdn] %> 2 | # If you mess with this file, AEM package deployments will almost certainly 3 | # not work anymore. At least not the way you expect. 4 | 5 | <%= @params[:version] %> 6 | -------------------------------------------------------------------------------- /templates/default/dispatcher.any.erb: -------------------------------------------------------------------------------- 1 | # Generated by Chef for <%= node[:fqdn] %> 2 | # Local modifications will be overwritten. 3 | 4 | /farms 5 | { 6 | <% node[:aem][:dispatcher][:farm_files].each do |farm| %> 7 | $include "<%= node[:aem][:dispatcher][:farm_dir] %>/<%= farm %>" 8 | <% end %> 9 | } 10 | -------------------------------------------------------------------------------- /templates/default/farm.any.erb: -------------------------------------------------------------------------------- 1 | # Generated by Chef for <%= node[:fqdn] %> 2 | # Local modifications will be overwritten. 3 | 4 | /<%= @farm_name %> 5 | { 6 | /clientheaders 7 | { 8 | <% @client_headers.each do |hdr| %> 9 | "<%= hdr %>" 10 | <% end %> 11 | } 12 | /virtualhosts 13 | { 14 | <% @virtual_hosts.each do |host| %> 15 | "<%= host %>" 16 | <% end %> 17 | } 18 | /renders 19 | { 20 | <% @renders.each do |render| %> 21 | /<%= render[:name] %> 22 | { 23 | /hostname "<%= render[:hostname] %>" 24 | /port "<%= render[:port] %>" 25 | /timeout "<%= render[:timeout] %>" 26 | } 27 | <% end %> 28 | } 29 | /filter 30 | { 31 | <% @filter_rules.keys.sort.each do |rule_number| %> 32 | /<%= rule_number %> { <%= @filter_rules[rule_number] %> } 33 | <% end %> 34 | } 35 | /cache 36 | { 37 | /docroot "<%= @cache_root %>" 38 | <% @cache_opts.each do |opt| %> 39 | <%= opt %> 40 | <% end %> 41 | /rules 42 | { 43 | <% @cache_rules.keys.sort.each do |rule_number| %> 44 | /<%= rule_number %> 45 | { 46 | /glob "<%= @cache_rules[rule_number][:glob] %>" 47 | /type "<%= @cache_rules[rule_number][:type] %>" 48 | } 49 | <% end %> 50 | } 51 | /invalidate 52 | { 53 | <% @invalidation_rules.keys.sort.each do |rule_number| %> 54 | /<%= rule_number %> 55 | { 56 | /glob "<%= @invalidation_rules[rule_number][:glob] %>" 57 | /type "<%= @invalidation_rules[rule_number][:type] %>" 58 | } 59 | <% end %> 60 | } 61 | /allowedClients 62 | { 63 | <% @allowed_clients.keys.sort.each do |rule_number| %> 64 | /<%= rule_number %> 65 | { 66 | /glob "<%= @allowed_clients[rule_number][:glob] %>" 67 | /type "<%= @allowed_clients[rule_number][:type] %>" 68 | } 69 | <% end %> 70 | } 71 | /ignoreUrlParams 72 | { 73 | <% @ignore_url_params.keys.sort.each do |rule_number| %> 74 | /<%= rule_number %> 75 | { 76 | /glob "<%= @ignore_url_params[rule_number][:glob] %>" 77 | /type "<%= @ignore_url_params[rule_number][:type] %>" 78 | } 79 | <% end %> 80 | } 81 | } 82 | /statistics 83 | { 84 | /categories 85 | { 86 | <% @statistics.each do |category| %> 87 | /<%= category[:name] %> 88 | { 89 | /glob "<%= category[:glob] %>" 90 | } 91 | <% end %> 92 | } 93 | } 94 | <% if @enable_session_mgmt then %> 95 | /sessionmanagement 96 | { 97 | <% @session_mgmt.keys.each do |key| %> 98 | /<%= key %> "<%= @session_mgmt[key] %>" 99 | <% end %> 100 | } 101 | <% end %> 102 | } 103 | -------------------------------------------------------------------------------- /templates/default/init.erb: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Generated by Chef for <%= node[:fqdn] %> 4 | # Local modifications will be overwritten. 5 | # 6 | # 7 | # chkconfig: - 80 10 8 | # description: AEM Author Service 9 | #--------------------------------------------------------------------- 10 | # $Id: serverctl 73877 2011-01-25 11:31:10Z bdelacre $ 11 | #--------------------------------------------------------------------- 12 | # This is the Quickstart variant of the serverctl script, which 13 | # is subtly different from the CQSE variant - check diffs for 14 | # more info. 15 | #--------------------------------------------------------------------- 16 | 17 | <% @aem_options.keys.sort.each do |key| %> 18 | <%= key %>=<%= @aem_options[key] %> 19 | <% end %> 20 | CQ_JVM_OPTS="<%= (@jvm_opts.keys.sort.map {|k| k if @jvm_opts[k]}).compact.join " " %>" 21 | 22 | CQ_JAR_OPTS="<%= @jar_opts.join " " %>" 23 | 24 | DEFAULT_CQ_CONTEXT=<%= @default_context %> 25 | 26 | CQ_RUNNABLE_JAR=<%= @runnable_jar %> 27 | 28 | #--------------------------------------------------------------------- 29 | # Don't edit below here 30 | #--------------------------------------------------------------------- 31 | 32 | KILL="/bin/kill" 33 | NOHUP="/usr/bin/nohup" 34 | 35 | #--------------------------------------------------------------------- 36 | # functions 37 | #--------------------------------------------------------------------- 38 | 39 | # print the usage info 40 | usage() { 41 | cat <<-@@ 42 | Day Quickstart Server Control, version 5.0.0 ($CQ_SVN_ID) 43 | usage: `basename $0` [options] {start|stop|restart|status} 44 | 45 | Engine Options: 46 | --context the communique context directory, defaults to `dirname $0` 47 | --port, -p the default port to listen to if not overrriden in server.xml 48 | --logdir the log directory for startup.log. defaults to `dirname $0`/logs 49 | --log the startup log file. defaults to `dirname $0`/logs/startup.log 50 | --interface, -a the interface to bind to (use 0.0.0.0 for any). 51 | --jar explicitely specify the jar file to run, relative to --context 52 | 53 | Java Options: 54 | --javahome the java home directory. overrides JAVA_HOME env var. 55 | --heap-min the minimum heap in megabytes. defaults to 128 56 | --heap-max the maximum heap in megabytes. defaults to 256 57 | --permgen the permgen space in megabytesm defaults to 128 58 | --debug, -d [socket|shmem] 59 | starts jvm in debug mode. default 'socket' 60 | --debug-suspended [socket|shmem] 61 | starts jvm in suspended debug mode. default 'socket' 62 | --debug-port port for debug address. default "${CQ_JVM_DEBUG_PORT}" 63 | --profile [yjp] start jvm with YourKit Java Profiler 64 | --javaopts additional java options 65 | --jaas use jaas.config. default is disabled 66 | --jaas-config config for jaas. default is /etc/jaas.config 67 | --verbose-gc turn on vebose gc 68 | 69 | Other options 70 | --fg, -D starts AEM in foreground 71 | --bg starts AEM in background. this is the default. 72 | --verbose, -v be more verbose 73 | --dry prepare but do not start 74 | --help, -h show this help 75 | --max-files sets the ulimit for max open files before executing the jvm. 76 | default is 8192 77 | @@ 78 | } 79 | 80 | # init the defaults 81 | initDefaults() { 82 | #BASEDIR=`fullpath -d $0` 83 | BASEDIR='<%= @base_dir %>' 84 | CQ_SVN_ID='$Rev: 73877 $' 85 | export CQ_SVN_ID 86 | CQ_CONTEXT="${CQ_CONTEXT:-$DEFAULT_CQ_CONTEXT}" 87 | export CQ_CONTEXT 88 | export CQ_PORT 89 | CQ_LOGDIR="${CQ_LOGDIR:-"$BASEDIR/logs"}" 90 | export CQ_LOGDIR 91 | CQ_LOG="${CQ_LOG:-"$CQ_LOGDIR/startup.log"}" 92 | export CQ_LOG 93 | CQ_INTERFACE="${CQ_INTERFACE:-$CQ_ADDRESS}" 94 | export CQ_INTERFACE 95 | CQ_JVM_HEAP_MIN="${CQ_HEAP_MIN:-"128"}" 96 | export CQ_JVM_HEAP_MIN 97 | CQ_JVM_HEAP_MAX="${CQ_HEAP_MAX:-"384"}" 98 | export CQ_JVM_HEAP_MAX 99 | CQ_PERMGEN="${CQ_PERMGEN:-"128"}" 100 | export CQ_PERMGEN 101 | export CQ_JVM_JAAS 102 | CQ_JVM_JAAS_CONFIG="`dirname $0`/etc/jaas.config" 103 | export CQ_JVM_JAAS_CONFIG 104 | export CQ_JVM_OPTS 105 | export CQ_JVM_VERBOSE_GC 106 | export CQ_JVM_DEBUG 107 | CQ_JVM_DEBUG_PORT=${CQ_JVM_DEBUG_PORT:-30303} 108 | export CQ_JVM_DEBUG_PORT 109 | CQ_JVM_DEBUG_SUSPENDED=n 110 | export CQ_JVM_DEBUG_SUSPENDED 111 | export CQ_JVM_PROFILE 112 | export CQ_FOREGROUND 113 | export CQ_DRY 114 | CQ_COMMAND=${CQ_COMMAND} 115 | export CQ_COMMAND 116 | export CQ_VERBOSE 117 | CQ_MAX_OPEN_FILES="${CQ_MAX_OPEN_FILES:-"8192"}" 118 | export CQ_MAX_OPEN_FILES 119 | STOP_MESSAGE="${STOP_MESSAGE:-Use CTRL-C or the stop script to stop server}" 120 | export STOP_MESSAGE 121 | NOFORK_OPT="-nofork -nobrowser" 122 | export NOFORK_OPT 123 | QUICKSTART_OPTS="${QUICKSTART_OPTS:-$NOFORK_OPT}" 124 | export QUICKSTART_OPTS 125 | } 126 | 127 | # echo to stderr and to the log file 128 | _log() { 129 | _level=$1; shift 130 | if [ "$use_stderr" = "YES" ] ; then 131 | echo "`date '+%d.%m.%Y %H:%M:%S'` *$_level* $*" >&2 132 | fi 133 | if [ -w "$CQ_LOG" ]; then 134 | echo "`date '+%d.%m.%Y %H:%M:%S'` *$_level* $*" >> "$CQ_LOG" 135 | fi 136 | } 137 | 138 | # log an error message 139 | err() { 140 | _log "ERROR" $* 141 | } 142 | 143 | # log an warning message 144 | warn() { 145 | _log "WARN " $* 146 | } 147 | 148 | # log an info message 149 | info() { 150 | _log "INFO " $* 151 | } 152 | 153 | # fatal error 154 | fatal() { 155 | err $* 156 | exit 1 157 | } 158 | 159 | # print all relevant variables 160 | dump() { 161 | set | grep CQ | sort 162 | } 163 | 164 | # calculate the fullpath 165 | fullpath() { 166 | OPWD="$PWD" 167 | if [ "$1" = "-d" ]; then 168 | cd `dirname $2` 169 | NPWD=`pwd -L` 170 | else 171 | cd `dirname $1` 172 | NPWD=`pwd -L`/`basename $1` 173 | fi 174 | 175 | # Bug 21241: on cygwin, convert path to windows style 176 | # Note: uname -s returns something like CYGWIN_NT-5.1 177 | IS_CYGWIN=`uname -s | grep "CYGWIN" 2>&1 >/dev/null` 178 | if [ -n "${IS_CYGWIN}" ]; then 179 | NPWD=`cygpath -m $NPWD` 180 | fi 181 | 182 | echo $NPWD 183 | cd $OPWD 184 | } 185 | 186 | # check if verbose level 187 | verbose() { 188 | test -n "$CQ_VERBOSE" 189 | } 190 | 191 | # print the java version of the $CQ_JVM vm 192 | javaVersion() { 193 | jvm_version=`$CQ_JVM -version 2>&1 | grep "java version"` 194 | case "$jvm_version" in 195 | "java version \"1.2"*) echo 1.2;; 196 | "java version \"1.3"*) echo 1.3;; 197 | "java version \"1.4"*) echo 1.4;; 198 | "java version \"1.5"*) echo 1.5;; 199 | "java version \"1.6"*) echo 1.6;; 200 | *) echo ;; 201 | esac 202 | } 203 | 204 | # print the debug info 205 | printDebug() { 206 | if [ "$CQ_JVM_DEBUG" = "socket" ]; then 207 | info "attaching debugger on port ${CQ_JVM_DEBUG_PORT}" 208 | if [ "${CQ_JVM_DEBUG_SUSPENDED}" = y ]; then 209 | info "jvm is suspended! attach debugger to continue." 210 | fi 211 | fi 212 | if [ "$CQ_JVM_DEBUG" = "shmem" ]; then 213 | info "attaching debugger using shared memory" 214 | if [ "${CQ_JVM_DEBUG_SUSPENDED}" = y ]; then 215 | info "jvm is suspended! attach debugger to continue." 216 | fi 217 | fi 218 | } 219 | 220 | # set ulimit value appropriately 221 | setUlimit() { 222 | NOF=`ulimit -n` 223 | if [ $NOF -lt $CQ_MAX_OPEN_FILES ]; then 224 | # already set limit is too low, increase it at least 225 | # standard value 226 | ulimit -n $CQ_MAX_OPEN_FILES 227 | fi 228 | } 229 | 230 | # Echo the path of the runnable jar to use, relative to CQ_CONTEXT 231 | findRunnableJar() { 232 | # look in CQ_HOME and under its target subfolder 233 | # for a single jar file containing crx, cq, aem, or quickstart in its name 234 | OLD_PWD=`pwd` 235 | cd $CQ_CONTEXT > /dev/null 236 | JARPATH="*.jar target/*.jar" 237 | EXPR="aem|crx|cq|quickstart" 238 | JARS=`ls $JARPATH 2>/dev/null | egrep $EXPR` 239 | COUNT=` ( for i in $JARS ; do echo $i ; done ) | wc -l ` 240 | if [ $COUNT -ne 1 ] ; then 241 | MSG="Expected 1 runnable jar file in ($JARPATH) under $PWD, found $JARS" 242 | err $MSG 243 | echo $MSG >&2 244 | fi 245 | cd $OLD_PWD > /dev/null 246 | echo $JARS 247 | } 248 | 249 | #--------------------------------------------------------------------- 250 | # main program begins here 251 | #--------------------------------------------------------------------- 252 | 253 | # parse the arguments 254 | initDefaults 255 | while [ -n "$1" ]; do 256 | case "$1" in 257 | '--context') 258 | CQ_CONTEXT=$2 259 | shift;; 260 | '--port' | '-p') 261 | CQ_PORT=$2 262 | shift;; 263 | '--logdir') 264 | CQ_LOGDIR=$2 265 | shift;; 266 | '--log') 267 | CQ_LOG=$2 268 | shift;; 269 | '--interface' | '-a') 270 | CQ_INTERFACE=$2 271 | shift;; 272 | '--jar') 273 | CQ_RUNNABLE_JAR=$2 274 | shift;; 275 | '--javahome') 276 | JAVA_HOME=$2 277 | shift;; 278 | '--javaopts') 279 | CQ_JVM_OPTS=$2 280 | shift;; 281 | '--heap-min') 282 | CQ_JVM_HEAP_MIN=$2 283 | shift;; 284 | '--heap-max') 285 | CQ_JVM_HEAP_MAX=$2 286 | shift;; 287 | '--permgen') 288 | CQ_PERMGEN=$2 289 | shift;; 290 | '--debug' | '-d' | '--debug-suspended') 291 | CQ_JVM_DEBUG=socket 292 | if [ "$1" = "--debug-suspended" ]; then 293 | CQ_JVM_DEBUG_SUSPENDED=y 294 | fi 295 | if [ "$2" = "socket" -o "$2" = "shmem" ]; then 296 | CQ_JVM_DEBUG=$2 297 | shift 298 | fi;; 299 | '--profile') 300 | CQ_JVM_PROFILE=yjp 301 | if [ "$2" = "yjp" ]; then 302 | CQ_JVM_PROFILE=$2 303 | shift 304 | fi;; 305 | '--debug-port') 306 | CQ_JVM_DEBUG_PORT=$2 307 | shift;; 308 | '--debug-suspended') 309 | CQ_JVM_DEBUG_SUSPENDED=y 310 | ;; 311 | '--jaas') 312 | CQ_JVM_JAAS=y 313 | ;; 314 | '--jaas-config') 315 | CQ_JVM_JAAS_CONFIG=$2 316 | shift;; 317 | '--verbose-gc') 318 | CQ_JVM_VERBOSE_GC=y 319 | ;; 320 | '--fg' | '-D') 321 | CQ_FOREGROUND=y 322 | ;; 323 | '--bg') 324 | CQ_FOREGROUND=n 325 | ;; 326 | '--verbose' | '-v') 327 | CQ_VERBOSE=y 328 | ;; 329 | '--max-files') 330 | CQ_MAX_OPEN_FILES=$2 331 | shift;; 332 | '--dry') 333 | CQ_DRY=y 334 | ;; 335 | '--help' | '-h') 336 | usage 337 | exit ;; 338 | 'status'|'start'|'stop'|'restart') 339 | CQ_COMMAND=$1 340 | ;; 341 | *) 342 | echo "Invalid option: $1" 343 | usage 344 | exit;; 345 | esac 346 | shift 347 | done 348 | 349 | # get and check runnable jar filename 350 | #-------------------------------------------------------------------------------- 351 | CQ_RUNNABLE_JAR="${CQ_RUNNABLE_JAR:-`findRunnableJar`}" 352 | CQ_RUNNABLE_JAR_FULLPATH=${CQ_CONTEXT}/${CQ_RUNNABLE_JAR} 353 | if [ -z "$CQ_RUNNABLE_JAR" ] ; then 354 | echo "Runnable jar not found, cannot start" >&2 355 | exit 4 356 | fi 357 | if [ ! -f "$CQ_RUNNABLE_JAR_FULLPATH" ] ; then 358 | echo "$CQ_RUNNABLE_JAR_FULLPATH not found" >&2 359 | exit 4 360 | fi 361 | 362 | # process options 363 | #-------------------------------------------------------------------------------- 364 | case "$CQ_COMMAND" in 365 | 'start') # test to be sure we can run, then bg 366 | # the startup 367 | use_stderr="YES" 368 | 369 | if [ ! -d "$CQ_LOGDIR" ] ; then 370 | su $RUNAS_USER -c "mkdir -p \"$CQ_LOGDIR\" 2>/dev/null || \ 371 | ( echo \"mkdir failed for $CQ_LOGDIR\" >&2 ; exit 2 )" 372 | fi 373 | for file in "$CQ_LOG" "$CQ_LOGDIR/cq.pid" ; do 374 | if [ ! -w "$file" ] ; then 375 | su $RUNAS_USER -c "touch \"$file\" 2>/dev/null || \ 376 | ( \"Couldn't create file $file\" >&2 ; exit 2 )" 377 | fi 378 | done 379 | 380 | if [ -n "$JAVA_HOME" -a -x "$JAVA_HOME/bin/java" ] ; then 381 | CQ_JVM=$JAVA_HOME/bin/java 382 | else 383 | JAVA_HOME= 384 | CQ_JVM="`which java 2>/dev/null`" 385 | if [ -z "$CQ_JVM" ] ; then 386 | for pfix in "/usr/local" "/opt" "/usr" ; do 387 | for jvers in "java" "j2sdk" "j2sdk1.4" "java1.4" \ 388 | "j2sdk1.3.1" "java1.3.1" "j2sdk1.3" "java1.3" ; do 389 | if [ -x "$pfix/$jvers/bin/java" ] ; then 390 | CQ_JVM="$pfix/$jvers/bin/java" 391 | break 2 392 | fi 393 | done 394 | done 395 | if [ -z "$CQ_JVM" ] ; then 396 | err "Unable to locate java, please make sure java is installed and JAVA_HOME set" 397 | exit 3 398 | fi 399 | fi 400 | fi 401 | 402 | # check if already running 403 | CQ_PID=`cat "$CQ_LOGDIR/cq.pid" 2> /dev/null` 404 | if [ -n "$CQ_PID" ]; then 405 | if ps -p $CQ_PID > /dev/null; then 406 | err "process $CQ_PID already running. please stop and try again." 407 | exit 4 408 | else 409 | warn "pid file $CQ_LOGDIR/cq.pid present, but process not running. "\ 410 | "maybe unclean shutdown ?" 411 | rm -f "$CQ_LOGDIR/cq.pid" 412 | CQ_PID= 413 | fi 414 | fi 415 | 416 | # assemble the startup param 417 | CQ_JAVA_VERSION=`javaVersion` 418 | if [ -n "$CQ_JVM_JAAS" ]; then 419 | jvmOpts="$jvmOpts -Djava.security.auth.login.config=$CQ_JVM_JAAS_CONFIG" 420 | fi 421 | if [ -n "$CQ_JVM_VERBOSE_GC" ]; then 422 | jvmOpts="$jvmOpts -verbose:gc" 423 | fi 424 | jvmOpts="$jvmOpts -Xms${CQ_JVM_HEAP_MIN}m" 425 | jvmOpts="$jvmOpts -Xmx${CQ_JVM_HEAP_MAX}m" 426 | jvmOpts="$jvmOpts -XX:MaxPermSize=${CQ_PERMGEN}m" 427 | jvmOpts="$jvmOpts -Djava.awt.headless=true" 428 | 429 | if [ -n "$CQ_JVM_DEBUG" ]; then 430 | jvmOpts="$jvmOpts -Xdebug -Xnoagent -Djava.compiler=NONE \ 431 | -Xrunjdwp:transport=dt_$CQ_JVM_DEBUG,address=$CQ_JVM_DEBUG_PORT,\ 432 | server=y,suspend=${CQ_JVM_DEBUG_SUSPENDED}" 433 | fi 434 | if [ "$CQ_JVM_PROFILE" = yjp ]; then 435 | if [ $CQ_JAVA_VERSION = "1.4" ]; then 436 | jvmOpts="$jvmOpts -Xrunyjpagent" 437 | else 438 | jvmOpts="$jvmOpts -agentlib:yjpagent" 439 | fi 440 | fi 441 | jvmOpts="$jvmOpts $CQ_JVM_OPTS" 442 | 443 | case "`uname -s`" in 444 | "AIX"*) 445 | # AIX java has a broken JIT compiler 446 | # see bugs: 8810 and 9072 447 | JITC_COMPILEOPT=NALL{com/day/cq/contentbus/core/HierarchyMapImpl$MapNode}{setChildrenOrder}{com/day/util/Counter}{*}{com/day/cq/mq/MessageQueueImpl}{*} 448 | export JITC_COMPILEOPT 449 | ;; 450 | esac 451 | 452 | # assemble program arguments 453 | if [ -n "$CQ_JAR_OPTS" ]; then 454 | cqOpts="$cqOpts $CQ_JAR_OPTS" 455 | fi 456 | if [ -n "$CQ_PORT" ]; then 457 | cqOpts="$cqOpts -p $CQ_PORT" 458 | fi 459 | if [ -n "$CQ_INTERFACE" ]; then 460 | cqOpts="$cqOpts -a $CQ_INTERFACE" 461 | fi 462 | if [ -n "$QUICKSTART_OPTS" ]; then 463 | cqOpts="$cqOpts $QUICKSTART_OPTS" 464 | fi 465 | 466 | # executable string 467 | jvmExe="$CQ_JVM $jvmOpts -jar $CQ_RUNNABLE_JAR $cqOpts" 468 | export jvmExe 469 | 470 | if verbose; then 471 | dump 472 | echo "" 473 | echo "Execute: $jvmExe" 474 | echo "From directory: $CQ_CONTEXT" 475 | echo "" 476 | fi 477 | if [ -n "$CQ_DRY" ]; then 478 | echo "" 479 | echo "--dry specified. not starting engine." 480 | exit 0 481 | fi 482 | 483 | info "Using JVM found at $CQ_JVM" 484 | setUlimit 485 | 486 | if [ -n "$CQ_FOREGROUND" ]; then 487 | ulimit -n $CQ_MAX_OPEN_FILES 488 | info "Starting in foreground" 489 | info "$STOP_MESSAGE" 490 | printDebug 491 | info "-----------------------------------------------------------" 492 | oldpwd="`pwd`" 493 | cd $CQ_CONTEXT || fatal "Cannot cd to $CQ_CONTEXT" 494 | info "Starting in $PWD" 495 | su $RUNAS_USER -c "$jvmExe | tee -a \"$CQ_LOG\" 2>&1" 496 | cd "$oldpwd" > /dev/null 497 | exit 0 # in case of failure 498 | else 499 | info "Starting in background..." 500 | printDebug 501 | oldpwd="`pwd`" 502 | cd $CQ_CONTEXT || fatal "Cannot cd to $CQ_CONTEXT" 503 | su $RUNAS_USER -c "$NOHUP $jvmExe > \"$CQ_LOG\" 2>&1 &" 504 | 505 | # Every so often, the attempt to look up the CQ pid in the process table fails because it hasn't shown up yet. 506 | # In that case, the pid file would end up empty, and eventually CQ would start. However, 'service cq-xxxxx status' 507 | # would no longer be able to find it. The code section below attempts to get the pid a few times before failing 508 | # to resolve this. 509 | # Note: This probably wouldn't ever be a problem on an isolated box, but if the chef cookbook is being used in 510 | # vagrant with limited resources, this problem may reveal itself. 511 | MAX_ATTEMPTS=10 512 | CURRENT_ATTEMPT=1 513 | PID="`ps -ef | grep "$CQ_RUNNABLE_JAR" | grep -v grep | awk '{print $2}'`" 514 | while [ "x${PID}" = "x" -a ${CURRENT_ATTEMPT} -le ${MAX_ATTEMPTS} ] ; do 515 | warn "Unable to find pid of ${CQ_RUNNABLE_JAR}. Attempt [${CURRENT_ATTEMPT}/${MAX_ATTEMPTS}]" 516 | sleep 1 517 | PID="`ps -ef | grep "$CQ_RUNNABLE_JAR" | grep -v grep | awk '{print $2}'`" 518 | let "CURRENT_ATTEMPT += 1" 519 | done 520 | 521 | if [ "x${PID}" = "x" ] ; then 522 | err "Could not find pid of ${CQ_RUNNABLE_JAR}. CQ startup failed." 523 | exit 10 524 | fi 525 | 526 | info "Successfully found pid of ${CQ_RUNNABLE_JAR}: ${PID}. Recording in $CQ_LOGDIR/cq.pid." 527 | echo "${PID}" > "$CQ_LOGDIR/cq.pid" 528 | 529 | cd "$oldpwd" > /dev/null 530 | info "Started." 531 | fi 532 | exit 0 533 | ;; 534 | #--------------------------------------------------------------------- 535 | 'stop') 536 | use_stderr="YES" 537 | cqpid=`/bin/cat "$CQ_LOGDIR/cq.pid" 2>/dev/null` 538 | if [ -z "$cqpid" ]; then 539 | echo "No process ID in $CQ_LOGDIR/cq.pid." 540 | exit 0; 541 | fi 542 | if ps -p $cqpid > /dev/null 2>&1; then :; else 543 | echo "pid file $CQ_LOGDIR/cq.pid present, but process $cqpid not running. "\ 544 | "maybe unclean shutdown ?" 545 | exit 0; 546 | fi 547 | 548 | printf "stopping..." 549 | $KILL $cqpid; status=$? 550 | 551 | if [ $status -eq 1 ]; then 552 | echo "Unable to kill process $cqpid" 553 | exit 0; 554 | fi; 555 | 556 | COUNTER=0 557 | # AEM6 takes a very long time to stop after the first run. Subsequent stops are usually much quicker. 558 | TIMEOUT_SECONDS=300 559 | while ps -p $cqpid > /dev/null 2>&1 && [ $COUNTER -lt ${TIMEOUT_SECONDS} ]; do 560 | printf "." 561 | COUNTER=`expr $COUNTER + 1` 562 | sleep 2 563 | done 564 | if ps -p $cqpid > /dev/null 2>&1; then 565 | echo "Process $cqpid still running, unable to stop" 566 | exit 20 567 | else 568 | echo "stopped." 569 | rm -f "$CQ_LOGDIR/cq.pid" 570 | fi 571 | ;; 572 | #--------------------------------------------------------------------- 573 | 'restart') 574 | "$0" stop 575 | "$0" start 576 | ;; 577 | #--------------------------------------------------------------------- 578 | 'status') 579 | cqpid=`/bin/cat "$CQ_LOGDIR/cq.pid" 2>/dev/null` 580 | if ps -p $cqpid > /dev/null 2>&1 ; then 581 | echo "$CQ_TITLE is running." 582 | else 583 | echo "$CQ_TITLE is stopped." 584 | fi 585 | ;; 586 | #--------------------------------------------------------------------- 587 | *) 588 | usage 589 | exit 590 | ;; 591 | esac 592 | 593 | -------------------------------------------------------------------------------- /templates/default/iptables.erb: -------------------------------------------------------------------------------- 1 | <% if node[:aem][:dispatcher][:allow_connections] %> 2 | <% node[:aem][:dispatcher][:allow_connections].each do |subnet| %> 3 | -A FWR -p TCP --dport 80 -s <%= subnet %> -j ACCEPT 4 | <% end %> 5 | <% else %> 6 | -A FWR -p TCP --dport 80 -j ACCEPT 7 | <% end %> 8 | -------------------------------------------------------------------------------- /templates/default/ldap_login.conf.erb: -------------------------------------------------------------------------------- 1 | /** 2 | * Generated by Chef for <%= node[:fqdn] %> 3 | * Local modifications will be overwritten. 4 | * 5 | * Copyright (c) 1997-2010 Day Management AG 6 | * Barfuesserplatz 6, 4001 Basel, Switzerland 7 | * All Rights Reserved. 8 | * 9 | * This software is the confidential and proprietary information of 10 | * Day Management AG, ("Confidential Information"). You shall not 11 | * disclose such Confidential Information and shall use it only in 12 | * accordance with the terms of the license agreement you entered into 13 | * with Day. 14 | * 15 | */ 16 | com.day.crx { 17 | com.day.crx.core.CRXLoginModule sufficient; 18 | com.day.crx.security.ldap.LDAPLoginModule required 19 | principal_provider.class="com.day.crx.security.ldap.principals.LDAPPrincipalProvider" 20 | <% @options.keys.each do |key| %> 21 | <%= key %>="<%= @options[key] %>" 22 | <% end %> 23 | ; 24 | }; 25 | -------------------------------------------------------------------------------- /templates/default/license.properties.erb: -------------------------------------------------------------------------------- 1 | #Adobe Granite License Properties 2 | license.product.name=<%= node['aem']['license_product_name'] %> 3 | license.customer.name=<%= node['aem']['license_customer_name'] %> 4 | license.product.version=<%= node['aem']['version'] %> 5 | license.downloadID=<%= node['aem']['license_download_id'] %> 6 | -------------------------------------------------------------------------------- /templates/default/mods/dispatcher.conf.erb: -------------------------------------------------------------------------------- 1 | # Generated by Chef for <%= node[:fqdn] %> 2 | # Local modifications will be overwritten. 3 | 4 | 5 | # location of the configuration file. eg: 'conf/dispatcher.any' 6 | <% options = node[:aem][:dispatcher] %> 7 | DispatcherConfig <%= options[:conf_file] %> 8 | 9 | # location of the dispatcher log file. eg: 'logs/dispatcher.log' 10 | DispatcherLog <%= options[:log_file] %> 11 | 12 | # log level for the dispatcher log 13 | # 0 Errors 14 | # 1 Warnings 15 | # 2 Infos 16 | # 3 Debug 17 | DispatcherLogLevel <%= options[:log_level] %> 18 | 19 | # if turned to 1, the dispatcher looks like a normal module 20 | DispatcherNoServerHeader <%= options[:no_server_header] %> 21 | 22 | # if turned to 1, request to / are not handled by the dispatcher 23 | # use the mod_alias then for the correct mapping 24 | DispatcherDeclineRoot <%= options[:decline_root] %> 25 | 26 | # if turned to 1, the dispatcher uses the URL already processed 27 | # by handlers preceeding the dispatcher (i.e. mod_rewrite) 28 | # instead of the original one passed to the web server. 29 | DispatcherUseProcessedURL <%= options[:use_processed_url] %> 30 | 31 | # if turned to 1, the dispatcher does not spool an error 32 | # response to the client (where the status code is greater 33 | # or equal than 400), but passes the status code to 34 | # Apache, which e.g. allows an ErrorDocument directive 35 | # to process such a status code. 36 | DispatcherPassError <%= options[:pass_error] %> 37 | 38 | 39 | -------------------------------------------------------------------------------- /templates/default/web.xml.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | Content Repository Extreme 7 | 8 | 9 | 10 | proxy.enabled 11 | false 12 | 13 | 14 | proxy.host 15 | proxy.company.com:80 16 | 17 | 18 | proxy.user 19 | 20 | 21 | 22 | proxy.password 23 | 24 | 25 | 26 | proxy.ntlm.host 27 | 28 | 29 | 30 | proxy.ntlm.domain 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | com.day.commons.httpclient.impl.ProxyContextListener 40 | 41 | 42 | 43 | 44 | 45 | 46 | org.apache.jackrabbit.j2ee.DerbyShutdown 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | Logging 55 | The logging servlet configures the Log4J logging facility. 56 | com.day.crx.j2ee.LoggingServlet 57 | 58 | 59 | log4j-config 60 | /WEB-INF/log4j.xml 61 | initial log4j configuration 62 | 63 | 64 | 1 65 | 66 | 67 | 68 | 69 | 70 | 71 | Repository 72 | repository servlet that starts the repository and registers it to JNDI. 73 | com.day.crx.j2ee.CRXRepositoryStartupServlet 74 | 75 | 76 | bootstrap-config 77 | bootstrap.properties 78 | 79 | Property file that hold the same initialization properties than 80 | the init-params below. If a parameter is specified in both 81 | places the one in the bootstrap-config wins. 82 | 83 | 84 | 85 | 86 | repository-home 87 | crx-quickstart/repository 88 | the repository home 89 | 90 | 91 | 92 | repository-name 93 | crx 94 | Repository Name under which the repository is registered via JNDI/RMI 95 | 96 | 97 | 100 | 111 | 112 | 115 | 116 | java.naming.provider.url 117 | http://jcr.day.com 118 | 119 | 120 | java.naming.factory.initial 121 | com.day.util.jndi.provider.MemoryInitialContextFactory 122 | 123 | 124 | 2 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | JCRExplorer 133 | the content-repository explorer servlet 134 | com.day.crx.j2ee.JCRExplorerServlet 135 | 136 | 137 | repository-name 138 | virtual-crx 139 | Repository Name that is used to retrieve it via JNDI 140 | 141 | 142 | 143 | explorer-home 144 | crx-quickstart/repository 145 | home directory of the explorer servlet 146 | 147 | 148 | 149 | crx-config 150 | /WEB-INF/crx.properties 151 | initial crx configuration 152 | 153 | 154 | 155 | docroot 156 | /docroot 157 | the docroot location 158 | 159 | 160 | 161 | temp-directory 162 | tmp 163 | the temp-directory location 164 | 165 | 166 | 174 | 175 | 178 | 179 | java.naming.provider.url 180 | http://jcr.day.com 181 | 182 | 183 | java.naming.factory.initial 184 | com.day.util.jndi.provider.MemoryInitialContextFactory 185 | 186 | 187 | 190 | 191 | checker-file 192 | checker.tmp 193 | 194 | 195 | 196 | checker-gif 197 | http://dev.day.com/crx.gif 198 | 199 | 200 | 201 | crx-update-url 202 | http://www.day.com/crx 203 | 204 | 205 | 206 | crx-support-email 207 | jcr@day.com 208 | 209 | 210 | 211 | 212 | launchpad.ctx.path 213 | / 214 | Context path of the launchpad 215 | 216 | 217 | 218 | 219 | session-timeout 220 | 3600 221 | 222 | 223 | 3 224 | 225 | 226 | 227 | 228 | 229 | 230 | NodeTree 231 | the node tree servlet for the NodeTree UI control 232 | com.day.ui.NodeTreeServlet 233 | 234 | 235 | 236 | 237 | 238 | 239 | Export 240 | The export servlet is used to generate various export 241 | com.day.crx.j2ee.ExportServlet 242 | 243 | export-prefix 244 | /export 245 | 246 | defines the prefix for this serlvet. 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | Webdav 256 | 257 | The webdav servlet that connects HTTP request to the repository. 258 | 259 | com.day.crx.j2ee.ResourceServlet 260 | 261 | 262 | resource-path-prefix 263 | /repository 264 | 265 | defines the prefix for spooling resources out of the repository. 266 | 267 | 268 | 271 | 272 | authenticate-header 273 | Basic realm="CRX Webdav Server" 274 | 275 | Defines the value of the 'WWW-Authenticate' header. 276 | 277 | 278 | 283 | 284 | resource-config 285 | /WEB-INF/config.xml 286 | 287 | Defines various dav-resource configuration parameters. 288 | 289 | 290 | 4 291 | 292 | 293 | 294 | 295 | 296 | 297 | JCRWebdavServer 298 | 299 | The webdav servlet that connects HTTP request to the repository. 300 | 301 | com.day.crx.j2ee.remoting.JcrRemotingServlet 302 | 303 | 304 | resource-path-prefix 305 | /server 306 | 307 | defines the prefix for spooling resources out of the repository. 308 | 309 | 310 | 311 | missing-auth-mapping 312 | 313 | 314 | 315 | home 316 | crx-quickstart 317 | Home directory for JcrRemotingServlet temporary files 318 | 319 | 320 | temp-directory 321 | server/tmp/remoting 322 | JcrRemotingServlet temporary directory name (under home) 323 | 324 | 5 325 | 326 | 327 | 328 | 329 | 330 | 331 | CqResource 332 | org.apache.jackrabbit.j2ee.SimpleWebdavServlet 333 | 334 | resource-path-prefix 335 | /cqresource 336 | 337 | 338 | resource-config 339 | /WEB-INF/cqresource.xml 340 | 341 | Defines various dav-resource configuration parameters. 342 | 343 | 344 | 6 345 | 346 | 347 | 348 | 349 | 350 | 351 | PackageShare 352 | com.day.crx.packaging.impl.PackageShareServlet 353 | 6 354 | 355 | 356 | 357 | 358 | 359 | 360 | PackageManager 361 | com.day.crx.packaging.impl.PackageManagerServlet 362 | 6 363 | 364 | 365 | 366 | 367 | 368 | 387 | 388 | 389 | 390 | 391 | 392 | NodeTree 393 | /ui/nodetree/* 394 | 395 | <% if node[:aem][:enable_webdav] %> 396 | 397 | Webdav 398 | /repository/* 399 | 400 | 401 | JCRWebdavServer 402 | /server/* 403 | 404 | 405 | CqResource 406 | /cqresource/* 407 | 408 | <% end %> 409 | 410 | Export 411 | /export/* 412 | 413 | 414 | PackageShare 415 | /packageshare/* 416 | 417 | 418 | PackageManager 419 | /packmgr/service/* 420 | 421 | 422 | JCRExplorer 423 | / 424 | 425 | 426 | 427 | 428 | 429 | 430 | doc 431 | application/msword 432 | 433 | 434 | bin 435 | application/octet-stream 436 | 437 | 438 | pdf 439 | application/pdf 440 | 441 | 442 | ai 443 | application/postscript 444 | 445 | 446 | eps 447 | application/postscript 448 | 449 | 450 | ps 451 | application/postscript 452 | 453 | 454 | rtf 455 | application/rtf 456 | 457 | 458 | mif 459 | application/vnd.mif 460 | 461 | 462 | ppt 463 | application/vnd.ms-powerpoint 464 | 465 | 466 | vcd 467 | application/x-cdlink 468 | 469 | 470 | js 471 | application/x-javascript 472 | 473 | 474 | mp3 475 | audio/mpeg 476 | 477 | 478 | ram 479 | audio/x-pn-realaudio 480 | 481 | 482 | rm 483 | audio/x-pn-realaudio 484 | 485 | 486 | ra 487 | audio/x-realaudio 488 | 489 | 490 | gif 491 | image/gif 492 | 493 | 494 | jpeg 495 | image/jpeg 496 | 497 | 498 | jpg 499 | image/jpeg 500 | 501 | 502 | png 503 | image/png 504 | 505 | 506 | tiff 507 | image/tiff 508 | 509 | 510 | tif 511 | image/tiff 512 | 513 | 514 | css 515 | text/css 516 | 517 | 518 | asc 519 | text/plain 520 | 521 | 522 | txt 523 | text/plain 524 | 525 | 526 | xml 527 | text/xml 528 | 529 | 530 | html 531 | text/html 532 | 533 | 534 | htm 535 | text/html 536 | 537 | 538 | 539 | 540 | 541 | 542 | index.jsp 543 | 544 | 545 | 546 | -------------------------------------------------------------------------------- /test/integration/author-5.5.0-oraclejdk6/serverspec/cq_author_daemon_spec.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | include Serverspec::Helper::Exec 4 | include Serverspec::Helper::DetectOS 5 | 6 | describe 'AEM Author Daemon' do 7 | it 'is listening on port 4502' do 8 | expect(port(4502)).to be_listening 9 | end 10 | 11 | it 'has a running service of aem-author' do 12 | expect(service('aem-author')).to be_running 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /test/integration/author-5.6.0-oraclejdk6/serverspec/cq_author_daemon_spec.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | include Serverspec::Helper::Exec 4 | include Serverspec::Helper::DetectOS 5 | 6 | describe 'AEM Author Daemon' do 7 | it 'is listening on port 4502' do 8 | expect(port(4502)).to be_listening 9 | end 10 | 11 | it 'has a running service of aem-author' do 12 | expect(service('aem-author')).to be_running 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /test/integration/author-5.6.1-oraclejdk7/serverspec/cq_author_daemon_spec.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | include Serverspec::Helper::Exec 4 | include Serverspec::Helper::DetectOS 5 | 6 | describe 'AEM Author Daemon' do 7 | it 'is listening on port 4502' do 8 | expect(port(4502)).to be_listening 9 | end 10 | 11 | it 'has a running service of aem-author' do 12 | expect(service('aem-author')).to be_running 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /test/integration/author-6.0.0-oraclejdk7/serverspec/cq_author_daemon_spec.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | include Serverspec::Helper::Exec 4 | include Serverspec::Helper::DetectOS 5 | 6 | describe 'AEM Author Daemon' do 7 | it 'is listening on port 4502' do 8 | expect(port(4502)).to be_listening 9 | end 10 | 11 | it 'has a running service of aem-author' do 12 | expect(service('aem-author')).to be_running 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /test/integration/author-publish-5.5.0-oraclejdk6/serverspec/cq_author_daemon_spec.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | include Serverspec::Helper::Exec 4 | include Serverspec::Helper::DetectOS 5 | 6 | describe 'AEM Author Daemon' do 7 | it 'is listening on port 4502' do 8 | expect(port(4502)).to be_listening 9 | end 10 | 11 | it 'has a running service of aem-author' do 12 | expect(service('aem-author')).to be_running 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /test/integration/author-publish-5.5.0-oraclejdk6/serverspec/cq_publish_daemon_spec.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | include Serverspec::Helper::Exec 4 | include Serverspec::Helper::DetectOS 5 | 6 | describe 'AEM Publish Daemon' do 7 | it 'is listening on port 4503' do 8 | expect(port(4503)).to be_listening 9 | end 10 | 11 | it 'has a running service of aem-publish' do 12 | expect(service('aem-publish')).to be_running 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /test/integration/author-publish-5.6.0-oraclejdk6/serverspec/cq_author_daemon_spec.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | include Serverspec::Helper::Exec 4 | include Serverspec::Helper::DetectOS 5 | 6 | describe 'AEM Author Daemon' do 7 | it 'is listening on port 4502' do 8 | expect(port(4502)).to be_listening 9 | end 10 | 11 | it 'has a running service of aem-author' do 12 | expect(service('aem-author')).to be_running 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /test/integration/author-publish-5.6.0-oraclejdk6/serverspec/cq_publish_daemon_spec.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | include Serverspec::Helper::Exec 4 | include Serverspec::Helper::DetectOS 5 | 6 | describe 'AEM Publish Daemon' do 7 | it 'is listening on port 4503' do 8 | expect(port(4503)).to be_listening 9 | end 10 | 11 | it 'has a running service of aem-publish' do 12 | expect(service('aem-publish')).to be_running 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /test/integration/author-publish-5.6.1-oraclejdk7/serverspec/cq_author_daemon_spec.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | include Serverspec::Helper::Exec 4 | include Serverspec::Helper::DetectOS 5 | 6 | describe 'AEM Author Daemon' do 7 | it 'is listening on port 4502' do 8 | expect(port(4502)).to be_listening 9 | end 10 | 11 | it 'has a running service of aem-author' do 12 | expect(service('aem-author')).to be_running 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /test/integration/author-publish-5.6.1-oraclejdk7/serverspec/cq_publish_daemon_spec.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | include Serverspec::Helper::Exec 4 | include Serverspec::Helper::DetectOS 5 | 6 | describe 'AEM Publish Daemon' do 7 | it 'is listening on port 4503' do 8 | expect(port(4503)).to be_listening 9 | end 10 | 11 | it 'has a running service of aem-publish' do 12 | expect(service('aem-publish')).to be_running 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /test/integration/author-publish-6.0.0-oraclejdk7/serverspec/cq_author_daemon_spec.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | include Serverspec::Helper::Exec 4 | include Serverspec::Helper::DetectOS 5 | 6 | describe 'AEM Author Daemon' do 7 | it 'is listening on port 4502' do 8 | expect(port(4502)).to be_listening 9 | end 10 | 11 | it 'has a running service of aem-author' do 12 | expect(service('aem-author')).to be_running 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /test/integration/author-publish-6.0.0-oraclejdk7/serverspec/cq_publish_daemon_spec.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | include Serverspec::Helper::Exec 4 | include Serverspec::Helper::DetectOS 5 | 6 | describe 'AEM Publish Daemon' do 7 | it 'is listening on port 4503' do 8 | expect(port(4503)).to be_listening 9 | end 10 | 11 | it 'has a running service of aem-publish' do 12 | expect(service('aem-publish')).to be_running 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /test/integration/publish-5.5.0-oraclejdk6/serverspec/cq_publish_daemon_spec.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | include Serverspec::Helper::Exec 4 | include Serverspec::Helper::DetectOS 5 | 6 | describe 'AEM Publish Daemon' do 7 | it 'is listening on port 4503' do 8 | expect(port(4503)).to be_listening 9 | end 10 | 11 | it 'has a running service of aem-publish' do 12 | expect(service('aem-publish')).to be_running 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /test/integration/publish-5.6.0-oraclejdk6/serverspec/cq_publish_daemon_spec.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | include Serverspec::Helper::Exec 4 | include Serverspec::Helper::DetectOS 5 | 6 | describe 'AEM Publish Daemon' do 7 | it 'is listening on port 4503' do 8 | expect(port(4503)).to be_listening 9 | end 10 | 11 | it 'has a running service of aem-publish' do 12 | expect(service('aem-publish')).to be_running 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /test/integration/publish-5.6.1-oraclejdk7/serverspec/cq_publish_daemon_spec.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | include Serverspec::Helper::Exec 4 | include Serverspec::Helper::DetectOS 5 | 6 | describe 'AEM Publish Daemon' do 7 | it 'is listening on port 4503' do 8 | expect(port(4503)).to be_listening 9 | end 10 | 11 | it 'has a running service of aem-publish' do 12 | expect(service('aem-publish')).to be_running 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /test/integration/publish-6.0.0-oraclejdk7/serverspec/cq_publish_daemon_spec.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | include Serverspec::Helper::Exec 4 | include Serverspec::Helper::DetectOS 5 | 6 | describe 'AEM Publish Daemon' do 7 | it 'is listening on port 4503' do 8 | expect(port(4503)).to be_listening 9 | end 10 | 11 | it 'has a running service of aem-publish' do 12 | expect(service('aem-publish')).to be_running 13 | end 14 | end 15 | --------------------------------------------------------------------------------