Skip to content
Permalink
Browse files
Update vagrant configuration (centos 7.x) and use the new RPM package…
… to install Brooklyn
  • Loading branch information
tbouron committed Nov 21, 2017
1 parent bfd6f55 commit b0042a22e57363ac67644eee7ddb659e3d46f9bb
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 125 deletions.
@@ -13,7 +13,7 @@

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

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

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

@@ -30,12 +30,12 @@
```


3. Copy your locally built `apache-brooklyn-<version>.tar.gz` archive to the same directory as the Vagrantfile (this directory is mounted in the Vagrant VM at `/vagrant/`).
3. Copy your locally built `apache-brooklyn-<version>.noarch.rpm` 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.12.0-SNAPSHOT` dist:

```
cp ~/.m2/repository/org/apache/brooklyn/apache-brooklyn/0.12.0-SNAPSHOT/apache-brooklyn-0.12.0-SNAPSHOT.tar.gz .
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
```

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

This file was deleted.

This file was deleted.

@@ -21,7 +21,7 @@

BROOKLYN_VERSION=""
INSTALL_FROM_LOCAL_DIST="false"
TMP_ARCHIVE_NAME=apache-brooklyn.tar.gz
TMP_ARCHIVE_NAME=apache-brooklyn.rpm

do_help() {
echo "./install.sh -v <Brooklyn Version> [-l <install from local file: true|false>]"
@@ -48,45 +48,53 @@ fi
if [ ! "${INSTALL_FROM_LOCAL_DIST}" == "true" ]; then
if [ ! -z "${BROOKLYN_VERSION##*-SNAPSHOT}" ] ; then
# url for official release versions
BROOKLYN_URL="https://www.apache.org/dyn/closer.lua?action=download&filename=brooklyn/apache-brooklyn-${BROOKLYN_VERSION}/apache-brooklyn-${BROOKLYN_VERSION}-bin.tar.gz"
BROOKLYN_DIR="apache-brooklyn-${BROOKLYN_VERSION}-bin"
BROOKLYN_URL="https://www.apache.org/dyn/closer.lua?action=download&filename=brooklyn/apache-brooklyn-${BROOKLYN_VERSION}/apache-brooklyn-${BROOKLYN_VERSION}.noarch.rpm"
else
# url for community-managed snapshots
BROOKLYN_URL="https://repository.apache.org/service/local/artifact/maven/redirect?r=snapshots&g=org.apache.brooklyn&a=apache-brooklyn&v=${BROOKLYN_VERSION}&e=tar.gz"
BROOKLYN_DIR="apache-brooklyn-${BROOKLYN_VERSION}"
BROOKLYN_URL="https://repository.apache.org/service/local/artifact/maven/redirect?r=snapshots&g=org.apache.brooklyn&a=rpm-packaging&v=${BROOKLYN_VERSION}&c=noarch&e=rpm"
fi
else
echo "Installing from a local -dist archive [ /vagrant/apache-brooklyn-${BROOKLYN_VERSION}.tar.gz]"
echo "Installing from a local -dist archive [ /vagrant/apache-brooklyn-${BROOKLYN_VERSION}.noarch.rpm]"
# url to install from mounted /vagrant dir
BROOKLYN_URL="file:///vagrant/apache-brooklyn-${BROOKLYN_VERSION}.tar.gz"
BROOKLYN_DIR="apache-brooklyn-${BROOKLYN_VERSION}"
BROOKLYN_URL="file:///vagrant/apache-brooklyn-${BROOKLYN_VERSION}.noarch.rpm"

# ensure local file exists
if [ ! -f /vagrant/apache-brooklyn-${BROOKLYN_VERSION}.tar.gz ]; then
echo "Error: file not found /vagrant/apache-brooklyn-${BROOKLYN_VERSION}.tar.gz"
if [ ! -f /vagrant/apache-brooklyn-${BROOKLYN_VERSION}.noarch.rpm ]; then
echo "Error: file not found /vagrant/apache-brooklyn-${BROOKLYN_VERSION}.noarch.rpm"
exit 1
fi
fi

echo "Installing Apache Brooklyn version ${BROOKLYN_VERSION} from [${BROOKLYN_URL}]"

echo "Downloading Brooklyn release archive"
curl --fail --silent --show-error --location --output ${TMP_ARCHIVE_NAME} "${BROOKLYN_URL}"
echo "Extracting Brooklyn release archive"
tar zxf ${TMP_ARCHIVE_NAME}

echo "Creating Brooklyn dirs and symlinks"
ln -s ${BROOKLYN_DIR} apache-brooklyn
sudo mkdir -p /var/log/brooklyn
sudo chown -R vagrant:vagrant /var/log/brooklyn
mkdir -p /home/vagrant/.brooklyn
echo "Restarting Syslog"
sudo systemctl restart rsyslog

echo "Updating Yum"
sudo yum -y update

echo "Install Java"
sudo yum install -y java-1.8.0-openjdk-headless

echo "Install Apache Brooklyn version ${BROOKLYN_VERSION} from [${BROOKLYN_URL}]"
sudo yum -y install ${TMP_ARCHIVE_NAME}

echo "Copying default vagrant Brooklyn properties file"
cp /vagrant/files/brooklyn.properties /home/vagrant/.brooklyn/
chmod 600 /home/vagrant/.brooklyn/brooklyn.properties
echo "Configure catalog"
sudo cp /vagrant/files/vagrant-catalog.bom /opt/brooklyn/catalog/vagrant-catalog.bom
sudo chown brooklyn:brooklyn /opt/brooklyn/catalog/vagrant-catalog.bom
sudo chmod 740 /opt/brooklyn/catalog/vagrant-catalog.bom
echo ' - file:catalog/vagrant-catalog.bom' | sudo tee -a /etc/brooklyn/default.catalog.bom

echo "Installing JRE"
sudo sh -c 'yum -y install java-1.8.0-openjdk-headless'
echo "Starting Apache Brooklyn..."
sudo systemctl start brooklyn

echo "Waiting for Apache Brooklyn to start..."
sleep 10

while ! (sudo grep "BundleEvent STARTED - org.apache.brooklyn.karaf-init" /var/log/brooklyn/brooklyn.debug.log) > /dev/null ; do
sleep 10
echo ".... waiting for Apache Brooklyn to start at `date`"
done

echo "Copying Brooklyn systemd service unit file"
sudo cp /vagrant/files/brooklyn.service /etc/systemd/system/brooklyn.service
echo "Apache Brooklyn started!"

This file was deleted.

@@ -47,14 +47,12 @@ servers:
autocorrect: true
shell:
env:
BROOKLYN_VERSION: "1.0.0-SNAPSHOT"
BROOKLYN_VERSION: "1.0.0-SNAPSHOT" # BROOKLYN_VERSION
INSTALL_FROM_LOCAL_DIST: false
cmd:
- ssh-keygen -t rsa -N "" -f $HOME/.ssh/id_rsa
- chmod a+x /vagrant/files/install_brooklyn.sh
- /vagrant/files/install_brooklyn.sh -v ${BROOKLYN_VERSION} -l ${INSTALL_FROM_LOCAL_DIST}
- sudo systemctl start brooklyn
- sudo systemctl enable brooklyn
- name: byon1
box: bento/centos-7.3
ram: 512

0 comments on commit b0042a2

Please sign in to comment.