├── .gitignore ├── .pmtignore ├── LICENSE ├── README.md ├── files ├── .gitkeep └── wso2demo.crt ├── hieradata └── dev │ └── wso2 │ └── common.yaml ├── issue_template.md ├── manifests ├── clean.pp ├── clean_deployment.pp ├── configure.pp ├── configure_idp_service_providers.pp ├── ensure_directory_structures.pp ├── import_cert.pp ├── init.pp ├── install.pp ├── java.pp ├── params.pp ├── patch.pp ├── push_files.pp ├── push_system_files.pp ├── push_templates.pp ├── remove_files.pp ├── service.pp └── system.pp ├── metadata.json ├── package.xml ├── pom.xml ├── pull_request_template.md └── templates ├── clustering ├── aws.erb ├── kubernetes.erb ├── mesos.erb ├── private-paas.erb └── wka.erb ├── wso2service.erb └── wso2unit.erb /.gitignore: -------------------------------------------------------------------------------- 1 | # Eclipse Project Files 2 | .project 3 | .classpath 4 | .settings/ 5 | .metadata 6 | 7 | # IntelliJ IDEA Project Files 8 | .idea/ 9 | *.iml 10 | *.ipr 11 | *.iws 12 | *.swp 13 | 14 | #Backup files 15 | *~ 16 | 17 | # puppet-modules 18 | *.zip 19 | *.gz 20 | *.tar 21 | *.jar 22 | 23 | target/ 24 | 25 | # Vagrant user data 26 | .vagrant/ 27 | vagrant/config.yaml 28 | 29 | # Virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 30 | hs_err_pid* 31 | -------------------------------------------------------------------------------- /.pmtignore: -------------------------------------------------------------------------------- 1 | # Puppet module related files 2 | package.xml 3 | pom.xml 4 | hieradata/ 5 | 6 | 7 | # Eclipse Project Files 8 | .project 9 | .classpath 10 | .settings/ 11 | .metadata 12 | 13 | # IntelliJ IDEA Project Files 14 | .idea/ 15 | *.iml 16 | *.ipr 17 | *.iws 18 | *.swp 19 | 20 | #Backup files 21 | *~ 22 | 23 | # puppet-modules 24 | *.zip 25 | *.gz 26 | *.tar 27 | *.jar 28 | 29 | target/ 30 | .vagrant 31 | 32 | # puppet packages 33 | pkg/ -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WSO2 Puppet Base Module 2 | 3 | WSO2 base puppet module provides features for installing and configuring WSO2 middleware products. 4 | On high level it includes following: 5 | 6 | - Install Java Runtime 7 | - Clean CARBON_HOME directory 8 | - Download and extract WSO2 product distribution 9 | - Apply Carbon Kernel and WSO2 product patches 10 | - Apply configuration data 11 | - Start WSO2 server as a service or in foreground 12 | 13 | #### System Service Re-starts 14 | 15 | The system service will only restart for distribution changes or configuration changes. 16 | 17 | ## Supported Operating Systems 18 | 19 | - Debian 6 or higher 20 | - Ubuntu 12.04 or higher 21 | 22 | ## Supported Puppet Versions 23 | 24 | - Puppet 2.7, 3 or newer 25 | 26 | ## How to Contribute 27 | Follow the steps mentioned in [puppet-common](https://github.com/wso2/puppet-common/) repository to setup a development environment and update existing or implement new puppet modules. 28 | 29 | -------------------------------------------------------------------------------- /files/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wso2/puppet-base/f6b1b5cbab36194263d2b85c49188334491c6e3d/files/.gitkeep -------------------------------------------------------------------------------- /files/wso2demo.crt: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------ 2 | # 3 | # Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 4 | # 5 | # WSO2 Inc. licenses this file to you under the Apache License, 6 | # Version 2.0 (the "License"); you may not use this file except 7 | # in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | # ------------------------------------------------------------------------------ 20 | -----BEGIN CERTIFICATE----- 21 | MIIDkjCCAnoCCQCr7BNXo/qPtjANBgkqhkiG9w0BAQUFADCBijELMAkGA1UEBhMC 22 | U0wxEDAOBgNVBAgTB1dlc3Rlcm4xEDAOBgNVBAcTB0NvbG9tYm8xDTALBgNVBAoT 23 | BFdTTzIxDjAMBgNVBAsTBVBQYWFTMRQwEgYDVQQDEwtNYXJhdGhvbi1sYjEiMCAG 24 | CSqGSIb3DQEJARYTYW51cnVkZGhhbEB3c28yLmNvbTAeFw0xNjA3MTgwNTU3MTJa 25 | Fw0xNzA3MTgwNTU3MTJaMIGKMQswCQYDVQQGEwJTTDEQMA4GA1UECBMHV2VzdGVy 26 | bjEQMA4GA1UEBxMHQ29sb21ibzENMAsGA1UEChMEV1NPMjEOMAwGA1UECxMFUFBh 27 | YVMxFDASBgNVBAMTC01hcmF0aG9uLWxiMSIwIAYJKoZIhvcNAQkBFhNhbnVydWRk 28 | aGFsQHdzbzIuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqhLA 29 | eMDCPx5dQDL+aUX0mr5VQd+Gndu2fO9fwpTfjeZUMY74k86vCgTNZ2Wb3gTOtPRt 30 | xxt1XrQX4wt30hu0d88yhqn7SV0fSRoWk+8gbA1fW8LTH+82KGKIyGdNzntbsYJQ 31 | 2Sh9RmPBY1xldNz9WW37vQklJFmzKP6uc7hT4nSQwwsTjIDoOhZS2P0wtWVAKrN+ 32 | 8EMmHNAK+CzHWVo7qsMk4y6xqkdS05lAoQ3j6hDyVcfGdHYAz9B/VW3vW8QRVKSb 33 | FG9AMclsbiQfyN4CvHNpxcVzLURe1qVSMRSjly8ry8uPsm4Sq3TNZEokj8Bh8tB1 34 | Ep/+o3gmrpGc9auQwQIDAQABMA0GCSqGSIb3DQEBBQUAA4IBAQBoW0XAwdhQlW2P 35 | MU98I10yJHmgGbRJhOCn5C+I8lqG0m/0ZogVfy15YeTowLjaaWNS4C9MnUGmwMiU 36 | NdKPFnlQgEedyazYqBt+MDjS55GEZFWP6u+Nh1bnJr9c8+VuQH6k2DQ/FsHhiFJu 37 | Q5temmevOsUuEKJd9k9gmoumBxVh0IDAd2DMEYhypXWZzgKid0sUDyXL5uVg1jdk 38 | yXcIyDnDa7mekQ5ZkB05RcNFrqGFU44xXzxvBlL9msU20NvkK8V7a/7bQwt03QYP 39 | /EZcx4GYyOmbFBifXPxF/sQLX1qrD7ZL21033lPfyCnEfBsw5oN9zH7VoVoqWkC0 40 | NQMBO6oG 41 | -----END CERTIFICATE----- -------------------------------------------------------------------------------- /hieradata/dev/wso2/common.yaml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | --- 16 | wso2::maintenance_mode: refresh 17 | wso2::install_mode: file_bucket 18 | wso2::patches_dir: repository/components/patches 19 | wso2::install_dir: "/mnt" 20 | wso2::user: wso2user 21 | wso2::group: wso2 22 | wso2::pack_dir: /mnt/packs 23 | wso2::carbon_home_symlink: "/mnt/%{::product_name}-%{::product_version}" 24 | wso2::pack_filename: "%{::product_name}-%{::product_version}.zip" 25 | wso2::pack_extracted_dir: "%{::product_name}-%{::product_version}" 26 | 27 | # Host mapping to be made in etc/hosts 28 | wso2::hosts_mapping: 29 | localhost: 30 | ip: 127.0.0.1 31 | name: localhost 32 | 33 | wso2::ipaddress: "%{::ipaddress}" 34 | wso2::fqdn: "%{::fqdn}" 35 | 36 | # System service template 37 | wso2::service_template: wso2base/wso2service.erb 38 | 39 | # Server startup script name 40 | wso2::startup_script_name: wso2server.sh 41 | 42 | # Process id file path 43 | wso2::pid_file_path: wso2carbon.pid 44 | 45 | # Start WSO2 Server Service automatically 46 | wso2::autostart_service: true 47 | 48 | # Puppet template list to be populated 49 | wso2::template_list: 50 | - repository/conf/carbon.xml 51 | - repository/conf/user-mgt.xml 52 | - repository/conf/registry.xml 53 | - repository/conf/datasources/master-datasources.xml 54 | - repository/conf/tomcat/catalina-server.xml 55 | - repository/conf/axis2/axis2.xml 56 | - repository/conf/security/authenticators.xml 57 | - bin/wso2server.sh 58 | # - bin/ciphertool.sh 59 | 60 | # File list to be copied to the product folder, if there are changes found in the files, the system 61 | # service will be restarted 62 | #wso2::file_list: 63 | # - repository/conf/security/cipher-tool.properties 64 | # - repository/conf/security/cipher-text.properties 65 | # - repository/conf/security/secret-conf.properties 66 | 67 | # Files to be copied to the product folder when restarting the system service 68 | #wso2::service_refresh_file_list: 69 | # - password-tmp 70 | 71 | # JVM settings 72 | wso2::jvm: 73 | xms: 256m 74 | xmx: 1024m 75 | max_perm_size: 256m 76 | 77 | # Server ports configuration 78 | wso2::ports: 79 | offset: 0 80 | 81 | # Hostname configuration 82 | wso2::hostname: "%{::clientcert}" 83 | wso2::mgt_hostname: "%{::clientcert}" 84 | 85 | # Clustering configuration 86 | wso2::worker_node: false 87 | wso2::clustering: 88 | enabled: false 89 | membership_scheme: wka 90 | domain: wso2.carbon.domain 91 | local_member_host: 127.0.0.1 92 | local_member_port: 4000 93 | sub_domain: worker 94 | wka: 95 | members: 96 | - 97 | hostname: 127.0.0.1 98 | port: 4000 99 | # multicast: 100 | # kubernetes: 101 | # ppaas: 102 | 103 | # Deployment synchronization configuration 104 | wso2::dep_sync: 105 | enabled: false 106 | auto_checkout: true 107 | auto_commit: false 108 | repository_type: svn 109 | svn: 110 | url: http://svnrepo.example.com/repos/ 111 | user: username 112 | password: password 113 | append_tenant_id: true 114 | 115 | # User management datasource defaults to local h2 db 116 | wso2::usermgt_datasource: wso2_carbon_db 117 | 118 | # Override this value if the Local registry space is mounted to a remote 119 | wso2::local_reg_datasource: wso2_carbon_db 120 | 121 | # WSO2 datasources 122 | wso2::master_datasources: 123 | wso2_carbon_db: 124 | name: WSO2_CARBON_DB 125 | description: The datasource used for registry and user manager 126 | driver_class_name: org.h2.Driver 127 | url: jdbc:h2:repository/database/WSO2CARBON_DB;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=60000 128 | username: "%{hiera('wso2::datasources::common::username')}" 129 | password: "%{hiera('wso2::datasources::common::password')}" 130 | jndi_config: jdbc/WSO2CarbonDB 131 | max_active: "%{hiera('wso2::datasources::common::max_active')}" 132 | max_wait: "%{hiera('wso2::datasources::common::max_wait')}" 133 | test_on_borrow: "%{hiera('wso2::datasources::common::test_on_borrow')}" 134 | default_auto_commit: "%{hiera('wso2::datasources::common::default_auto_commit')}" 135 | validation_query: "%{hiera('wso2::datasources::h2::validation_query')}" 136 | validation_interval: "%{hiera('wso2::datasources::common::validation_interval')}" 137 | # wso2user_db: 138 | # name: WSO2_USER_DB 139 | # description: The datasource is used for user mangement and userstore 140 | # driver_class_name: org.h2.Driver 141 | # url: jdbc:h2:repository/database/WSO2CARBON_DB?autoReconnect=true 142 | # username: "%{hiera('wso2::datasources::common::username')}" 143 | # password: "%{hiera('wso2::datasources::common::password')}" 144 | # jndi_config: jdbc/WSO2_USER_DB 145 | # max_active: "%{hiera('wso2::datasources::common::max_active')}" 146 | # max_wait: "%{hiera('wso2::datasources::common::max_wait')}" 147 | # test_on_borrow: "%{hiera('wso2::datasources::common::test_on_borrow')}" 148 | # default_auto_commit: "%{hiera('wso2::datasources::common::default_auto_commit')}" 149 | # validation_query: "%{hiera('wso2::datasources::h2::validation_query')}" 150 | # validation_interval: "%{hiera('wso2::datasources::common::validation_interval')}" 151 | 152 | # Common datasources configuration 153 | wso2::datasources::common::username: 'wso2carbon' 154 | wso2::datasources::common::password: 'wso2carbon' 155 | wso2::datasources::common::max_active: '50' 156 | wso2::datasources::common::max_idle: '20' 157 | wso2::datasources::common::max_wait: '60000' 158 | wso2::datasources::common::default_auto_commit: 'false' 159 | wso2::datasources::common::test_on_borrow: 'true' 160 | wso2::datasources::common::validation_interval: '30000' 161 | wso2::datasources::common::use_datasource_factory: 'false' 162 | 163 | # H2 datasources configuration 164 | wso2::datasources::h2::driver_class_name: 'org.h2.Driver' 165 | wso2::datasources::h2::validation_query: 'SELECT 1' 166 | 167 | # MySQL datasources configuration 168 | wso2::datasources::mysql::username: 'root' 169 | wso2::datasources::mysql::password: 'root' 170 | wso2::datasources::mysql::connector_jar: 'mysql-connector-java-5.1.36-bin.jar' 171 | wso2::datasources::mysql::driver_class_name: 'com.mysql.jdbc.Driver' 172 | wso2::datasources::mysql::validation_query: 'SELECT 1' 173 | 174 | # KeyStores 175 | wso2::key_stores: 176 | # primary key store for the purpose of storing the keys for encrypting sensitive data 177 | key_store: 178 | location: 'repository/resources/security/wso2carbon.jks' 179 | type: 'JKS' 180 | password: "%{hiera('wso2::key_stores::key_store::password')}" 181 | key_alias: 'wso2carbon' 182 | key_password: "%{hiera('wso2::key_stores::key_store::key_password')}" 183 | # Encrypt Decrypt Store will be used for encrypting and decrypting 184 | registry_key_store: 185 | location: 'repository/resources/security/wso2carbon.jks' 186 | type: 'JKS' 187 | password: "%{hiera('wso2::key_stores::registry_key_store::password')}" 188 | key_alias: 'wso2carbon' 189 | key_password: "%{hiera('wso2::key_stores::registry_key_store::key_password')}" 190 | # key store for the purpose of storing the trusted certificates of public keys in keystores 191 | trust_store: 192 | location: 'repository/resources/security/client-truststore.jks' 193 | type: 'JKS' 194 | password: "%{hiera('wso2::key_stores::trust_store::password')}" 195 | # keystore for authenticating the communication over SSL/TLS for Tomcat level connections 196 | connector_key_store: 197 | location: 'repository/resources/security/wso2carbon.jks' 198 | password: "%{hiera('wso2::key_stores::connector_key_store::password')}" 199 | user_trusted_rp_store: 200 | location: 'repository/resources/security/userRP.jks' 201 | type: 'JKS' 202 | password: "%{hiera('wso2::key_stores::user_trusted_rp_store::password')}" 203 | key_password: "%{hiera('wso2::key_stores::user_trusted_rp_store::key_password')}" 204 | 205 | # KeyStore passwords 206 | wso2::key_stores::key_store::password: 'wso2carbon' 207 | wso2::key_stores::key_store::key_password: 'wso2carbon' 208 | wso2::key_stores::registry_key_store::password: 'wso2carbon' 209 | wso2::key_stores::registry_key_store::key_password: 'wso2carbon' 210 | wso2::key_stores::trust_store::password: 'wso2carbon' 211 | wso2::key_stores::connector_key_store::password: 'wso2carbon' 212 | wso2::key_stores::user_trusted_rp_store::password: 'wso2carbon' 213 | wso2::key_stores::user_trusted_rp_store::key_password: 'wso2carbon' 214 | 215 | # Secure vault configuration 216 | wso2::enable_secure_vault: false 217 | 218 | wso2::sso_authentication: 219 | enabled: false 220 | login_page: /carbon/admin/login.jsp 221 | service_provider_id: carbonServer 222 | sso_service_url: https://localhost:9443/samlsso 223 | consumer_service_url: https://localhost:9443/acs 224 | 225 | wso2::super_admin::username: 'admin' 226 | wso2::super_admin::password: 'admin' 227 | 228 | wso2::user_management: 229 | admin_role: admin 230 | admin_username: "%{hiera('wso2::super_admin::username')}" 231 | admin_password: "%{hiera('wso2::super_admin::password')}" 232 | 233 | # symlink to Java install directory 234 | java_home: /opt/java 235 | 236 | # Java preferences storage location 237 | java_prefs_system_root: "/home/%{hiera('wso2::user')}/.java" 238 | java_prefs_user_root: "/home/%{hiera('wso2::user')}/.java/.systemPrefs" 239 | 240 | # wso2base::java class automatic parameter lookup 241 | wso2::java::install: true 242 | wso2::java::installation_dir: /mnt/jdk-8u131 243 | wso2::java::source_file: jdk-8u131-linux-x64.tar.gz 244 | wso2::java::user: "%{hiera('wso2::user')}" 245 | wso2::java::group: "%{hiera('wso2::group')}" 246 | wso2::java::home: "%{hiera('java_home')}" 247 | wso2::java::prefs_system_root: "%{hiera('java_prefs_system_root')}" 248 | wso2::java::prefs_user_root: "%{hiera('java_prefs_user_root')}" 249 | 250 | packages: 251 | - zip 252 | - unzip 253 | 254 | # setting a list of files to be removed from the pack. e.g: 255 | # wso2::remove_file_list: 256 | # - "repository/deployment/server/synapse-configs/default/inbound-endpoints/WebSocketInboundEndpoint.xml" 257 | # - "repository/deployment/server/synapse-configs/default/sequences/dispatchSeq.xml" 258 | -------------------------------------------------------------------------------- /issue_template.md: -------------------------------------------------------------------------------- 1 | **Description:** 2 | 3 | 4 | **Suggested Labels:** 5 | 6 | 7 | **Suggested Assignees:** 8 | 9 | 10 | **Affected Product Version:** 11 | 12 | **OS, DB, other environment details and versions:** 13 | 14 | **Steps to reproduce:** 15 | 16 | 17 | **Related Issues:** 18 | -------------------------------------------------------------------------------- /manifests/clean.pp: -------------------------------------------------------------------------------- 1 | #---------------------------------------------------------------------------- 2 | # Copyright (c) 2016 WSO2, Inc. http://www.wso2.org 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | #---------------------------------------------------------------------------- 16 | 17 | # TODO: Clean will be removed from the next major version release of wso2base puppet module 18 | # This file is only kept to support backward compatibility 19 | class wso2base::clean { 20 | } -------------------------------------------------------------------------------- /manifests/clean_deployment.pp: -------------------------------------------------------------------------------- 1 | #---------------------------------------------------------------------------- 2 | # Copyright (c) 2016 WSO2, Inc. http://www.wso2.org 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | #---------------------------------------------------------------------------- 16 | 17 | # check the pack against the latest pack in the puppet master and do cleanup if necessary 18 | define wso2base::clean_deployment ($pack_file_abs_path, $caller_module_name, $pack_filename, $user, $group, $install_dir, $pack_dir) { 19 | $temp_pack_file_abs_path = "/tmp/${pack_filename}" 20 | $install_dirs = [ $install_dir, $pack_dir ] 21 | 22 | # download the current pack exists in the puppet master to temporary location 23 | file { "${temp_pack_file_abs_path}": 24 | ensure => present, 25 | source => ["puppet:///modules/${caller_module_name}/${pack_filename}", "puppet:///files/packs/${pack_filename}"], 26 | replace => true, 27 | notify => Exec['check_diff'] 28 | } 29 | 30 | # if there is a difference between the current pack and the new pack, remove the current pack and the deployment 31 | exec { 'check_diff': 32 | provider => shell, 33 | command => "if [ -f `${carbon_home}/wso2carbon.pid`]; then kill -9 `cat ${carbon_home}/wso2carbon.pid`; fi && wait && rm -rf ${pack_dir}/* ${carbon_home}", 34 | path => ['/usr/bin', '/usr/sbin', '/bin'], 35 | onlyif => "test `diff -q ${pack_file_abs_path} ${temp_pack_file_abs_path} >/dev/null; echo $?` -eq 1", 36 | refreshonly => true, 37 | notify => Exec['clean_temp_pack'] 38 | } 39 | 40 | # remove the temporary packs 41 | exec { 'clean_temp_pack': 42 | command => "rm ${temp_pack_file_abs_path}", 43 | path => ['/usr/bin', '/usr/sbin', '/bin'], 44 | onlyif => "test -f ${temp_pack_file_abs_path}", 45 | refreshonly => true 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /manifests/configure.pp: -------------------------------------------------------------------------------- 1 | #---------------------------------------------------------------------------- 2 | # Copyright (c) 2016 WSO2, Inc. http://www.wso2.org 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | #---------------------------------------------------------------------------- 16 | 17 | class wso2base::configure { 18 | 19 | $patches_dir = $wso2base::patches_dir 20 | $template_list = $wso2base::template_list 21 | $file_list = $wso2base::file_list 22 | $remove_file_list = $wso2base::remove_file_list 23 | $patch_list = $wso2base::patch_list 24 | $cert_list = $wso2base::cert_list 25 | $system_file_list = $wso2base::system_file_list 26 | $carbon_home = $wso2base::carbon_home 27 | $wso2_group = $wso2base::wso2_group 28 | $wso2_user = $wso2base::wso2_user 29 | $platform_version = $wso2base::platform_version 30 | $java_home = $wso2base::java_home 31 | $key_stores = $wso2base::key_stores 32 | 33 | # Ensure that patches specified in patch_list are present 34 | if ($patch_list != undef and size($patch_list) > 0) { 35 | wso2base::patch { 36 | $patch_list: 37 | carbon_home => $carbon_home, 38 | patches_dir => $patches_dir, 39 | platform_version => $platform_version, 40 | owner => $wso2_user, 41 | group => $wso2_group, 42 | wso2_module => $caller_module_name 43 | } 44 | } else { 45 | # If the patch_list is empty then copy all the patches from Puppet patch files source 46 | ensure_resource('file', "${carbon_home}/${patches_dir}", { 47 | ensure => present, 48 | owner => $wso2_user, 49 | group => $wso2_group, 50 | recurse => remote, 51 | mode => '0755', 52 | source => ["puppet:///modules/${caller_module_name}/patches/${platform_version}"] 53 | }) 54 | } 55 | 56 | if ($template_list != undef and size($template_list) > 0) { 57 | wso2base::push_templates { 58 | $template_list: 59 | owner => $wso2_user, 60 | group => $wso2_group, 61 | carbon_home => $carbon_home, 62 | wso2_module => $caller_module_name 63 | } 64 | } 65 | 66 | if ($file_list != undef and size($file_list) > 0) { 67 | wso2base::push_files { 68 | $file_list: 69 | owner => $wso2_user, 70 | group => $wso2_group, 71 | carbon_home => $carbon_home, 72 | wso2_module => $caller_module_name 73 | } 74 | } 75 | 76 | if ($system_file_list != undef and size($system_file_list) > 0) { 77 | wso2base::push_system_files { 78 | $system_file_list: 79 | owner => $wso2_user, 80 | group => $wso2_group, 81 | wso2_module => $caller_module_name 82 | } 83 | } 84 | 85 | if ($cert_list != undef and size($cert_list) > 0) { 86 | wso2base::import_cert { 87 | $cert_list: 88 | carbon_home => $carbon_home, 89 | java_home => $java_home, 90 | owner => $wso2_user, 91 | group => $wso2_group, 92 | wso2_module => $caller_module_name, 93 | trust_store_password => $key_stores['trust_store']['password'] 94 | } 95 | } 96 | 97 | if ($remove_file_list != undef and size(remove_file_list) > 0) { 98 | wso2base::remove_files { 99 | $remove_file_list: 100 | owner => $wso2_user, 101 | group => $wso2_group, 102 | carbon_home => $carbon_home, 103 | wso2_module => $caller_module_name, 104 | require => [Wso2base::Push_files[$file_list], Wso2base::Push_templates[$template_list]] 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /manifests/configure_idp_service_providers.pp: -------------------------------------------------------------------------------- 1 | #---------------------------------------------------------------------------- 2 | # Copyright (c) 2016 WSO2, Inc. http://www.wso2.org 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | #---------------------------------------------------------------------------- 16 | 17 | define wso2base::configure_idp_service_providers($carbon_home, $owner, $group, $wso2_module) { 18 | 19 | $template_path = 'repository/conf/identity/service-providers' 20 | 21 | ensure_resource('file', "${carbon_home}/${template_path}/${name}.xml", { 22 | ensure => file, 23 | owner => $owner, 24 | group => $group, 25 | mode => '0755', 26 | content => template("${wso2_module}/${template_path}/service_provider_template.xml.erb") 27 | }) 28 | } 29 | -------------------------------------------------------------------------------- /manifests/ensure_directory_structures.pp: -------------------------------------------------------------------------------- 1 | #---------------------------------------------------------------------------- 2 | # Copyright (c) 2016 WSO2, Inc. http://www.wso2.org 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | #---------------------------------------------------------------------------- 16 | 17 | define wso2base::ensure_directory_structures ($system, $carbon_home, $owner, $group) { 18 | # system - true if path name is absolute, false if relative to $carbon_home 19 | 20 | if ($system != undef and $system == true){ 21 | exec { "create_directory_structure_${carbon_home}/${name}": 22 | unless => "test -d ${name}", 23 | command => "mkdir -p ${name}", 24 | path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 25 | } 26 | }else{ 27 | exec { "create_directory_structure_${carbon_home}/${name}": 28 | unless => "test -d ${carbon_home}/${name}", 29 | command => "mkdir -p ${carbon_home}/${name} && chown -R ${owner}:${group} ${carbon_home}/${name}", 30 | path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 31 | } 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /manifests/import_cert.pp: -------------------------------------------------------------------------------- 1 | #---------------------------------------------------------------------------- 2 | # Copyright (c) 2016 WSO2, Inc. http://www.wso2.org 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | #---------------------------------------------------------------------------- 16 | 17 | # Add certificate to wso2 server's trust-store 18 | define wso2base::import_cert ($carbon_home, $java_home, $owner, $group, $wso2_module, $trust_store_password) { 19 | $cert_file = $name['file'] 20 | $alias = $name['alias'] 21 | 22 | ensure_resource('file', "${carbon_home}/repository/resources/security/${cert_file}", { 23 | ensure => file, 24 | owner => $owner, 25 | group => $group, 26 | mode => '0755', 27 | source => [ 28 | "puppet:///modules/${wso2_module}/certs/${cert_file}", 29 | "puppet:///modules/wso2base/certs/${cert_file}", 30 | "puppet:///files/certs/${cert_file}" 31 | ] 32 | }) 33 | 34 | exec { "import_cert_${cert_file}": 35 | path => "${java_home}/bin", 36 | cwd => "${carbon_home}/repository/resources/security", 37 | command => "keytool -importcert -noprompt -alias ${alias} -keystore client-truststore.jks -storepass ${trust_store_password} -file ${cert_file}", 38 | logoutput => 'on_failure', 39 | require => File["${carbon_home}/repository/resources/security/${cert_file}"], 40 | notify => Exec["delete_cert_${cert_file}"], 41 | } 42 | 43 | exec { "delete_cert_${cert_file}": 44 | path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 45 | cwd => "${carbon_home}/repository/resources/security", 46 | command => "rm -rf ${cert_file}", 47 | logoutput => 'on_failure', 48 | refreshonly => true, 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /manifests/init.pp: -------------------------------------------------------------------------------- 1 | #---------------------------------------------------------------------------- 2 | # Copyright (c) 2016 WSO2, Inc. http://www.wso2.org 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | #---------------------------------------------------------------------------- 16 | 17 | # wso2base main class. This class validates base configuration parameters 18 | class wso2base ( 19 | $packages, 20 | $template_list, 21 | $file_list, 22 | $remove_file_list, 23 | $patch_list, 24 | $cert_list, 25 | $system_file_list, 26 | $directory_list, 27 | $hosts_mapping, 28 | $java_home, 29 | $java_prefs_system_root, 30 | $java_prefs_user_root, 31 | $vm_type, 32 | $wso2_user, 33 | $wso2_group, 34 | $product_name, 35 | $product_version, 36 | $platform_version, 37 | $carbon_home_symlink, 38 | $remote_file_url, 39 | $maintenance_mode, 40 | $install_mode, 41 | $install_dir, 42 | $pack_dir, 43 | $pack_filename, 44 | $pack_extracted_dir, 45 | $patches_dir, 46 | $service_name, 47 | $service_template, 48 | $ipaddress, 49 | $enable_secure_vault, 50 | $secure_vault_configs, 51 | $key_stores, 52 | $carbon_home, 53 | $pack_file_abs_path 54 | ) inherits wso2base::params { 55 | 56 | validate_array($packages) 57 | validate_array($template_list) 58 | 59 | # validate optional parameters only if they are defined 60 | if $file_list != undef { 61 | validate_array($file_list) 62 | } 63 | if $remove_file_list != undef { 64 | validate_array($remove_file_list) 65 | } 66 | if $patch_list != undef { 67 | validate_array($patch_list) 68 | } 69 | if $cert_list != undef { 70 | validate_array($cert_list) 71 | } 72 | if $system_file_list != undef { 73 | validate_hash($system_file_list) 74 | } 75 | if $directory_list != undef { 76 | validate_array($directory_list) 77 | } 78 | 79 | validate_hash($hosts_mapping) 80 | validate_string($vm_type) 81 | validate_string($wso2_user) 82 | validate_string($wso2_group) 83 | validate_string($product_name) 84 | validate_string($product_version) 85 | validate_string($platform_version) 86 | validate_string($carbon_home_symlink) 87 | validate_string($maintenance_mode) 88 | validate_string($install_mode) 89 | validate_string($install_dir) 90 | validate_string($pack_dir) 91 | validate_string($pack_filename) 92 | validate_string($pack_extracted_dir) 93 | validate_string($patches_dir) 94 | validate_string($service_name) 95 | validate_string($service_template) 96 | validate_string($ipaddress) 97 | validate_bool($enable_secure_vault) 98 | validate_hash($key_stores) 99 | validate_string($carbon_home) 100 | validate_string($pack_file_abs_path) 101 | 102 | if $install_mode == 'file_repo' { 103 | validate_string($remote_file_url) 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /manifests/install.pp: -------------------------------------------------------------------------------- 1 | #---------------------------------------------------------------------------- 2 | # Copyright (c) 2016 WSO2, Inc. http://www.wso2.org 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | #---------------------------------------------------------------------------- 16 | 17 | # Downloads the pack, extract and set user permissions 18 | class wso2base::install { 19 | 20 | $wso2_group = $wso2base::wso2_group 21 | $wso2_user = $wso2base::wso2_user 22 | $vm_type = $wso2base::vm_type 23 | $mode = $wso2base::install_mode 24 | $install_dir = $wso2base::install_dir 25 | $pack_filename = $wso2base::pack_filename 26 | $pack_dir = $wso2base::pack_dir 27 | $carbon_home_symlink = $wso2base::carbon_home_symlink 28 | $carbon_home = $wso2base::carbon_home 29 | $pack_file_abs_path = $wso2base::pack_file_abs_path 30 | $remote_file_url = $wso2base::remote_file_url 31 | $directory_list = $wso2base::directory_list 32 | 33 | # create directories for installation if they do not exist 34 | $install_dirs=[$install_dir, $pack_dir] 35 | wso2base::ensure_directory_structures { 36 | $install_dirs: 37 | system => true, 38 | carbon_home => $carbon_home, 39 | owner => $wso2_user, 40 | group => $wso2_group 41 | } 42 | 43 | # create required directories inside CARBON_HOME 44 | if ($directory_list != undef and size($directory_list) > 0) { 45 | wso2base::ensure_directory_structures { 46 | $directory_list: 47 | system => false, 48 | carbon_home => $carbon_home, 49 | owner => $wso2_user, 50 | group => $wso2_group 51 | } 52 | } 53 | 54 | wso2base::clean_deployment { 55 | 'clean_on_pack_change': 56 | pack_file_abs_path => $pack_file_abs_path, 57 | caller_module_name => $caller_module_name, 58 | pack_filename => $pack_filename, 59 | user => $wso2_user, 60 | group => $wso2_group, 61 | install_dir => $install_dir, 62 | pack_dir => $pack_dir 63 | } 64 | 65 | # download wso2 product pack zip archive 66 | case $mode { 67 | 'file_repo': { 68 | ensure_resource('exec', $pack_file_abs_path, { 69 | path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 70 | cwd => $pack_dir, 71 | command => "wget -q ${remote_file_url}", 72 | logoutput => 'on_failure', 73 | creates => $pack_file_abs_path, 74 | onlyif => "test -f ${pack_file_abs_path}", 75 | timeout => 0, 76 | notify => Exec["extract_${pack_file_abs_path}"], 77 | require => Wso2base::Ensure_directory_structures[$install_dirs] 78 | }) 79 | } 80 | 81 | 'file_bucket': { 82 | file { $pack_file_abs_path: 83 | ensure => present, 84 | owner => $wso2_user, 85 | group => $wso2_group, 86 | mode => 755, 87 | source => [ 88 | "puppet:///modules/${caller_module_name}/${pack_filename}", 89 | "puppet:///files/packs/${pack_filename}" 90 | ], 91 | require => [Wso2base::Clean_deployment['clean_on_pack_change'], Wso2base::Ensure_directory_structures[$install_dirs]], 92 | notify => Exec["extract_${pack_file_abs_path}"], 93 | replace => true 94 | } 95 | } 96 | 97 | default: { fail("Install mode ${mode} is not supported by this module.") } 98 | } 99 | 100 | # extract downloaded wso2 product pack archive 101 | ensure_resource('exec', "extract_${pack_file_abs_path}", { 102 | path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 103 | cwd => $install_dir, 104 | command => "unzip -u ${pack_file_abs_path}", 105 | logoutput => 'on_failure', 106 | creates => "${carbon_home}/bin", 107 | timeout => 0, 108 | require => Wso2base::Ensure_directory_structures[$install_dirs], 109 | refreshonly => true, 110 | notify => Exec["set_ownership_${carbon_home}"] 111 | }) 112 | 113 | # set ownership for carbon_home 114 | ensure_resource('exec', "set_ownership_${carbon_home}", { 115 | path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 116 | cwd => $carbon_home, 117 | command => "chown -R ${wso2_user}:${wso2_group} ${install_dir}", 118 | logoutput => 'on_failure', 119 | timeout => 0, 120 | refreshonly => true, 121 | notify => Exec["set_permissions_${carbon_home}"] 122 | }) 123 | 124 | # set file permissions for carbon_home 125 | ensure_resource('exec', "set_permissions_${carbon_home}", { 126 | path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 127 | cwd => $carbon_home, 128 | command => "chmod -R 755 ${install_dir}", 129 | logoutput => 'on_failure', 130 | timeout => 0, 131 | refreshonly => true 132 | }) 133 | 134 | if $vm_type == 'docker' { 135 | # Remove wso2 product pack zip archive when provisioning the Docker image 136 | # We are going to re-use the zip archive in non-Docker scenarios to minimize network traffic (for eg. AWS-EC2) 137 | exec { "remove_product_pack_${carbon_home}": 138 | path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 139 | command => "rm -rf ${pack_file_abs_path}", 140 | require => Exec["set_permissions_${carbon_home}"] 141 | } 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /manifests/java.pp: -------------------------------------------------------------------------------- 1 | #---------------------------------------------------------------------------- 2 | # Copyright (c) 2016 WSO2, Inc. http://www.wso2.org 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | #---------------------------------------------------------------------------- 16 | # 17 | # Class to manage Java installation 18 | define wso2base::java ($deploymentdir, $source, $java_home, $user, $group) { 19 | 20 | case $::osfamily { 21 | 'Debian' : { $supported = true } 22 | 'RedHat' : { $supported = true } 23 | 'Suse' : { $supported = true } 24 | default : { fail("The ${module_name} module is not supported on ${::osfamily} based systems") } 25 | } 26 | 27 | # Validate parameters 28 | validate_string($source) 29 | validate_string($user) 30 | validate_string($group) 31 | validate_string($deploymentdir) 32 | validate_string($java_home) 33 | 34 | # Validate source is .gz or .tar.gz 35 | if !(('.tar.gz' in $source) or ('.gz' in $source) or ('.bin' in $source)) { 36 | fail('source must be either .tar.gz or .gz or .bin') 37 | } 38 | 39 | if ($caller_module_name == undef) { 40 | $mod_name = $module_name 41 | } else { 42 | $mod_name = $caller_module_name 43 | } 44 | 45 | # Resource default for Exec 46 | Exec { 47 | path => ['/sbin', '/bin', '/usr/sbin', '/usr/bin'], 48 | } 49 | 50 | $install_dirs = [$deploymentdir, '/opt/java-setup'] 51 | ensure_resource('file', $install_dirs, { 52 | ensure => 'directory' 53 | }) 54 | 55 | file { "/opt/java-setup/${source}": 56 | source => [ 57 | "puppet:///modules/${mod_name}/${source}", 58 | "puppet:///files/packs/${source}" 59 | ], 60 | mode => '0711', 61 | require => File[$install_dirs], 62 | } 63 | 64 | if ('.bin' in $source) { 65 | exec { "extract_java-${name}": 66 | cwd => '/opt/java-setup', 67 | command => "mkdir extracted; cd extracted ; ../*.bin <> echo '\n\n' -d extracted && touch /opt/java-setup/.java_extracted", 68 | creates => "/opt/java-setup/.java_extracted", 69 | # in case of a bin archive, we get a return code of 1 from unzip. This is ok 70 | returns => [0, 1], 71 | require => File["/opt/java-setup/${source}"], 72 | } 73 | } else { 74 | exec { "extract_java-${name}": 75 | cwd => '/opt/java-setup', 76 | command => "mkdir extracted; tar -C extracted -xzf *.gz && touch /opt/java-setup/.java_extracted", 77 | creates => "/opt/java-setup/.java_extracted", 78 | require => File["/opt/java-setup/${source}"], 79 | } 80 | } 81 | 82 | exec { "create_target-${name}": 83 | cwd => '/', 84 | command => "mkdir -p ${deploymentdir}", 85 | creates => $deploymentdir, 86 | require => Exec["extract_java-${name}"], 87 | } 88 | 89 | exec { "move_java-${name}": 90 | cwd => "/opt/java-setup/extracted", 91 | command => "cp -r */* ${deploymentdir}/ && chown -R ${user}:${group} ${deploymentdir} && touch ${deploymentdir}/.puppet_java_${name}_deployed", 92 | creates => "${deploymentdir}/.puppet_java_${name}_deployed", 93 | require => Exec["create_target-${name}"], 94 | } 95 | 96 | exec { "set_java_home-${name}": 97 | cwd => '/', 98 | command => "echo 'export JAVA_HOME=${java_home}' >> /etc/.bashrc", 99 | unless => "grep 'JAVA_HOME=${java_home}' /etc/.bashrc", 100 | require => Exec["move_java-${name}"], 101 | } 102 | 103 | exec { "update_path-${name}": 104 | cwd => '/', 105 | command => "echo 'export PATH=\$JAVA_HOME/bin:\$PATH' >> /etc/.bashrc", 106 | unless => "grep 'export PATH=\$JAVA_HOME/bin:\$PATH' /etc/.bashrc", 107 | require => Exec["set_java_home-${name}"], 108 | } 109 | 110 | exec { "update_classpath-${name}": 111 | cwd => '/', 112 | command => "echo 'export CLASSPATH=\$JAVA_HOME/lib/classes.zip' >> /etc/.bashrc", 113 | unless => "grep 'export CLASSPATH=\$JAVA_HOME/lib/classes.zip' /etc/.bashrc", 114 | require => Exec["set_java_home-${name}"], 115 | } 116 | 117 | # create a symlink for Java deployment 118 | file { $java_home: 119 | ensure => 'link', 120 | target => $deploymentdir, 121 | require => Exec["update_classpath-${name}"] 122 | } 123 | 124 | # set JAVA_HOME environment variable and include JAVA_HOME/bin in PATH for all users 125 | file { '/etc/profile.d/set_java_home.sh': 126 | ensure => present, 127 | content => inline_template("JAVA_HOME=${java_home}\nPATH=${java_home}/bin:\$PATH"), 128 | require => File[$java_home] 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /manifests/params.pp: -------------------------------------------------------------------------------- 1 | #---------------------------------------------------------------------------- 2 | # Copyright (c) 2017 WSO2, Inc. http://www.wso2.org 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | #---------------------------------------------------------------------------- 16 | 17 | class wso2base::params { 18 | 19 | # use_hieradata facter flags whether parameter lookup should be done via Hiera 20 | if $::use_hieradata == 'true' { 21 | 22 | # server startup script name 23 | $startup_script_name = hiera('wso2::startup_script_name') 24 | # process id file path 25 | $pid_file_path = hiera('wso2::pid_file_path') 26 | # whether we automatically start wso2service or not 27 | $autostart_service = hiera('wso2::autostart_service') 28 | # java properties 29 | $install_java = hiera('wso2::java::install') 30 | $java_install_dir = hiera('wso2::java::installation_dir') 31 | $java_source_file = hiera('wso2::java::source_file') 32 | $java_user = hiera('wso2::java::user') 33 | $java_group = hiera('wso2::java::group') 34 | $service_refresh_file_list = hiera('wso2::service_refresh_file_list', undef) 35 | 36 | } else { 37 | 38 | # whether we automatically start wso2service or not 39 | $autostart_service = true 40 | # java properties 41 | $install_java = true 42 | $java_install_dir = '/mnt/jdk-8u131' 43 | $java_source_file = 'jdk-8u131-linux-x64.tar.gz' 44 | $java_user = 'wso2user' 45 | $java_group = 'wso2' 46 | } 47 | 48 | validate_bool($autostart_service) 49 | validate_bool($install_java) 50 | validate_string($java_install_dir) 51 | validate_string($java_source_file) 52 | validate_string($java_user) 53 | validate_string($java_group) 54 | } 55 | -------------------------------------------------------------------------------- /manifests/patch.pp: -------------------------------------------------------------------------------- 1 | #---------------------------------------------------------------------------- 2 | # Copyright (c) 2016 WSO2, Inc. http://www.wso2.org 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | #---------------------------------------------------------------------------- 16 | 17 | define wso2base::patch ($carbon_home, $patches_dir, $platform_version, $owner, $group, $wso2_module) { 18 | 19 | if ($name != undef and size($name) > 0) { 20 | ensure_resource('file', "${carbon_home}/${patches_dir}/${name}", { 21 | ensure => present, 22 | owner => $owner, 23 | group => $group, 24 | recurse => remote, 25 | mode => '0755', 26 | source => [ 27 | "puppet:///modules/${wso2_module}/patches/${platform_version}/${name}", 28 | "puppet:///modules/wso2base/patches/${platform_version}/${name}", 29 | "puppet:///files/patches/${platform_version}/${name}" 30 | ] 31 | }) 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /manifests/push_files.pp: -------------------------------------------------------------------------------- 1 | #---------------------------------------------------------------------------- 2 | # Copyright (c) 2016 WSO2, Inc. http://www.wso2.org 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | #---------------------------------------------------------------------------- 16 | 17 | define wso2base::push_files ($carbon_home, $owner, $group, $wso2_module) { 18 | ensure_resource('file', "${carbon_home}/${name}", { 19 | ensure => present, 20 | owner => $owner, 21 | group => $group, 22 | recurse => remote, 23 | mode => '0755', 24 | source => [ 25 | "puppet:///modules/${wso2_module}/configs/${name}", 26 | "puppet:///modules/wso2base/configs/${name}", 27 | "puppet:///files/configs/${name}" 28 | ] 29 | }) 30 | } 31 | -------------------------------------------------------------------------------- /manifests/push_system_files.pp: -------------------------------------------------------------------------------- 1 | #---------------------------------------------------------------------------- 2 | # Copyright (c) 2016 WSO2, Inc. http://www.wso2.org 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | #---------------------------------------------------------------------------- 16 | 17 | define wso2base::push_system_files ($owner, $group, $wso2_module) { 18 | $file = $name['file'] 19 | $target_path = $name['target_path'] 20 | 21 | ensure_resource('file', "${target_path}/${file}", { 22 | ensure => present, 23 | owner => $owner, 24 | group => $group, 25 | recurse => remote, 26 | mode => '0755', 27 | source => [ 28 | "puppet:///modules/${wso2_module}/system/${file}", 29 | "puppet:///modules/wso2base/system/${file}", 30 | "puppet:///files/system/${file}" 31 | ] 32 | }) 33 | } 34 | -------------------------------------------------------------------------------- /manifests/push_templates.pp: -------------------------------------------------------------------------------- 1 | #---------------------------------------------------------------------------- 2 | # Copyright (c) 2016 WSO2, Inc. http://www.wso2.org 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | #---------------------------------------------------------------------------- 16 | 17 | define wso2base::push_templates ($carbon_home, $owner, $group, $wso2_module) { 18 | ensure_resource('file', "${carbon_home}/${name}", { 19 | ensure => file, 20 | owner => $owner, 21 | group => $group, 22 | mode => '0755', 23 | content => template("${wso2_module}/${name}.erb") 24 | }) 25 | } 26 | -------------------------------------------------------------------------------- /manifests/remove_files.pp: -------------------------------------------------------------------------------- 1 | #---------------------------------------------------------------------------- 2 | # Copyright (c) 2017 WSO2, Inc. http://www.wso2.org 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | #---------------------------------------------------------------------------- 16 | 17 | define wso2base::remove_files ($carbon_home, $owner, $group, $wso2_module) { 18 | ensure_resource('file', "${carbon_home}/${name}", { 19 | ensure => absent, 20 | owner => $owner, 21 | group => $group, 22 | recurse => false, 23 | mode => '0755', 24 | force => true 25 | }) 26 | } 27 | -------------------------------------------------------------------------------- /manifests/service.pp: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------ 2 | # Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # ------------------------------------------------------------------------------ 16 | 17 | class wso2base::service { 18 | 19 | $vm_type = $wso2base::vm_type 20 | $service_name = $wso2base::service_name 21 | $install_dir = $wso2base::install_dir 22 | $carbon_home = $wso2base::carbon_home 23 | $autostart_service = $wso2base::autostart_service 24 | $service_refresh_file_list = $wso2base::service_refresh_file_list 25 | 26 | if ($service_refresh_file_list != undef and size($service_refresh_file_list) > 0) { 27 | wso2base::push_files { 28 | $service_refresh_file_list: 29 | owner => $wso2_user, 30 | group => $wso2_group, 31 | carbon_home => $carbon_home, 32 | wso2_module => $caller_module_name 33 | } 34 | } 35 | 36 | # Start the service 37 | if ($vm_type != 'docker') and ($autostart_service) { 38 | service { $service_name: 39 | ensure => running, 40 | hasstatus => true, 41 | hasrestart => true, 42 | enable => true 43 | } 44 | 45 | notify { "Successfully started WSO2 service [name] ${service_name}, [CARBON_HOME] ${carbon_home}": 46 | withpath => true, 47 | require => Service[$service_name] 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /manifests/system.pp: -------------------------------------------------------------------------------- 1 | #---------------------------------------------------------------------------- 2 | # Copyright (c) 2016 WSO2, Inc. http://www.wso2.org 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | #---------------------------------------------------------------------------- 16 | # 17 | # Manages system configuration 18 | class wso2base::system { 19 | 20 | $packages = $wso2base::packages 21 | $wso2_group = $wso2base::wso2_group 22 | $wso2_user = $wso2base::wso2_user 23 | $vm_type = $wso2base::vm_type 24 | $service_name = $wso2base::service_name 25 | $service_template = $wso2base::service_template 26 | $hosts_mapping = $wso2base::hosts_mapping 27 | $install_java = $wso2base::install_java 28 | $java_install_dir = $wso2base::java_install_dir 29 | $java_source_file = $wso2base::java_source_file 30 | $java_user = $wso2base::java_user 31 | $java_group = $wso2base::java_group 32 | $java_home = $wso2base::java_home 33 | $java_prefs_system_root = $wso2base::java_prefs_system_root 34 | $java_prefs_user_root = $wso2base::java_prefs_user_root 35 | $startup_script_name = $wso2base::startup_script_name 36 | $pid_file_path = $wso2base::pid_file_path 37 | 38 | # Install system packages 39 | package { $packages: 40 | ensure => installed 41 | } 42 | 43 | group { $wso2_group: 44 | ensure => 'present', 45 | gid => '502', 46 | } 47 | 48 | user { $wso2_user: 49 | ensure => present, 50 | gid => $wso2_group, 51 | managehome => true, 52 | shell => '/bin/bash', 53 | require => Group[$wso2_group] 54 | } 55 | 56 | if $vm_type != 'docker' { 57 | cron { 'ntpdate': 58 | command => '/usr/sbin/ntpdate pool.ntp.org', 59 | user => 'root', 60 | minute => '*/50' 61 | } 62 | 63 | create_resources(host, $hosts_mapping) 64 | 65 | file { "/etc/init.d/${service_name}": 66 | ensure => present, 67 | owner => $wso2_user, 68 | group => $wso2_group, 69 | mode => '0755', 70 | content => template($service_template), 71 | require => [Group[$wso2_group], User[$wso2_user]] 72 | } 73 | 74 | if ($osfamily == 'RedHat') and ($operatingsystemmajrelease >= 7) { 75 | file { "/etc/systemd/system/${service_name}.service": 76 | ensure => present, 77 | owner => root, 78 | group => root, 79 | mode => '0644', 80 | content => template('wso2base/wso2unit.erb') 81 | } 82 | } 83 | } 84 | 85 | # Install JDK only if install_java is set to true 86 | if ($install_java) { 87 | # Set Java system preferences directory 88 | file{ [$java_prefs_system_root, $java_prefs_user_root]: 89 | ensure => 'directory', 90 | owner => $wso2_user, 91 | group => $wso2_group, 92 | mode => '0755', 93 | require => [Group[$wso2_group], User[$wso2_user]] 94 | } 95 | 96 | wso2base::java { 97 | 'jdk_installation': 98 | deploymentdir => $java_install_dir, 99 | source => $java_source_file, 100 | java_home => $java_home, 101 | user => $java_user, 102 | group => $java_group 103 | } 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "wso2-wso2base", 3 | "version": "1.2.0", 4 | "author": "WSO2", 5 | "license": "Apache-2.0", 6 | "summary": "WSO2 base Puppet module", 7 | "source": "https://github.com/wso2/puppet-base", 8 | "project_page": "https://github.com/wso2/puppet-base", 9 | "issues_url": "https://github.com/wso2/puppet-base/issues", 10 | "operatingsystem_support": [ 11 | { 12 | "operatingsystem": "Ubuntu", 13 | "operatingsystemrelease": [ 14 | "12.04", 15 | "14.04" 16 | ] 17 | } 18 | ], 19 | "tags": [ 20 | "wso2base" 21 | ], 22 | "dependencies": [ 23 | { 24 | "name": "puppetlabs/stdlib", 25 | "version_requirement": ">= 3.2.0 < 5.0.0" 26 | } 27 | ], 28 | "requirements": [ 29 | { 30 | "name": "puppet", 31 | "version_requirement": ">= 2.7.0 < 5.0.0" 32 | } 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /package.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 21 | 22 | package 23 | 24 | zip 25 | 26 | false 27 | 28 | 29 | 30 | ${project.basedir}/hieradata 31 | ${project.artifactId}-${puppet.hieradata}-${project.version}/hieradata 32 | 33 | **/* 34 | 35 | 36 | 37 | 38 | 39 | 40 | LICENSE 41 | ${project.artifactId}-${puppet.hieradata}-${project.version}/ 42 | true 43 | 644 44 | 45 | 46 | README.md 47 | ${project.artifactId}-${puppet.hieradata}-${project.version}/ 48 | true 49 | 644 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 20 | 21 | 4.0.0 22 | org.wso2.puppet 23 | wso2base-puppet-module 24 | pom 25 | 1.0.1-SNAPSHOT 26 | WSO2 Base Puppet Module 27 | 28 | 29 | 30 | Apache License Version 2.0 31 | http://www.apache.org/licenses/LICENSE-2.0 32 | 33 | 34 | 35 | 36 | 37 | 38 | maven-assembly-plugin 39 | true 40 | 2.5.3 41 | 42 | ${project.artifactId}-${puppet.hieradata}-${project.version} 43 | package.xml 44 | false 45 | 46 | 47 | 48 | create-archive 49 | package 50 | 51 | single 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | pedantic 63 | 64 | 65 | 66 | org.apache.rat 67 | apache-rat-plugin 68 | 0.12 69 | 70 | 71 | 72 | WSO2 73 | WSO2 License 1.0 74 | 75 | 76 | Copyright WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 77 | WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 78 | WSO2, Inc. http://www.wso2.org 79 | WSO2 Inc. (http://wso2.com) All Rights Reserved. 80 | WSO2, Inc. (http://wso2.com) 81 | 82 | 83 | 84 | 85 | 86 | 87 | WSO2 License 1.0 88 | 89 | 90 | 91 | 92 | **/target/**/* 93 | **/.settings/**/* 94 | **/.project 95 | **/.classpath 96 | **/.git/**/* 97 | **/.vagrant/**/* 98 | **/README.md 99 | **/*.iml 100 | **/*.iws 101 | **/*.ipr 102 | **/.gitignore 103 | **/.pmtignore 104 | **/.gitkeep 105 | **/*.key 106 | **/*.json 107 | **/*.json.erb 108 | 109 | **/*.config.erb 110 | **/*.sql 111 | **/.idea/**/* 112 | **/.idea 113 | **/tlds/**/* 114 | **/*.log 115 | **/.gitmodules 116 | **/password-tmp.erb 117 | 118 | false 119 | 120 | 121 | 122 | verify 123 | 124 | check 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | puppet-build 135 | 136 | 137 | 138 | org.codehaus.mojo 139 | exec-maven-plugin 140 | 1.5.0 141 | 142 | 143 | compile 144 | 145 | puppet 146 | ${puppet.module.home} 147 | 148 | module 149 | build 150 | 151 | 152 | compile 153 | 154 | exec 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | central 167 | Maven Central Repository 168 | default 169 | http://repo1.maven.org/maven2 170 | 171 | true 172 | daily 173 | ignore 174 | 175 | 176 | 177 | wso2-nexus 178 | WSO2 Internal Repository 179 | http://maven.wso2.org/nexus/content/groups/wso2-public/ 180 | 181 | true 182 | daily 183 | ignore 184 | 185 | 186 | 187 | 188 | 189 | UTF-8 190 | ${project.basedir} 191 | hieradata 192 | 193 | 194 | -------------------------------------------------------------------------------- /pull_request_template.md: -------------------------------------------------------------------------------- 1 | ## Purpose 2 | > Describe the problems, issues, or needs driving this feature/fix and include links to related issues in the following format: Resolves issue1, issue2, etc. 3 | 4 | ## Goals 5 | > Describe the solutions that this feature/fix will introduce to resolve the problems described above 6 | 7 | ## Approach 8 | > Describe how you are implementing the solutions. Include an animated GIF or screenshot if the change affects the UI (email documentation@wso2.com to review all UI text). Include a link to a Markdown file or Google doc if the feature write-up is too long to paste here. 9 | 10 | ## User stories 11 | > Summary of user stories addressed by this change> 12 | 13 | ## Release note 14 | > Brief description of the new feature or bug fix as it will appear in the release notes 15 | 16 | ## Documentation 17 | > Link(s) to product documentation that addresses the changes of this PR. If no doc impact, enter “N/A” plus brief explanation of why there’s no doc impact 18 | 19 | ## Training 20 | > Link to the PR for changes to the training content in https://github.com/wso2/WSO2-Training, if applicable 21 | 22 | ## Certification 23 | > Type “Sent” when you have provided new/updated certification questions, plus four answers for each question (correct answer highlighted in bold), based on this change. Certification questions/answers should be sent to certification@wso2.com and NOT pasted in this PR. If there is no impact on certification exams, type “N/A” and explain why. 24 | 25 | ## Marketing 26 | > Link to drafts of marketing content that will describe and promote this feature, including product page changes, technical articles, blog posts, videos, etc., if applicable 27 | 28 | ## Automation tests 29 | - Unit tests 30 | > Code coverage information 31 | - Integration tests 32 | > Details about the test cases and coverage 33 | 34 | ## Security checks 35 | - Followed secure coding standards in http://wso2.com/technical-reports/wso2-secure-engineering-guidelines? yes/no 36 | - Ran FindSecurityBugs plugin and verified report? yes/no 37 | - Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets? yes/no 38 | 39 | ## Samples 40 | > Provide high-level details about the samples related to this feature 41 | 42 | ## Related PRs 43 | > List any other related PRs 44 | 45 | ## Migrations (if applicable) 46 | > Describe migration steps and platforms on which migration has been tested 47 | 48 | ## Test environment 49 | > List all JDK versions, operating systems, databases, and browser/versions on which this feature/fix was tested 50 | 51 | ## Learning 52 | > Describe the research phase and any blog posts, patterns, libraries, or add-ons you used to solve the problem. -------------------------------------------------------------------------------- /templates/clustering/aws.erb: -------------------------------------------------------------------------------- 1 | <% 2 | # Copyright (c) 2016, WSO2 Inc. (http://wso2.com) All Rights Reserved. 3 | # 4 | # WSO2 Inc. licenses this file to you under the Apache License, 5 | # Version 2.0 (the "License"); you may not use this file except 6 | # 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, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | %> 18 | 19 | <%= @clustering['aws']['access_key'] %> 20 | <%= @clustering['aws']['secret_key'] %> 21 | <%= @clustering['aws']['security_group'] %> 22 | <%= @clustering['aws']['host_header'] %> 23 | <%= @clustering['aws']['region'] %> 24 | <%= @clustering['aws']['tag_key'] %> 25 | <%= @clustering['aws']['tag_value'] %> 26 | -------------------------------------------------------------------------------- /templates/clustering/kubernetes.erb: -------------------------------------------------------------------------------- 1 | <% 2 | # Copyright (c) 2016, WSO2 Inc. (http://wso2.com) All Rights Reserved. 3 | # 4 | # WSO2 Inc. licenses this file to you under the Apache License, 5 | # Version 2.0 (the "License"); you may not use this file except 6 | # 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, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | %> 18 | 19 | org.wso2.carbon.membership.scheme.kubernetes.KubernetesMembershipScheme 20 | <%- if @clustering['kubernetes'] and @clustering['kubernetes']['kubernetes_namespace'] -%> 21 | <%= @clustering['kubernetes']['kubernetes_namespace'] %> 22 | <%- end -%> 23 | <%- if @clustering['kubernetes'] and @clustering['kubernetes']['kubernetes_services'] -%> 24 | <%= @clustering['kubernetes']['kubernetes_services'] %> 25 | <%- end -%> 26 | -------------------------------------------------------------------------------- /templates/clustering/mesos.erb: -------------------------------------------------------------------------------- 1 | <% 2 | # Copyright (c) 2016, WSO2 Inc. (http://wso2.com) All Rights Reserved. 3 | # 4 | # WSO2 Inc. licenses this file to you under the Apache License, 5 | # Version 2.0 (the "License"); you may not use this file except 6 | # 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, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | %> 18 | 19 | org.wso2.carbon.clustering.mesos.MesosMembershipScheme 20 | <%- if @clustering['mesos'] and @clustering['mesos']['member_discovery_scheme'] -%> 21 | <%= @clustering['mesos']['member_discovery_scheme'] %> 22 | <%- end -%> 23 | <%- if @clustering['mesos'] and @clustering['mesos']['marathon_applications'] -%> 24 | <%= @clustering['mesos']['marathon_applications'] %> 25 | <%- end -%> 26 | <%- if @clustering['mesos'] and @clustering['mesos']['marathon_endpoint'] -%> 27 | <%= @clustering['mesos']['marathon_endpoint'] %> 28 | <%- end -%> 29 | <%- if @clustering['mesos'] and @clustering['mesos']['enable_marathon_basic_auth'] -%> 30 | <%= @clustering['mesos']['enable_marathon_basic_auth'] %> 31 | <%- end -%> 32 | <%- if @clustering['mesos'] and @clustering['mesos']['marathon_username'] -%> 33 | <%= @clustering['mesos']['marathon_username'] %> 34 | <%- end -%> 35 | <%- if @clustering['mesos'] and @clustering['mesos']['marathon_password'] -%> 36 | <%= @clustering['mesos']['marathon_password'] %> 37 | <%- end -%> 38 | <%- if @clustering['mesos'] and @clustering['mesos']['dns_endpoint'] -%> 39 | <%= @clustering['mesos']['dns_endpoint'] %> 40 | <%- end -%> 41 | -------------------------------------------------------------------------------- /templates/clustering/private-paas.erb: -------------------------------------------------------------------------------- 1 | <% 2 | # Copyright (c) 2016, WSO2 Inc. (http://wso2.com) All Rights Reserved. 3 | # 4 | # WSO2 Inc. licenses this file to you under the Apache License, 5 | # Version 2.0 (the "License"); you may not use this file except 6 | # 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, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | %> 18 | 19 | org.wso2.carbon.ppaas.PrivatePaaSBasedMembershipScheme 20 | <%- if @clustering['private_paas'] and @clustering['private_paas']['cluster_ids'] -%> 21 | <%= @clustering['private_paas']['cluster_ids'] %> 22 | <%- end -%> 23 | -------------------------------------------------------------------------------- /templates/clustering/wka.erb: -------------------------------------------------------------------------------- 1 | <% 2 | # Copyright (c) 2016, WSO2 Inc. (http://wso2.com) All Rights Reserved. 3 | # 4 | # WSO2 Inc. licenses this file to you under the Apache License, 5 | # Version 2.0 (the "License"); you may not use this file except 6 | # 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, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | %> 18 | 19 | 23 | 24 | <%- @clustering['wka']['members'].each do |member| -%> 25 | 26 | <%= member['hostname'] %> 27 | <%= member['port'] %> 28 | 29 | <%- end -%> 30 | 31 | -------------------------------------------------------------------------------- /templates/wso2service.erb: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------ 2 | # 3 | # Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 4 | # 5 | # WSO2 Inc. licenses this file to you under the Apache License, 6 | # Version 2.0 (the "License"); you may not use this file except 7 | # in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | # ------------------------------------------------------------------------------ 20 | 21 | #!/bin/bash 22 | # 23 | # /etc/init.d/as 24 | # chkconfig: 2345 90 10 25 | # description: wso2 service init script. 26 | # Provides: wso2 Inc 27 | # Required-Start: $syslog 28 | # Should-Start: 29 | # Required-Stop: $syslog 30 | # Should-Stop: 31 | # Default-Start: 2 3 4 5 32 | # Default-Stop: 0 1 6 33 | # Short-Description: wso2 service # 34 | # Get function from functions library 35 | 36 | if [ -f /etc/init.d/functions ]; then 37 | . /etc/init.d/functions 38 | else 39 | . /lib/lsb/init-functions 40 | fi 41 | 42 | #set the configuration settings for the service 43 | USER="<%= @wso2_user %>" 44 | PRODUCT_CODE="<%= @service_name %>" 45 | JAVA_HOME="<%= @java_home %>" 46 | CARBON_HOME="<%= @carbon_home %>" 47 | LOCK_FILE="${CARBON_HOME}/wso2carbon.lck" 48 | PID_FILE="${CARBON_HOME}/<%= @pid_file_path %>" 49 | CMD="${CARBON_HOME}/bin/<%= @startup_script_name %>" 50 | 51 | SERVICE_RUNNING=0 52 | SERVICE_STOPPED=3 53 | SERVICE_STATUS_UNKNOWN=4 54 | 55 | get_service_status() { 56 | if [ -e ${PID_FILE} ]; then 57 | PID=`cat ${PID_FILE}` 58 | if ps -p ${PID} > /dev/null ; then 59 | # service is running 60 | return ${SERVICE_RUNNING} 61 | else 62 | # service is stopped 63 | return ${SERVICE_STOPPED} 64 | fi 65 | else 66 | # pid file was not found, may be service was not started before. 67 | return ${SERVICE_STATUS_UNKNOWN} 68 | fi 69 | } 70 | 71 | #Get the status details of the service 72 | status() { 73 | get_service_status 74 | service_status=$? 75 | 76 | if [ ${service_status} -eq ${SERVICE_RUNNING} ]; then 77 | echo "${PRODUCT_CODE} service is currently running..." 78 | return ${SERVICE_RUNNING} 79 | elif [ ${service_status} -eq ${SERVICE_STOPPED} ]; then 80 | echo "${PRODUCT_CODE} service has been already stopped." 81 | return ${SERVICE_STOPPED} 82 | else 83 | echo "${PRODUCT_CODE} service status is currently unknown. Please check in a while." 84 | return ${SERVICE_STATUS_UNKNOWN} 85 | fi 86 | } 87 | 88 | #Start the service 89 | start() { 90 | get_service_status 91 | service_status=$? 92 | 93 | if [ ${service_status} -eq ${SERVICE_RUNNING} ]; then 94 | echo "${PRODUCT_CODE} service has been already running..." 95 | return ${SERVICE_RUNNING} 96 | fi 97 | 98 | echo "Starting ${PRODUCT_CODE} service..." 99 | touch $LOCK_FILE 100 | su - ${USER} -c "export JAVA_HOME=${JAVA_HOME}; ${CMD} start > /dev/null 2>&1 &" 101 | 102 | get_service_status 103 | service_status=$? 104 | 105 | while [ ${service_status} -ne ${SERVICE_RUNNING} ] 106 | do 107 | sleep 1; 108 | get_service_status 109 | service_status=$? 110 | done 111 | 112 | echo "${PRODUCT_CODE} service has been just started..." 113 | return ${SERVICE_RUNNING} 114 | } 115 | 116 | #Restart the service 117 | restart() { 118 | echo "Restarting ${PRODUCT_CODE} service..." 119 | touch $LOCK_FILE 120 | su - ${USER} -c "export JAVA_HOME=${JAVA_HOME}; $CMD restart > /dev/null 2>&1 &" 121 | return ${SERVICE_RUNNING} 122 | } 123 | 124 | #Stop the service 125 | stop() { 126 | get_service_status 127 | service_status=$? 128 | 129 | if [ ${service_status} -eq ${SERVICE_STOPPED} ]; then 130 | echo "${PRODUCT_CODE} service has been already stopped." 131 | return ${SERVICE_STOPPED} 132 | fi 133 | 134 | echo "Stopping ${PRODUCT_CODE} service..." 135 | su - ${USER} -c "export JAVA_HOME=${JAVA_HOME}; $CMD stop > /dev/null 2>&1 &" 136 | rm -f $LOCK_FILE 137 | 138 | while [ ${service_status} -eq ${SERVICE_RUNNING} ] 139 | do 140 | sleep 1; 141 | get_service_status 142 | service_status=$? 143 | done 144 | 145 | echo "${PRODUCT_CODE} service has been stopped." 146 | return ${SERVICE_STOPPED} 147 | } 148 | 149 | ###Main logic of the service### 150 | case "$1" in 151 | start) 152 | start 153 | ;; 154 | stop) 155 | stop 156 | ;; 157 | status) 158 | status 159 | ;; 160 | restart|reload|condrestart) 161 | restart 162 | ;; 163 | *) 164 | echo $"Usage: $0 {start|stop|status|restart|reload}" 165 | exit 1 166 | esac 167 | exit $? 168 | -------------------------------------------------------------------------------- /templates/wso2unit.erb: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=<%= @service_name %> Server 3 | After=syslog.target network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | ExecStart=<%= @carbon_home %>/bin/wso2server.sh start 8 | ExecStop=<%= @carbon_home %>/bin/wso2server.sh stop 9 | PIDFile=<%= @carbon_home %>/bin/wso2carbon.pid 10 | User=<%= @wso2_user %> 11 | RemainAfterExit=yes 12 | StandardOutput=syslog 13 | StandardError=syslog 14 | 15 | [Install] 16 | WantedBy=multi-user.target 17 | --------------------------------------------------------------------------------