| # -*- 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. |
| # |
| |
| # Vagrantfile that creates a basic workstation for compiling Brooklyn and |
| # running tests. Particularly useful for running integration tests, as you |
| # can clean up any failed tests simply by destroying and rebuilding the |
| # Vagrant instance. |
| |
| # All Vagrant configuration is done below. The "2" in Vagrant.configure |
| # configures the configuration version (we support older styles for |
| # backwards compatibility). Please don't change it unless you know what |
| # you're doing. |
| Vagrant.configure(2) do |config| |
| |
| # Base on Ubuntu 14.04 LTS |
| config.vm.box = "ubuntu/trusty64" |
| |
| # Provider-specific configuration so you can fine-tune various |
| # backing providers for Vagrant. These expose provider-specific options. |
| config.vm.provider "virtualbox" do |vb| |
| vb.memory = "6144" |
| vb.cpus = 2 |
| end |
| |
| config.vm.provider :aws do |aws, override| |
| aws.access_key_id = ENV['AWS_ACCESS_KEY_ID'] |
| aws.secret_access_key = ENV['AWS_SECRET_ACCESS_KEY'] |
| aws.keypair_name = "richardcloudsoft" |
| aws.region = "eu-west-1" |
| aws.tags = { |
| 'Name' => 'Release Apache Brooklyn' |
| } |
| aws.instance_type = "m4.xlarge" |
| |
| aws.region_config "eu-west-1" do |region| |
| region.ami = "ami-f95ef58a" |
| region.subnet_id = "subnet-56d3f922" |
| region.associate_public_ip = true |
| region.security_groups = [ 'sg-ac8f86c8' ] |
| end |
| |
| override.ssh.username = "ubuntu" |
| override.ssh.private_key_path = ENV['HOME']+"/.ssh/id_rsa" |
| end |
| |
| config.vm.provision "file", source: "~/.gitconfig", destination: ".gitconfig" |
| config.vm.provision "file", source: "~/.gnupg/gpg.conf", destination: ".gnupg/gpg.conf" |
| config.vm.provision "file", source: "~/.gnupg/pubring.gpg", destination: ".gnupg/pubring.gpg" |
| config.vm.provision "file", source: "~/.gnupg/secring.gpg", destination: ".gnupg/secring.gpg" |
| config.vm.provision "file", source: "gpg-agent.conf", destination: ".gnupg/gpg-agent.conf" |
| config.vm.provision "file", source: "settings.xml", destination: ".m2/settings.xml" |
| |
| # Update the VM, install Java and Maven, enable passwordless-ssh-to-localhost, |
| # clone the canonical repository |
| config.vm.provision "shell", inline: <<-SHELL |
| NORMALUSER=$( getent passwd 1000 | cut -f1 -d: ) |
| add-apt-repository -y ppa:mwhudson/go16-trusty |
| apt-get update |
| apt-get upgrade -y |
| apt-get install -y default-jdk git subversion xmlstarlet zip unzip language-pack-en vim-nox gnupg2 gnupg-agent pinentry-curses golang-1.6 rpm |
| mkdir -p /opt |
| curl http://archive.apache.org/dist/maven/maven-3/3.1.1/binaries/apache-maven-3.1.1-bin.tar.gz | tar xz -C /opt |
| ln -s /opt/apache-maven-3.1.1/bin/mvn /usr/local/bin |
| echo "MAVEN_OPTS=\"-Xmx512m -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M\"" >> /etc/environment |
| mkdir -p /work |
| mount -ttmpfs -osize=3g none /work |
| eval chmod -R go= ~${NORMALUSER}/.gnupg |
| cat /etc/ssh/ssh_host_*_key.pub | awk '{print "localhost,127.0.0.1 "$0}' >> /etc/ssh/ssh_known_hosts |
| su -c 'ssh-keygen -t rsa -b 2048 -N "" -f ~/.ssh/id_rsa; cat ~/.ssh/*.pub >> ~/.ssh/authorized_keys' $NORMALUSER |
| su -c '/vagrant/clone-and-configure-repos.sh' $NORMALUSER |
| SHELL |
| end |