├── .gitignore ├── LICENSE ├── README.md ├── puppet ├── Puppetfile ├── environments │ └── local │ │ └── manifests │ │ └── .gitignore ├── files │ └── .gitignore └── modules │ └── .gitignore └── setup ├── .gitignore ├── setup.rb ├── templates ├── Vagrantfile.erb ├── dispatcher.any.erb └── site.pp.erb ├── update-puppet.sh └── update-vm.sh /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .idea 3 | .project 4 | .vagrant 5 | Vagrantfile 6 | puppet/Puppetfile.lock 7 | puppet/.tmp 8 | puppet/.librarian 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vagrant-aem - Vagrant boxes for AEM 2 | 3 | #### Table of Contents 4 | 5 | 1. [Overview](#overview) 6 | * [Example Scenarios](#examples) 7 | 1. [Usage](#usage) 8 | * [Prerequisites](#prerequisites) 9 | * [Setup](#setup) 10 | * [Setup Parameters](#setup-parameters) 11 | * [Vagrant](#vagrant) 12 | 1. [Host System](#host-system) 13 | * [System Requirements](#system-requirements) 14 | * [Cautions](#cautions) 15 | 1. [Guest System](#guest-system) 16 | * [Running Applications](#running-applications) 17 | * [Access Points](#access-points) 18 | 1. [Contributing](#development) 19 | 20 | 21 | ## Overview 22 | 23 | This project is a tool to help developers manage virtual machines contianing AEM instances. It is designed to allow quick setup and creation of vagrant images with a full AEM stack: Author, Publish, & Dispatcher. 24 | 25 | ### Examples 26 | 27 | This is an example for the use of this project, there are two roles in it's use: 28 | 29 | **Team Lead Tasks** 30 | 31 | 1. A new project is tasked to a development team. 32 | 1. Team lead forks the project and clones it to local system. 33 | 1. Lead creates a branch for the new project/client. 34 | 1. Lead runs the setup script providing responses or a manually managed parameter file. 35 | 1. The setup creates the appropriate Vagrant file, Puppet site manifest, and other necessary files. 36 | 1. Lead edits the gitignore files to allow for check-in of the files created by the setup process. 37 | 1. Lead commits & pushes the branch out. 38 | 1. Run `vagrant up` and create a new VM for development. 39 | 40 | **Team Member Tasks** 41 | 1. Clones forked project and switches to new branch. 42 | 1. Run `vagrant up` and create a new VM for development. 43 | 44 | The end result is a standard work environment for the entire team, one that hopefully matches the Development environment. 45 | 46 | ## Usage 47 | 48 | ### Prerequisites 49 | 50 | **Supporting Software** 51 | 1. Vagrant (v1.8.4) 52 | 1. Do not use v1.8.5; it has an [issue when updating the authorized keys](https://github.com/mitchellh/vagrant/issues/7610). 53 | 54 | 55 | **Required** 56 | 1. AEM Quickstart jar file 57 | 1. AEM [Dispatcher module](https://www.adobeaemcloud.com/content/companies/public/adobe/dispatcher/dispatcher.html) for your web server 58 | 1. AEM License Key for your client 59 | 60 | 61 | **Optional** 62 | 1. Java JDK that is required for your client. [Java](http://www.oracle.com/technetwork/java/index.html) or [OpenJDK](http://openjdk.java.net/) 63 | 1. Custom dispatcher.any file 64 | 65 | ### Setup 66 | 67 | There are two options for preparing the vagrant configuration: Answering questions during setup or creating a parameter file. 68 | 69 | #### Setup with Prompts 70 | 71 | There is a setup script which will prompt for necessary configuration needs. This script will prepare the templated files so Vagrant will provision the system correct. Usage from root folder: 72 | 73 | ~~~ 74 | > setup/setup.rb 75 | ~~~ 76 | 77 | This will create a file *./setup/parameters.json* containing the responses. This allows for other teams to quickly reuse an existing configuration. 78 | 79 | #### Setup with Parameter File 80 | 81 | The setup script will output all answers to the prompted questions to a file for future use. This file can also be manually created and specified as a parameter to the setup script: 82 | 83 | ~~~ 84 | > setup/setup.rb setup/parameters.json 85 | ~~~ 86 | 87 | Doing so will read the file, and configure the setup accordingly. If any required parameter is missing, that item will be requested via a prompt. 88 | 89 | **Keep in mind that the setup process will replace all contents of the parameter file with the new information.** 90 | 91 | This is an example of a file which shows format and parameters: 92 | 93 | ~~~ 94 | { 95 | "client" : "test", 96 | "jdk_pkg" : "", 97 | "aem_jar" : "/path/to/aem-quickstart-6.1.jar", 98 | "aem_license" : "your license here", 99 | "dispatcher_mod" : "/path/to/dispatcher-apache2.4-4.1.10.so", 100 | "dispatcher_any" : "" 101 | } 102 | 103 | ~~~ 104 | 105 | ### Setup Parameters 106 | 107 | The following are the parameters which are needed in order to setup the Vagrant and puppet configuration files. They are propmpted for in the script and used in the JSON parameter file: 108 | 109 | ##### `client` 110 | 111 | **Required**. This is the name of the client for which the VM is intended. This is used as way to distinguish this system from others on the host. It affects: 112 | 113 | * VM name in VirtualBox 114 | * Host name for accessing dispatcher content (See [Access Points](#access-points)). 115 | * Docroot in the HTTP Server configurations. 116 | 117 | Format: Any valid string. 118 | 119 | ##### `jdk_pkg` 120 | 121 | Optional. This specifies the package to use when installing the JDK. If not provided, the default JDK for the system will be used. Format: fully qualified path to file. 122 | 123 | ##### `aem_jar` 124 | 125 | **Required**. This specifies the location of the AEM installation jar. This file is not provided as part of this project, and must be provided by the consumer. Format: fully qualified path to file. 126 | 127 | ##### `aem_license` 128 | 129 | **Required**. This is the license key for running the AEM system. Format: String. 130 | 131 | ##### `dispatcher_mod` 132 | 133 | **Required**. This specifies the location of the AEM dispatcher module. This file is not provided as part of this project, and must be provided by the consumer. Format: fully qualified path to file. 134 | 135 | ##### `dispatcher_any` 136 | 137 | Optional. This is a dispatcher.any file which can be specified for use, instead of the [default template](setup/templates/dispatcher.any.erb) Format: fully qualified path to file. 138 | 139 | ### Vagrant 140 | 141 | #### VM Initialization 142 | 143 | Once the setup has been accomplished, the vagrant system can be started: 144 | 145 | ~~~ 146 | > vagrant up 147 | ~~~ 148 | 149 | This step will take time to run, as it is configuring and setting up all of the software on the guest. 150 | 151 | #### VM Re-provisioning 152 | 153 | If there is an update to the setup defintions, then a system reprovision may be required. This is as simple as executing this command while the VM is running: 154 | 155 | ~~~ 156 | > vagrant provision 157 | ~~~ 158 | 159 | ## Host System 160 | 161 | ### System Requirements 162 | 163 | Because of the number of applications running inside the guest, the definition is configured to consume a relatively large amount of system resources. It is recommended that the host sytem have: 164 | 165 | * 4 CPUs (or cores) 166 | * 16 GB of RAM 167 | * 100 GB free disk space 168 | 169 | ### Consumer Provided 170 | 171 | The following items are required for the setup process, and are not provided by this project: 172 | 173 | * AEM Quickstart Jar 174 | * Dispatcher Module 175 | 176 | ### Cautions 177 | 178 | The following ports are forwarded to the guest VM. If any are unavailable, the guest system may not start corrrectly: 179 | 180 | * 4502 181 | * 4503 182 | * 10080 183 | * 18080 184 | * 18009 185 | * 30300 186 | * 30303 187 | * 30304 188 | 189 | ## Guest System 190 | 191 | ### Running Applications 192 | 193 | The following applications are running by default: 194 | 195 | * HTTP Server 196 | * w/ dispatcher module 197 | * AEM Author 198 | * AEM Publish 199 | 200 | ### Access Points 201 | 202 | Most of the systems inside the VM are accessible using two different URLs. This is due to possible cookie issues when using just host/port combination, therefore named virtual hosts are also provided. 203 | 204 | #### AEM Author 205 | ##### Web Interface 206 | * [http://localhost:4502/](http://localhost:4502/) 207 | * [http://author.localhost:10080/](http://author.localhost:10080/) 208 | 209 | ##### Debugging 210 | Debugging is enabled by default on the Author system, connect using port 30303. 211 | 212 | #### AEM Publish 213 | ##### Web Interface 214 | * [http://localhost:4503/](http://localhost:4503/) 215 | * [http://publish.localhost:10080/](http://publish.localhost:10080/) 216 | 217 | ##### Debugging 218 | Debugging is enabled by default on the Author system, connect using port 30304. 219 | 220 | #### Client Site (HTTP Server) 221 | * [http://localhost:10080](http://localhost:10080) 222 | * http://<<client>>.localhost:10080 223 | 224 | ## Development 225 | 226 | This project was the driver behind the Puppet AEM module. As new features are added to that module, this project will be updated to incorporate their use for standarization of environments. 227 | 228 | Contributions are always welcome, however please ensure that no AEM Quickstar jars or license keys are included in pull requests. 229 | -------------------------------------------------------------------------------- /puppet/Puppetfile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | #^syntax detection 3 | 4 | forge "https://forgeapi.puppetlabs.com" 5 | 6 | # use dependencies defined in Modulefile 7 | #modulefile 8 | 9 | # Puppet Supported Modules 10 | # https://forge.puppetlabs.com/supported 11 | mod 'puppetlabs/stdlib', '< 6.0.0' 12 | mod 'puppetlabs/firewall' 13 | mod 'puppetlabs/java' 14 | mod 'puppetlabs/apache' 15 | 16 | #mod 'puppetlabs/concat' 17 | #mod 'puppetlabs/inifile' 18 | #mod 'puppetlabs/tomcat' 19 | 20 | # Puppet Approved Modules 21 | # https://forge.puppetlabs.com/approved 22 | mod 'maestrodev/wget' 23 | mod 'rodjek/logrotate' 24 | 25 | mod 'bstopp-aem', 26 | :git => 'http://github.com/bstopp/puppet-aem.git' 27 | -------------------------------------------------------------------------------- /puppet/environments/local/manifests/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /puppet/files/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | 3 | !dispatcher.conf.erb 4 | !.gitignore 5 | -------------------------------------------------------------------------------- /puppet/modules/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /setup/.gitignore: -------------------------------------------------------------------------------- 1 | parameters*.json 2 | -------------------------------------------------------------------------------- /setup/setup.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require 'erb' 4 | require 'fileutils' 5 | require 'json' 6 | require 'ostruct' 7 | 8 | PROJECT_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..')) 9 | SETUP_DIR = File.join(PROJECT_ROOT, 'setup') 10 | TEMPLATE_DIR = File.join(SETUP_DIR, 'templates') 11 | PUPPET_DIR = File.join(PROJECT_ROOT, 'puppet') 12 | FILES_DIR = File.join(PUPPET_DIR, 'files') 13 | MANIFEST_DIR = File.join(PUPPET_DIR, 'environments', 'local', 'manifests') 14 | 15 | FILE_MODES = File::CREAT | File::TRUNC | File::WRONLY 16 | VAGRANT_FILE = 'Vagrantfile' 17 | MANIFEST_FILE = 'site.pp' 18 | DISPATCHER_FILE = 'dispatcher.any' 19 | PARAMS_FILE = File.join(SETUP_DIR, 'parameters.json') 20 | 21 | def readParams(file) 22 | 23 | if File.exist?(file) 24 | contents = '' 25 | File.open(file, File::RDONLY) do |f| 26 | contents = f.read() 27 | end 28 | OpenStruct.new(JSON.parse(contents)) 29 | end 30 | end 31 | 32 | def writeParams(params, file) 33 | 34 | params ||= OpenStruct.new 35 | file ||= PARAMS_FILE 36 | File.open(file, FILE_MODES, 0644) do |f| 37 | f.write("#{params.to_h.to_json}\n") 38 | end 39 | 40 | end 41 | 42 | def getParameters(param_file) 43 | 44 | params = readParams(param_file) if param_file 45 | 46 | params = OpenStruct.new unless params 47 | 48 | if params.client.nil? || params.client.empty? 49 | print 'Client name: ' 50 | params.client = gets.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '') 51 | end 52 | 53 | if params.jdk_pkg.nil? 54 | print 'Path to JDK Package (leave blank to use default for OS): ' 55 | params.jdk_pkg = gets.chomp 56 | end 57 | 58 | if params.aem_jar.nil? || params.aem_jar.empty? 59 | print 'Path to AEM installer jar: ' 60 | params.aem_jar = gets.chomp 61 | end 62 | 63 | if params.aem_license.nil? || params.aem_license.empty? 64 | print 'AEM License Key: ' 65 | params.aem_license = gets.chomp 66 | end 67 | 68 | if params.dispatcher_mod.nil? || params.dispatcher_mod.empty? 69 | print 'Path to Dispatcher Module file: ' 70 | params.dispatcher_mod = gets.chomp 71 | end 72 | 73 | if params.dispatcher_any.nil? 74 | print 'Custom dispatcher.any file: ' 75 | params.dispatcher_any = gets.chomp 76 | end 77 | 78 | writeParams(params, param_file) 79 | params 80 | end 81 | 82 | def writeTemplate(filename, params, dest_dir = PROJECT_ROOT, mode = 0644) 83 | 84 | tpl_data = OpenStruct.new(params) 85 | 86 | template = File.read(File.join(TEMPLATE_DIR, "#{filename}.erb")) 87 | renderer = ERB.new(template, nil, '<>') 88 | File.open(File.join(dest_dir, filename), FILE_MODES, mode) do |f| 89 | f.write(renderer.result(tpl_data.instance_eval { binding })) 90 | end 91 | end 92 | 93 | def copyFile(file) 94 | FileUtils.cp(file, FILES_DIR) 95 | end 96 | 97 | param_file = ARGV.shift 98 | 99 | # Params is an OpenStruct 100 | params = getParameters(param_file) 101 | 102 | writeTemplate(VAGRANT_FILE, params) 103 | writeTemplate(MANIFEST_FILE, params, MANIFEST_DIR) 104 | 105 | if params[:dispatcher_any].nil? or params[:dispatcher_any].empty? 106 | writeTemplate(DISPATCHER_FILE, params, FILES_DIR) 107 | else 108 | copyFile(params[:dispatcher_any]) 109 | end 110 | 111 | copyFile(params[:jdk_pkg]) unless params[:jdk_pkg].nil? or params[:jdk_pkg].empty? 112 | 113 | copyFile(params[:aem_jar]) 114 | copyFile(params[:dispatcher_mod]) 115 | 116 | # Make sure vbguest plugin exists 117 | `vagrant plugin install vagrant-vbguest` 118 | if $?.to_i != 0 119 | puts "Unable to install vbguest plugin, errors may occur with VirtualBox Guest pluings." 120 | end 121 | -------------------------------------------------------------------------------- /setup/templates/Vagrantfile.erb: -------------------------------------------------------------------------------- 1 | Vagrant.configure('2') do |config| 2 | 3 | config.vm.box = 'centos/7' 4 | 5 | config.vm.graceful_halt_timeout = 300 6 | config.vm.base_mac = '0800277C11F2' 7 | config.vm.host_name = 'vagrant.aem' 8 | 9 | config.vm.provider 'virtualbox' do |v| 10 | v.name = '<%= client %>-aem' 11 | v.cpus = 2 12 | v.memory = 8192 13 | end 14 | 15 | config.vm.synced_folder ".", '/vagrant', type: 'virtualbox' 16 | 17 | config.vm.provision :shell, path: 'setup/update-vm.sh' 18 | config.vm.provision :shell, path: 'setup/update-puppet.sh' 19 | config.vm.provision :puppet do |puppet| 20 | puppet.environment = 'local' 21 | puppet.environment_path = 'puppet/environments' 22 | puppet.module_path = 'puppet/modules' 23 | end 24 | 25 | config.vm.network :forwarded_port, guest:80, host:10080 26 | config.vm.network :forwarded_port, guest:8080, host:18080 27 | config.vm.network :forwarded_port, guest:8009, host:18009 28 | config.vm.network :forwarded_port, guest:4502, host:4502 29 | config.vm.network :forwarded_port, guest:4503, host:4503 30 | config.vm.network :forwarded_port, guest:30300, host:30300 31 | config.vm.network :forwarded_port, guest:30303, host:30303 32 | config.vm.network :forwarded_port, guest:30304, host:30304 33 | 34 | end 35 | -------------------------------------------------------------------------------- /setup/templates/dispatcher.any.erb: -------------------------------------------------------------------------------- 1 | /farms 2 | { 3 | /<%= client %>-site 4 | { 5 | /clientheaders { "*" } 6 | 7 | /virtualhosts 8 | { 9 | "<%= client %>.localhost" 10 | } 11 | 12 | # The load will be balanced among these render instances 13 | /renders 14 | { 15 | /publish 16 | { 17 | /hostname "127.0.0.1" 18 | /port "4503" 19 | } 20 | } 21 | 22 | /filter 23 | { 24 | # Allow everything! 25 | /0001 { /type "allow" /glob "*" } 26 | } 27 | 28 | # The cache section regulates what responses will be cached and where. 29 | /cache 30 | { 31 | /docroot "/var/www/vhosts/<%= client %>" 32 | 33 | /statfileslevel "0" 34 | 35 | /allowAuthorized "0" 36 | 37 | /serveStaleOnError "0" 38 | 39 | /rules 40 | { 41 | # Nothing is cached 42 | /0000 { /glob "*" /type "deny" } 43 | } 44 | 45 | /invalidate 46 | { 47 | /0000 { /glob "*" /type "allow" } 48 | } 49 | 50 | /allowedClients { } 51 | } 52 | } 53 | } 54 | 55 | -------------------------------------------------------------------------------- /setup/templates/site.pp.erb: -------------------------------------------------------------------------------- 1 | # Default settings 2 | File { ignore => '.svn', 3 | source_permissions => ignore, 4 | backup => false, 5 | } 6 | 7 | Package { 8 | allow_virtual => false, 9 | } 10 | 11 | Exec { 12 | path => '/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin', 13 | } 14 | 15 | service { 'firewalld' : 16 | ensure => stopped, 17 | enable => false, 18 | } 19 | 20 | # Apahe Configurations 21 | 22 | $apache_dirs = [ '/var/www', 23 | '/var/www/vhosts', ] 24 | 25 | file { $apache_dirs : 26 | ensure => directory, 27 | owner => 'root', 28 | group => 'root', 29 | mode => '0775', 30 | before => Class['apache'], 31 | } 32 | 33 | class { 'apache' : 34 | default_confd_files => false, 35 | default_mods => false, 36 | default_vhost => false, 37 | purge_vhost_dir => true, 38 | vhost_dir => '/etc/httpd/vhost.d', 39 | } 40 | 41 | include apache::mod::rewrite 42 | include apache::mod::deflate 43 | 44 | class { 'apache::mod::info' : 45 | restrict_access => false, 46 | } 47 | 48 | class { 'aem::dispatcher' : 49 | decline_root => 'off', 50 | module_file => '/vagrant/puppet/files/<%= File.basename(dispatcher_mod) %>', 51 | dispatcher_name => '<%= client %>', 52 | log_level => 'debug', 53 | use_processed_url => 'on' 54 | } 55 | 56 | aem::dispatcher::farm { '<%= client %>' : 57 | docroot => '/var/www/vhosts/<%=client %>', 58 | } 59 | 60 | apache::vhost { 'jenkins.localhost' : 61 | docroot => '/var/www/vhosts/jenkins', 62 | port => '80', 63 | } 64 | 65 | apache::vhost { 'author.localhost' : 66 | docroot => '/var/www/vhosts/author', 67 | port => '80', 68 | proxy_pass => [ 69 | { 'path' => '/', 'url' => 'http://localhost:4502/' } 70 | ] 71 | } 72 | 73 | apache::vhost { 'publish.localhost' : 74 | docroot => '/var/www/vhosts/publish', 75 | port => '80', 76 | proxy_pass => [ 77 | { 'path' => '/', 'url' => 'http://localhost:4503/' } 78 | ] 79 | } 80 | 81 | apache::vhost { '<%= client %>.localhost' : 82 | custom_fragment => ' 83 | 84 | 85 | SetHandler dispatcher-handler 86 | 87 | ', 88 | default_vhost => true, 89 | docroot => '/var/www/vhosts/<%= client %>', 90 | port => '80', 91 | # proxy_pass => [], 92 | request_headers => ['unset Authorization'], 93 | # rewrites => [], 94 | } 95 | 96 | 97 | # Java Configurations 98 | 99 | <% if jdk_pkg and !jdk_pkg.empty? %> 100 | package { 'java' : 101 | ensure => 'installed', 102 | source => '/vagrant/puppet/files/<%= File.basename(jdk_pkg) %>', 103 | provider => 'rpm', 104 | before => File['/opt/aem'], 105 | install_options => '--replacepkgs' 106 | 107 | } 108 | 109 | <% else %> 110 | 111 | class { 'java' : 112 | before => File['/opt/aem'], 113 | } 114 | 115 | <% end %> 116 | 117 | # AEM Configurations 118 | 119 | file { '/opt/aem': 120 | ensure => directory, 121 | owner => 'vagrant', 122 | group => 'vagrant', 123 | } 124 | 125 | aem::instance { 'author' : 126 | debug_port => 30303, 127 | group => 'vagrant', 128 | home => '/opt/aem/author', 129 | jvm_mem_opts => '-Xmx2048m', 130 | manage_group => false, 131 | manage_user => false, 132 | port => 4502, 133 | runmodes => ['localdev', 'local'], 134 | sample_content => false, 135 | source => '/vagrant/puppet/files/<%= File.basename(aem_jar) %>', 136 | type => 'author', 137 | user => 'vagrant', 138 | version => '6.1.0', 139 | require => File['/opt/aem'], 140 | } 141 | 142 | aem::instance { 'publish' : 143 | debug_port => 30304, 144 | group => 'vagrant', 145 | home => '/opt/aem/publish', 146 | jvm_mem_opts => '-Xmx2048m', 147 | manage_group => false, 148 | manage_user => false, 149 | port => 4503, 150 | runmodes => ['localdev', 'local'], 151 | sample_content => false, 152 | source => '/vagrant/puppet/files/<%= File.basename(aem_jar) %>', 153 | type => 'publish', 154 | user => 'vagrant', 155 | version => '6.1.0', 156 | require => File['/opt/aem'], 157 | } 158 | 159 | aem::license { 'author' : 160 | customer => '<%= client %>', 161 | group => 'vagrant', 162 | home => '/opt/aem/author', 163 | license_key => '<%= aem_license %>', 164 | user => 'vagrant', 165 | version => '6.1.0', 166 | } 167 | 168 | aem::license { 'publish' : 169 | customer => '<%= client %>', 170 | group => 'vagrant', 171 | home => '/opt/aem/publish', 172 | license_key => '<%= aem_license %>', 173 | user => 'vagrant', 174 | version => '6.1.0', 175 | } 176 | 177 | -------------------------------------------------------------------------------- /setup/update-puppet.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo 'Starting Puppet VM Provisioning' 4 | 5 | # Install puppet 6 | echo 'Puppet VM Provisioning: Installing puppet.' 7 | rpm -Uvh https://yum.puppet.com/puppet6-release-el-5.noarch.rpm 8 | yum -y install puppet-agent 9 | echo 'PATH=$PATH:/opt/puppetlabs/bin' >> ~/.bash_profile 10 | echo 'export PATH' >> ~/.bash_profile 11 | . ~/.bash_profile 12 | 13 | # Install puppet modules. 14 | echo 'Puppet VM Provisioning: Installing puppet modules.' 15 | rm -Rf /vagrant/puppet/.librarian 16 | rm -Rf /vagrant/puppet/.tmp 17 | rm -Rf /vagrant/puppet/Puppetfile.lock 18 | 19 | # Cleaning old modules, just in case. 20 | rm -Rf /vagrant/puppet/modules/* 21 | 22 | # Install gems for Puppet 23 | cd /vagrant/puppet 24 | source /etc/profile.d/rvm.sh 25 | LIBRARIAN_PUPPET_TMP=/tmp librarian-puppet install 26 | 27 | echo 'Finished basic VM Provisioning.' 28 | -------------------------------------------------------------------------------- /setup/update-vm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo 'Starting Basic VM Provisioning' 4 | 5 | # Update the OS & Fix Guest Tools 6 | echo 'Basic VM Provisioning: Updating the OS.' 7 | yum update -y 8 | yum install -y git 9 | #/etc/init.d/vboxadd setup 10 | 11 | # Update Ruby gems. 12 | echo 'Basic VM Provisioning: Updating Ruby gems.' 13 | yum install -y gcc ruby-devel rubygems 14 | 15 | echo 'Basic VM Provisioning: Installing RVM' 16 | curl -sSL https://rvm.io/mpapis.asc | gpg2 --import - 17 | curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import - 18 | curl -L get.rvm.io | bash -s stable 19 | 20 | usermod -a -G rvm root 21 | source /etc/profile.d/rvm.sh 22 | 23 | rvm reload 24 | rvm install 2.5 25 | rvm use 2.5 --default 26 | 27 | gem install librarian-puppet concurrent-ruby semantic_puppet deep_merge 28 | 29 | echo 'Finished basic VM Provisioning.' 30 | --------------------------------------------------------------------------------