| # -*- 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| |
| |
| config.vm.box = "ubuntu/xenial64" |
| |
| # 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" # part of vpc-d9b5bebb |
| region.associate_public_ip = true |
| region.security_groups = [ 'sg-285d4b4a' ] |
| 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" |
| |
| # Uncomment these lines if you would like to include your local gnupg keys |
| #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 |
| eval $( /vagrant/vagrant-activate-proxy.sh ) |
| NORMALUSER=$( getent passwd 1000 | cut -f1 -d: ) |
| add-apt-repository -y ppa:ubuntu-lxc/lxd-stable |
| 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 rpm mmv haveged |
| mkdir -p /opt |
| MAVEN_VERSION=3.3.3 |
| curl http://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz | tar xz -C /opt |
| ln -s /opt/apache-maven-${MAVEN_VERSION}/bin/mvn /usr/local/bin |
| 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 'git config --global credential.helper cache' $NORMALUSER |
| su -c '/vagrant/clone-and-configure-repos.sh' $NORMALUSER |
| SHELL |
| end |