Skip to content
Permalink
Browse files
This closes #1170
  • Loading branch information
ahgittin committed Jan 30, 2016
2 parents e56536b + 16d1e91 commit 00d99b9a386232ec1c77e7b9e11af7c3cbc53ab7
Showing 17 changed files with 603 additions and 18 deletions.
@@ -28,5 +28,6 @@ prodDb.*
brooklyn*.log.*

*brooklyn-persisted-state/
*.vagrant/

ignored
@@ -76,6 +76,7 @@
<module>downstream-parent</module>
<module>all</module>
<module>dist</module>
<module>vagrant</module>
<module>archetypes/quickstart</module>
</modules>

@@ -18,7 +18,10 @@
# under the License.
#

# creates a source release - this is a .tar.gz file containing all the source code files that are permitted to be released.
# Creates the following releases with archives (.tar.gz/.zip), signatures and checksums:
# binary (-bin) - contains the brooklyn dist binary release
# source (-src) - contains all the source code files that are permitted to be released
# vagrant (-vagrant) - contains a Vagrantfile/scripts to start a Brooklyn getting started environment

set -e

@@ -179,7 +182,7 @@ mkdir -p ${bin_staging_dir}
# * release (where this is running, and people who *have* the release don't need to make it)
# * jars and friends (these are sometimes included for tests, but those are marked as skippable,
# and apache convention does not allow them in source builds; see PR #365
rsync -rtp --exclude .git\* --exclude docs/ --exclude sandbox/ --exclude release/ --exclude '**/*.[ejw]ar' . ${staging_dir}/${release_name}-src
rsync -rtp --exclude .git\* --exclude brooklyn-docs/ --exclude brooklyn-library/sandbox/ --exclude brooklyn-dist/release/ --exclude '**/*.[ejw]ar' . ${staging_dir}/${release_name}-src
rm -rf ${artifact_dir}
mkdir -p ${artifact_dir}
@@ -210,15 +213,28 @@ fi
# Perform the build and deploy to Nexus staging repository
( cd ${src_staging_dir} && mvn deploy -Papache-release )
## To test the script without a big deploy, use the line below instead of above
#( cd ${src_staging_dir} && cd usage/dist && mvn clean install )
#( cd ${src_staging_dir} && mvn clean install )
# Re-pack the archive with the correct names
tar xzf ${src_staging_dir}/usage/dist/target/brooklyn-dist-${current_version}-dist.tar.gz -C ${bin_staging_dir}
tar xzf ${src_staging_dir}/brooklyn-dist/dist/target/brooklyn-dist-${current_version}-dist.tar.gz -C ${bin_staging_dir}
mv ${bin_staging_dir}/brooklyn-dist-${current_version} ${bin_staging_dir}/${release_name}-bin
( cd ${bin_staging_dir} && tar czf ${artifact_dir}/${artifact_name}-bin.tar.gz ${release_name}-bin )
( cd ${bin_staging_dir} && zip -qr ${artifact_dir}/${artifact_name}-bin.zip ${release_name}-bin )
###############################################################################
# Vagrant release
set +x
echo "Proceeding to rename and repackage vagrant environment release"
set -x
# Re-pack the archive with the correct names
tar xzf ${src_staging_dir}/brooklyn-dist/vagrant/target/brooklyn-vagrant-${current_version}-dist.tar.gz -C ${bin_staging_dir}
mv ${bin_staging_dir}/brooklyn-vagrant-${current_version} ${bin_staging_dir}/${release_name}-vagrant
( cd ${bin_staging_dir} && tar czf ${artifact_dir}/${artifact_name}-vagrant.tar.gz ${release_name}-vagrant )
( cd ${bin_staging_dir} && zip -qr ${artifact_dir}/${artifact_name}-vagrant.zip ${release_name}-vagrant )
###############################################################################
# Signatures and checksums
@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>

<artifactId>brooklyn-vagrant</artifactId>

<name>Brooklyn Vagrant Getting Started Environment</name>
<description>
Brooklyn Getting Started Vagrant environment archive, includes all required
files to start Brooklyn and sample BYON nodes for use.
</description>

<parent>
<groupId>org.apache.brooklyn</groupId>
<artifactId>brooklyn-dist-root</artifactId>
<version>0.9.0-SNAPSHOT</version> <!-- BROOKLYN_VERSION -->
<relativePath>../pom.xml</relativePath>
</parent>

<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>build-distribution-archive</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<appendAssemblyId>true</appendAssemblyId>
<descriptors>
<descriptor>src/main/config/build-distribution.xml</descriptor>
</descriptors>
<!-- finalName affects name in `target/` but we cannot influence name when it is attached/installed,
so `apache-` prefix would be lost there. to keep it consistent this is commented out,
but would be nice to have if there is a way!
<finalName>apache-brooklyn-${project.version}</finalName>
-->
<formats>
<format>tar.gz</format>
<format>zip</format>
</formats>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
<configuration>
<excludes combine.children="append">
<exclude>src/main/vagrant/README.md</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>dist</id>
<formats><!-- empty, intended for caller to specify --></formats>
<fileSets>
<fileSet>
<directory>${project.basedir}/src/main/vagrant</directory>
<outputDirectory></outputDirectory>
<fileMode>0644</fileMode>
<directoryMode>0755</directoryMode>
</fileSet>
</fileSets>
</assembly>
@@ -0,0 +1,41 @@

# [![**Brooklyn**](https://brooklyn.apache.org/style/img/apache-brooklyn-logo-244px-wide.png)](http://brooklyn.apache.org/)

### Using Vagrant with Brooklyn -SNAPSHOT builds

##### Install a community-managed version from Maven
1. No action is required other than setting the `BROOKLYN_VERSION:` environment variable in `servers.yaml` to a `-SNAPSHOT` version. For example:

```
env:
BROOKLYN_VERSION: 0.9.0-SNAPSHOT
```

2. You may proceed to use the `Vagrantfile` as normal; `vagrant up`, `vagrant destroy` etc.

##### Install a locally built `-dist.tar.gz`

1. Set the `BROOKLYN_VERSION:` environment variable in `servers.yaml` to your current `-SNAPSHOT` version. For example:

```
env:
BROOKLYN_VERSION: 0.9.0-SNAPSHOT
```

2. Set the `INSTALL_FROM_LOCAL_DIST:` environment variable in `servers.yaml` to `true`. For example:

```
env:
INSTALL_FROM_LOCAL_DIST: true
```


3. Copy your locally built `-dist.tar.gz` archive to the same directory as the Vagrantfile (this directory is mounted in the Vagrant VM at `/vagrant/`).

For example to copy a locally built `0.9.0-SNAPSHOT` dist:

```
cp ~/.m2/repository/org/apache/brooklyn/brooklyn-dist/0.9.0-SNAPSHOT/brooklyn-dist-0.9.0-SNAPSHOT-dist.tar.gz .
```

4. You may proceed to use the `Vagrantfile` as normal; `vagrant up`, `vagrant destroy` etc.
@@ -0,0 +1,76 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

# Specify minimum Vagrant version and Vagrant API version
Vagrant.require_version ">= 1.8.1"
VAGRANTFILE_API_VERSION = "2"

# Update OS (Debian/RedHat based only)
UPDATE_OS_CMD = "(sudo apt-get update && sudo apt-get -y upgrade) || (sudo yum -y update)"

# Require YAML module
require 'yaml'

# Read YAML file with box details
yaml_cfg = YAML.load_file(__dir__ + '/servers.yaml')

# Create boxes
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

# Iterate through server entries in YAML file
yaml_cfg["servers"].each do |server|
config.vm.define server["name"] do |server_config|

server_config.vm.box = server["box"]

server_config.vm.box_check_update = yaml_cfg["default_config"]["check_newer_vagrant_box"]

if server.has_key?("ip")
server_config.vm.network "private_network", ip: server["ip"]
end

if server.has_key?("forwarded_ports")
server["forwarded_ports"].each do |ports|
server_config.vm.network "forwarded_port", guest: ports["guest"], host: ports["host"], guest_ip: ports["guest_ip"]
end
end

server_config.vm.hostname = server["name"]
server_config.vm.provider :virtualbox do |vb|
vb.name = server["name"]
vb.memory = server["ram"]
vb.cpus = server["cpus"]
end

if yaml_cfg["default_config"]["run_os_update"]
server_config.vm.provision "shell", privileged: false, inline: UPDATE_OS_CMD
end

if server["shell"] && server["shell"]["cmd"]
server["shell"]["cmd"].each do |cmd|
server_config.vm.provision "shell", privileged: false, inline: cmd, env: server["shell"]["env"]
end
end

server_config.vm.post_up_message = server["post_up_message"]
end
end
end
@@ -0,0 +1,23 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

# Disabling security on the Vagrant Brooklyn instance for training purposes
brooklyn.webconsole.security.provider = org.apache.brooklyn.rest.security.provider.AnyoneSecurityProvider

# Note: BYON locations are loaded from the files/vagrant-catalog.bom on startup
@@ -0,0 +1,32 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

[Unit]
Description=Apache Brooklyn service
Documentation=http://brooklyn.apache.org/documentation/index.html

[Service]
ExecStart=/home/vagrant/apache-brooklyn/bin/brooklyn launch --persist auto --persistenceDir /vagrant/brooklyn-persisted-state --catalogAdd /vagrant/files/vagrant-catalog.bom
WorkingDirectory=/home/vagrant/apache-brooklyn
Restart=on-abort
User=vagrant
Group=vagrant

[Install]
WantedBy=multi-user.target

0 comments on commit 00d99b9

Please sign in to comment.