├── .mvn └── jvm.config ├── release ├── .gitignore ├── gpg-agent.conf ├── pull-request-reports │ ├── Gemfile │ ├── pr_report.rb │ └── Gemfile.lock ├── settings.xml ├── clone-and-configure-repos.sh ├── common.sh ├── README.md └── change-version.sh ├── archetypes └── quickstart │ ├── src │ ├── main │ │ └── resources │ │ │ ├── .gitignore │ │ │ └── META-INF │ │ │ └── maven │ │ │ └── archetype-metadata.xml │ ├── test │ │ └── resources │ │ │ └── projects │ │ │ └── integration-test-1 │ │ │ ├── goal.txt │ │ │ ├── .gitignore │ │ │ └── archetype.properties │ └── brooklyn-sample │ │ ├── src │ │ ├── main │ │ │ ├── resources │ │ │ │ ├── sample-icon.png │ │ │ │ └── catalog.bom │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── acme │ │ │ │ └── sample │ │ │ │ └── brooklyn │ │ │ │ ├── MySample.java │ │ │ │ └── MySampleImpl.java │ │ └── test │ │ │ ├── resources │ │ │ ├── sample.bom │ │ │ └── sample-test.yaml │ │ │ └── java │ │ │ └── com │ │ │ └── acme │ │ │ └── sample │ │ │ └── brooklyn │ │ │ ├── MySampleTest.java │ │ │ └── MySampleYamlTest.java │ │ └── README.md │ └── NOTES.txt ├── karaf ├── features │ └── src │ │ └── main │ │ ├── filtered-resources │ │ └── resources │ │ │ ├── etc │ │ │ ├── config.properties │ │ │ └── branding.properties │ │ │ └── catalog │ │ │ ├── catalog.bom │ │ │ ├── catalog-library-software.bom │ │ │ ├── catalog-core.bom │ │ │ ├── catalog-brooklyn-default.bom │ │ │ ├── catalog-brooklyn-software-brooklyn.bom │ │ │ └── catalog-brooklyn-software-base.bom │ │ └── resources │ │ └── resources │ │ ├── etc │ │ ├── brooklyn-ui.cfg │ │ ├── default.catalog.bom │ │ ├── org.ops4j.pax.web.cfg │ │ ├── org.apache.brooklyn.classrename.cfg │ │ ├── custom.system.properties │ │ ├── org.apache.felix.scr.ScrService.cfg │ │ ├── brooklyn.cfg │ │ ├── org.apache.karaf.shell.cfg │ │ └── org.apache.brooklyn.osgilauncher.cfg │ │ └── bin │ │ ├── runbrooklyn │ │ ├── setenv.bat │ │ ├── generate-password.sh │ │ └── setenv └── itest │ └── src │ └── test │ ├── java │ └── org │ │ └── apache │ │ └── brooklyn │ │ ├── test │ │ └── IntegrationTest.java │ │ ├── security │ │ └── CustomSecurityProvider.java │ │ ├── core │ │ └── catalog │ │ │ └── internal │ │ │ └── DefaultBomLoadTest.java │ │ ├── AssemblyTest.java │ │ ├── rest │ │ └── BrooklynRestApiLauncherTest.java │ │ └── KarafTestUtils.java │ └── resources │ ├── exam.properties │ └── logback.xml ├── dist ├── src │ └── main │ │ ├── license │ │ └── README.md │ │ ├── dist │ │ ├── bin │ │ │ ├── .gitattributes │ │ │ └── brooklyn │ │ ├── README.md │ │ └── conf │ │ │ └── logback.xml │ │ └── config │ │ └── build-distribution.xml └── licensing │ ├── license-text │ ├── Public Domain │ ├── WTF Public License │ ├── MIT License │ ├── BSD 2-Clause (Simplified or FreeBSD) License │ ├── BSD 3-Clause (New BSD) License │ ├── Font Awesome License │ ├── Eclipse Distribution License, version 1.0 │ ├── DOM4J MetaStuff BSD style license (3-clause) │ ├── Indiana University Extreme! Lab Software License, version 1.1.1 │ ├── Java HTML Tidy License │ └── Indiana University Extreme! Lab Software License, version 1.2 │ ├── parts │ ├── license-deps-with-additional-binary │ ├── notice-additional-binary │ ├── license-deps │ ├── license-deps-source-dist │ ├── notice-top │ ├── notice-top-source-dist │ ├── notice-top-with-additional-binary │ └── yaml-asf-header │ ├── compute-nodejs-license-dependencies.format.json │ ├── update-brooklyn-license-metadata.sh │ ├── license-metadata-manual-2-angular.yaml │ ├── license-metadata-manual-go-libraries.yaml │ └── compute-nodejs-license-dependencies.sh ├── .gitattributes ├── vagrant ├── src │ └── main │ │ ├── vagrant │ │ ├── NOTICE │ │ ├── README.md │ │ ├── files │ │ │ └── vagrant-catalog.bom │ │ ├── servers.yaml │ │ └── Vagrantfile │ │ └── config │ │ └── build-distribution.xml ├── README.md └── pom.xml ├── .gitignore ├── scripts ├── README.md ├── grep-in-poms.sh ├── jstack-named.sh ├── rsd.sh ├── jstack-active.sh ├── mvnf.sh └── am ├── NOTICE ├── docker-image ├── README.md ├── Dockerfile └── pom.xml ├── docker ├── README.md ├── Dockerfile └── Makefile ├── deb-packaging └── deb │ └── control │ ├── postinst │ ├── prerm │ ├── control │ └── preinst ├── rpm-packaging └── rpm │ ├── postinstall.sh │ ├── preremove.sh │ └── preinstall.sh ├── README.md ├── shared-packaging ├── src │ ├── main │ │ └── resources │ │ │ ├── conf │ │ │ ├── logback.xml │ │ │ └── brooklyn.conf │ │ │ └── service │ │ │ ├── systemd │ │ │ └── brooklyn.service │ │ │ └── upstart │ │ │ ├── rpm │ │ │ └── brooklyn.conf │ │ │ └── deb │ │ │ └── brooklyn.conf │ └── test │ │ └── yaml │ │ ├── Vagrantfile │ │ └── package-apps.yaml └── pom.xml ├── Dockerfile ├── docker-itest ├── entrypoint.sh ├── Jenkinsfile └── Dockerfile └── Jenkinsfile /.mvn/jvm.config: -------------------------------------------------------------------------------- 1 | -Xmx1024m -Xms512m 2 | -------------------------------------------------------------------------------- /release/.gitignore: -------------------------------------------------------------------------------- 1 | .vagrant 2 | tmp 3 | -------------------------------------------------------------------------------- /release/gpg-agent.conf: -------------------------------------------------------------------------------- 1 | default-cache-ttl 3600 2 | max-cache-ttl 14400 3 | -------------------------------------------------------------------------------- /archetypes/quickstart/src/main/resources/.gitignore: -------------------------------------------------------------------------------- 1 | archetype-resources 2 | -------------------------------------------------------------------------------- /archetypes/quickstart/src/test/resources/projects/integration-test-1/goal.txt: -------------------------------------------------------------------------------- 1 | install -------------------------------------------------------------------------------- /archetypes/quickstart/src/test/resources/projects/integration-test-1/.gitignore: -------------------------------------------------------------------------------- 1 | reference 2 | -------------------------------------------------------------------------------- /karaf/features/src/main/filtered-resources/resources/etc/config.properties: -------------------------------------------------------------------------------- 1 | ${kar.config.properties} 2 | -------------------------------------------------------------------------------- /dist/src/main/license/README.md: -------------------------------------------------------------------------------- 1 | See /usage/dist/licensing/README.md for an explanation of this directory. 2 | 3 | -------------------------------------------------------------------------------- /dist/licensing/license-text/Public Domain: -------------------------------------------------------------------------------- 1 | The project indicates it is in the public domain and does not require any license inclusion. 2 | 3 | -------------------------------------------------------------------------------- /release/pull-request-reports/Gemfile: -------------------------------------------------------------------------------- 1 | #ruby=ruby-2.1.2 2 | #ruby-gemset=brooklyn-release-helpers 3 | 4 | source 'https://rubygems.org' 5 | gem 'github_api' 6 | -------------------------------------------------------------------------------- /dist/src/main/dist/bin/.gitattributes: -------------------------------------------------------------------------------- 1 | #Don't auto-convert line endings for shell scripts on Windows (breaks the scripts) 2 | brooklyn text eol=lf 3 | cloud-explorer text eol=lf 4 | -------------------------------------------------------------------------------- /karaf/features/src/main/resources/resources/etc/brooklyn-ui.cfg: -------------------------------------------------------------------------------- 1 | ## regexes for bundles to exclude from the UI registry can be supplied here 2 | # exclude_bundle_regex: [ ... ] 3 | 4 | -------------------------------------------------------------------------------- /dist/licensing/parts/license-deps-with-additional-binary: -------------------------------------------------------------------------------- 1 | 2 | Dependency licenses: 3 | 4 | # Licenses of the source and binary dependencies of this software are included below. 5 | 6 | -------------------------------------------------------------------------------- /archetypes/quickstart/src/brooklyn-sample/src/main/resources/sample-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/brooklyn-dist/HEAD/archetypes/quickstart/src/brooklyn-sample/src/main/resources/sample-icon.png -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | #Don't auto-convert line endings for shell scripts on Windows (breaks the scripts) 2 | * text=auto 3 | *.sh text eol=lf 4 | *.bat text eol=crlf 5 | *.ps1 text eol=crlf 6 | *.ini text eol=crlf 7 | -------------------------------------------------------------------------------- /vagrant/src/main/vagrant/NOTICE: -------------------------------------------------------------------------------- 1 | Apache Brooklyn 2 | Copyright 2014-2018 The Apache Software Foundation 3 | 4 | This product includes software developed at 5 | The Apache Software Foundation (http://www.apache.org/). 6 | -------------------------------------------------------------------------------- /dist/licensing/parts/notice-additional-binary: -------------------------------------------------------------------------------- 1 | 2 | Runtime dependencies: 3 | 4 | # This software depends on additional third-party components at runtime. 5 | # These are not bundled here but may be included as part of a build. 6 | 7 | -------------------------------------------------------------------------------- /dist/licensing/compute-nodejs-license-dependencies.format.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "", 3 | "version": "", 4 | "description": "", 5 | "repository": "", 6 | "homepage": "", 7 | "licenses": "", 8 | "copyright": "", 9 | "licenseText": "none" 10 | } 11 | -------------------------------------------------------------------------------- /archetypes/quickstart/src/brooklyn-sample/src/main/resources/catalog.bom: -------------------------------------------------------------------------------- 1 | brooklyn.catalog: 2 | version: "0.1.0-SNAPSHOT" 3 | itemType: entity 4 | items: 5 | - id: com.acme.sample.brooklyn.MySample 6 | item: 7 | type: com.acme.sample.brooklyn.MySample 8 | -------------------------------------------------------------------------------- /dist/licensing/parts/license-deps: -------------------------------------------------------------------------------- 1 | 2 | Dependency licenses: 3 | 4 | # This software includes third-party code under their licenses. 5 | # These licenses are compatible with the Apache License above. 6 | # Details of these dependencies can be found in the accompanying NOTICE file. 7 | # These licenses are included below with their full text. 8 | 9 | -------------------------------------------------------------------------------- /dist/licensing/parts/license-deps-source-dist: -------------------------------------------------------------------------------- 1 | 2 | Dependency licenses: 3 | 4 | # This source distribution includes third-party code under their licenses. 5 | # These licenses are compatible with the Apache License above. 6 | # Details of these dependencies can be found in the accompanying NOTICE file. 7 | # These licenses are included below with their full text. 8 | 9 | -------------------------------------------------------------------------------- /release/pull-request-reports/pr_report.rb: -------------------------------------------------------------------------------- 1 | #ruby 2 | 3 | require 'CSV' 4 | require 'github_api' 5 | 6 | gh = Github.new 7 | 8 | CSV.open("pr_report.tsv", "wb", { :col_sep => "\t" }) do |csv| 9 | gh.pull_requests.list('apache', 'incubator-brooklyn'). 10 | select { |pr| pr.state == "open" }. 11 | each { |pr| csv << [ pr.number, pr.title, pr.created_at, pr.user.login ] } 12 | end 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | \#*\# 2 | *~ 3 | *.bak 4 | *.swp 5 | *.swo 6 | .DS_Store 7 | 8 | atlassian-ide-plugin.xml 9 | *.class 10 | 11 | target/ 12 | test-output/ 13 | 14 | .project 15 | .classpath 16 | .settings/ 17 | .metadata/ 18 | 19 | .idea/ 20 | *.iml 21 | 22 | nbactions.xml 23 | nb-configuration.xml 24 | 25 | prodDb.* 26 | 27 | *.log 28 | brooklyn*.log.* 29 | 30 | *brooklyn-persisted-state/ 31 | *.vagrant/ 32 | 33 | ignored 34 | -------------------------------------------------------------------------------- /dist/licensing/parts/notice-top: -------------------------------------------------------------------------------- 1 | Notice: | 2 | 3 | Apache Brooklyn 4 | Copyright 2014-2020 The Apache Software Foundation 5 | 6 | This product includes software developed at 7 | The Apache Software Foundation (http://www.apache.org/). 8 | 9 | 10 | Bundled dependencies: 11 | 12 | # This software distribution includes the following bundled third-party components. 13 | # Referenced licenses can be found in the accompanying LICENSE file. 14 | 15 | -------------------------------------------------------------------------------- /scripts/README.md: -------------------------------------------------------------------------------- 1 | General Scripts 2 | =============== 3 | 4 | This folder contains a number of items that can assist developers of the project. 5 | 6 | In general see comments at the start of each file and/or `--help` output when running it. 7 | 8 | You can install the `*.sh` files as commands (without the `.sh` suffix linked to these) to your `bin` dir with: 9 | 10 | for x in *.sh ; do sudo ln -s `pwd`/$x /usr/local/bin/${x%.sh}; done 11 | 12 | 13 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Notice: | 2 | 3 | Apache Brooklyn 4 | Copyright 2014-2020 The Apache Software Foundation 5 | 6 | This product includes software developed at 7 | The Apache Software Foundation (http://www.apache.org/). 8 | 9 | 10 | Bundled dependencies: 11 | 12 | # This source code distribution includes the following bundled third-party components. 13 | # Referenced licenses can be found in the accompanying LICENSE file. 14 | 15 | # No such dependencies 16 | 17 | -------------------------------------------------------------------------------- /archetypes/quickstart/src/brooklyn-sample/src/test/resources/sample.bom: -------------------------------------------------------------------------------- 1 | brooklyn.catalog: 2 | id: com.acme.sample.brooklyn.MySampleInCatalog 3 | version: "1.0" 4 | itemType: template 5 | description: My Sample 6 | displayName: MySample 7 | iconUrl: classpath:///sample-icon.png 8 | libraries: 9 | - file:///Path/to/archetype/sample/target/brooklyn-sample-0.1.0-SNAPSHOT.jar 10 | item: 11 | services: 12 | - type: com.acme.sample.brooklyn.MySample 13 | -------------------------------------------------------------------------------- /dist/licensing/parts/notice-top-source-dist: -------------------------------------------------------------------------------- 1 | Notice: | 2 | 3 | Apache Brooklyn 4 | Copyright 2014-2020 The Apache Software Foundation 5 | 6 | This product includes software developed at 7 | The Apache Software Foundation (http://www.apache.org/). 8 | 9 | 10 | Bundled dependencies: 11 | 12 | # This source code distribution includes the following bundled third-party components. 13 | # Referenced licenses can be found in the accompanying LICENSE file. 14 | 15 | -------------------------------------------------------------------------------- /dist/src/main/dist/README.md: -------------------------------------------------------------------------------- 1 | 2 | # [![**Brooklyn**](https://brooklyn.apache.org/style/img/apache-brooklyn-logo-244px-wide.png)](http://brooklyn.apache.org/) 3 | 4 | ### Apache Brooklyn 5 | 6 | This is the distribution of Apache Brooklyn. 7 | 8 | As a quick start, run: 9 | 10 | ./bin/brooklyn launch 11 | 12 | For server CLI info, use: 13 | 14 | ./bin/brooklyn help 15 | 16 | And to learn more, including the full user's guide, visit [brooklyn.apache.org](http://brooklyn.apache.org/). 17 | 18 | -------------------------------------------------------------------------------- /dist/src/main/dist/conf/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /karaf/features/src/main/resources/resources/etc/default.catalog.bom: -------------------------------------------------------------------------------- 1 | 2 | # this catalog bom is an illustration supplying a few useful sample items 3 | # and templates to get started using Brooklyn 4 | 5 | brooklyn.catalog: 6 | bundle: brooklyn-default-karaf-catalog 7 | version: "1.2.0-SNAPSHOT" # BROOKLYN_VERSION 8 | catalog.osgi.wrap.headers: 9 | # when this is wrapped to produce a bundle, insert these headers so previous persisted default catalogs are replaced 10 | Brooklyn-Catalog-Force-Remove-Bundles: "*" 11 | Brooklyn-Catalog-Upgrade-For-Bundles: "*" 12 | items: 13 | - file:catalog/catalog.bom 14 | -------------------------------------------------------------------------------- /dist/licensing/license-text/WTF Public License: -------------------------------------------------------------------------------- 1 | # from http://www.wtfpl.net/about/ 2 | 3 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 4 | Version 2, December 2004 5 | 6 | Copyright (C) 2004 Sam Hocevar 7 | 8 | Everyone is permitted to copy and distribute verbatim or modified 9 | copies of this license document, and changing it is allowed as long 10 | as the name is changed. 11 | 12 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 13 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 14 | 15 | 0. You just DO WHAT THE FUCK YOU WANT TO. 16 | -------------------------------------------------------------------------------- /dist/licensing/parts/notice-top-with-additional-binary: -------------------------------------------------------------------------------- 1 | Notice: | 2 | 3 | Apache Brooklyn 4 | Copyright 2014-2020 The Apache Software Foundation 5 | 6 | This product includes software developed at 7 | The Apache Software Foundation (http://www.apache.org/). 8 | 9 | This software is released under the Apache Software License, verison 2.0. 10 | This license and the licenses for all dependencies are included below 11 | following the dependencies and their notices. 12 | 13 | Source dependencies: 14 | 15 | # This software includes the following third-party components in its source code. 16 | # Additional runtime dependencies are required when built and are listed in the subsequent section. 17 | 18 | -------------------------------------------------------------------------------- /docker-image/README.md: -------------------------------------------------------------------------------- 1 | 2 | ### Brooklyn Karaf Distribution Docker Image 3 | 4 | The instructions in this directory will build a Docker image of the `apache-brooklyn` Karaf distribution. 5 | This is an optional step in the build of Apache Brooklyn, enabled as a profile: 6 | 7 | ```bash 8 | mvn clean install -Pdocker 9 | ``` 10 | 11 | Docker should be installed and running when doing such a build. 12 | 13 | The image can then be run as usual with Docker. For example create a folder `my-brooklyn-config` which 14 | contains an `etc` directory containing your configuration for Brooklyn. Then Brooklyn can be run as: 15 | 16 | 17 | ```bash 18 | docker run --name brooklyn -d -p8081:8081 -p8443:8443 -v ${HOME}/my-brooklyn-config/etc:/brooklyn/etc apache/brooklyn:1.0.0-SNAPSHOT 19 | ``` -------------------------------------------------------------------------------- /dist/licensing/parts/yaml-asf-header: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. 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 | -------------------------------------------------------------------------------- /docker/README.md: -------------------------------------------------------------------------------- 1 | 2 | This folder is not part of the build but exists to facilitate making Docker images containing Brooklyn. 3 | 4 | To use, with `docker` tools installed, run `make all` after the Brooklyn `dist` has been built. 5 | Then do `make run` to see the options (or look in [brooklyn-docker-start]()). 6 | 7 | When building, you can use: 8 | 9 | * `--build-arg debug=true` to install extra tools on the VM and show debug output from our script when booting the container 10 | * `--build-arg application=my-app` to create a container which boots `my-app` by default 11 | * `--build-arg install_boms="http://path/to/file.bom http://path/to/another.bom"` to replace the default catalog with one or more BOM files (useful with `application` above) 12 | * `--build-arg dropins_jars="http://path/to/file.jar http://path/to/another.jar"` to add JARs in the dropins dir (useful with `application` and `install_boms` above) 13 | 14 | See examples in the `Makefile`. 15 | 16 | -------------------------------------------------------------------------------- /deb-packaging/deb/control/postinst: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. 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 | if which systemctl > /dev/null 2>&1; then 20 | systemctl daemon-reload 21 | fi 22 | -------------------------------------------------------------------------------- /rpm-packaging/rpm/postinstall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | if which systemctl >> /dev/null 2>&1; then 21 | systemctl daemon-reload 22 | fi 23 | -------------------------------------------------------------------------------- /rpm-packaging/rpm/preremove.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | if which systemctl; then 21 | systemctl stop brooklyn.service 22 | else 23 | initctl stop brooklyn 24 | fi 25 | -------------------------------------------------------------------------------- /release/pull-request-reports/Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | addressable (2.3.8) 5 | descendants_tracker (0.0.4) 6 | thread_safe (~> 0.3, >= 0.3.1) 7 | faraday (0.9.1) 8 | multipart-post (>= 1.2, < 3) 9 | github_api (0.12.3) 10 | addressable (~> 2.3) 11 | descendants_tracker (~> 0.0.4) 12 | faraday (~> 0.8, < 0.10) 13 | hashie (>= 3.3) 14 | multi_json (>= 1.7.5, < 2.0) 15 | nokogiri (~> 1.6.3) 16 | oauth2 17 | hashie (3.4.2) 18 | jwt (1.5.1) 19 | mini_portile (0.6.2) 20 | multi_json (1.11.1) 21 | multi_xml (0.5.5) 22 | multipart-post (2.0.0) 23 | nokogiri (1.6.6.2) 24 | mini_portile (~> 0.6.0) 25 | oauth2 (1.0.0) 26 | faraday (>= 0.8, < 0.10) 27 | jwt (~> 1.0) 28 | multi_json (~> 1.3) 29 | multi_xml (~> 0.5) 30 | rack (~> 1.2) 31 | rack (1.6.4) 32 | thread_safe (0.3.5) 33 | 34 | PLATFORMS 35 | ruby 36 | 37 | DEPENDENCIES 38 | github_api 39 | -------------------------------------------------------------------------------- /karaf/features/src/main/resources/resources/etc/org.ops4j.pax.web.cfg: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | org.osgi.service.http.port=8081 18 | org.ops4j.pax.web.session.cookie.httpOnly=true 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # [![**Brooklyn**](https://brooklyn.apache.org/style/img/apache-brooklyn-logo-244px-wide.png)](http://brooklyn.apache.org/) 3 | 4 | ### Distribution Sub-Project for Apache Brooklyn 5 | 6 | This repo contains modules for creating the distributable binary 7 | combining the `server`, the `ui`, and other elements in other Brooklyn repos. 8 | 9 | ### Building the project 10 | 11 | 2 methods are available to build this project: within a docker container or directly with maven. 12 | 13 | #### Using docker 14 | 15 | The project comes with a `Dockerfile` that contains everything you need to build this project. 16 | First, build the docker image: 17 | 18 | ```bash 19 | docker build -t brooklyn:dist . 20 | ``` 21 | 22 | Then run the build: 23 | 24 | ```bash 25 | docker run -i --rm --name brooklyn-dist -v /var/run/docker.sock:/var/run/docker.sock -v ${HOME}/.m2:/root/.m2 -v ${PWD}:/usr/build -w /usr/build brooklyn:dist mvn clean install 26 | ``` 27 | 28 | ### Using maven 29 | 30 | Simply run: 31 | 32 | ```bash 33 | mvn clean install 34 | ``` 35 | -------------------------------------------------------------------------------- /deb-packaging/deb/control/prerm: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. 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 | if which systemctl > /dev/null 2>&1; then 19 | systemctl stop brooklyn.service 20 | elif which initctl > /dev/null 2>&1; then 21 | initctl stop brooklyn 22 | fi 23 | -------------------------------------------------------------------------------- /karaf/features/src/main/filtered-resources/resources/catalog/catalog.bom: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. 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 | brooklyn.catalog: 19 | version: "1.2.0-SNAPSHOT" # BROOKLYN_VERSION 20 | 21 | items: 22 | - 'file:catalog/catalog-brooklyn-default.bom' 23 | -------------------------------------------------------------------------------- /karaf/itest/src/test/java/org/apache/brooklyn/test/IntegrationTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. 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 | package org.apache.brooklyn.test; 20 | 21 | /** 22 | * Used by junit for grouping tests 23 | */ 24 | public class IntegrationTest { 25 | 26 | } 27 | -------------------------------------------------------------------------------- /scripts/grep-in-poms.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # 20 | 21 | # usage: run in the root dir of a project, it will grep in poms up to 3 levels deep 22 | # e.g. where are shaded jars defined? 23 | # brooklyn% grep-in-poms -i slf4j 24 | 25 | grep $* {.,*,*/*,*/*/*}/pom.xml 26 | -------------------------------------------------------------------------------- /archetypes/quickstart/src/test/resources/projects/integration-test-1/archetype.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. 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 | groupId=com.acme.sample 20 | artifactId=brooklyn-sample 21 | version=0.1.0-SNAPSHOT 22 | package=com.acme.sample.brooklyn 23 | archetypeRepository=extra://brooklyn-sample-extra-repo-url -------------------------------------------------------------------------------- /karaf/itest/src/test/resources/exam.properties: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one or more 4 | # contributor license agreements. See the NOTICE file distributed with 5 | # this work for additional information regarding copyright ownership. 6 | # The ASF licenses this file to You under the Apache License, Version 2.0 7 | # (the "License"); you may not use this file except in compliance with 8 | # the License. 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, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | ################################################################################ 19 | 20 | pax.exam.logging = none 21 | pax.exam.service.timeout = 5000 22 | -------------------------------------------------------------------------------- /vagrant/README.md: -------------------------------------------------------------------------------- 1 | 2 | # [![**Brooklyn**](https://brooklyn.apache.org/style/img/apache-brooklyn-logo-244px-wide.png)](http://brooklyn.apache.org/) 3 | 4 | ### Apache Brooklyn Vagrant Sub-Project. 5 | 6 | This repo contains the files to generate a preconfigured Vagrant environment for use with the [Getting Started Guide](http://brooklyn.apache.org/v/latest/start/index.html). 7 | 8 | #### Building the Vagrant archive 9 | 10 | This project is built as part of the main Brooklyn project but can also be built locally with: 11 | ``` 12 | mvn clean install 13 | ``` 14 | 15 | The resulting archive artifact can be found in: 16 | ``` 17 | ./target/brooklyn-vagrant--dist.zip 18 | ``` 19 | Extract and cd into this archive at which point you can follow the [Getting Started Guide](http://brooklyn.apache.org/v/latest/start/index.html) steps. 20 | 21 | #### Distributing the Vagrant archive release 22 | 23 | This artifact will be distributed via the ASF mirrors as part of the release process. 24 | 25 | #### Additional information 26 | 27 | Some additional information is provided in the [README.md](src/main/vagrant/README.md) distributed in the Vagrant archive. 28 | -------------------------------------------------------------------------------- /deb-packaging/deb/control/control: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. 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 | Package: apache-brooklyn 18 | Version: [[version]] 19 | Section: misc 20 | Priority: optional 21 | Architecture: all 22 | Depends: java8-runtime 23 | Maintainer: Aleksandr Vasilev 24 | Description: Apache Brooklyn is a framework for modeling, monitoring, and managing applications through autonomic blueprints. 25 | -------------------------------------------------------------------------------- /dist/licensing/license-text/MIT License: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) as noted in accompanying NOTICE file. All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this 6 | software and associated documentation files (the "Software"), to deal in the Software 7 | without restriction, including without limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of the Software, and to permit 9 | persons to whom the Software is furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all copies or 12 | substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 15 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 16 | PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 17 | FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 18 | OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | DEALINGS IN THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /dist/licensing/update-brooklyn-license-metadata.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # 20 | 21 | 22 | # for Go code, see the glide.yaml in those projects; you'll have to manually update 23 | 24 | 25 | # for new JS UI we have good automation: 26 | 27 | for x in $(ls ../../../brooklyn-ui/ui-modules/*/package.json) ; do 28 | ./compute-nodejs-license-dependencies.sh ${x%package.json} 29 | done 30 | -------------------------------------------------------------------------------- /shared-packaging/src/main/resources/conf/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /karaf/features/src/main/filtered-resources/resources/catalog/catalog-library-software.bom: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. 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 | brooklyn.catalog: 19 | version: "1.2.0-SNAPSHOT" # BROOKLYN_VERSION 20 | 21 | brooklyn.libraries: 22 | 23 | # possibly useful blueprints for common software (but often users will want to replace) 24 | - mvn:org.apache.brooklyn/brooklyn-library-catalog/1.2.0-SNAPSHOT # BROOKLYN_VERSION 25 | 26 | -------------------------------------------------------------------------------- /karaf/features/src/main/resources/resources/etc/org.apache.brooklyn.classrename.cfg: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one or more 4 | # contributor license agreements. See the NOTICE file distributed with 5 | # this work for additional information regarding copyright ownership. 6 | # The ASF licenses this file to You under the Apache License, Version 2.0 7 | # (the "License"); you may not use this file except in compliance with 8 | # the License. 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, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | ################################################################################ 19 | 20 | # This file can contains custom deserialization class mappings for the persistence state 21 | # Syntax should be = -------------------------------------------------------------------------------- /scripts/jstack-named.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # 20 | 21 | # displays a jstack thread dump for a single named thread 22 | # 23 | # takes a PID as first argument and the thread name as second argument 24 | 25 | jstack $1 | awk -v thread_name="$2" ' 26 | { 27 | if (!match($0,"[^\\s]")) active=0; 28 | else if (substr($0,1,1)=="\"") active= $1==("\"" thread_name "\"") 29 | if (active) { 30 | print $0 31 | } 32 | } 33 | ' 34 | -------------------------------------------------------------------------------- /dist/licensing/license-metadata-manual-2-angular.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. 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 | # overrides file for org.heneveld.license-audit-maven-plugin 22 | # expands/corrects detail from autogenerated node js metadata files 23 | 24 | - id: font-awesome@4.7.0 25 | license: 26 | name: Font Awesome License 27 | url: https://github.com/FortAwesome/Font-Awesome/blob/master/LICENSE.txt 28 | 29 | - id: identicon.js@1.3.0 30 | license: BSD-2-Clause 31 | -------------------------------------------------------------------------------- /archetypes/quickstart/src/brooklyn-sample/src/test/resources/sample-test.yaml: -------------------------------------------------------------------------------- 1 | name: my test 2 | services: 3 | - type: com.acme.sample.brooklyn.MySample 4 | id: sample 5 | 6 | - type: org.apache.brooklyn.test.framework.TestCase 7 | brooklyn.children: 8 | 9 | # Starting 10 | - type: org.apache.brooklyn.test.framework.TestSensor 11 | targetId: sample 12 | sensor: service.isUp 13 | timeout: 10s 14 | assert: 15 | equalTo: true 16 | - type: org.apache.brooklyn.test.framework.TestSensor 17 | targetId: sample 18 | sensor: lastCall 19 | assert: 20 | equalTo: "start" 21 | 22 | # Call our example effector 23 | - type: org.apache.brooklyn.test.framework.TestEffector 24 | targetId: sample 25 | effector: myEffector 26 | params: 27 | arg1: "myVal" 28 | - type: org.apache.brooklyn.test.framework.TestSensor 29 | targetId: sample 30 | sensor: lastCall 31 | assert: 32 | equalTo: "myEffector(myVal)" 33 | 34 | # Stopping 35 | - type: org.apache.brooklyn.test.framework.TestEffector 36 | targetId: sample 37 | effector: stop 38 | - type: org.apache.brooklyn.test.framework.TestSensor 39 | targetId: sample 40 | sensor: service.isUp 41 | timeout: 10s 42 | assert: 43 | equalTo: false 44 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. 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 | FROM maven:3.8.6-eclipse-temurin-8 19 | 20 | # Install necessary binaries to build brooklyn-dist 21 | #RUN apk add --no-cache git rpm dpkg 22 | RUN apt-get update && apt-get install -y git rpm dpkg 23 | 24 | # Make sure the /var/tmp (for RPM build) is writable for all users 25 | RUN mkdir -p /var/tmp/ && chmod -R 777 /var/tmp/ 26 | 27 | # Make sure the /var/maven is writable for all users 28 | RUN mkdir -p /var/maven/.m2/ && chmod -R 777 /var/maven/ 29 | ENV MAVEN_CONFIG=/var/maven/.m2 30 | -------------------------------------------------------------------------------- /shared-packaging/src/main/resources/conf/brooklyn.conf: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. 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 | ################################## Welcome! ############################################ 19 | 20 | # It's great to have you here. 21 | # Documentation is available at https://brooklyn.apache.org/documentation/index.html 22 | ########################################################################################## 23 | 24 | brooklyn.base.dir=/var/lib/brooklyn/ 25 | brooklyn.persistence.dir=data 26 | brooklyn.persistence.backups.dir=backups 27 | -------------------------------------------------------------------------------- /docker-image/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. 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 | FROM openjdk:8-jre-alpine 21 | LABEL maintainer="Brooklyn Team :: https://brooklyn.apache.org/" 22 | EXPOSE 8081 8443 23 | 24 | ARG DIST_TAR_GZ 25 | COPY ${DIST_TAR_GZ} brooklyn.tar.gz 26 | ENV EXTRA_JAVA_OPTS="-XX:SoftRefLRUPolicyMSPerMB=1 -Djava.security.egd=file:/dev/./urandom" 27 | 28 | RUN apk --no-cache add bash ; \ 29 | mkdir brooklyn ; \ 30 | tar xzf brooklyn.tar.gz -C /brooklyn --strip-components 1 ; 31 | 32 | ENTRYPOINT ["/brooklyn/bin/karaf"] 33 | CMD ["server"] 34 | -------------------------------------------------------------------------------- /release/settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 9 | 10 | apache.snapshots.https 11 | xxx 12 | xxx 13 | 14 | 15 | apache.releases.https 16 | xxx 17 | xxx 18 | 19 | 20 | 21 | 22 | 23 | gpg 24 | 25 | gpg2 26 | true 27 | true 28 | true 29 | 30 | 31 | 32 | 33 | gpg 34 | 35 | 36 | -------------------------------------------------------------------------------- /dist/licensing/license-text/BSD 2-Clause (Simplified or FreeBSD) License: -------------------------------------------------------------------------------- 1 | Redistribution and use in source and binary forms, with or without modification, 2 | are permitted provided that the following conditions are met: 3 | 4 | 1. Redistributions of source code must retain the above copyright notice, this list 5 | of conditions and the following disclaimer. 6 | 7 | 2. Redistributions in binary form must reproduce the above copyright notice, this 8 | list of conditions and the following disclaimer in the documentation and/or other 9 | materials provided with the distribution. 10 | 11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 12 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 13 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 14 | SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 15 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 16 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 17 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 18 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 19 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 20 | DAMAGE. 21 | -------------------------------------------------------------------------------- /rpm-packaging/rpm/preinstall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | getent group brooklyn || groupadd -r brooklyn 21 | getent passwd brooklyn || useradd -r -g brooklyn -d /opt/brooklyn -s /sbin/nologin brooklyn 22 | # Remove the symbolic link "/opt/brooklyn" if exists (means that we are upgrading brooklyn) 23 | BROOKLYN_ROOT=/opt/brooklyn 24 | if [[ -L $BROOKLYN_ROOT && -d $BROOKLYN_ROOT ]]; then 25 | rm -f $BROOKLYN_ROOT 26 | fi 27 | # Remove the symbolic link "/var/log/brooklyn" if exists (means that we are upgrading brooklyn) 28 | BROOKLYN_LOG=/var/log/brooklyn 29 | if [[ -L $BROOKLYN_LOG && -d $BROOKLYN_LOG ]]; then 30 | rm -f $BROOKLYN_LOG 31 | fi 32 | -------------------------------------------------------------------------------- /deb-packaging/deb/control/preinst: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. 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 | /usr/bin/getent group brooklyn || /usr/sbin/groupadd -r brooklyn 19 | /usr/bin/getent passwd brooklyn || /usr/sbin/useradd -r -g brooklyn -d /opt/brooklyn -s /bin/false brooklyn 20 | # Remove the symbolic link "/opt/brooklyn" if exists (means that we are upgrading brooklyn) 21 | BROOKLYN_ROOT=/opt/brooklyn 22 | if [[ -L $BROOKLYN_ROOT && -d $BROOKLYN_ROOT ]]; then 23 | rm -f $BROOKLYN_ROOT 24 | fi 25 | # Remove the symbolic link "/var/log/brooklyn" if exists (means that we are upgrading brooklyn) 26 | BROOKLYN_LOG=/var/log/brooklyn 27 | if [[ -L $BROOKLYN_LOG && -d $BROOKLYN_LOG ]]; then 28 | rm -f $BROOKLYN_LOG 29 | fi -------------------------------------------------------------------------------- /scripts/rsd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # 20 | 21 | # executes the command supplied as an argument in a tmp directory rsynched against the current directory 22 | # the tmp is a hash of `pwd` so the target will be the same on multiple runs 23 | # esp useful when running something like `rsd mvn clean install` 24 | # but you don't want your IDE or other changes to interfere 25 | 26 | ORIG=`pwd` 27 | DIR=`basename $(pwd -P)`-`pwd | md5sum | awk '{print $1}'` 28 | mkdir -p /tmp/$DIR/ 29 | pushd /tmp/$DIR/ > /dev/null 30 | echo executing \'$@\' in `pwd` as a copy of $ORIG 31 | rsync -a --delete $ORIG/ . 32 | "$@" 33 | # not necessary as command invoked in subshell 34 | # popd > /dev/null 35 | 36 | -------------------------------------------------------------------------------- /karaf/features/src/main/resources/resources/etc/custom.system.properties: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one or more 4 | # contributor license agreements. See the NOTICE file distributed with 5 | # this work for additional information regarding copyright ownership. 6 | # The ASF licenses this file to You under the Apache License, Version 2.0 7 | # (the "License"); you may not use this file except in compliance with 8 | # the License. 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, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | ################################################################################ 19 | 20 | # Customizations for Apache Brooklyn, read by default system.properties 21 | # 22 | # The properties defined in this file will be made available through system 23 | # properties at the very beginning of the Karaf's boot process. 24 | 25 | # 26 | # Name of this Karaf instance. 27 | # 28 | karaf.name = brooklyn 29 | 30 | 31 | # Needed to get CXF to run as the Jersey provider 32 | javax.ws.rs.ext.RuntimeDelegate = org.apache.cxf.jaxrs.impl.RuntimeDelegateImpl 33 | -------------------------------------------------------------------------------- /dist/licensing/license-text/BSD 3-Clause (New BSD) License: -------------------------------------------------------------------------------- 1 | Copyright (c) as noted in accompanying NOTICE file. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are met: 5 | 6 | 1. Redistributions of source code must retain the above copyright notice, 7 | this list of conditions and the following disclaimer. 8 | 9 | 2. Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in 11 | the documentation and/or other materials provided with the distribution. 12 | 13 | 3. The names of the authors may not be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, 17 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT, 19 | INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 22 | OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 25 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | -------------------------------------------------------------------------------- /karaf/features/src/main/resources/resources/etc/org.apache.felix.scr.ScrService.cfg: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one or more 4 | # contributor license agreements. See the NOTICE file distributed with 5 | # this work for additional information regarding copyright ownership. 6 | # The ASF licenses this file to You under the Apache License, Version 2.0 7 | # (the "License"); you may not use this file except in compliance with 8 | # the License. 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, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | ################################################################################ 19 | 20 | # make SCR components wrapping a call eg UiMetadataConfigListener 21 | # use their own namespace for logging not the namespace of the wrapped class; 22 | # to prevent flooding of the logs with low-level SCR debug for the above class. 23 | # (not working with 2.1.24 but likely soon after as was added around time of release; 24 | # other fields eg ds.loglevel set here are visible in karaf with scr:config) 25 | # see https://github.com/apache/felix-dev/pull/36 26 | ds.log.extension=true 27 | 28 | -------------------------------------------------------------------------------- /shared-packaging/src/main/resources/service/systemd/brooklyn.service: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. 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 | [Unit] 19 | Description=Apache Brooklyn Service 20 | Documentation=https://brooklyn.apache.org/documentation/index.html 21 | 22 | [Service] 23 | Type=simple 24 | WorkingDirectory=/opt/brooklyn/ 25 | Environment="EXTRA_JAVA_OPTS=-Dbrooklyn.location.localhost.address=127.0.0.1 -XX:SoftRefLRUPolicyMSPerMB=1 -Xms256m -Xmx2g" 26 | Environment="KARAF_HOME=/opt/brooklyn" 27 | Environment="KARAF_ETC=/etc/brooklyn" 28 | Environment="KARAF_REDIRECT=/dev/null" 29 | Environment="BROOKLYN_PERSISTENCE_DIR=/var/lib/brooklyn" 30 | ExecStart=/opt/brooklyn/bin/karaf server >> "$KARAF_REDIRECT" 2>&1 31 | Restart=always 32 | User=brooklyn 33 | Group=brooklyn 34 | UMask=0066 35 | 36 | [Install] 37 | WantedBy=multi-user.target 38 | -------------------------------------------------------------------------------- /vagrant/src/main/vagrant/README.md: -------------------------------------------------------------------------------- 1 | 2 | # [![**Brooklyn**](https://brooklyn.apache.org/style/img/apache-brooklyn-logo-244px-wide.png)](http://brooklyn.apache.org/) 3 | 4 | ### Using Vagrant with Brooklyn -SNAPSHOT builds 5 | 6 | ##### Install a community-managed version from Maven 7 | 1. No action is required other than setting the `BROOKLYN_VERSION:` environment variable in `servers.yaml` to a `-SNAPSHOT` version. For example: 8 | 9 | ``` 10 | env: 11 | BROOKLYN_VERSION: 1.2.0-SNAPSHOT 12 | ``` 13 | 14 | 2. You may proceed to use the `Vagrantfile` as normal; `vagrant up`, `vagrant destroy` etc. 15 | 16 | ##### Install a locally built RPM package 17 | 18 | 1. Set the `BROOKLYN_VERSION:` environment variable in `servers.yaml` to your current `-SNAPSHOT` version. For example: 19 | 20 | ``` 21 | env: 22 | BROOKLYN_VERSION: 1.2.0-SNAPSHOT 23 | ``` 24 | 25 | 2. Set the `INSTALL_FROM_LOCAL_DIST:` environment variable in `servers.yaml` to `true`. For example: 26 | 27 | ``` 28 | env: 29 | INSTALL_FROM_LOCAL_DIST: true 30 | ``` 31 | 32 | 33 | 3. Copy your locally built `apache-brooklyn-.noarch.rpm` archive to the same directory as the Vagrantfile (this directory is mounted in the Vagrant VM at `/vagrant/`). 34 | 35 | For example to copy a locally built `0.12.0-SNAPSHOT` dist: 36 | 37 | ``` 38 | cp ~/.m2/repository/org/apache/brooklyn/rpm-packaging/0.12.0-SNAPSHOT/rpm-packaging-0.12.0-SNAPSHOT-noarch.rpm ./apache-brooklyn-0.12.0-SNAPSHOT.noarch.rpm 39 | ``` 40 | 41 | 4. You may proceed to use the `Vagrantfile` as normal; `vagrant up`, `vagrant destroy` etc. 42 | -------------------------------------------------------------------------------- /karaf/features/src/main/resources/resources/bin/runbrooklyn: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | # This script is a convenience wrapper for use to avoid problems on Centos 6 21 | # Upstart is too old on CentOS 6, at least v1.4 required to use setuid, setgid. 22 | # This script does the setuid and handles termination via signals. 23 | 24 | trap terminate_all SIGTERM 25 | trap kill_all SIGKILL 26 | 27 | function terminate_all () { 28 | pkill -SIGTERM -g ${PGROUP} 29 | kill -s SIGTERM ${KARAF} 30 | } 31 | function kill_all () { 32 | pkill -SIGKILL -g ${PGROUP} 33 | kill -s SIGKILL ${KARAF} 34 | } 35 | 36 | su -c "/opt/brooklyn/bin/karaf server >> /dev/null 2>&1" brooklyn & KARAF=$! 37 | sleep 1 # gives time for process structure to be established 38 | PGROUP=$(pgrep -P $KARAF) 39 | wait 40 | -------------------------------------------------------------------------------- /karaf/features/src/main/filtered-resources/resources/catalog/catalog-core.bom: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. 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 | brooklyn.catalog: 19 | version: "1.2.0-SNAPSHOT" # BROOKLYN_VERSION 20 | 21 | brooklyn.libraries: 22 | 23 | # very common building blocks 24 | - mvn:org.apache.brooklyn/brooklyn-core/1.2.0-SNAPSHOT # BROOKLYN_VERSION 25 | - mvn:org.apache.brooklyn/brooklyn-policy/1.2.0-SNAPSHOT # BROOKLYN_VERSION 26 | 27 | # often useful server-related entities 28 | - mvn:org.apache.brooklyn/brooklyn-software-base/1.2.0-SNAPSHOT # BROOKLYN_VERSION 29 | 30 | # possibly useful test entities 31 | - mvn:org.apache.brooklyn/brooklyn-test-framework/1.2.0-SNAPSHOT # BROOKLYN_VERSION 32 | 33 | # convenient aliases for common things 34 | - mvn:org.apache.brooklyn/brooklyn-karaf-init/1.2.0-SNAPSHOT # BROOKLYN_VERSION 35 | 36 | -------------------------------------------------------------------------------- /archetypes/quickstart/src/brooklyn-sample/src/main/java/com/acme/sample/brooklyn/MySample.java: -------------------------------------------------------------------------------- 1 | package com.acme.sample.brooklyn; 2 | 3 | import org.apache.brooklyn.api.entity.Entity; 4 | import org.apache.brooklyn.api.entity.ImplementedBy; 5 | import org.apache.brooklyn.api.sensor.AttributeSensor; 6 | import org.apache.brooklyn.config.ConfigKey; 7 | import org.apache.brooklyn.core.annotation.Effector; 8 | import org.apache.brooklyn.core.annotation.EffectorParam; 9 | import org.apache.brooklyn.core.config.ConfigKeys; 10 | import org.apache.brooklyn.core.entity.trait.Startable; 11 | import org.apache.brooklyn.core.sensor.Sensors; 12 | 13 | /** 14 | * A simple entity, which demonstrates some of the things that can be done in Java when 15 | * implementing an entity. 16 | * 17 | * Note the {@link ImplementedBy} annotation, which points at the class to be instantiated 18 | * for this entity type. 19 | */ 20 | @ImplementedBy(MySampleImpl.class) 21 | public interface MySample extends Entity, Startable { 22 | 23 | ConfigKey MY_CONF = ConfigKeys.newStringConfigKey( 24 | "myConf", 25 | "My example config key", 26 | "defaultval"); 27 | 28 | AttributeSensor LAST_CALL = Sensors.newStringSensor( 29 | "lastCall", 30 | "Example sensor, showing the last effector call"); 31 | 32 | /** 33 | * Declares an effector. The annotation marks this as an effector, so the effector will 34 | * be automatically wired up to the method's implementation. 35 | */ 36 | @Effector(description="My example effector") 37 | void myEffector(@EffectorParam(name="arg1") String arg1); 38 | } 39 | -------------------------------------------------------------------------------- /karaf/features/src/main/filtered-resources/resources/catalog/catalog-brooklyn-default.bom: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. 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 | brooklyn.catalog: 19 | version: "1.2.0-SNAPSHOT" # BROOKLYN_VERSION 20 | 21 | # this is the set of items included by default with Apache Brooklyn, 22 | # if referenced by catalog.bom. or the catalog.bom can be replaced entirely. 23 | 24 | items: 25 | # the most useful stuff 26 | - 'file:catalog/catalog-core.bom' 27 | 28 | # useful server-related entities 29 | - 'file:catalog/catalog-brooklyn-software-base.bom' 30 | 31 | # brooklyn nodes 32 | - 'file:catalog/catalog-brooklyn-software-brooklyn.bom' 33 | 34 | # occasionally useful blueprints for common software 35 | - 'file:catalog/catalog-library-software.bom' 36 | 37 | # brooklyn standard examples 38 | - 'file:catalog/catalog-templates-brooklyn-samples.bom' 39 | 40 | -------------------------------------------------------------------------------- /vagrant/src/main/config/build-distribution.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 23 | dist 24 | 25 | 26 | 27 | ${project.basedir}/src/main/vagrant 28 | 29 | 0644 30 | 0755 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /dist/licensing/license-text/Font Awesome License: -------------------------------------------------------------------------------- 1 | Font Awesome Free License 2 | ------------------------- 3 | 4 | Font Awesome Free is free, open source, and GPL friendly. You can use it for 5 | commercial projects, open source projects, or really almost whatever you want. 6 | Full Font Awesome Free license: https://fontawesome.com/license. 7 | 8 | # Icons: CC BY 4.0 License (https://creativecommons.org/licenses/by/4.0/) 9 | In the Font Awesome Free download, the CC BY 4.0 license applies to all icons 10 | packaged as SVG and JS file types. 11 | 12 | # Fonts: SIL OFL 1.1 License (https://scripts.sil.org/OFL) 13 | In the Font Awesome Free download, the SIL OLF license applies to all icons 14 | packaged as web and desktop font files. 15 | 16 | # Code: MIT License (https://opensource.org/licenses/MIT) 17 | In the Font Awesome Free download, the MIT license applies to all non-font and 18 | non-icon files. 19 | 20 | # Attribution 21 | Attribution is required by MIT, SIL OLF, and CC BY licenses. Downloaded Font 22 | Awesome Free files already contain embedded comments with sufficient 23 | attribution, so you shouldn't need to do anything additional when using these 24 | files normally. 25 | 26 | We've kept attribution comments terse, so we ask that you do not actively work 27 | to remove them from files, especially code. They're a great way for folks to 28 | learn about Font Awesome. 29 | 30 | # Brand Icons 31 | All brand icons are trademarks of their respective owners. The use of these 32 | trademarks does not indicate endorsement of the trademark holder by Font 33 | Awesome, nor vice versa. **Please do not use brand logos for any purpose except 34 | to represent the company, product, or service to which they refer.** 35 | -------------------------------------------------------------------------------- /dist/licensing/license-text/Eclipse Distribution License, version 1.0: -------------------------------------------------------------------------------- 1 | Eclipse Distribution License - v 1.0 2 | Copyright (c) 2007, Eclipse Foundation, Inc. and its licensors. 3 | 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without modification, 7 | are permitted provided that the following conditions are met: 8 | 9 | Redistributions of source code must retain the above copyright notice, this list 10 | of conditions and the following disclaimer. 11 | 12 | Redistributions in binary form must reproduce the above copyright notice, this 13 | list of conditions and the following disclaimer in the documentation and/or other 14 | materials provided with the distribution. 15 | 16 | Neither the name of the Eclipse Foundation, Inc. nor the names of its contributors 17 | may be used to endorse or promote products derived from this software without 18 | specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 23 | IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 24 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 25 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 27 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 29 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /karaf/features/src/main/filtered-resources/resources/catalog/catalog-brooklyn-software-brooklyn.bom: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. 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 | brooklyn.catalog: 19 | version: "1.2.0-SNAPSHOT" # BROOKLYN_VERSION 20 | itemType: entity 21 | items: 22 | - id: org.apache.brooklyn.entity.brooklynnode.BrooklynNode 23 | item: 24 | type: org.apache.brooklyn.entity.brooklynnode.BrooklynNode 25 | name: Brooklyn Node 26 | description: Deploys a Brooklyn management server 27 | - id: org.apache.brooklyn.entity.brooklynnode.BrooklynCluster 28 | item: 29 | type: org.apache.brooklyn.entity.brooklynnode.BrooklynCluster 30 | name: Brooklyn Cluster 31 | - id: org.apache.brooklyn.entity.brooklynnode.LocalBrooklynNode 32 | item: 33 | type: org.apache.brooklyn.entity.brooklynnode.LocalBrooklynNode 34 | name: Local Brooklyn Node 35 | description: An entity that represents the local Brooklyn server. 36 | -------------------------------------------------------------------------------- /karaf/itest/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 23 | 24 | 25 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 26 | 27 | 28 | 29 | 30 | 31 | test.log 32 | 33 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /archetypes/quickstart/src/brooklyn-sample/src/test/java/com/acme/sample/brooklyn/MySampleTest.java: -------------------------------------------------------------------------------- 1 | package com.acme.sample.brooklyn; 2 | 3 | import static org.testng.Assert.assertEquals; 4 | 5 | import org.apache.brooklyn.api.entity.EntitySpec; 6 | import org.apache.brooklyn.api.location.Location; 7 | import org.apache.brooklyn.core.entity.Attributes; 8 | import org.apache.brooklyn.core.entity.EntityAsserts; 9 | import org.apache.brooklyn.core.entity.lifecycle.Lifecycle; 10 | import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport; 11 | import org.testng.annotations.Test; 12 | 13 | import com.acme.sample.brooklyn.MySample; 14 | import com.google.common.collect.ImmutableList; 15 | 16 | public class MySampleTest extends BrooklynAppUnitTestSupport { 17 | 18 | @Test 19 | public void testEntity() throws Exception { 20 | MySample entity = app.createAndManageChild(EntitySpec.create(MySample.class) 21 | .configure(MySample.MY_CONF, "myConfVal")); 22 | 23 | app.start(ImmutableList.of()); 24 | assertEquals(entity.sensors().get(MySample.LAST_CALL), "start"); 25 | EntityAsserts.assertAttributeEqualsEventually(entity, Attributes.SERVICE_UP, true); 26 | EntityAsserts.assertAttributeEqualsEventually(entity, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); 27 | 28 | entity.myEffector("myArgVal"); 29 | assertEquals(entity.sensors().get(MySample.LAST_CALL), "myEffector(myArgVal)"); 30 | 31 | app.stop(); 32 | assertEquals(entity.sensors().get(MySample.LAST_CALL), "stop"); 33 | EntityAsserts.assertAttributeEqualsEventually(entity, Attributes.SERVICE_UP, false); 34 | EntityAsserts.assertAttributeEqualsEventually(entity, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.STOPPED); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /karaf/itest/src/test/java/org/apache/brooklyn/security/CustomSecurityProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. 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 | package org.apache.brooklyn.security; 20 | 21 | import java.util.function.Supplier; 22 | 23 | import javax.servlet.http.HttpServletRequest; 24 | import javax.servlet.http.HttpSession; 25 | 26 | import org.apache.brooklyn.rest.security.provider.AbstractSecurityProvider; 27 | import org.apache.brooklyn.rest.security.provider.SecurityProvider; 28 | 29 | public class CustomSecurityProvider extends AbstractSecurityProvider implements SecurityProvider { 30 | 31 | static final String USER = "custom"; 32 | 33 | @Override 34 | public boolean authenticate(HttpServletRequest request, Supplier sessionSupplierOnSuccess, String user, String pass) throws SecurityProviderDeniedAuthentication { 35 | return USER.equals(user); 36 | } 37 | 38 | @Override 39 | public boolean requiresUserPass() { 40 | return true; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /dist/licensing/license-metadata-manual-go-libraries.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. 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 | # overrides file for org.heneveld.license-audit-maven-plugin 22 | # expands/corrects detail needed for generating license notices 23 | 24 | 25 | # used in brooklyn-client (Go project) 26 | 27 | - id: github.com/urfave/cli 28 | url: https://github.com/urfave/cli 29 | name: github.com/urfave/cli 30 | description: A simple, fast, and fun package for building command line apps in Go 31 | license: MIT 32 | notices: 33 | - Copyright (c) 2016 Jeremy Saenz & Contributors 34 | 35 | - id: github.com/kubernetes/client-go/util/jsonpath 36 | url: github.com/kubernetes/client-go 37 | name: Go client for Kubernetes 38 | description: Only used for the JSON-Path library 39 | license: Apache-2.0 40 | 41 | - id: golang.org/x/crypto/ssh 42 | url: https://godoc.org/golang.org/x/crypto/ssh 43 | name: golang.org/x/crypto/ssh 44 | description: Package ssh implements an SSH client and server. 45 | license: BSD-3-Clause 46 | notices: 47 | - Copyright (c) 2009 The Go Authors. All rights reserved. 48 | -------------------------------------------------------------------------------- /shared-packaging/src/main/resources/service/upstart/rpm/brooklyn.conf: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. 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 | description "Apache Brooklyn upstart script" 19 | author "Aleksandr Vasilev aleksandr.vasilev@cloudsoftcorp.com" 20 | 21 | start on runlevel [23] 22 | stop on runlevel [016] 23 | respawn 24 | respawn limit 5 10 25 | umask 0066 26 | 27 | console output 28 | 29 | pre-start script 30 | logger -i -t "$UPSTART_JOB" "[`date -u +%Y-%m-%dT%T.%3NZ`] Starting Apache Brooklyn" 31 | end script 32 | 33 | script 34 | EXTRA_JAVA_OPTS="-Dbrooklyn.location.localhost.address=127.0.0.1 -XX:SoftRefLRUPolicyMSPerMB=1 -Xms256m -Xmx2g" 35 | KARAF_HOME="/opt/brooklyn/" 36 | KARAF_ETC="/etc/brooklyn/" 37 | KARAF_REDIRECT=/dev/null 38 | BROOKLYN_PERSISTENCE_DIR="/var/lib/brooklyn" 39 | export EXTRA_JAVA_OPTS KARAF_REDIRECT KARAF_HOME KARAF_ETC BROOKLYN_PERSISTENCE_DIR 40 | chsh -s /bin/bash brooklyn 41 | exec /opt/brooklyn/bin/runbrooklyn >> "$KARAF_REDIRECT" 2>&1 42 | end script 43 | 44 | pre-stop script 45 | logger -i -t "$UPSTART_JOB" "[`date -u +%Y-%m-%dT%T.%3NZ`] Stopping Apache Brooklyn" 46 | end script 47 | -------------------------------------------------------------------------------- /shared-packaging/src/main/resources/service/upstart/deb/brooklyn.conf: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. 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 | description "Apache Brooklyn upstart script" 19 | author "Aleksandr Vasilev aleksandr.vasilev@cloudsoftcorp.com" 20 | 21 | start on started networking 22 | stop on runlevel [016] 23 | respawn 24 | respawn limit 5 10 25 | umask 0066 26 | 27 | setuid brooklyn 28 | setgid brooklyn 29 | 30 | console log 31 | 32 | pre-start script 33 | logger -i -t "$UPSTART_JOB" "[`date -u +%Y-%m-%dT%T.%3NZ`] Starting Apache Brooklyn" 34 | end script 35 | 36 | script 37 | EXTRA_JAVA_OPTS="-Dbrooklyn.location.localhost.address=127.0.0.1 -XX:SoftRefLRUPolicyMSPerMB=1 -Xms256m -Xmx2g" 38 | KARAF_HOME="/opt/brooklyn/" 39 | KARAF_ETC="/etc/brooklyn/" 40 | KARAF_REDIRECT=/dev/null 41 | BROOKLYN_PERSISTENCE_DIR="/var/lib/brooklyn" 42 | export EXTRA_JAVA_OPTS KARAF_REDIRECT KARAF_HOME KARAF_ETC BROOKLYN_PERSISTENCE_DIR 43 | exec /opt/brooklyn/bin/karaf server >> "$KARAF_REDIRECT" 2>&1 44 | end script 45 | 46 | pre-stop script 47 | logger -i -t "$UPSTART_JOB" "[`date -u +%Y-%m-%dT%T.%3NZ`] Stopping Apache Brooklyn" 48 | end script 49 | -------------------------------------------------------------------------------- /docker-itest/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # 20 | 21 | set -e 22 | if [ "$(id -u)" = "0" ]; then 23 | echo "Setting up system" 24 | echo "brooklyn ALL = (ALL) NOPASSWD: ALL" > /etc/sudoers.d/brooklyn 25 | chmod 0440 /etc/sudoers.d/brooklyn 26 | GROUP_ID=${DOCKER_GROUP_ID:-1000} 27 | USER_ID=${DOCKER_USER_ID:-1000} 28 | #(alpine): addgroup -g $GROUP_ID brooklyn 29 | #(alpine): adduser -g "brooklyn" -s /bin/bash -G brooklyn -u $USER_ID -D brooklyn 30 | groupadd -g $GROUP_ID brooklyn 31 | echo "Creating user" 32 | useradd --shell /bin/bash -u $USER_ID -o -c "" -m -k /etc/skel -g brooklyn brooklyn 33 | chown brooklyn:brooklyn /home/brooklyn 34 | sudo service ssh start 35 | exec sudo -H -u brooklyn -i /usr/local/bin/entrypoint.sh $@ 36 | else 37 | echo "Setting up Brooklyn" 38 | # Integration tests requirements 39 | ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa 40 | cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys 41 | ssh-keygen -t rsa -N "mypassphrase" -f ~/.ssh/id_rsa_with_passphrase 42 | cat ~/.ssh/id_rsa_with_passphrase.pub >> ~/.ssh/authorized_keys 43 | 44 | cd /usr/build 45 | echo "Available entropy in container: $(cat /proc/sys/kernel/random/entropy_avail)" 46 | exec $@ 47 | fi 48 | -------------------------------------------------------------------------------- /shared-packaging/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 4.0.0 22 | shared-packaging 23 | jar 24 | Brooklyn Shared Package Files 25 | 26 | Brooklyn shared files for creating RPM and DEB packages 27 | 28 | 29 | 30 | org.apache.brooklyn 31 | brooklyn-dist-root 32 | 1.2.0-SNAPSHOT 33 | ../pom.xml 34 | 35 | 36 | 37 | 38 | 39 | org.testng 40 | testng 41 | test 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /dist/licensing/license-text/DOM4J MetaStuff BSD style license (3-clause): -------------------------------------------------------------------------------- 1 | Copyright 2001-2016 (C) MetaStuff, Ltd. and DOM4J contributors. All Rights Reserved. 2 | 3 | Redistribution and use of this software and associated documentation 4 | ("Software"), with or without modification, are permitted provided 5 | that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain copyright 8 | statements and notices. Redistributions must also contain a 9 | copy of this document. 10 | 11 | 2. Redistributions in binary form must reproduce the 12 | above copyright notice, this list of conditions and the 13 | following disclaimer in the documentation and/or other 14 | materials provided with the distribution. 15 | 16 | 3. The name "DOM4J" must not be used to endorse or promote 17 | products derived from this Software without prior written 18 | permission of MetaStuff, Ltd. For written permission, 19 | please contact dom4j-info@metastuff.com. 20 | 21 | 4. Products derived from this Software may not be called "DOM4J" 22 | nor may "DOM4J" appear in their names without prior written 23 | permission of MetaStuff, Ltd. DOM4J is a registered 24 | trademark of MetaStuff, Ltd. 25 | 26 | 5. Due credit should be given to the DOM4J Project - https://dom4j.github.io/ 27 | 28 | THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS 29 | ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT 30 | NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 31 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 32 | METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 33 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 34 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 35 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 36 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 37 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 38 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 39 | OF THE POSSIBILITY OF SUCH DAMAGE. 40 | -------------------------------------------------------------------------------- /release/clone-and-configure-repos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # 20 | 21 | set -e 22 | set -x 23 | 24 | # Do the basics 25 | git clone -o apache-git https://git-wip-us.apache.org/repos/asf/brooklyn 26 | cd brooklyn 27 | git submodule init 28 | git submodule update --remote --merge --recursive 29 | 30 | # .gitmodules sets the submodules up from GitHub. Replace the origin with Apache canonical 31 | git submodule foreach 'git remote add apache-git https://git-wip-us.apache.org/repos/asf/${name}' 32 | git submodule foreach 'git fetch apache-git' 33 | git submodule foreach 'git checkout master' 34 | git submodule foreach 'git branch --set-upstream-to apache-git/master master' 35 | git submodule foreach 'git reset --hard apache-git/master' 36 | git submodule foreach 'git remote remove origin' 37 | 38 | # Final check we are up to date 39 | git pull 40 | git submodule update --remote --merge --recursive 41 | 42 | # And also the location for publishing RC artifacts 43 | svn --non-interactive co --depth=immediates https://dist.apache.org/repos/dist/release/brooklyn ~/apache-dist-release-brooklyn 44 | svn --non-interactive co --depth=immediates https://dist.apache.org/repos/dist/dev/brooklyn ~/apache-dist-dev-brooklyn 45 | echo "export APACHE_DIST_SVN_DIR=$HOME/apache-dist-dev-brooklyn" >> ~/.profile 46 | -------------------------------------------------------------------------------- /karaf/features/src/main/filtered-resources/resources/etc/branding.properties: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one or more 4 | # contributor license agreements. See the NOTICE file distributed with 5 | # this work for additional information regarding copyright ownership. 6 | # The ASF licenses this file to You under the Apache License, Version 2.0 7 | # (the "License"); you may not use this file except in compliance with 8 | # the License. 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, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | ################################################################################ 19 | 20 | welcome = \ 21 | \u001B[33m\u001B[0m\n\ 22 | \u001B[33m _ _ _ \u001B[0m\n\ 23 | \u001B[33m | |__ _ __ ___ ___ | | _| |_ _ _ __ (R) \u001B[0m\n\ 24 | \u001B[33m | '_ \\| '__/ _ \\ / _ \\| |/ / | | | | '_ \\ \u001B[0m\n\ 25 | \u001B[33m | |_) | | | (_) | (_) | <| | |_| | | | | \u001B[0m\n\ 26 | \u001B[33m |_.__/|_| \\___/ \\___/|_|\\_\\_|\\__, |_| |_| \u001B[0m\n\ 27 | \u001B[33m |___/ \u001B[0m\n\ 28 | \u001B[33m \u001B[0m\n\ 29 | \u001B[33m http://brooklyn.apache.org \u001B[0m\n\ 30 | \u001B[33m (version ${project.version})\u001B[0m\n\ 31 | \u001B[33m\u001B[0m\n\ 32 | \u001B[33mHit '\u001B[1m\u001B[0m' for a list of available commands\u001B[0m\n\ 33 | \u001B[33mand '\u001B[1m[cmd] --help\u001B[0m' for help on a specific command.\u001B[0m\n\ 34 | \u001B[33mHit '\u001B[1m\u001B[0m' or '\u001B[1mosgi:shutdown\u001B[0m' to shutdown\u001B[0m\n\ 35 | \u001B[33m\u001B[0m\n\ 36 | -------------------------------------------------------------------------------- /release/common.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # 20 | 21 | ############################################################################### 22 | fail() { 23 | echo >&2 "$@" 24 | exit 1 25 | } 26 | 27 | ############################################################################### 28 | confirm() { 29 | # call with a prompt string or use a default 30 | if [ "${batch_confirm_y}" == "true" ] ; then 31 | true 32 | else 33 | read -r -p "${1:-Are you sure? [y/N]} " response 34 | case $response in 35 | [yY][eE][sS]|[yY]) 36 | true 37 | ;; 38 | *) 39 | false 40 | ;; 41 | esac 42 | fi 43 | } 44 | 45 | ############################################################################### 46 | detect_version() { 47 | if [ \! -z "${current_version}" ]; then 48 | return 49 | fi 50 | 51 | set +e 52 | current_version=$( xmlstarlet select -t -v '/_:project/_:version/text()' pom.xml 2>/dev/null ) 53 | success=$? 54 | set -e 55 | if [ "${success}" -ne 0 -o -z "${current_version}" ]; then 56 | fail Could not detect version number 57 | fi 58 | } 59 | 60 | ############################################################################### 61 | assert_in_project_root() { 62 | [ -d .git ] || fail Must run in brooklyn project root directory 63 | } 64 | 65 | -------------------------------------------------------------------------------- /scripts/jstack-active.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # 20 | 21 | # displays a jstack thread dump showing only "really-running" threads 22 | # 23 | # takes a PID as argument 24 | # filters jstack to remove wait/blocked threads and known 25 | # wait points which report themselves as active (e.g. socket.read) 26 | # 27 | # very useful for spot-checking what is *actually* consuming CPU 28 | 29 | 30 | jstack $@ | awk ' 31 | function onTraceBegin() { 32 | onTraceEnd() 33 | data["lineCount"]=0 34 | data["head"]=$0 35 | } 36 | 37 | function onTraceEnd() { 38 | if ("head" in data) { 39 | if (data["active"] && "topClass" in data) { 40 | print data["head"] 41 | for (l=1; l<=data["lineCount"]; l++) { print lines[l] } 42 | print "" 43 | } 44 | } 45 | delete lines 46 | delete data 47 | } 48 | 49 | function startsWith(whole,prefix) { 50 | return (substr(whole,1,length(prefix))==prefix); 51 | } 52 | 53 | { 54 | if (!match($0,"[^\\s]")) onTraceEnd(); 55 | else if (substr($0,1,1)=="\"") onTraceBegin(); 56 | else if ("head" in data) { 57 | lc = ++data["lineCount"]; 58 | lines[lc]=$0 59 | if (lc==1) { 60 | state=data["state"]=$2; 61 | data["active"] = !(state=="WAITING" || state=="BLOCKED" || state=="TIMED_WAITING") 62 | } 63 | if ($1=="at") { 64 | if ("topClass" in data) { 65 | } else { 66 | data["topClass"] = $0; 67 | tc = $2; 68 | if (data["active"]) { 69 | if (startsWith(tc,"java.net") || startsWith(tc,"sun.nio")) data["active"]=false; 70 | } 71 | } 72 | } 73 | } 74 | } 75 | END { 76 | onTraceEnd(); 77 | } 78 | ' 79 | -------------------------------------------------------------------------------- /shared-packaging/src/test/yaml/Vagrantfile: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. 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 | # Example Vagrantfile for testing RPM/DEB installation on a 20 | # convenient Vagrant box. 21 | # Maps your public key to 'authorized_keys' on the vagrant. 22 | # see note on 'source below'. 23 | 24 | Vagrant.configure(2) do |config| 25 | config.vm.provider "virtualbox" do |vb| 26 | vb.memory = "1024" 27 | vb.customize ["modifyvm", :id, "--nictype1", "virtio"] 28 | vb.customize ["modifyvm", :id, "--nictype2", "virtio"] 29 | end 30 | 31 | # change the 'source' below if necessary to match your public key file path 32 | config.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "~/.ssh/authorized_keys" 33 | config.vm.provision "shell", name:"set key permissions", privileged:false, inline: "chmod 400 ~/.ssh/authorized_keys" 34 | 35 | config.vm.define "apt-systemd" do |config| 36 | config.vm.box = "ubuntu/xenial64" 37 | config.vm.network "private_network", ip: "172.28.128.3" 38 | config.ssh.insert_key = true 39 | config.ssh.forward_agent = true 40 | end 41 | config.vm.define "apt-upstart" do |config| 42 | config.vm.box = "ubuntu/trusty64" 43 | config.vm.network "private_network", ip: "172.28.128.4" 44 | end 45 | config.vm.define "yum-systemd" do |config| 46 | config.vm.box = "bento/centos-7.3" 47 | config.vm.network "private_network", ip: "172.28.128.5" 48 | end 49 | config.vm.define "yum-upstart" do |config| 50 | config.vm.box = "nrel/CentOS-6.5-x86_64" 51 | config.vm.network "private_network", ip: "172.28.128.6" 52 | end 53 | end 54 | -------------------------------------------------------------------------------- /docker/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. 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 | FROM openjdk:8-jre-alpine 22 | MAINTAINER Alex Heneveld "alex@cloudsoft.io" 23 | 24 | RUN apk add --update --no-cache bash openssh wget 25 | RUN adduser -D brooklyn 26 | WORKDIR /home/brooklyn 27 | 28 | # now install software brooklyn 29 | COPY target/files/ . 30 | RUN \ 31 | # install br for global use \ 32 | cp ./bin/br /usr/bin/br ; \ 33 | # and fix perms (irritating that docker won't do this) \ 34 | chown -R brooklyn:brooklyn . 35 | 36 | USER brooklyn 37 | 38 | # handle customisation, including passing args through to the container script and installing boms 39 | ARG application 40 | ARG install_boms 41 | ARG dropins_jars 42 | RUN \ 43 | if [ -n "${debug}" ] ; then echo debug=true >> brooklyn-docker-start.opts ; fi ; \ 44 | if [ -n "${application}" ] ; then echo application=${application} >> brooklyn-docker-start.opts ; fi ; \ 45 | if [ -n "${install_boms}" ] ; then \ 46 | echo "brooklyn.catalog:" > conf/brooklyn/default.catalog.bom ; \ 47 | echo " items:" >> conf/brooklyn/default.catalog.bom ; \ 48 | for x in ${install_boms} ; do \ 49 | echo Installing $x to catalog ; \ 50 | echo " - "$x >> conf/brooklyn/default.catalog.bom ; \ 51 | done ; \ 52 | fi ; \ 53 | if [ -n "${dropins_jars}" ] ; then \ 54 | cd lib/dropins/ ; \ 55 | for x in ${dropins_jars} ; do \ 56 | echo Download $x to lib/dropins ; \ 57 | wget -q --trust-server-names $x ; \ 58 | done ; \ 59 | fi 60 | 61 | # and start 62 | EXPOSE 8081 63 | ENTRYPOINT ["bin/brooklyn-docker-start"] 64 | CMD [] 65 | 66 | -------------------------------------------------------------------------------- /dist/licensing/license-text/Indiana University Extreme! Lab Software License, version 1.1.1: -------------------------------------------------------------------------------- 1 | Indiana University Extreme! Lab Software License 2 | 3 | Version 1.1.1 4 | 5 | Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | 1. Redistributions of source code must retain the above copyright notice, 12 | this list of conditions and the following disclaimer. 13 | 14 | 2. Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in 16 | the documentation and/or other materials provided with the distribution. 17 | 18 | 3. The end-user documentation included with the redistribution, if any, 19 | must include the following acknowledgment: 20 | 21 | "This product includes software developed by the Indiana University 22 | Extreme! Lab (http://www.extreme.indiana.edu/)." 23 | 24 | Alternately, this acknowledgment may appear in the software itself, 25 | if and wherever such third-party acknowledgments normally appear. 26 | 27 | 4. The names "Indiana Univeristy" and "Indiana Univeristy Extreme! Lab" 28 | must not be used to endorse or promote products derived from this 29 | software without prior written permission. For written permission, 30 | please contact http://www.extreme.indiana.edu/. 31 | 32 | 5. Products derived from this software may not use "Indiana Univeristy" 33 | name nor may "Indiana Univeristy" appear in their name, without prior 34 | written permission of the Indiana University. 35 | 36 | THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED 37 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 38 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 39 | IN NO EVENT SHALL THE AUTHORS, COPYRIGHT HOLDERS OR ITS CONTRIBUTORS 40 | BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 41 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 42 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 43 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 44 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 45 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 46 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 47 | 48 | -------------------------------------------------------------------------------- /shared-packaging/src/test/yaml/package-apps.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. 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 | services: 20 | - type: test-apt-systemd-brooklyn 21 | name: 1. apt-systemd 22 | location: 23 | byon: 24 | hosts: ["172.28.128.3"] 25 | # privateKeyFile: ~/.ssh/ 26 | user: ubuntu 27 | brooklyn.config: 28 | package.file: ~/.m2/repository/org/apache/brooklyn/deb-packaging/1.2.0-SNAPSHOT/deb-packaging-1.2.0-SNAPSHOT-all.deb # BROOKLYN_VERSION 29 | 30 | --- 31 | 32 | services: 33 | - type: test-apt-upstart-brooklyn 34 | name: 2. apt-upstart 35 | location: 36 | byon: 37 | hosts: ["172.28.128.4"] 38 | # privateKeyFile: ~/.ssh/ 39 | user: vagrant 40 | brooklyn.config: 41 | package.file: ~/.m2/repository/org/apache/brooklyn/deb-packaging/1.2.0-SNAPSHOT/deb-packaging-1.2.0-SNAPSHOT-all.deb # BROOKLYN_VERSION 42 | 43 | --- 44 | 45 | services: 46 | - type: test-yum-systemd-brooklyn 47 | name: 3. yum-systemd 48 | location: 49 | byon: 50 | hosts: ["172.28.128.5"] 51 | # privateKeyFile: ~/.ssh/ 52 | user: vagrant 53 | brooklyn.config: 54 | package.file: ~/.m2/repository/org/apache/brooklyn/rpm-packaging/1.2.0-SNAPSHOT/rpm-packaging-1.2.0-SNAPSHOT-noarch.rpm # BROOKLYN_VERSION 55 | 56 | --- 57 | 58 | services: 59 | - type: test-yum-upstart-brooklyn 60 | name: 4. yum-upstart 61 | location: 62 | byon: 63 | hosts: ["172.28.128.6"] 64 | # privateKeyFile: ~/.ssh/ 65 | user: vagrant 66 | brooklyn.config: 67 | package.file: ~/.m2/repository/org/apache/brooklyn/rpm-packaging/1.2.0-SNAPSHOT/rpm-packaging-1.2.0-SNAPSHOT-noarch.rpm # BROOKLYN_VERSION 68 | 69 | 70 | -------------------------------------------------------------------------------- /dist/licensing/license-text/Java HTML Tidy License: -------------------------------------------------------------------------------- 1 | /** 2 | * Java HTML Tidy - JTidy 3 | * HTML parser and pretty printer 4 | * 5 | * Copyright (c) 1998-2000 World Wide Web Consortium (Massachusetts 6 | * Institute of Technology, Institut National de Recherche en 7 | * Informatique et en Automatique, Keio University). All Rights 8 | * Reserved. 9 | * 10 | * Contributing Author(s): 11 | * 12 | * Dave Raggett 13 | * Andy Quick (translation to Java) 14 | * Gary L Peskin (Java development) 15 | * Sami Lempinen (release management) 16 | * Fabrizio Giustina 17 | * 18 | * The contributing author(s) would like to thank all those who 19 | * helped with testing, bug fixes, and patience. This wouldn't 20 | * have been possible without all of you. 21 | * 22 | * COPYRIGHT NOTICE: 23 | * 24 | * This software and documentation is provided "as is," and 25 | * the copyright holders and contributing author(s) make no 26 | * representations or warranties, express or implied, including 27 | * but not limited to, warranties of merchantability or fitness 28 | * for any particular purpose or that the use of the software or 29 | * documentation will not infringe any third party patents, 30 | * copyrights, trademarks or other rights. 31 | * 32 | * The copyright holders and contributing author(s) will not be 33 | * liable for any direct, indirect, special or consequential damages 34 | * arising out of any use of the software or documentation, even if 35 | * advised of the possibility of such damage. 36 | * 37 | * Permission is hereby granted to use, copy, modify, and distribute 38 | * this source code, or portions hereof, documentation and executables, 39 | * for any purpose, without fee, subject to the following restrictions: 40 | * 41 | * 1. The origin of this source code must not be misrepresented. 42 | * 2. Altered versions must be plainly marked as such and must 43 | * not be misrepresented as being the original source. 44 | * 3. This Copyright notice may not be removed or altered from any 45 | * source or altered source distribution. 46 | * 47 | * The copyright holders and contributing author(s) specifically 48 | * permit, without fee, and encourage the use of this source code 49 | * as a component for supporting the Hypertext Markup Language in 50 | * commercial products. If you use this source code in a product, 51 | * acknowledgment is not required but would be appreciated. 52 | * 53 | */ 54 | -------------------------------------------------------------------------------- /vagrant/src/main/vagrant/files/vagrant-catalog.bom: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. 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 | brooklyn.catalog: 20 | items: 21 | - id: byon1 22 | version: "1.2.0-SNAPSHOT" # BROOKLYN_VERSION 23 | itemType: location 24 | name: Vagrant BYON VM 1 25 | item: 26 | type: byon 27 | brooklyn.config: 28 | user: vagrant 29 | password: vagrant 30 | hosts: 31 | - 10.10.10.101 32 | 33 | - id: byon2 34 | name: Vagrant BYON VM 2 35 | version: "1.2.0-SNAPSHOT" # BROOKLYN_VERSION 36 | itemType: location 37 | item: 38 | type: byon 39 | brooklyn.config: 40 | user: vagrant 41 | password: vagrant 42 | hosts: 43 | - 10.10.10.102 44 | 45 | - id: byon3 46 | version: "1.2.0-SNAPSHOT" # BROOKLYN_VERSION 47 | itemType: location 48 | name: Vagrant BYON VM 3 49 | item: 50 | type: byon 51 | brooklyn.config: 52 | user: vagrant 53 | password: vagrant 54 | hosts: 55 | - 10.10.10.103 56 | 57 | - id: byon4 58 | version: "1.2.0-SNAPSHOT" # BROOKLYN_VERSION 59 | itemType: location 60 | name: Vagrant BYON VM 4 61 | item: 62 | type: byon 63 | brooklyn.config: 64 | user: vagrant 65 | password: vagrant 66 | hosts: 67 | - 10.10.10.104 68 | 69 | - id: byon-all 70 | version: "1.2.0-SNAPSHOT" # BROOKLYN_VERSION 71 | itemType: location 72 | name: Vagrant BYON VM 1-4 73 | item: 74 | type: byon 75 | brooklyn.config: 76 | user: vagrant 77 | password: vagrant 78 | hosts: 79 | - 10.10.10.101 80 | - 10.10.10.102 81 | - 10.10.10.103 82 | - 10.10.10.104 83 | -------------------------------------------------------------------------------- /dist/src/main/dist/bin/brooklyn: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # 20 | # Brooklyn 21 | # 22 | 23 | #set -x # debug 24 | 25 | # discover BROOKLYN_HOME if not set, by attempting to resolve absolute path of this command 26 | ROOT=$(cd "$(dirname "$0")/.." && pwd -P) 27 | if [ -z "$BROOKLYN_HOME" ] ; then 28 | BROOKLYN_HOME=$(cd "$(dirname "$(readlink -f "$0" 2> /dev/null || readlink "$0" 2> /dev/null || echo "$0")")/.." && pwd) 29 | fi 30 | export ROOT BROOKLYN_HOME 31 | 32 | # use default memory settings, if not specified 33 | if [ -z "${JAVA_OPTS}" ] ; then 34 | JAVA_OPTS="-Xms256m -Xmx1g" 35 | fi 36 | 37 | # set up the classpath 38 | INITIAL_CLASSPATH=${BROOKLYN_HOME}/conf:${BROOKLYN_HOME}/lib/patch/*:${BROOKLYN_HOME}/lib/brooklyn/*:${BROOKLYN_HOME}/lib/dropins/* 39 | # specify additional CP args in BROOKLYN_CLASSPATH 40 | if [ ! -z "${BROOKLYN_CLASSPATH}" ]; then 41 | INITIAL_CLASSPATH=${BROOKLYN_CLASSPATH}:${INITIAL_CLASSPATH} 42 | fi 43 | export INITIAL_CLASSPATH 44 | 45 | # force resolution of localhost to be loopback, otherwise we hit problems 46 | # TODO should be changed in code 47 | JAVA_OPTS="-Dbrooklyn.location.localhost.address=127.0.0.1 ${JAVA_OPTS}" 48 | 49 | # Increase garbage collection, see https://issues.apache.org/jira/browse/BROOKLYN-375 50 | JAVA_OPTS="-XX:SoftRefLRUPolicyMSPerMB=1 ${JAVA_OPTS}" 51 | 52 | # Set the TLS protocol versions 53 | JAVA_OPTS="-Dhttps.protocols=TLSv1.1,TLSv1.2 ${JAVA_OPTS}" 54 | 55 | # start Brooklyn 56 | echo $$ > "$ROOT/pid_java" 57 | if [[ -n "$JAVA_HOME" && -d "$JAVA_HOME" ]] ; then 58 | JAVACMD="$JAVA_HOME/bin/java" 59 | else 60 | JAVACMD="java" 61 | fi 62 | 63 | exec $JAVACMD ${JAVA_OPTS} -cp "${INITIAL_CLASSPATH}" org.apache.brooklyn.cli.Main "$@" 64 | -------------------------------------------------------------------------------- /karaf/features/src/main/resources/resources/etc/brooklyn.cfg: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one or more 4 | # contributor license agreements. See the NOTICE file distributed with 5 | # this work for additional information regarding copyright ownership. 6 | # The ASF licenses this file to You under the Apache License, Version 2.0 7 | # (the "License"); you may not use this file except in compliance with 8 | # the License. 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, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | ################################################################################ 19 | 20 | # Default configuration does NOT require log in; THIS SHOULD BE CHANGED if on a public endpoint 21 | brooklyn.webconsole.security.provider = org.apache.brooklyn.rest.security.provider.AnyoneSecurityProvider 22 | 23 | # One alternative to the above (comment out the provider above and uncomment this) 24 | # is to allow any localhost access and create a password for other usage 25 | #brooklyn.webconsole.security.provider = org.apache.brooklyn.rest.security.provider.BrooklynUserWithRandomPasswordSecurityProvider 26 | 27 | # Or to set a password and user, or multiple ones, comment the provider above out and uncomment the two lines below 28 | #brooklyn.webconsole.security.users=admin 29 | #brooklyn.webconsole.security.user.admin.password=password 30 | 31 | # Can use a login form rather than browser auth 32 | #brooklyn.webconsole.security.unauthenticated.endpoints=brooklyn-ui-login 33 | #brooklyn.webconsole.security.login.form=brooklyn-ui-login 34 | 35 | # Refer to the documentation for other auth settings, including LDAP, and other settings 36 | 37 | #brooklyn.security.sensitive.fields.tokens=[password,passwd,credential,secret,private,access.cert,access.key] 38 | #brooklyn.security.sensitive.fields.plaintext.blocked=false 39 | 40 | # Default initializers to automatically add to any application deployed with Brooklyn 41 | # This expect a comma separated list of initializer class names 42 | brooklyn.deployment.initializers=org.apache.brooklyn.core.effector.AddDeploySensorsInitializer 43 | 44 | -------------------------------------------------------------------------------- /karaf/features/src/main/resources/resources/bin/setenv.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem 3 | rem 4 | rem Licensed to the Apache Software Foundation (ASF) under one or more 5 | rem contributor license agreements. See the NOTICE file distributed with 6 | rem this work for additional information regarding copyright ownership. 7 | rem The ASF licenses this file to You under the Apache License, Version 2.0 8 | rem (the "License"); you may not use this file except in compliance with 9 | rem the License. You may obtain a copy of the License at 10 | rem 11 | rem http://www.apache.org/licenses/LICENSE-2.0 12 | rem 13 | rem Unless required by applicable law or agreed to in writing, software 14 | rem distributed under the License is distributed on an "AS IS" BASIS, 15 | rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | rem See the License for the specific language governing permissions and 17 | rem limitations under the License. 18 | rem 19 | 20 | rem 21 | rem handle specific scripts; the SCRIPT_NAME is exactly the name of the Karaf 22 | rem script; for example karaf.bat, start.bat, stop.bat, admin.bat, client.bat, ... 23 | rem 24 | rem if "%KARAF_SCRIPT%" == "SCRIPT_NAME" ( 25 | rem Actions go here... 26 | rem ) 27 | 28 | rem 29 | rem general settings which should be applied for all scripts go here; please keep 30 | rem in mind that it is possible that scripts might be executed more than once, e.g. 31 | rem in example of the start script where the start script is executed first and the 32 | rem karaf script afterwards. 33 | rem 34 | 35 | rem 36 | rem The following section shows the possible configuration options for the default 37 | rem karaf scripts 38 | rem 39 | rem Window name of the windows console 40 | rem SET KARAF_TITLE 41 | rem Location of Java installation 42 | rem SET JAVA_HOME 43 | rem Minimum memory for the JVM 44 | SET JAVA_MIN_MEM=1024M 45 | rem Maximum memory for the JVM 46 | SET JAVA_MAX_MEM=4096M 47 | rem Minimum perm memory for the JVM 48 | rem SET JAVA_PERM_MEM 49 | rem Maximum perm memory for the JVM 50 | rem SET JAVA_MAX_PERM_MEM 51 | rem Additional JVM options 52 | rem SET EXTRA_JAVA_OPTS 53 | rem Karaf home folder 54 | rem SET KARAF_HOME 55 | rem Karaf data folder 56 | rem SET KARAF_DATA 57 | rem Karaf base folder 58 | rem SET KARAF_BASE 59 | rem Karaf etc folder 60 | rem SET KARAF_ETC 61 | rem First citizen Karaf options 62 | rem SET KARAF_SYSTEM_OPTS 63 | rem Additional available Karaf options 64 | rem SET KARAF_OPTS 65 | rem Enable debug mode 66 | rem SET KARAF_DEBUG 67 | 68 | rem Set the TLS protocol versions 69 | SET EXTRA_JAVA_OPTS=-Dhttps.protocols=TLSv1.2,TLSv1.1,TLSv1,SSLv3 %EXTRA_JAVA_OPTS% 70 | -------------------------------------------------------------------------------- /scripts/mvnf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, 15 | # software distributed under the License is distributed on an 16 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | # KIND, either express or implied. See the License for the 18 | # specific language governing permissions and limitations 19 | # under the License. 20 | # 21 | 22 | # runs mvn fast in several dirs; run with `-h` for more info 23 | 24 | 25 | export DIRS="" 26 | export ARGS="-o clean install -DskipTests" 27 | if [[ -z $1 || $1 = "-h" || $1 == "--help" ]] ; then 28 | echo 29 | echo "MVNF: a simple script for building multiple maven directories" 30 | echo 31 | echo "usage: mvnf [ -x \"install -Dxxx\" ] dir1 [ dir2 [ ... ]]" 32 | echo 33 | echo "This will do a maven build in each directory specified, in order, " 34 | echo "giving arguments '-o clean install -DskipTests' to mvn by default " 35 | echo "or other arguments if supplied in the word following -x at start. " 36 | echo "The script aborts if any build fails, giving the last return code " 37 | echo "code, and returning to the directory where it was invoked." 38 | echo 39 | echo "eg: \`mvnf ../other . && ./target/dist/run.sh\`" 40 | echo " will build other, then build ., then run a just-build script " 41 | echo " if all went well (but if it fails you'll see that too)" 42 | echo 43 | if [ -z $1 ] ; then exit 1 ; fi 44 | exit 0 45 | fi 46 | if [ $1 = "-x" ] ; then 47 | shift 48 | export ARGS=$1 49 | shift 50 | fi 51 | echo "MVNF: running \`mvn $ARGS\` on: $@" 52 | for x in $@ 53 | do 54 | if [ ! -d $x ] ; then 55 | export RETVAL=1 56 | echo "MVNF: no such directory $x" 57 | break 58 | fi 59 | if [ ! -f $x/pom.xml ] ; then 60 | export RETVAL=1 61 | echo "MVNF: no pom available in $x" 62 | break 63 | fi 64 | pushd $x > /dev/null 65 | export DIR=`basename \`pwd\`` 66 | echo "MVNF: building $DIR (${x})" 67 | mvn $ARGS 68 | export RETVAL=$? 69 | export DIRS="${DIRS}${DIR} " 70 | echo 71 | popd > /dev/null 72 | if [ $RETVAL != 0 ] ; then 73 | echo "MVNF: mvn failed in directory $DIR (${x})" 74 | break 75 | fi 76 | done 77 | if [ $RETVAL = 0 ] ; then 78 | echo MVNF: successfully built $DIRS 79 | fi 80 | test ${RETVAL} = 0 81 | -------------------------------------------------------------------------------- /dist/licensing/license-text/Indiana University Extreme! Lab Software License, version 1.2: -------------------------------------------------------------------------------- 1 | Indiana University Extreme! Lab Software License, Version 1.2 2 | 3 | Copyright (C) 2003 The Trustees of Indiana University. 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are 8 | met: 9 | 10 | 1) All redistributions of source code must retain the above 11 | copyright notice, the list of authors in the original source 12 | code, this list of conditions and the disclaimer listed in this 13 | license; 14 | 15 | 2) All redistributions in binary form must reproduce the above 16 | copyright notice, this list of conditions and the disclaimer 17 | listed in this license in the documentation and/or other 18 | materials provided with the distribution; 19 | 20 | 3) Any documentation included with all redistributions must include 21 | the following acknowledgement: 22 | 23 | "This product includes software developed by the Indiana 24 | University Extreme! Lab. For further information please visit 25 | http://www.extreme.indiana.edu/" 26 | 27 | Alternatively, this acknowledgment may appear in the software 28 | itself, and wherever such third-party acknowledgments normally 29 | appear. 30 | 31 | 4) The name "Indiana University" or "Indiana University 32 | Extreme! Lab" shall not be used to endorse or promote 33 | products derived from this software without prior written 34 | permission from Indiana University. For written permission, 35 | please contact http://www.extreme.indiana.edu/. 36 | 37 | 5) Products derived from this software may not use "Indiana 38 | University" name nor may "Indiana University" appear in their name, 39 | without prior written permission of the Indiana University. 40 | 41 | Indiana University provides no reassurances that the source code 42 | provided does not infringe the patent or any other intellectual 43 | property rights of any other entity. Indiana University disclaims any 44 | liability to any recipient for claims brought by any other entity 45 | based on infringement of intellectual property rights or otherwise. 46 | 47 | LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH 48 | NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA 49 | UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT 50 | SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR 51 | OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT 52 | SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP 53 | DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE 54 | RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, 55 | AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING 56 | SOFTWARE. 57 | -------------------------------------------------------------------------------- /release/README.md: -------------------------------------------------------------------------------- 1 | Release Scripts and Helpers 2 | =========================== 3 | 4 | This folder contains a number of items that will assist in the production of Brooklyn releases. 5 | 6 | 7 | Release scripts - change-version.sh and make-release-artifacts.sh 8 | ----------------------------------------------------------------- 9 | 10 | `change-version.sh` will update version numbers across the whole distribution. It is recommended to use this script 11 | rather than "rolling your own" or using a manual process, as you risk missing out some version numbers (and 12 | accidentally changing some that should not be changed). 13 | 14 | `make-release-artifacts.sh` will produce the release artifacts with appropriate signatures. It is recommended to use 15 | this script rather than "rolling your own" or using a manual process, as this script codifies several Apache 16 | requirements about the release artifacts. 17 | 18 | These scripts are fully documented in **Release Process** pages on the website. 19 | 20 | 21 | Vagrant configuration 22 | --------------------- 23 | 24 | The `Vagrantfile` and associated files `settings.xml` and `gpg-agent.conf` are for setting up a virtual machine hosting 25 | a complete and clean development environment. You may benefit from using this environment when making the release, but 26 | it is not required that you do so. 27 | 28 | The environment is a single VM that configured with all the tools needed to make the release. It also configures GnuPG 29 | by copying your `gpg.conf`, `secring.gpg` and `pubring.gpg` into the VM; also copied is your `.gitconfig`. The 30 | GnuPG agent is configured to assist with the release signing by caching your passphrase, so you will only need to enter 31 | it once during the build process. A Maven `settings.xml` is provided to assist with the upload to Apache's Nexus server. 32 | Finally the canonical Git repository for Apache Brooklyn is cloned into the home directory. 33 | 34 | You should edit `settings.xml` before deployment, or `~/.m2/settings.xml` inside the VM after deployment, to include 35 | your Apache credentials. 36 | 37 | Assuming you have VirtualBox and Vagrant already installed, you should simply be able to run `vagrant up` to create the 38 | VM, and then `vagrant ssh` to get a shell prompt inside the VM. Finally run `vagrant destroy` to clean up afterwards. 39 | 40 | This folder is mounted at `/vagrant` inside the VM - this means the release helpers are close to hand, so you can 41 | run for example `/vagrant/make-release/artifacts.sh`. 42 | 43 | 44 | Pull request reporting 45 | ---------------------- 46 | 47 | The files in `pull-request-reports`, mainly `pr_report.rb` 48 | (and associated files `Gemfile` and `Gemfile.lock`) uses the GitHub API to extract a list of open pull 49 | requests, and writes a summary into `pr_report.tsv`. This could then be imported into Google Sheets to provide a handy 50 | way of classifying and managing outstanding PRs ahead of making a release. 51 | -------------------------------------------------------------------------------- /archetypes/quickstart/src/brooklyn-sample/src/test/java/com/acme/sample/brooklyn/MySampleYamlTest.java: -------------------------------------------------------------------------------- 1 | package com.acme.sample.brooklyn; 2 | 3 | import static org.testng.Assert.assertEquals; 4 | 5 | import org.apache.brooklyn.api.entity.Entity; 6 | import org.apache.brooklyn.camp.brooklyn.AbstractYamlTest; 7 | import org.apache.brooklyn.core.entity.Attributes; 8 | import org.apache.brooklyn.core.entity.Entities; 9 | import org.apache.brooklyn.core.entity.EntityAsserts; 10 | import org.apache.brooklyn.util.core.ResourceUtils; 11 | import org.testng.annotations.Test; 12 | 13 | import com.google.common.base.Joiner; 14 | import com.google.common.collect.Iterables; 15 | 16 | public class MySampleYamlTest extends AbstractYamlTest { 17 | 18 | @Test 19 | public void testEntity() throws Exception { 20 | String yaml = Joiner.on("\n").join( 21 | "name: my test", 22 | "services:", 23 | "- type: com.acme.sample.brooklyn.MySample", 24 | " brooklyn.config:", 25 | " myConf: myConfVal"); 26 | 27 | Entity app = createAndStartApplication(yaml); 28 | waitForApplicationTasks(app); 29 | 30 | Entities.dumpInfo(app); 31 | 32 | MySample entity = (MySample) Iterables.getOnlyElement(app.getChildren()); 33 | assertEquals(entity.config().get(MySample.MY_CONF), "myConfVal"); 34 | } 35 | 36 | @Test 37 | public void testUsingTestFramework() throws Exception { 38 | String yaml = ResourceUtils.create().getResourceAsString("classpath://sample-test.yaml"); 39 | 40 | Entity app = createAndStartApplication(yaml); 41 | waitForApplicationTasks(app); 42 | 43 | Entities.dumpInfo(app); 44 | 45 | EntityAsserts.assertAttributeEqualsEventually(app, Attributes.SERVICE_UP, true); 46 | } 47 | 48 | /** 49 | * For this to pass, the sample.bom's library URL needs to be updated, to point at 50 | * the jar built using {@code mvn clean install} on this project. 51 | * 52 | * The group "WIP" (short for "work in progress") disables this test when run by maven. 53 | */ 54 | @Test(groups="WIP") 55 | public void testViaCatalog() throws Exception { 56 | String catalogYaml = ResourceUtils.create().getResourceAsString("classpath://sample.bom"); 57 | 58 | addCatalogItems(catalogYaml); 59 | 60 | String blueprintYaml = Joiner.on("\n").join( 61 | "name: my test", 62 | "services:", 63 | "- type: com.acme.sample.brooklyn.MySampleInCatalog:1.0"); 64 | 65 | Entity app = createAndStartApplication(blueprintYaml); 66 | waitForApplicationTasks(app); 67 | 68 | Entities.dumpInfo(app); 69 | 70 | MySample entity = (MySample) Iterables.getOnlyElement(app.getChildren()); 71 | EntityAsserts.assertAttributeEqualsEventually(entity, Attributes.SERVICE_UP, true); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /archetypes/quickstart/src/main/resources/META-INF/maven/archetype-metadata.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 22 | 23 | 24 | 25 | https://repository.apache.org/content/repositories/releases 26 | 27 | 28 | 29 | 30 | 31 | src/main/java 32 | 33 | **/*.java 34 | 35 | 36 | 37 | 38 | src/test/java 39 | 40 | **/*.java 41 | 42 | 43 | 44 | 47 | 48 | 49 | 50 | 51 | **/*.png 52 | **/*.sh 53 | 54 | 55 | 56 | 57 | 58 | **/* 59 | * 60 | 61 | 62 | src/main/java/** 63 | src/test/java/** 64 | pom.xml 65 | **.png 66 | **.sh 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /docker-itest/Jenkinsfile: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. 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 | node(label: 'ubuntu') { 21 | catchError { 22 | def environmentDockerImage 23 | 24 | def dockerTag = env.BUILD_TAG.replace('%2F', '-') 25 | 26 | withEnv(["DOCKER_TAG=${dockerTag}"]) { 27 | stage('Clone repository') { 28 | checkout scm 29 | } 30 | 31 | stage('Prepare environment') { 32 | echo 'Creating maven cache ...' 33 | sh 'mkdir -p ${WORKSPACE}/.m2' 34 | sh 'git submodule init' 35 | sh 'git submodule update --remote --merge --recursive' 36 | echo 'Building docker image for test environment ...' 37 | echo "Using docker tag DOCKER_TAG=${DOCKER_TAG}" // double quotes to resolve env vars 38 | environmentDockerImage = docker.build("brooklyn:${DOCKER_TAG}") // double quotes to resolve env vars 39 | } 40 | 41 | stage('Run tests') { 42 | environmentDockerImage.inside('-i --name brooklyn-${DOCKER_TAG} -v ${WORKSPACE}/.m2:/var/maven/.m2 --mount type=bind,source="${HOME}/.m2/settings.xml",target=/var/maven/.m2/settings.xml,readonly -v ${WORKSPACE}:/usr/build -w /usr/build') { 43 | sh 'mvn clean test -PIntegration -Duser.home=/var/maven -Duser.name=jenkins' 44 | } 45 | } 46 | } 47 | } 48 | 49 | // ---- Post actions steps, to always perform ---- 50 | 51 | stage('Publish test results') { 52 | // Publish JUnit results 53 | junit allowEmptyResults: true, testResults: '**/target/surefire-reports/junitreports/*.xml' 54 | 55 | // Publish TestNG results 56 | step([ 57 | $class: 'Publisher', 58 | reportFilenamePattern: '**/testng-results.xml' 59 | ]) 60 | } 61 | 62 | stage('Send notifications') { 63 | // Send email notifications 64 | step([ 65 | $class: 'Mailer', 66 | notifyEveryUnstableBuild: true, 67 | recipients: 'dev@brooklyn.apache.org', 68 | sendToIndividuals: false 69 | ]) 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /archetypes/quickstart/src/brooklyn-sample/README.md: -------------------------------------------------------------------------------- 1 | brooklyn-sample 2 | === 3 | 4 | This is a Sample Brooklyn project, showing how to write a Java-based entity and 5 | build it as an OSGi bundle that can be used in a Brooklyn catalog. 6 | 7 | This sample project is intended to be customized to suit your purposes: but 8 | search for all lines containing the word "sample" or "acme" to make sure all the 9 | references to this being a sample are removed! 10 | 11 | To easily find the bits you should customize, do a: 12 | 13 | grep -ri sample src/ *.* 14 | 15 | 16 | ### Building 17 | 18 | To build an assembly, simply run: 19 | 20 | mvn clean install 21 | 22 | This creates an OSGi bundle at: 23 | 24 | target/brooklyn-sample-0.1.0-SNAPSHOT.jar 25 | 26 | 27 | ### Opening in an IDE 28 | 29 | To open this project in an IDE, you will need maven support enabled 30 | (e.g. with the relevant plugin). You should then be able to develop 31 | it and run it as usual. For more information on IDE support, visit: 32 | 33 | https://brooklyn.apache.org/v/latest/dev/env/ide/ 34 | 35 | 36 | ### Brooklyn Catalog 37 | 38 | The new blueprint can be added to the Brooklyn catalog using the `sample.bom` file. 39 | located in `src/test/resources`. You will first have to copy the target jar to a suitable location, 40 | and update the URL in `sample.bom` pointing at that jar. 41 | 42 | The command below will use the REST api to add this to the catalog of a running Brooklyn instance: 43 | 44 | curl -u admin:pa55w0rd http://127.0.0.1:8081/v1/catalog --data-binary @src/test/resources/sample.bom 45 | 46 | The YAML blueprint below shows an example usage of this blueprint: 47 | 48 | name: my sample 49 | services: 50 | - type: com.acme.sample.brooklyn.MySampleInCatalog:1.0 51 | 52 | 53 | ### Testing Entities 54 | 55 | This project comes with unit tests that demonstrate how to test entities, both within Java and 56 | also using YAML-based blueprints. 57 | 58 | A strongly recommended way is to write a YAML test blueprint using the test framework, and making 59 | this available to anyone who will use your entity. This will allow users to easily run the test 60 | blueprint in their own environment (simply by deploying it to their own Brooklyn server) to confirm 61 | that the entity is working as expected. An example is shown in `src/test/resources/sample-test.yaml`. 62 | 63 | 64 | ### More About Apache Brooklyn 65 | 66 | Apache Brooklyn is a code library and framework for managing applications in a 67 | cloud-first dev-ops-y way. It has been used to create this sample project 68 | which shows how to define an application and entities for Brooklyn. 69 | 70 | For more information consider: 71 | 72 | * Visiting the Apache Brooklyn home page at https://brooklyn.apache.org 73 | * Finding us on IRC #brooklyncentral or email (click "Community" at the site above) 74 | * Forking the project at http://github.com/apache/brooklyn/ 75 | 76 | 77 | ### License 78 | 79 | Please add your desired license to this project template. 80 | -------------------------------------------------------------------------------- /karaf/itest/src/test/java/org/apache/brooklyn/core/catalog/internal/DefaultBomLoadTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. 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 | package org.apache.brooklyn.core.catalog.internal; 20 | 21 | 22 | import static org.apache.brooklyn.KarafTestUtils.defaultOptionsWith; 23 | import static org.junit.Assert.assertEquals; 24 | import static org.junit.Assert.assertNotNull; 25 | 26 | import javax.inject.Inject; 27 | 28 | import org.apache.brooklyn.api.mgmt.ManagementContext; 29 | import org.apache.brooklyn.api.typereg.RegisteredType; 30 | import org.apache.brooklyn.core.BrooklynVersion; 31 | import org.apache.brooklyn.test.IntegrationTest; 32 | import org.apache.karaf.features.BootFinished; 33 | import org.junit.Test; 34 | import org.junit.experimental.categories.Category; 35 | import org.junit.runner.RunWith; 36 | import org.ops4j.pax.exam.Configuration; 37 | import org.ops4j.pax.exam.Option; 38 | import org.ops4j.pax.exam.junit.PaxExam; 39 | import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; 40 | import org.ops4j.pax.exam.spi.reactors.PerMethod; 41 | import org.ops4j.pax.exam.util.Filter; 42 | 43 | @RunWith(PaxExam.class) 44 | @ExamReactorStrategy(PerMethod.class) 45 | @Category(IntegrationTest.class) 46 | public class DefaultBomLoadTest { 47 | 48 | /** 49 | * To make sure the tests run only when the boot features are fully installed 50 | */ 51 | @Inject 52 | @Filter(timeout = 120000) 53 | BootFinished bootFinished; 54 | 55 | @Inject 56 | @Filter(timeout = 120000) 57 | protected ManagementContext managementContext; 58 | 59 | 60 | @Configuration 61 | public static Option[] configuration() throws Exception { 62 | return defaultOptionsWith( 63 | // Uncomment this for remote debugging the tests on port 5005 64 | // , KarafDistributionOption.debugConfiguration() 65 | ); 66 | } 67 | 68 | 69 | @Test 70 | @Category(IntegrationTest.class) 71 | public void shouldHaveLoadedDefaultCatalogBom() throws Exception { 72 | RegisteredType item = managementContext.getTypeRegistry().get("server-template", BrooklynVersion.get()); 73 | assertNotNull(item); 74 | assertEquals("Template: Server", item.getDisplayName()); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /release/change-version.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # 20 | 21 | set -e 22 | 23 | # changes the version everywhere 24 | # usage, e.g.: change-version.sh 0.3.0-SNAPSHOT 0.3.0-RC1 25 | # or: change-version.sh MARKER 0.3.0-SNAPSHOT 0.3.0-RC1 26 | 27 | [ -d .git ] || [ -f .git ] || { 28 | echo "Must run in brooklyn project root directory" 29 | exit 1 30 | } 31 | 32 | if [ "$#" -eq 2 ]; then 33 | VERSION_MARKER=BROOKLYN_VERSION 34 | elif [ "$#" -eq 3 ]; then 35 | VERSION_MARKER=$1_VERSION 36 | shift; 37 | else 38 | echo "Usage: "$0" [VERSION_MARKER] CURRENT_VERSION NEW_VERSION" 39 | echo " e.g.: "$0" BROOKLYN 0.3.0-SNAPSHOT 0.3.0-RC1" 40 | exit 1 41 | fi 42 | 43 | VERSION_MARKER_NL=${VERSION_MARKER}_BELOW 44 | CURRENT_VERSION=$1 45 | NEW_VERSION=$2 46 | 47 | # grep --exclude-dir working only in recent versions, not on all platforms, replace with find; 48 | # skip folders named "ignored" or .xxx (but not the current folder "."); 49 | # exclude log, war, swp, etc. files; 50 | # use null delimiters so files containing spaces are supported; 51 | # pass /dev/null as the first file to search in, so the command doesn't fail if find doesn't match any files; 52 | # add || true for the case where grep doesn't have matches, so the script doesn't halt 53 | # If there's an error "Argument list too long" add -n20 to xargs arguments and loop over $FILE around sed 54 | FILES=`find . -type d \( -name ignored -or -name target -or -name node_modules -or \( -name .?\* -and -not -name .mvn \) \) -prune \ 55 | -o -type f -not \( -name \*.log -or -name '*.war' -or -name '*.min.js' -or -name '*.min.css' -or -name '*.swp' \) -print0 | \ 56 | xargs -0 grep -l "${VERSION_MARKER}\|${VERSION_MARKER_NL}" /dev/null || true` 57 | 58 | FILES_COUNT=`echo $FILES | wc | awk '{print $2}'` 59 | 60 | if [ ${FILES_COUNT} -ne 0 ]; then 61 | # search for files containing version markers 62 | sed -i.bak -e "/${VERSION_MARKER}/s/${CURRENT_VERSION}/${NEW_VERSION}/g" $FILES 63 | sed -i.bak -e "/${VERSION_MARKER_NL}/{n;s/${CURRENT_VERSION}/${NEW_VERSION}/g;}" $FILES 64 | fi 65 | 66 | echo "Changed ${VERSION_MARKER} from ${CURRENT_VERSION} to ${NEW_VERSION} for "${FILES_COUNT}" files" 67 | echo "(Do a \`find . -name \"*.bak\" -delete\` to delete the backup files.)" 68 | -------------------------------------------------------------------------------- /archetypes/quickstart/NOTES.txt: -------------------------------------------------------------------------------- 1 | 2 | This file contains notes for anyone working on the archetype. 3 | 4 | 5 | Some things to keep in mind: 6 | 7 | * The sample project in `src/brooklyn-sample` is what populates the 8 | archetype source (in `src/main/resources/archetype-resources`, 9 | copied there by the `pom.xml` in this directory, in `clean` phase). 10 | (You can open and edit it in your IDE.) 11 | 12 | * That archetype source then becomes the archetype (in `install` phase) 13 | according to the copy and filter rules in `src/main/resources/META-INF/maven/archetype-metadata.xml` 14 | 15 | * For any changes to the project: 16 | 17 | * ensure `brooklyn-sample` builds as you would like 18 | * ensure the resulting archetype builds as you would like 19 | (should be reasonably safe and automated, but check that the 2 sets of 20 | copy/translation rules above do what you intended!) 21 | * update the `README.*` files in the root of `brooklyn-sample` and the 22 | `src/main/assembly/files` within that 23 | * update the docs under `use/guide/defining-applications/archetype.md` and `use/guide/quickstart/index.md` 24 | 25 | 26 | To build: 27 | 28 | mvn clean install 29 | 30 | 31 | To test a build: 32 | 33 | pushd /tmp 34 | rm -rf brooklyn-sample 35 | export BV=1.2.0-SNAPSHOT # BROOKLYN_VERSION 36 | 37 | mvn archetype:generate \ 38 | \ 39 | -DarchetypeGroupId=org.apache.brooklyn \ 40 | -DarchetypeArtifactId=brooklyn-archetype-quickstart \ 41 | -DarchetypeVersion=${BV} \ 42 | \ 43 | -DgroupId=com.acme.sample \ 44 | -DartifactId=brooklyn-sample \ 45 | -Dversion=0.1.0-SNAPSHOT \ 46 | -Dpackage=com.acme.sample.brooklyn \ 47 | \ 48 | --batch-mode 49 | 50 | cd brooklyn-sample 51 | mvn clean assembly:assembly 52 | cd target/brooklyn-sample-0.1.0-SNAPSHOT-dist/brooklyn-sample-0.1.0-SNAPSHOT/ 53 | ./start.sh launch --cluster --location localhost 54 | 55 | 56 | References 57 | 58 | * http://stackoverflow.com/questions/4082643/how-can-i-test-a-maven-archetype-that-ive-just-created/18916065#18916065 59 | 60 | ---- 61 | Licensed to the Apache Software Foundation (ASF) under one 62 | or more contributor license agreements. See the NOTICE file 63 | distributed with this work for additional information 64 | regarding copyright ownership. The ASF licenses this file 65 | to you under the Apache License, Version 2.0 (the 66 | "License"); you may not use this file except in compliance 67 | with the License. You may obtain a copy of the License at 68 | 69 | http://www.apache.org/licenses/LICENSE-2.0 70 | 71 | Unless required by applicable law or agreed to in writing, 72 | software distributed under the License is distributed on an 73 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 74 | KIND, either express or implied. See the License for the 75 | specific language governing permissions and limitations 76 | under the License. 77 | -------------------------------------------------------------------------------- /Jenkinsfile: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. 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 | node(label: 'ubuntu') { 21 | if (env.CHANGE_ID) { 22 | properties([ 23 | pipelineTriggers([ 24 | issueCommentTrigger('.*test this please.*') 25 | ]) 26 | ]) 27 | } 28 | 29 | catchError { 30 | def environmentDockerImage 31 | 32 | def dockerTag = env.BUILD_TAG.replace('%2F', '-') 33 | 34 | withEnv(["DOCKER_TAG=${dockerTag}"]) { 35 | stage('Clone repository') { 36 | checkout scm 37 | } 38 | 39 | stage('Prepare environment') { 40 | echo 'Creating maven cache ...' 41 | sh 'mkdir -p ${WORKSPACE}/.m2' 42 | sh 'docker logout' // needed because sometimes cached credentials break the following step (creds aren't needed) 43 | echo 'Building docker image for test environment ...' 44 | echo "Using docker tag DOCKER_TAG=${DOCKER_TAG}" // double quotes to resolve env vars 45 | environmentDockerImage = docker.build("brooklyn:${DOCKER_TAG}") // double quotes to resolve env vars 46 | } 47 | 48 | stage('Run tests') { 49 | environmentDockerImage.inside('-i --name brooklyn-${DOCKER_TAG} -v ${WORKSPACE}/.m2:/var/maven/.m2 --mount type=bind,source="${HOME}/.m2/settings.xml",target=/var/maven/.m2/settings.xml,readonly -v ${WORKSPACE}:/usr/build -w /usr/build') { 50 | sh 'mvn clean install -Prpm -Pdeb -Duser.home=/var/maven -Duser.name=jenkins' 51 | } 52 | } 53 | } 54 | } 55 | 56 | // ---- Post actions steps, to always perform ---- 57 | 58 | stage('Publish test results') { 59 | // Publish JUnit results 60 | junit allowEmptyResults: true, testResults: '**/target/surefire-reports/junitreports/*.xml' 61 | 62 | // Publish TestNG results 63 | step([ 64 | $class: 'Publisher', 65 | reportFilenamePattern: '**/testng-results.xml' 66 | ]) 67 | } 68 | 69 | // Conditional stage, when not building a PR 70 | if (env.CHANGE_ID == null) { 71 | stage('Send notifications') { 72 | // Send email notifications 73 | step([ 74 | $class: 'Mailer', 75 | notifyEveryUnstableBuild: true, 76 | recipients: 'dev@brooklyn.apache.org', 77 | sendToIndividuals: false 78 | ]) 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /archetypes/quickstart/src/brooklyn-sample/src/main/java/com/acme/sample/brooklyn/MySampleImpl.java: -------------------------------------------------------------------------------- 1 | package com.acme.sample.brooklyn; 2 | 3 | import java.util.Collection; 4 | 5 | import org.apache.brooklyn.api.location.Location; 6 | import org.apache.brooklyn.core.entity.AbstractEntity; 7 | import org.apache.brooklyn.core.entity.lifecycle.Lifecycle; 8 | import org.apache.brooklyn.core.entity.lifecycle.ServiceStateLogic; 9 | import org.apache.brooklyn.core.entity.lifecycle.ServiceStateLogic.ServiceNotUpLogic; 10 | import org.slf4j.Logger; 11 | import org.slf4j.LoggerFactory; 12 | 13 | /** 14 | * The entity's implementation. It is normal to extend one of the pre-existing superclasses 15 | * such as the most basic {@link AbstractEntity} or (for a software process being installed) 16 | * a {@link org.apache.brooklyn.entity.software.base.SoftwareProcessImpl}. However, for the 17 | * latter it is strongly encouraged to instead consider using YAML-based blueprints. 18 | * 19 | * The service.isUp and service.state sensors are populated by using the {@link ServiceNotUpLogic} 20 | * and {@link ServiceStateLogic} utilities. A simpler (less powerful) way is to directly set 21 | * the sensors {@link org.apache.brooklyn.core.entity.Attributes#SERVICE_UP} and 22 | * {@link org.apache.brooklyn.core.entity.Attributes#SERVICE_STATE_ACTUAL}. The advantage 23 | * of the {@link ServiceNotUpLogic} is that multiple indicators can be used, all of which 24 | * must be satisfied for the service to be considered healthy. For example, it might be required 25 | * that a web-app's URL is reachable and also that the app-server's management API reports 26 | * healthy. 27 | */ 28 | public class MySampleImpl extends AbstractEntity implements MySample { 29 | 30 | private static final Logger LOG = LoggerFactory.getLogger(MySampleImpl.class); 31 | 32 | @Override 33 | public void init() { 34 | super.init(); 35 | LOG.info("MySampleImpl.init() with config {}", config().get(MY_CONF)); 36 | ServiceNotUpLogic.updateNotUpIndicator(this, "started", "not started"); 37 | } 38 | 39 | @Override 40 | protected void initEnrichers() { 41 | super.initEnrichers(); 42 | } 43 | 44 | @Override 45 | public void start(Collection locs) { 46 | LOG.info("MySampleImpl.start({})", locs); 47 | sensors().set(LAST_CALL, "start"); 48 | ServiceNotUpLogic.clearNotUpIndicator(this, "started"); 49 | ServiceStateLogic.setExpectedState(this, Lifecycle.RUNNING); 50 | } 51 | 52 | @Override 53 | public void stop() { 54 | LOG.info("MySampleImpl.stop()"); 55 | sensors().set(LAST_CALL, "stop"); 56 | ServiceStateLogic.setExpectedState(this, Lifecycle.STOPPED); 57 | ServiceNotUpLogic.updateNotUpIndicator(this, "started", "stopped"); 58 | } 59 | 60 | @Override 61 | public void restart() { 62 | LOG.info("MySampleImpl.restart()"); 63 | sensors().set(LAST_CALL, "restart"); 64 | ServiceStateLogic.setExpectedState(this, Lifecycle.STOPPED); 65 | ServiceStateLogic.setExpectedState(this, Lifecycle.RUNNING); 66 | } 67 | 68 | @Override 69 | public void myEffector(String arg1) { 70 | LOG.info("MySampleImpl.myEffector({})", arg1); 71 | sensors().set(LAST_CALL, "myEffector("+arg1+")"); 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /karaf/itest/src/test/java/org/apache/brooklyn/AssemblyTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. 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 | package org.apache.brooklyn; 20 | 21 | import static org.apache.brooklyn.KarafTestUtils.defaultOptionsWith; 22 | import static org.junit.Assert.assertNotNull; 23 | import static org.junit.Assert.assertTrue; 24 | 25 | import javax.inject.Inject; 26 | 27 | import org.apache.karaf.features.BootFinished; 28 | import org.apache.karaf.features.FeaturesService; 29 | import org.junit.Ignore; 30 | import org.junit.Test; 31 | import org.junit.runner.RunWith; 32 | import org.ops4j.pax.exam.Configuration; 33 | import org.ops4j.pax.exam.Option; 34 | import org.ops4j.pax.exam.junit.PaxExam; 35 | import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; 36 | import org.ops4j.pax.exam.spi.reactors.PerClass; 37 | import org.ops4j.pax.exam.util.Filter; 38 | import org.osgi.framework.BundleContext; 39 | 40 | /** 41 | * Tests the apache-brooklyn karaf runtime assembly. 42 | * 43 | * Keeping it a non-integration test so we have at least a basic OSGi sanity check. (takes 14 sec) 44 | */ 45 | @Ignore // See Thread at https://lists.apache.org/thread.html/rc4c563e1d320164b75a52581e65ff9c5888917153d3241865ec94a38%40%3Cdev.brooklyn.apache.org%3E 46 | @RunWith(PaxExam.class) 47 | @ExamReactorStrategy(PerClass.class) 48 | public class AssemblyTest { 49 | 50 | @Inject 51 | private BundleContext bc; 52 | 53 | @Inject 54 | @Filter(timeout = 120000) 55 | protected FeaturesService featuresService; 56 | 57 | /** 58 | * To make sure the tests run only when the boot features are fully 59 | * installed 60 | */ 61 | @Inject 62 | @Filter(timeout = 120000) 63 | BootFinished bootFinished; 64 | 65 | @Configuration 66 | public static Option[] configuration() throws Exception { 67 | return defaultOptionsWith( 68 | // Uncomment this for remote debugging the tests on port 5005 69 | // KarafDistributionOption.debugConfiguration() 70 | ); 71 | } 72 | 73 | @Test 74 | public void shouldHaveBundleContext() { 75 | assertNotNull(bc); 76 | } 77 | 78 | @Test 79 | public void checkEventFeature() throws Exception { 80 | assertTrue(featuresService.isInstalled(featuresService.getFeature("eventadmin"))); 81 | } 82 | 83 | @Test 84 | public void checkBrooklynCoreFeature() throws Exception { 85 | featuresService.installFeature("brooklyn-core"); 86 | assertTrue(featuresService.isInstalled(featuresService.getFeature("brooklyn-core"))); 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /docker/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. 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 | BROOKLYN_VERSION=1.2.0-SNAPSHOT 21 | 22 | default: all 23 | 24 | clean: 25 | rm -rf target/ 26 | 27 | prep: clean 28 | mkdir -p target/files/ 29 | cp -a ../dist/target/brooklyn-dist/brooklyn/* target/files 30 | cp -a target/files/bin/brooklyn-client-cli/linux.386/br target/files/bin/ 31 | cp -a brooklyn-docker-start target/files/bin/ 32 | 33 | image-only: 34 | docker build -t brooklyncentral/brooklyn:$(BROOKLYN_VERSION) . 35 | 36 | image-debug: prep 37 | # image based on ubuntu (instead of alpine) with more tools installed and better debug output 38 | docker build -t brooklyncentral/brooklyn:${BROOKLYN_VERSION}-debug -f Dockerfile-debug-ubuntu . 39 | 40 | all: prep image-only 41 | 42 | 43 | # illustrations, useful for copy-pasting 44 | 45 | run: 46 | # BROOKLYN_VERSION_BELOW 47 | docker run -d -p 8081:8081 brooklyncentral/brooklyn:${BROOKLYN_VERSION} --password S3CR3T > /tmp/brooklyn_container 48 | docker logs -f `cat /tmp/brooklyn_container` 49 | 50 | run-shell: 51 | docker run -ti --entrypoint /bin/bash brooklyncentral/brooklyn:$(BROOKLYN_VERSION) 52 | 53 | 54 | # an example pre-installing blueprints and even taking a location as argument to quick launch 55 | 56 | example-image-hyperledger: prep 57 | docker build -t brooklyncentral/brooklyn-hyperledger \ 58 | --build-arg install_boms="https://raw.githubusercontent.com/cloudsoft/brooklyn-hyperledger/master/docker.bom \ 59 | https://raw.githubusercontent.com/cloudsoft/brooklyn-hyperledger/master/catalog.bom" \ 60 | --build-arg application=hyperledger-fabric-single-cluster-application \ 61 | . 62 | 63 | example-run-hyperledger: 64 | # add id:cred@cloud as an argument to launch the blueprint in that cloud 65 | docker run -p 8081:8081 brooklyncentral/brooklyn-hyperledger --password S3CR3T 66 | 67 | example-image-kubernetes: prep 68 | docker build -t brooklyncentral/brooklyn-kubernetes \ 69 | --build-arg install_boms="classpath://swarm/catalog.bom classpath://kubernetes/catalog.bom" \ 70 | --build-arg dropins_jars="https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=io.brooklyn.etcd&a=brooklyn-etcd&v=2.3.0-SNAPSHOT \ 71 | https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=io.brooklyn.clocker&a=clocker-common&v=2.1.0-SNAPSHOT \ 72 | https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=io.brooklyn.clocker&a=clocker-swarm&v=2.1.0-SNAPSHOT \ 73 | https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=io.brooklyn.clocker&a=clocker-kubernetes&v=2.1.0-SNAPSHOT" \ 74 | --build-arg application=kubernetes-cluster-template \ 75 | . 76 | 77 | -------------------------------------------------------------------------------- /vagrant/src/main/vagrant/servers.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. 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 | # Default Config 21 | # check_newer_vagrant_box 22 | # enable/disable the vagrant check for an updated box 23 | # run_os_update 24 | # enable/disable running a yum/apt-get update on box start 25 | # 26 | # Brooklyn Server Config 27 | # shell:env:BROOKLYN_VERSION 28 | # specifies the version of Brooklyn to install, be aware that for SNAPSHOTS you 29 | # may wish to download a local -dist.tar.gz for the latest version. 30 | # shell:env:INSTALL_FROM_LOCAL_DIST 31 | # if set to `true` Vagrant will install from a local -dist.tar.gz stored in /vagrant 32 | # on the guest VM (which is mounted from the Vagrantfile directory). You must 33 | # ensure that a -dist.tar.gz archive has been copied to this directory on your host. 34 | 35 | --- 36 | default_config: 37 | check_newer_vagrant_box: true 38 | run_os_update: true 39 | servers: 40 | - name: brooklyn 41 | box: bento/centos-7.3 42 | ram: 2048 43 | cpus: 4 44 | forwarded_ports: 45 | - guest: 8081 46 | host: 8081 47 | autocorrect: true 48 | shell: 49 | env: 50 | BROOKLYN_VERSION: "1.2.0-SNAPSHOT" # BROOKLYN_VERSION 51 | INSTALL_FROM_LOCAL_DIST: false 52 | cmd: 53 | - ssh-keygen -t rsa -N "" -f $HOME/.ssh/id_rsa 54 | - chmod a+x /vagrant/files/install_brooklyn.sh 55 | - /vagrant/files/install_brooklyn.sh -v ${BROOKLYN_VERSION} -l ${INSTALL_FROM_LOCAL_DIST} 56 | - name: byon1 57 | box: bento/centos-7.3 58 | ram: 512 59 | cpus: 2 60 | ip: 10.10.10.101 61 | shell: 62 | env: {} 63 | cmd: 64 | - sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config 65 | - sudo service sshd restart 66 | - name: byon2 67 | box: bento/centos-7.3 68 | ram: 512 69 | cpus: 2 70 | ip: 10.10.10.102 71 | shell: 72 | env: {} 73 | cmd: 74 | - sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config 75 | - sudo service sshd restart 76 | - name: byon3 77 | box: bento/centos-7.3 78 | ram: 512 79 | cpus: 2 80 | ip: 10.10.10.103 81 | shell: 82 | env: {} 83 | cmd: 84 | - sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config 85 | - sudo service sshd restart 86 | - name: byon4 87 | box: bento/centos-7.3 88 | ram: 512 89 | cpus: 2 90 | ip: 10.10.10.104 91 | shell: 92 | env: {} 93 | cmd: 94 | - sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config 95 | - sudo service sshd restart 96 | ... 97 | -------------------------------------------------------------------------------- /dist/licensing/compute-nodejs-license-dependencies.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # 20 | 21 | # requires: 22 | # node js license-checker to generate the list of deps of this project in the format used by brooklyn 23 | # (https://github.com/davglass/license-checker) 24 | # jq to process json (https://stedolan.github.io/jq/) 25 | # node js json2yaml to output yaml for merging (https://www.npmjs.com/package/json2yaml) 26 | 27 | if [ "$1" == "--help" ] ; then 28 | echo Computes NodeJS dependencies and outputs metadata files in `config/license-` 29 | echo Works in current directory, or takes target directory as single argument. 30 | exit 0 31 | fi 32 | 33 | EXCLUDE_DEPS=brooklyn 34 | 35 | BASE_DIR=$(pushd $(dirname $0) > /dev/null ; pwd -P ; popd > /dev/null) 36 | 37 | if [ ! -z "$1" ] ; then pushd $1 > /dev/null ; fi 38 | OUTDIR=. 39 | 40 | if [ -d $OUTDIR/config ] ; then OUTDIR=$OUTDIR/config ; fi 41 | TEMPFILE=$OUTDIR/license-dependencies.json.tmp 42 | 43 | license-checker --production --json --customPath $BASE_DIR/compute-nodejs-license-dependencies.format.json > $TEMPFILE 44 | 45 | cp $BASE_DIR/parts/yaml-asf-header $OUTDIR/license-inclusions-binary-autogenerated-js-license-checker.yaml 46 | cat $TEMPFILE | jq 'keys | .[]' | awk '{ print "- id: "$0 }' | \ 47 | grep -v "id: \"${EXCLUDE_DEPS}-" >> $OUTDIR/license-inclusions-binary-autogenerated-js-license-checker.yaml 48 | 49 | # a few things to note: 50 | # * we exclude keys with null/empty values in jq 51 | # * if homepage and repo are the same, or homepage is autogen with #readme appended, we drop homepage 52 | # ("unique" changes the order, which we don't want) 53 | # * json2yaml prepends --- to the file and " " on every line, which we don't want 54 | cp $BASE_DIR/parts/yaml-asf-header $OUTDIR/license-metadata-autogenerated-js.yaml 55 | cat $TEMPFILE | jq 'to_entries | 56 | map({ id: .key } + 57 | .value | { 58 | id, name: (.name + " (NodeJS module)"), version, description, 59 | url: ([ (select(.homepage != .repository+"#readme" and .homepage != .repository) | .homepage), .repository ] 60 | | map(select(length > 0))), 61 | organization: (. | { name: .publisher, email: .email, url: .url } | with_entries(select((.value | length) > 0)) ), 62 | license: .licenses, 63 | copyright_by: .copyright, license_text: .licenseText } 64 | | with_entries(select((.value | length) > 0)) )' \ 65 | | json2yaml | grep -v ^--- | sed 's/^ //' \ 66 | >> $OUTDIR/license-metadata-autogenerated-js.yaml 67 | 68 | rm $TEMPFILE 69 | 70 | echo Reported $(wc $OUTDIR/license-inclusions-binary-autogenerated-js-license-checker.yaml | awk '{print $1}') JS dependencies for $(basename $(pwd)) 71 | 72 | if [ ! -z "$1" ] ; then popd > /dev/null ; fi 73 | 74 | -------------------------------------------------------------------------------- /docker-image/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 22 | 23 | 4.0.0 24 | 25 | karaf-docker-image 26 | pom 27 | Brooklyn Docker Image 28 | 29 | 30 | org.apache.brooklyn 31 | brooklyn-dist-root 32 | 1.2.0-SNAPSHOT 33 | ../pom.xml 34 | 35 | 36 | 37 | 38 | org.apache.brooklyn 39 | apache-brooklyn 40 | ${project.version} 41 | tar.gz 42 | 43 | 44 | 45 | 46 | 47 | 48 | maven-dependency-plugin 49 | 50 | 51 | copy-distro 52 | prepare-package 53 | 54 | copy 55 | 56 | 57 | 58 | 59 | org.apache.brooklyn 60 | apache-brooklyn 61 | tar.gz 62 | ${project.build.directory} 63 | apache-brooklyn-${project.version}.tar.gz 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | com.spotify 72 | dockerfile-maven-plugin 73 | ${dockerfile-maven-plugin.version} 74 | 75 | 76 | default 77 | 78 | build 79 | 80 | 81 | 82 | 83 | apache/brooklyn 84 | ${project.version} 85 | 86 | target/apache-brooklyn-${project.version}.tar.gz 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /karaf/features/src/main/resources/resources/etc/org.apache.karaf.shell.cfg: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one or more 4 | # contributor license agreements. See the NOTICE file distributed with 5 | # this work for additional information regarding copyright ownership. 6 | # The ASF licenses this file to You under the Apache License, Version 2.0 7 | # (the "License"); you may not use this file except in compliance with 8 | # the License. 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, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | ################################################################################ 19 | 20 | # 21 | # These properties are used to configure Karaf's ssh shell. 22 | # 23 | 24 | # 25 | # Via sshPort and sshHost you define the address you can login into Karaf. 26 | # 27 | sshPort = 8101 28 | sshHost = 127.0.0.1 29 | 30 | # 31 | # The sshIdleTimeout defines the inactivity timeout to logout the SSH session. 32 | # The sshIdleTimeout is in milliseconds, and the default is set to 30 minutes. 33 | # 34 | sshIdleTimeout = 1800000 35 | 36 | # 37 | # sshRealm defines which JAAS domain to use for password authentication. 38 | # 39 | sshRealm = karaf 40 | 41 | # 42 | # The location of the hostKey file defines where the private/public key of the server 43 | # is located. If no file is at the defined location it will be ignored. 44 | # 45 | hostKey = ${karaf.etc}/host.key 46 | 47 | # 48 | # The format used for hostKey. 49 | # Possible values are simple (Karaf internal), or PEM (OpenSSH format) 50 | # 51 | hostKeyFormat = simple 52 | 53 | # 54 | # Role name used for SSH access authorization 55 | # If not set, this defaults to the ${karaf.admin.role} configured in etc/system.properties 56 | # 57 | # sshRole = admin 58 | 59 | # 60 | # Self defined key size in 1024, 2048, 3072, or 4096 61 | # If not set, this defaults to 4096. 62 | # 63 | # keySize = 4096 64 | 65 | # 66 | # Specify host key algorithm, defaults to RSA 67 | # 68 | # algorithm = RSA 69 | 70 | # 71 | # Specify the client log level (default is WARN) 72 | # 0: ERROR 73 | # 1: WARN 74 | # 2: INFO 75 | # 3: DEBUG 76 | # 4: TRACE 77 | # 78 | #logLevel=1 79 | 80 | # 81 | # Specify an additional welcome banner to be displayed when a user logs into the server. 82 | # 83 | # welcomeBanner = 84 | 85 | # 86 | # Defines the completion mode on the Karaf shell console. The possible values are: 87 | # - GLOBAL: it's the same behavior as in previous Karaf releases. The completion displays all commands and all aliases 88 | # ignoring if you are in a subshell or not. 89 | # - FIRST: the completion displays all commands and all aliases only when you are not in a subshell. When you are 90 | # in a subshell, the completion displays only the commands local to the subshell. 91 | # - SUBSHELL: the completion displays only the subshells on the root level. When you are in a subshell, the completion 92 | # displays only the commands local to the subshell. 93 | # This property define the default value when you use the Karaf shell console. 94 | # You can change the completion mode directly in the shell console, using shell:completion command. 95 | # 96 | completionMode = GLOBAL 97 | -------------------------------------------------------------------------------- /vagrant/src/main/vagrant/Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, 15 | # software distributed under the License is distributed on an 16 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | # KIND, either express or implied. See the License for the 18 | # specific language governing permissions and limitations 19 | # under the License. 20 | # 21 | 22 | # Specify minimum Vagrant version and Vagrant API version 23 | Vagrant.require_version ">= 1.8.1" 24 | VAGRANTFILE_API_VERSION = "2" 25 | 26 | # Update OS (Debian/RedHat based only) 27 | UPDATE_OS_CMD = "(sudo apt-get update && sudo apt-get -y upgrade) || (sudo yum -y update)" 28 | 29 | # Autocorrect Port Clashes 30 | DEFAULT_AUTOCORRECT = false 31 | 32 | # Require YAML module 33 | require 'yaml' 34 | 35 | # Read YAML file with box details 36 | yaml_cfg = YAML.load_file(__dir__ + '/servers.yaml') 37 | 38 | # Create boxes 39 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 40 | 41 | # Iterate through server entries in YAML file 42 | yaml_cfg["servers"].each do |server| 43 | config.vm.define server["name"] do |server_config| 44 | 45 | server_config.vm.box = server["box"] 46 | 47 | server_config.vm.box_check_update = yaml_cfg["default_config"]["check_newer_vagrant_box"] 48 | 49 | if server.has_key?("ip") 50 | server_config.vm.network "private_network", ip: server["ip"] 51 | end 52 | 53 | if server.has_key?("forwarded_ports") 54 | server["forwarded_ports"].each do |port| 55 | if port.has_key?("autocorrect") 56 | autocorrect = true 57 | else 58 | autocorrect = DEFAULT_AUTOCORRECT 59 | end 60 | server_config.vm.network "forwarded_port", guest: port["guest"], host: port["host"], guest_ip: port["guest_ip"], autocorrect: autocorrect 61 | end 62 | end 63 | 64 | server_config.vm.hostname = server["name"] 65 | server_config.vm.provider :virtualbox do |vb| 66 | vb.name = server["name"] 67 | vb.memory = server["ram"] 68 | vb.cpus = server["cpus"] 69 | end 70 | 71 | if yaml_cfg["default_config"]["run_os_update"] 72 | server_config.vm.provision "shell", privileged: false, inline: UPDATE_OS_CMD 73 | end 74 | 75 | if server["shell"] && server["shell"]["cmd"] 76 | server["shell"]["cmd"].each do |cmd| 77 | server_config.vm.provision "shell", privileged: false, inline: cmd, env: server["shell"]["env"] 78 | end 79 | end 80 | 81 | server_config.vm.post_up_message = server["post_up_message"] 82 | end 83 | end 84 | end 85 | 86 | # ALTERING PORT FORWARDING 87 | # If you are reading this you have likely been instructed by Vagrant to alter the example 88 | # line below due to the forwarded port colliding with one alread in use on your system. 89 | # 90 | # config.vm.network :forwarded_port, guest: 80, host: 1234 91 | # 92 | # This Vagrantfile does not define the port mapping here, instead you should alter 93 | # the following line in the `servers.yaml` file in this directory. 94 | # 95 | # host: 8081 96 | # 97 | # Change 8081 to a port that is not in use on your local machine before attempting 98 | # to run vagrant up again. -------------------------------------------------------------------------------- /karaf/features/src/main/resources/resources/etc/org.apache.brooklyn.osgilauncher.cfg: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one or more 4 | # contributor license agreements. See the NOTICE file distributed with 5 | # this work for additional information regarding copyright ownership. 6 | # The ASF licenses this file to You under the Apache License, Version 2.0 7 | # (the "License"); you may not use this file except in compliance with 8 | # the License. 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, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | ################################################################################ 19 | 20 | # This file contains boot settings for brooklyn karaf launcher 21 | 22 | # Location of the global brooklyn.properties file 23 | #globalBrooklynPropertiesFile=~/.brooklyn/brooklyn.properties 24 | 25 | # Location of the default catalog.bom 26 | default.catalog.location=${karaf.etc}/default.catalog.bom 27 | 28 | # Location of the local brooklyn.properties file, normally specified at the cli. Overrides properties from the global set. 29 | #localBrooklynPropertiesFile= 30 | 31 | # Ignore catalog subsystem failures during startup (default is to continue, so errors can be viewed via the API) 32 | #ignoreCatalogErrors=true 33 | 34 | # Ignore persistence/HA subsystem failures during startup (default is to continue, so errors can be viewed via the API) 35 | #ignorePersistenceErrors=true 36 | 37 | # The high availability mode. Possible values are: 38 | # - AUTO: (default) will look for other management nodes, and will allocate itself as standby or master based on other nodes' states, 39 | # using HOT_STANDBY as the preferred standby unless the `defaultStandbyIsHot` experimental feature is set false; 40 | # - MASTER: will startup as master - if there is already a master then fails immediately; 41 | # - DISABLED: management node works in isolation - will not cooperate with any other standby/master nodes in management plane, 42 | # will assume no other nodes are using the same persisted state, and may break persistence if other nodes are; 43 | # - STANDBY: will start up as lukewarm standby with no state - if there is not already a master then fails immediately, 44 | # and if there is a master which subsequently fails, this node can promote itself; 45 | # - HOT_STANDBY: will start up as hot standby in read-only mode - if there is not already a master then fails immediately, 46 | # and if there is a master which subsequently fails, this node can promote itself; 47 | # - HOT_BACKUP: will start up as hot backup in read-only mode - no master is required, and this node will not become a master 48 | #highAvailabilityMode=AUTO 49 | 50 | # The persistence mode. Possible values are: 51 | # - AUTO: (default) will rebind to any existing state, or start up fresh if no state; 52 | # - DISABLED: will not read or persist any state; 53 | # - REBIND: will rebind to the existing state, or fail if no state available; 54 | # - CLEAN: will start up fresh (removing any existing state) 55 | #persistMode=AUTO 56 | 57 | # The directory to read/write persisted state (or container name if using an object store) 58 | persistenceDir=${brooklyn.persistence.dir} 59 | 60 | # The location spec for an object store to read/write persisted state 61 | #persistenceLocation= 62 | 63 | # Periodic read-only rebind 64 | #persistPeriod=1s 65 | -------------------------------------------------------------------------------- /karaf/itest/src/test/java/org/apache/brooklyn/rest/BrooklynRestApiLauncherTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. 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 | package org.apache.brooklyn.rest; 20 | 21 | import static org.apache.brooklyn.KarafTestUtils.defaultOptionsWith; 22 | import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut; 23 | import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features; 24 | 25 | import java.util.concurrent.Callable; 26 | 27 | import org.apache.brooklyn.KarafTestUtils; 28 | import org.apache.brooklyn.entity.brooklynnode.BrooklynNode; 29 | import org.apache.brooklyn.test.Asserts; 30 | import org.apache.brooklyn.util.http.HttpAsserts; 31 | import org.apache.brooklyn.util.http.HttpTool; 32 | import org.apache.http.HttpStatus; 33 | import org.junit.Ignore; 34 | import org.junit.Test; 35 | import org.junit.runner.RunWith; 36 | import org.ops4j.pax.exam.Configuration; 37 | import org.ops4j.pax.exam.Option; 38 | import org.ops4j.pax.exam.junit.PaxExam; 39 | import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; 40 | import org.ops4j.pax.exam.spi.reactors.PerClass; 41 | 42 | @RunWith(PaxExam.class) 43 | @ExamReactorStrategy(PerClass.class) 44 | @Ignore // TODO: re-enable after brooklyn is properly initialized within the OSGI environment 45 | public class BrooklynRestApiLauncherTest { 46 | 47 | private static final String HTTP_PORT = "9998"; 48 | private static final String ROOT_URL = "http://localhost:" + HTTP_PORT; 49 | 50 | @Configuration 51 | public static Option[] configuration() throws Exception { 52 | return defaultOptionsWith( 53 | editConfigurationFilePut("etc/org.ops4j.pax.web.cfg", "org.osgi.service.http.port", HTTP_PORT), 54 | features(KarafTestUtils.brooklynFeaturesRepository(), "brooklyn-software-base") 55 | // Uncomment this for remote debugging the tests on port 5005 56 | // ,KarafDistributionOption.debugConfiguration() 57 | ); 58 | } 59 | 60 | @Test 61 | public void testStart() throws Exception { 62 | ensureBrooklynStarted(); 63 | 64 | final String testUrl = ROOT_URL + "/v1/catalog/entities"; 65 | int code = Asserts.succeedsEventually(new Callable() { 66 | @Override 67 | public Integer call() throws Exception { 68 | int code = HttpTool.getHttpStatusCode(testUrl); 69 | if (code == HttpStatus.SC_FORBIDDEN) { 70 | throw new RuntimeException("Retry request"); 71 | } else { 72 | return code; 73 | } 74 | } 75 | }); 76 | HttpAsserts.assertHealthyStatusCode(code); 77 | HttpAsserts.assertContentContainsText(testUrl, BrooklynNode.class.getSimpleName()); 78 | } 79 | 80 | private void ensureBrooklynStarted() { 81 | final String upUrl = ROOT_URL + "/v1/server/up"; 82 | HttpAsserts.assertContentEventuallyMatches(upUrl, "true"); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /scripts/am: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. 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 | # Always use on a separate merge-only repo! 20 | 21 | # Best used with a wrapper script in your PATH 22 | # #!/bin/bash 23 | # export USERNAME= 24 | # export PERSONAL_TOKEN= 25 | # /scripts/am $@ 26 | 27 | set -e 28 | 29 | PR=$1 30 | BRANCH=${2:-master} 31 | : ${PR_REMOTE:=upstream} 32 | : ${APACHE_REMOTE:=apache} 33 | : ${CLOSES_MESSAGE:="Closes #"} 34 | 35 | # Includes a fallback for git versions earlier than 2.7.0 36 | REMOTE_URL=$(git remote get-url ${APACHE_REMOTE} || git remote show apache | grep "Push URL"); 37 | MODULE=${REMOTE_URL##*/} 38 | 39 | if [ -z "$PR" ]; then 40 | echo "Usage: am [ branch-name ]" 41 | echo "Supply branch-name if you are merging onto a branch that is not master" 42 | exit 1 43 | fi 44 | 45 | if ! git branch | grep -q "* ${BRANCH}"; then 46 | echo "Must be on ${BRANCH} branch" 47 | exit 1 48 | fi 49 | 50 | if [ -z "$USERNAME" ] || [ -z "$PERSONAL_TOKEN" ]; then 51 | echo "Anonymous requests to Github are subject to rate limiting - 60 unauthenticated requests per hour per ip (https://developer.github.com/v3/#rate-limiting)" 52 | echo "Pass USERNAME and PERSONAL_TOKEN environment variables to authenticate. PERSONAL_TOKEN can be created at https://github.com/settings/tokens" 53 | fi 54 | 55 | function get_pr_message { 56 | local TMP_JSON=${TMPDIR:-/tmp}/pr-${PR}.$$.json 57 | local URL=https://api.github.com/repos/apache/${MODULE}/pulls/$PR 58 | if [ -n "$USERNAME" ] && [ -n "$PERSONAL_TOKEN" ]; then 59 | AUTH="-u ${USERNAME}:${PERSONAL_TOKEN}" 60 | fi 61 | curl ${AUTH} --fail -sH "Accept: application/vnd.github.v3+json" -o ${TMP_JSON} ${URL} 62 | 63 | if [ $? -ne 0 ]; then 64 | echo "Couldn't fetch PR ${PR} details from ${URL}" >&2 65 | cat ${TMP_JSON} >&2 66 | exit 1 67 | fi 68 | 69 | cat ${TMP_JSON} | 70 | PYTHONIOENCODING=utf-8 python -c 'import json,sys; resp=json.load(sys.stdin); print resp["title"];print "";print resp["body"]' 71 | 72 | rm -f ${TMP_JSON} 73 | } 74 | 75 | PR_MESSAGE=$(get_pr_message) 76 | 77 | if [ -z "$MESSAGE" ]; then 78 | MESSAGE="${CLOSES_MESSAGE//#/#${PR}} 79 | 80 | ${PR_MESSAGE}" 81 | fi 82 | 83 | # Fetch fresh PR references 84 | git fetch ${PR_REMOTE} 85 | git fetch ${APACHE_REMOTE} 86 | # Makes sure we are on the latest upstream/${BRANCH} 87 | # TODO Warn or fail if there are extra local commits? Could be committed by mistake or just a previous PR merge. 88 | git merge ${APACHE_REMOTE}/${BRANCH} --ff-only 89 | 90 | echo 91 | echo "Merge commit message" 92 | echo "==================================" 93 | echo "$MESSAGE" 94 | echo "==================================" 95 | echo 96 | 97 | # Do the merge 98 | git merge --no-ff -m "${MESSAGE}" ${PR_REMOTE}/pr/${PR} 99 | 100 | echo "Type 'git push ${APACHE_REMOTE} ${BRANCH}' to complete the merge." 101 | -------------------------------------------------------------------------------- /docker-itest/Dockerfile: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. 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 | FROM maven:3.5.2-jdk-8 20 | 21 | # For Alpine: 22 | # FROM maven:3.3.9-jdk-8-alpine 23 | # RUN apk add --update --no-cache bash netcat-openbsd sudo wget openssh 24 | # RUN ssh-keygen -A 25 | # This is missing knife - adding it would grow the image size considerably 26 | # making it on par with the full debian image. Also some tests fail 27 | # because of differences in the accepted arguments of the busybox provided tools. 28 | 29 | # Install the non-headless JRE as some tests requires them 30 | RUN apt-get update && apt-get install -y openjdk-8-jre 31 | 32 | # Install necessary binaries to build brooklyn 33 | RUN apt-get update && \ 34 | DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \ 35 | git-core \ 36 | procps \ 37 | golang-go \ 38 | rpm \ 39 | dpkg \ 40 | libpng-dev \ 41 | make \ 42 | automake \ 43 | autoconf \ 44 | libtool \ 45 | dpkg \ 46 | pkg-config \ 47 | nasm \ 48 | gcc \ 49 | net-tools \ 50 | ssh \ 51 | sudo \ 52 | wget \ 53 | chef && \ 54 | rm -rf /var/lib/apt/lists/* 55 | 56 | # Prepare container for IT tests 57 | RUN mkdir /etc/skel/.m2 && \ 58 | echo "" > /etc/skel/.m2/settings.xml && \ 59 | echo " /var/maven" >> /etc/skel/.m2/settings.xml && \ 60 | echo "" >> /etc/skel/.m2/settings.xml && \ 61 | : The following are integration tests requirements && \ 62 | echo "127.0.0.1 localhost1 localhost2 localhost3 localhost4" >> /etc/hosts && \ 63 | mkdir /etc/skel/.brooklyn && \ 64 | cd /etc/skel/.brooklyn && \ 65 | wget -q http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz && \ 66 | gunzip GeoLite2-City.mmdb.gz && \ 67 | echo "brooklyn.location.named.localhost-passphrase=localhost" >> brooklyn.properties && \ 68 | echo "brooklyn.location.named.localhost-passphrase.privateKeyFile=~/.ssh/id_rsa_with_passphrase" >> brooklyn.properties && \ 69 | echo "brooklyn.location.named.localhost-passphrase.privateKeyPassphrase=mypassphrase" >> brooklyn.properties && \ 70 | chmod 600 brooklyn.properties 71 | 72 | # Add the brooklyn user at runtime so that we can set its USER_ID same as the user that's calling "docker run" 73 | # We need them the same so that the mounted /build volume is accessible from inside the container. 74 | COPY entrypoint.sh /usr/local/bin/entrypoint.sh 75 | 76 | # Make sure the /.config && /.npm (for UI module builds) is writable for all users 77 | RUN mkdir -p /.config && chmod -R 777 /.config 78 | RUN mkdir -p /.npm && chmod -R 777 /.npm 79 | 80 | # Make sure the /var/tmp (for RPM build) is writable for all users 81 | RUN mkdir -p /var/tmp/ && chmod -R 777 /var/tmp/ 82 | 83 | # Make sure the /var/maven is writable for all users 84 | RUN mkdir -p /var/maven/.m2/ && chmod -R 777 /var/maven/ 85 | ENV MAVEN_CONFIG=/var/maven/.m2 86 | 87 | VOLUME /usr/build 88 | VOLUME /var/maven 89 | 90 | ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] 91 | CMD ["mvn -B clean test -PIntegration"] 92 | -------------------------------------------------------------------------------- /karaf/itest/src/test/java/org/apache/brooklyn/KarafTestUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. 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 | package org.apache.brooklyn; 20 | 21 | import static org.ops4j.pax.exam.CoreOptions.junitBundles; 22 | import static org.ops4j.pax.exam.CoreOptions.maven; 23 | import static org.ops4j.pax.exam.MavenUtils.asInProject; 24 | import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureConsole; 25 | import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut; 26 | import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features; 27 | import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration; 28 | import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel; 29 | 30 | import java.io.File; 31 | 32 | import org.apache.brooklyn.util.text.Identifiers; 33 | import org.ops4j.pax.exam.Option; 34 | import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel; 35 | import org.ops4j.pax.exam.options.MavenArtifactUrlReference; 36 | import org.ops4j.pax.exam.options.MavenUrlReference; 37 | 38 | import com.google.common.collect.ObjectArrays; 39 | 40 | public class KarafTestUtils { 41 | public static final Option[] DEFAULT_OPTIONS = { 42 | karafDistributionConfiguration() 43 | .frameworkUrl(brooklynKarafDist()) 44 | .unpackDirectory(new File("target/paxexam/unpack/")) 45 | .useDeployFolder(false), 46 | configureConsole().ignoreLocalConsole(), 47 | logLevel(LogLevel.INFO), 48 | features(karafStandardFeaturesRepository(), "eventadmin"), 49 | junitBundles(), 50 | editConfigurationFilePut("etc/org.apache.brooklyn.osgilauncher.cfg", "persistMode", "AUTO"), 51 | editConfigurationFilePut("etc/org.apache.brooklyn.osgilauncher.cfg", "persistenceDir", new File("target/paxexam/persistence/" + Identifiers.makeRandomId(6) + "/").getAbsolutePath()), 52 | }; 53 | 54 | public static MavenUrlReference karafStandardFeaturesRepository() { 55 | return maven() 56 | .groupId("org.apache.karaf.features") 57 | .artifactId("standard") 58 | .type("xml") 59 | .classifier("features") 60 | .version(asInProject()); 61 | } 62 | 63 | 64 | public static MavenArtifactUrlReference brooklynKarafDist() { 65 | return maven() 66 | .groupId("org.apache.brooklyn") 67 | .artifactId("apache-brooklyn") 68 | .type("zip") 69 | .version(asInProject()); 70 | } 71 | 72 | public static Option[] defaultOptionsWith(Option... options) { 73 | return ObjectArrays.concat(DEFAULT_OPTIONS, options, Option.class); 74 | } 75 | 76 | public static MavenUrlReference brooklynFeaturesRepository() { 77 | return maven() 78 | .groupId("org.apache.brooklyn") 79 | .artifactId("brooklyn-features") 80 | .type("xml") 81 | .classifier("features") 82 | .versionAsInProject(); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /karaf/features/src/main/filtered-resources/resources/catalog/catalog-brooklyn-software-base.bom: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. 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 | brooklyn.catalog: 19 | version: "1.2.0-SNAPSHOT" # BROOKLYN_VERSION 20 | itemType: entity 21 | items: 22 | - id: org.apache.brooklyn.entity.machine.MachineEntity 23 | item: 24 | type: org.apache.brooklyn.entity.machine.MachineEntity 25 | name: Machine Entity 26 | description: Represents a machine, providing metrics about it (e.g. obtained from ssh) 27 | - id: org.apache.brooklyn.entity.software.base.SameServerEntity 28 | item: 29 | type: org.apache.brooklyn.entity.software.base.SameServerEntity 30 | name: Same Server Entity 31 | description: | 32 | An entity that, on start, will obtain a machine and pass that to each of its children 33 | by calling their start effectors. 34 | - id: org.apache.brooklyn.entity.brooklynnode.BrooklynEntityMirror 35 | item: 36 | type: org.apache.brooklyn.entity.brooklynnode.BrooklynEntityMirror 37 | name: Brooklyn Entity Mirror 38 | description: | 39 | Provides an entity which can sit in one brooklyn 40 | domain and reflect the status of an entity via the REST API of another domain. 41 | - id: org.apache.brooklyn.entity.software.base.EmptySoftwareProcess 42 | item: 43 | type: org.apache.brooklyn.entity.software.base.EmptySoftwareProcess 44 | name: Empty Software Process 45 | - id: org.apache.brooklyn.entity.software.base.EmptyWindowsProcess 46 | item: 47 | type: org.apache.brooklyn.entity.software.base.EmptyWindowsProcess 48 | name: Empty Windows Process 49 | - id: org.apache.brooklyn.entity.software.base.VanillaWindowsProcess 50 | item: 51 | type: org.apache.brooklyn.entity.software.base.VanillaWindowsProcess 52 | name: Vanilla Windows Process 53 | description: A basic Windows entity configured with scripts, e.g. for launch, check-running and stop 54 | - id: org.apache.brooklyn.entity.software.base.WorkflowSoftwareProcess 55 | item: 56 | type: org.apache.brooklyn.entity.software.base.WorkflowSoftwareProcess 57 | name: Workflow Software Process 58 | description: A base entity for SSH-based machines expecting workflow to define how to start and stop 59 | - id: org.apache.brooklyn.entity.java.VanillaJavaApp 60 | item: 61 | type: org.apache.brooklyn.entity.java.VanillaJavaApp 62 | name: Vanilla Java App 63 | - id: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess 64 | item: 65 | type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess 66 | name: Vanilla Software Process 67 | description: A software process configured with scripts, e.g. for launch, check-running and stop 68 | - id: org.apache.brooklyn.entity.machine.pool.ServerPool 69 | item: 70 | type: org.apache.brooklyn.entity.machine.pool.ServerPool 71 | name: Server Pool 72 | description: Creates a pre-allocated server pool, which other applications can deploy to 73 | 74 | -------------------------------------------------------------------------------- /vagrant/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 4.0.0 22 | pom 23 | 24 | brooklyn-vagrant 25 | 26 | Brooklyn Vagrant Getting Started Environment 27 | 28 | Brooklyn Getting Started Vagrant environment archive, includes all required 29 | files to start Brooklyn and sample BYON nodes for use. 30 | 31 | 32 | 33 | org.apache.brooklyn 34 | brooklyn-dist-root 35 | 1.2.0-SNAPSHOT 36 | ../pom.xml 37 | 38 | 39 | 40 | 41 | 42 | maven-assembly-plugin 43 | 44 | 45 | build-distribution-archive 46 | package 47 | 48 | single 49 | 50 | 51 | true 52 | 53 | src/main/config/build-distribution.xml 54 | 55 | 60 | 61 | tar.gz 62 | zip 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | org.apache.rat 73 | apache-rat-plugin 74 | 75 | 76 | src/main/vagrant/README.md 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /karaf/features/src/main/resources/resources/bin/generate-password.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | ################################################################################ 4 | # 5 | # Licensed to the Apache Software Foundation (ASF) under one or more 6 | # contributor license agreements. See the NOTICE file distributed with 7 | # this work for additional information regarding copyright ownership. 8 | # The ASF licenses this file to You under the Apache License, Version 2.0 9 | # (the "License"); you may not use this file except in compliance with 10 | # the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | ################################################################################ 21 | 22 | 23 | usage() { 24 | echo "Usage: $0 -u [--salt ]" 1>&2 25 | exit 1 26 | } 27 | 28 | generateSalt() { 29 | # For explanation of LC_TYPE, see 30 | # https://unix.stackexchange.com/questions/45404/why-cant-tr-read-from-dev-urandom-on-osx 31 | echo "$(LC_CTYPE=C tr -dc "A-Za-z0-9" < /dev/urandom | head -c 4)" 32 | } 33 | 34 | checkCanGenerateHash() { 35 | if ! ( type sha256sum >/dev/null 2>&1 || type shasum >/dev/null 2>&1 ); then 36 | echo "No sha256sum or shasum tool available." 1>&2 37 | echo "Please install one of these tools, and retry." 1>&2 38 | exit 1 39 | fi 40 | } 41 | 42 | generateHash() { 43 | local __input=${1} 44 | if type sha256sum >/dev/null 2>&1; then 45 | echo "$(echo -n "${__input}" | sha256sum | awk '{print $1}')" 46 | elif type shasum >/dev/null 2>&1; then 47 | echo "$(echo -n "${__input}" | shasum -a 256 | awk '{print $1}')" 48 | else 49 | # Should have been detected earlier with checkCanGenerateHash 50 | echo "No sha256sum or shasum tool available." 1>&2 51 | echo "Please install one of these tools, and retry." 1>&2 52 | exit 1 53 | fi 54 | } 55 | 56 | checkCanGenerateHash 57 | 58 | while getopts ":u:-:" optchar; do 59 | case "${optchar}" in 60 | -) 61 | case "${OPTARG}" in 62 | user) 63 | user="${!OPTIND}"; OPTIND=$(( $OPTIND + 1 )) 64 | ;; 65 | salt) 66 | salt="${!OPTIND}"; OPTIND=$(( $OPTIND + 1 )) 67 | if [ -z "${salt}" ]; then 68 | usage 69 | fi 70 | ;; 71 | *) 72 | usage 73 | ;; 74 | esac 75 | ;; 76 | u) 77 | user=${OPTARG} 78 | ;; 79 | *) 80 | usage 81 | ;; 82 | esac 83 | done 84 | shift $((OPTIND-1)) 85 | 86 | if [ -z "${user}" ]; then 87 | usage 88 | fi 89 | 90 | if [ -z "${salt}" ]; then 91 | salt=$(generateSalt) 92 | fi 93 | 94 | echo -n Password: 95 | read -s password 96 | echo 97 | echo -n Re-enter password: 98 | read -s password2 99 | echo 100 | echo 101 | 102 | if [ "${password}" != "${password2}" ]; then 103 | echo "Passwords do not match" 1>&2 104 | exit 1 105 | fi 106 | 107 | if [ -z "${password}" ]; then 108 | echo "Password must not be blank" 1>&2 109 | exit 1 110 | fi 111 | 112 | hash=$(generateHash "${salt}${password}") 113 | 114 | echo "Please add the following to your etc/brooklyn.cfg:" 115 | echo 116 | echo brooklyn.webconsole.security.users=${user} 117 | echo brooklyn.webconsole.security.user.${user}.salt=${salt} 118 | echo brooklyn.webconsole.security.user.${user}.sha256=${hash} 119 | 120 | -------------------------------------------------------------------------------- /dist/src/main/config/build-distribution.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 23 | dist 24 | 25 | 26 | 27 | ${project.basedir}/src/main/license/files 28 | 29 | 0644 30 | 0755 31 | 32 | 33 | ${project.basedir}/src/main/dist/bin 34 | bin 35 | 0755 36 | 0755 37 | 38 | 39 | 40 | ${project.basedir}/src/main/dist 41 | lib/dropins 42 | 0755 43 | 44 | **/* 45 | 46 | 47 | 48 | 49 | ${project.basedir}/src/main/dist 50 | lib/patch 51 | 0755 52 | 53 | **/* 54 | 55 | 56 | 57 | ${project.basedir}/src/main/dist 58 | 59 | 0644 60 | 0755 61 | 62 | bin/* 63 | 64 | 65 | 66 | 67 | ${project.build.directory}/brooklyn-client-cli-unpacked/brooklyn-client-cli-${project.version} 68 | bin/brooklyn-client-cli 69 | 70 | 71 | 72 | 73 | 74 | 75 | false 76 | lib/brooklyn 77 | 0644 78 | 0755 79 | ${artifact.groupId}-${artifact.artifactId}-${artifact.version}${dashClassifier?}.${artifact.extension} 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /karaf/features/src/main/resources/resources/bin/setenv: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one or more 4 | # contributor license agreements. See the NOTICE file distributed with 5 | # this work for additional information regarding copyright ownership. 6 | # The ASF licenses this file to You under the Apache License, Version 2.0 7 | # (the "License"); you may not use this file except in compliance with 8 | # the License. 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, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | # use default memory settings, if not specified 20 | if [ -z "${JAVA_MAX_MEM}" ] ; then 21 | export JAVA_MAX_MEM="2G" 22 | fi 23 | # use the default DNS TTL, if not specified 24 | if [ -z "${DNS_TTL}" ] ; then 25 | export DNS_TTL="60" 26 | fi 27 | 28 | # OS specific support (must be 'true' or 'false'). 29 | cygwin=false; 30 | darwin=false; 31 | aix=false; 32 | os400=false; 33 | case "`uname`" in 34 | CYGWIN*) 35 | cygwin=true 36 | ;; 37 | Darwin*) 38 | darwin=true 39 | ;; 40 | AIX*) 41 | aix=true 42 | ;; 43 | OS400*) 44 | os400=true 45 | ;; 46 | esac 47 | 48 | # abort if java is not installed 49 | if $cygwin ; then 50 | [ -n "$JAVA" ] && JAVA=`cygpath --unix "$JAVA"` 51 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 52 | fi 53 | 54 | if [ "x$JAVA_HOME" = "x" ] && [ "$darwin" = "true" ]; then 55 | JAVA_HOME="$(/usr/libexec/java_home -v 1.8)" 56 | fi 57 | if [ "x$JAVA" = "x" ] && [ -r /etc/gentoo-release ] ; then 58 | JAVA_HOME=`java-config --jre-home` 59 | fi 60 | 61 | if [ "x$JAVA" = "x" ]; then 62 | if [ "x$JAVA_HOME" != "x" ]; then 63 | if [ ! -d "$JAVA_HOME" ]; then 64 | echo "Aborting: JAVA_HOME is not valid: $JAVA_HOME" 65 | exit 1 66 | fi 67 | JAVA="$JAVA_HOME/bin/java" 68 | else 69 | echo "JAVA_HOME not set; results may vary" 70 | JAVA=`type java` 71 | JAVA=`expr "$JAVA" : '.* \(/.*\)$'` 72 | if [ "x$JAVA" = "x" ]; then 73 | echo "Aborting: java command not found" 74 | exit 1 75 | fi 76 | fi 77 | fi 78 | 79 | if [ -z "${BROOKLYN_PERSISTENCE_DIR}" ] ; then 80 | export BROOKLYN_PERSISTENCE_DIR="~/.brooklyn/brooklyn-persisted-state" 81 | fi 82 | 83 | # force resolution of localhost to be loopback 84 | export EXTRA_JAVA_OPTS="-Dbrooklyn.location.localhost.address=127.0.0.1 ${EXTRA_JAVA_OPTS}" 85 | 86 | # Increase garbage collection, see https://issues.apache.org/jira/browse/BROOKLYN-375 87 | export EXTRA_JAVA_OPTS="-XX:SoftRefLRUPolicyMSPerMB=1 ${EXTRA_JAVA_OPTS}" 88 | 89 | # Set the DNS TTL for the JVM 90 | # By default, java does not refresh DNS records, ever. This is due to the default value of networkaddress.cache.ttl set to -1, i.e. cache forever. 91 | # However, networkaddress.cache.ttl is not a system property, but a security property. It cannot be updated through from the JVM. 92 | # But, using the old system property sun.net.inetaddr.ttl has the desirable effect (see: https://stackoverflow.com/a/17219327) 93 | export EXTRA_JAVA_OPTS="-Dsun.net.inetaddr.ttl=${DNS_TTL} ${EXTRA_JAVA_OPTS}" 94 | 95 | # Set the TLS protocol versions 96 | export EXTRA_JAVA_OPTS="-Dhttps.protocols=TLSv1.2,TLSv1.1,TLSv1,SSLv3 ${EXTRA_JAVA_OPTS}" 97 | 98 | # Set the persistence directory 99 | export EXTRA_JAVA_OPTS="-Dbrooklyn.persistence.dir=${BROOKLYN_PERSISTENCE_DIR} ${EXTRA_JAVA_OPTS}" 100 | 101 | # Set the memory available to AMP 102 | export EXTRA_JAVA_OPTS="-Xmx${JAVA_MAX_MEM} ${EXTRA_JAVA_OPTS}" --------------------------------------------------------------------------------