Randy Abernethy | ba30239 | 2014-11-19 18:09:58 -0800 | [diff] [blame] | 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 | # APACHE THRIFT PROVISIONING SCRIPT |
| 22 | ############################################################## |
| 23 | # This script is used to configure the base Centos 6.5 |
| 24 | # Vagrant box for Apache Thrift compiler and lib builds. |
| 25 | # The base box is Centos 6.5 with no additional packages |
| 26 | # except those required to support VirtualBox Guest tools: |
| 27 | # perl, dkms, kernel-devel and the "Development Tools" group. |
| 28 | # The epel repo was also added along with the |
| 29 | # yum-plugin-protectbase package to prefer base repo packages. |
| 30 | # The script below provisions ALL languages. This will take |
| 31 | # time. You can greatly reduce the build time by commenting |
| 32 | # out the LIB provisioning for uneeded language libraries. |
| 33 | # Expect full provisioning to take 30 minutes on a fast |
| 34 | # machine with an excellent Internet connection (and another |
| 35 | # 15 minutes for the build). |
| 36 | # |
| 37 | # Machine accounts: |
| 38 | # - User: vagrant/vagrant |
| 39 | # - Admin: root/vagrant |
| 40 | # Vagrant public ssh key also installed |
| 41 | ############################################################## |
| 42 | |
| 43 | $build_and_test = <<SCRIPT |
| 44 | echo "Provisioning system to compile and test Apache Thrift." |
| 45 | date > /etc/vagrant.provision_begin |
| 46 | |
| 47 | # Apache Thrift compiler dependencies |
| 48 | ##################################### |
| 49 | |
| 50 | #install an updated autoconf |
| 51 | wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz |
| 52 | tar xvf autoconf-2.69.tar.gz |
| 53 | cd autoconf-2.69 |
| 54 | ./configure --prefix=/usr |
| 55 | make |
| 56 | sudo make install |
| 57 | cd .. |
| 58 | |
| 59 | #install an updated automake |
| 60 | wget http://ftp.gnu.org/gnu/automake/automake-1.14.tar.gz |
| 61 | tar xvf automake-1.14.tar.gz |
| 62 | cd automake-1.14 |
| 63 | ./configure --prefix=/usr |
| 64 | make |
| 65 | sudo make install |
| 66 | cd .. |
| 67 | |
| 68 | #install an updated bison |
| 69 | wget http://ftp.gnu.org/gnu/bison/bison-2.5.1.tar.gz |
| 70 | tar xvf bison-2.5.1.tar.gz |
| 71 | cd bison-2.5.1 |
| 72 | ./configure --prefix=/usr |
| 73 | make |
| 74 | sudo make install |
| 75 | cd .. |
| 76 | |
| 77 | # C++98 LIB Dependencies |
| 78 | ##################################### |
| 79 | sudo yum -y install libevent-devel zlib-devel openssl-devel |
| 80 | |
| 81 | #Install an updated Boost library |
| 82 | wget http://sourceforge.net/projects/boost/files/boost/1.55.0/boost_1_55_0.tar.gz |
| 83 | tar xvf boost_1_55_0.tar.gz |
| 84 | cd boost_1_55_0 |
| 85 | ./bootstrap.sh |
| 86 | sudo ./b2 install |
| 87 | |
| 88 | # Java LIB Dependencies |
| 89 | ##################################### |
| 90 | sudo yum install -y ant junit ant-nodeps ant-junit java-1.7.0-openjdk-devel |
| 91 | |
| 92 | # Python LIB Dependencies |
| 93 | ##################################### |
| 94 | sudo yum install -y python-devel python-setuptools python-twisted |
| 95 | |
| 96 | # Ruby LIB Dependencies |
| 97 | ##################################### |
| 98 | sudo yum install -y ruby ruby-devel rubygems |
| 99 | sudo gem install bundler rake |
| 100 | |
| 101 | # Node.js LIB Dependencies |
| 102 | ##################################### |
| 103 | sudo yum install -y nodejs nodejs-devel npm |
| 104 | |
| 105 | # Perl LIB Dependencies |
| 106 | ##################################### |
| 107 | sudo yum install -y perl-Bit-Vector perl-Class-Accessor perl-ExtUtils-MakeMaker perl-Test-Simple |
| 108 | |
| 109 | # PHP LIB Dependencies |
| 110 | ##################################### |
| 111 | sudo yum install -y php php-devel php-pear re2c |
| 112 | |
| 113 | # GLibC LIB Dependencies |
| 114 | ##################################### |
| 115 | sudo yum install -y glib2-devel |
| 116 | |
| 117 | # Erlang LIB Dependencies |
| 118 | ##################################### |
| 119 | sudo yum install -y erlang-kernel erlang-erts erlang-stdlib erlang-eunit erlang-rebar |
| 120 | |
| 121 | # Lua LIB Dependencies |
| 122 | ##################################### |
| 123 | sudo yum install -y lua-devel |
| 124 | |
| 125 | # Go LIB Dependencies |
| 126 | ##################################### |
| 127 | sudo yum install -y golang golang-pkg-linux-amd64 |
| 128 | |
| 129 | # C# LIB Dependencies |
| 130 | ##################################### |
| 131 | sudo yum install -y mono-core mono-devel mono-web-devel mono-extras mingw32-binutils mingw32-runtime mingw32-nsis |
| 132 | |
| 133 | # Haskell LIB Dependencies |
| 134 | ##################################### |
| 135 | wget http://sherkin.justhub.org/el6/RPMS/x86_64/justhub-release-2.0-4.0.el6.x86_64.rpm |
| 136 | sudo rpm -ivh justhub-release-2.0-4.0.el6.x86_64.rpm |
| 137 | sudo yum -y install haskell |
| 138 | sudo cabal update |
| 139 | sudo cabal install cabal-install |
| 140 | |
| 141 | # Build and Test Apache Thrift |
| 142 | ##################################### |
| 143 | date > /etc/vagrant.provision_end |
| 144 | echo "Starting Apache Thrift build..." |
| 145 | cd /thrift |
| 146 | sh bootstrap.sh |
| 147 | |
| 148 | # At the time of this file's creation Ruby, Python, Go and Lua fail |
| 149 | # their unit tests in this environment. To build and test any of these |
| 150 | # libraries uncomment the appropriate --without switches below. |
| 151 | |
| 152 | sh configure --without-ruby --without-go --without-lua --without-python |
| 153 | make |
| 154 | echo "Starting Apache Thrift tests..." |
| 155 | make check |
| 156 | echo "Finished building and testing Apache Thrift." |
| 157 | echo 'Use "make install" to install the compiler and libraries.' |
| 158 | date > /etc/vagrant.make_end |
| 159 | |
| 160 | SCRIPT |
| 161 | |
| 162 | Vagrant.configure("2") do |config| |
| 163 | # Every Vagrant virtual environment requires a box to build off of. |
| 164 | ##### Centos 6.5 minimal system with VirtualBox Guest Additions |
| 165 | ##### Box maintained by ra@apache.org, see README.md for box config |
| 166 | config.vm.box = "RandyAbernethy/thrift-centos-6.5-64" |
| 167 | |
| 168 | # Disable automatic box update checking. If you disable this, then |
| 169 | # boxes will only be checked for updates when the user runs |
| 170 | # `vagrant box outdated`. This is not recommended. |
| 171 | ##### This box will never change |
| 172 | config.vm.box_check_update = false |
| 173 | |
| 174 | # Create a forwarded port mapping which allows access to a specific port |
| 175 | # within the machine from a port on the host machine. In the example below, |
| 176 | # accessing "localhost:8080" will access port 80 on the guest machine. |
| 177 | # config.vm.network "forwarded_port", guest: 80, host: 8080 |
| 178 | |
| 179 | # Create a private network, which allows host-only access to the machine |
| 180 | # using a specific IP. |
| 181 | # config.vm.network "private_network", ip: "192.168.33.10" |
| 182 | |
| 183 | # Create a public network, which generally matched to bridged network. |
| 184 | # Bridged networks make the machine appear as another physical device on |
| 185 | # your network. |
| 186 | # config.vm.network "public_network" |
| 187 | |
| 188 | # If true, then any SSH connections made will enable agent forwarding. |
| 189 | # Default value: false |
| 190 | # config.ssh.forward_agent = true |
| 191 | |
| 192 | # Share an additional folder to the guest VM. The first argument is |
| 193 | # the path on the host to the actual folder. The second argument is |
| 194 | # the path on the guest to mount the folder. And the optional third |
| 195 | # argument is a set of non-required options. |
| 196 | # config.vm.synced_folder "../data", "/vagrant_data" |
| 197 | ##### By convention the thrift source tree is mapped to /thrift |
| 198 | config.vm.synced_folder "../../../", "/thrift" |
| 199 | |
| 200 | # Provider-specific configuration so you can fine-tune various |
| 201 | # backing providers for Vagrant. These expose provider-specific options. |
| 202 | ##### The machine needs 2 CPUs and 2GB RAM for reasonable performance |
| 203 | config.vm.provider "virtualbox" do |vb| |
| 204 | vb.customize ["modifyvm", :id, "--memory", "2048"] |
| 205 | vb.customize ["modifyvm", :id, "--cpus", "2"] |
| 206 | end |
| 207 | |
| 208 | # Enable provisioning with CFEngine. CFEngine Community packages are |
| 209 | # automatically installed. For example, configure the host as a |
| 210 | # policy server and optionally a policy file to run: |
| 211 | # |
| 212 | # config.vm.provision "cfengine" do |cf| |
| 213 | # cf.am_policy_hub = true |
| 214 | # # cf.run_file = "motd.cf" |
| 215 | # end |
| 216 | # |
| 217 | # You can also configure and bootstrap a client to an existing |
| 218 | # policy server: |
| 219 | # |
| 220 | # config.vm.provision "cfengine" do |cf| |
| 221 | # cf.policy_server_address = "10.0.2.15" |
| 222 | # end |
| 223 | |
| 224 | # Enable provisioning with Puppet stand alone. Puppet manifests |
| 225 | # are contained in a directory path relative to this Vagrantfile. |
| 226 | # You will need to create the manifests directory and a manifest in |
| 227 | # the file default.pp in the manifests_path directory. |
| 228 | # |
| 229 | # config.vm.provision "puppet" do |puppet| |
| 230 | # puppet.manifests_path = "manifests" |
| 231 | # puppet.manifest_file = "default.pp" |
| 232 | # end |
| 233 | |
| 234 | # Enable provisioning with chef solo, specifying a cookbooks path, roles |
| 235 | # path, and data_bags path (all relative to this Vagrantfile), and adding |
| 236 | # some recipes and/or roles. |
| 237 | # |
| 238 | # config.vm.provision "chef_solo" do |chef| |
| 239 | # chef.cookbooks_path = "../my-recipes/cookbooks" |
| 240 | # chef.roles_path = "../my-recipes/roles" |
| 241 | # chef.data_bags_path = "../my-recipes/data_bags" |
| 242 | # chef.add_recipe "mysql" |
| 243 | # chef.add_role "web" |
| 244 | # |
| 245 | # # You may also specify custom JSON attributes: |
| 246 | # chef.json = { mysql_password: "foo" } |
| 247 | # end |
| 248 | |
| 249 | # Enable provisioning with chef server, specifying the chef server URL, |
| 250 | # and the path to the validation key (relative to this Vagrantfile). |
| 251 | # |
| 252 | # The Opscode Platform uses HTTPS. Substitute your organization for |
| 253 | # ORGNAME in the URL and validation key. |
| 254 | # |
| 255 | # If you have your own Chef Server, use the appropriate URL, which may be |
| 256 | # HTTP instead of HTTPS depending on your configuration. Also change the |
| 257 | # validation key to validation.pem. |
| 258 | # |
| 259 | # config.vm.provision "chef_client" do |chef| |
| 260 | # chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME" |
| 261 | # chef.validation_key_path = "ORGNAME-validator.pem" |
| 262 | # end |
| 263 | # |
| 264 | # If you're using the Opscode platform, your validator client is |
| 265 | # ORGNAME-validator, replacing ORGNAME with your organization name. |
| 266 | # |
| 267 | # If you have your own Chef Server, the default validation client name is |
| 268 | # chef-validator, unless you changed the configuration. |
| 269 | # |
| 270 | # chef.validation_client_name = "ORGNAME-validator" |
| 271 | |
| 272 | ##### Run the Apache Thrift provisioning script (declared above) |
| 273 | config.vm.provision :shell, :inline => $build_and_test |
| 274 | end |