| 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 | ##################################### | 
| Beluga Behr | 99f673a | 2018-12-30 22:10:00 -0500 | [diff] [blame] | 90 | sudo yum install -y ant junit ant-nodeps ant-junit java-1.8.0-openjdk-devel | 
| Randy Abernethy | ba30239 | 2014-11-19 18:09:58 -0800 | [diff] [blame] | 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 |  | 
| Randy Abernethy | ba30239 | 2014-11-19 18:09:58 -0800 | [diff] [blame] | 133 | # Build and Test Apache Thrift | 
|  | 134 | ##################################### | 
|  | 135 | date > /etc/vagrant.provision_end | 
|  | 136 | echo "Starting Apache Thrift build..." | 
|  | 137 | cd /thrift | 
|  | 138 | sh bootstrap.sh | 
|  | 139 |  | 
|  | 140 | # At the time of this file's creation Ruby, Python, Go and Lua fail | 
|  | 141 | # their unit tests in this environment. To build and test any of these | 
|  | 142 | # libraries uncomment the appropriate --without switches below. | 
|  | 143 |  | 
|  | 144 | sh configure --without-ruby --without-go --without-lua --without-python | 
|  | 145 | make | 
|  | 146 | echo "Starting Apache Thrift tests..." | 
|  | 147 | make check | 
|  | 148 | echo "Finished building and testing Apache Thrift." | 
|  | 149 | echo 'Use "make install" to install the compiler and libraries.' | 
|  | 150 | date > /etc/vagrant.make_end | 
|  | 151 |  | 
|  | 152 | SCRIPT | 
|  | 153 |  | 
|  | 154 | Vagrant.configure("2") do |config| | 
|  | 155 | # Every Vagrant virtual environment requires a box to build off of. | 
|  | 156 | ##### Centos 6.5 minimal system with VirtualBox Guest Additions | 
|  | 157 | ##### Box maintained by ra@apache.org, see README.md for box config | 
|  | 158 | config.vm.box = "RandyAbernethy/thrift-centos-6.5-64" | 
|  | 159 |  | 
|  | 160 | # Disable automatic box update checking. If you disable this, then | 
|  | 161 | # boxes will only be checked for updates when the user runs | 
|  | 162 | # `vagrant box outdated`. This is not recommended. | 
|  | 163 | ##### This box will never change | 
|  | 164 | config.vm.box_check_update = false | 
|  | 165 |  | 
|  | 166 | # Create a forwarded port mapping which allows access to a specific port | 
|  | 167 | # within the machine from a port on the host machine. In the example below, | 
|  | 168 | # accessing "localhost:8080" will access port 80 on the guest machine. | 
|  | 169 | # config.vm.network "forwarded_port", guest: 80, host: 8080 | 
|  | 170 |  | 
|  | 171 | # Create a private network, which allows host-only access to the machine | 
|  | 172 | # using a specific IP. | 
|  | 173 | # config.vm.network "private_network", ip: "192.168.33.10" | 
|  | 174 |  | 
|  | 175 | # Create a public network, which generally matched to bridged network. | 
|  | 176 | # Bridged networks make the machine appear as another physical device on | 
|  | 177 | # your network. | 
|  | 178 | # config.vm.network "public_network" | 
|  | 179 |  | 
|  | 180 | # If true, then any SSH connections made will enable agent forwarding. | 
|  | 181 | # Default value: false | 
|  | 182 | # config.ssh.forward_agent = true | 
|  | 183 |  | 
|  | 184 | # Share an additional folder to the guest VM. The first argument is | 
|  | 185 | # the path on the host to the actual folder. The second argument is | 
|  | 186 | # the path on the guest to mount the folder. And the optional third | 
|  | 187 | # argument is a set of non-required options. | 
|  | 188 | # config.vm.synced_folder "../data", "/vagrant_data" | 
|  | 189 | ##### By convention the thrift source tree is mapped to /thrift | 
|  | 190 | config.vm.synced_folder "../../../", "/thrift" | 
|  | 191 |  | 
|  | 192 | # Provider-specific configuration so you can fine-tune various | 
|  | 193 | # backing providers for Vagrant. These expose provider-specific options. | 
|  | 194 | ##### The machine needs 2 CPUs and 2GB RAM for reasonable performance | 
|  | 195 | config.vm.provider "virtualbox" do |vb| | 
|  | 196 | vb.customize ["modifyvm", :id, "--memory", "2048"] | 
|  | 197 | vb.customize ["modifyvm", :id, "--cpus", "2"] | 
|  | 198 | end | 
|  | 199 |  | 
|  | 200 | # Enable provisioning with CFEngine. CFEngine Community packages are | 
|  | 201 | # automatically installed. For example, configure the host as a | 
|  | 202 | # policy server and optionally a policy file to run: | 
|  | 203 | # | 
|  | 204 | # config.vm.provision "cfengine" do |cf| | 
|  | 205 | #   cf.am_policy_hub = true | 
|  | 206 | #   # cf.run_file = "motd.cf" | 
|  | 207 | # end | 
|  | 208 | # | 
|  | 209 | # You can also configure and bootstrap a client to an existing | 
|  | 210 | # policy server: | 
|  | 211 | # | 
|  | 212 | # config.vm.provision "cfengine" do |cf| | 
|  | 213 | #   cf.policy_server_address = "10.0.2.15" | 
|  | 214 | # end | 
|  | 215 |  | 
|  | 216 | # Enable provisioning with Puppet stand alone.  Puppet manifests | 
|  | 217 | # are contained in a directory path relative to this Vagrantfile. | 
|  | 218 | # You will need to create the manifests directory and a manifest in | 
|  | 219 | # the file default.pp in the manifests_path directory. | 
|  | 220 | # | 
|  | 221 | # config.vm.provision "puppet" do |puppet| | 
|  | 222 | #   puppet.manifests_path = "manifests" | 
|  | 223 | #   puppet.manifest_file  = "default.pp" | 
|  | 224 | # end | 
|  | 225 |  | 
|  | 226 | # Enable provisioning with chef solo, specifying a cookbooks path, roles | 
|  | 227 | # path, and data_bags path (all relative to this Vagrantfile), and adding | 
|  | 228 | # some recipes and/or roles. | 
|  | 229 | # | 
|  | 230 | # config.vm.provision "chef_solo" do |chef| | 
|  | 231 | #   chef.cookbooks_path = "../my-recipes/cookbooks" | 
|  | 232 | #   chef.roles_path = "../my-recipes/roles" | 
|  | 233 | #   chef.data_bags_path = "../my-recipes/data_bags" | 
|  | 234 | #   chef.add_recipe "mysql" | 
|  | 235 | #   chef.add_role "web" | 
|  | 236 | # | 
|  | 237 | #   # You may also specify custom JSON attributes: | 
|  | 238 | #   chef.json = { mysql_password: "foo" } | 
|  | 239 | # end | 
|  | 240 |  | 
|  | 241 | # Enable provisioning with chef server, specifying the chef server URL, | 
|  | 242 | # and the path to the validation key (relative to this Vagrantfile). | 
|  | 243 | # | 
|  | 244 | # The Opscode Platform uses HTTPS. Substitute your organization for | 
|  | 245 | # ORGNAME in the URL and validation key. | 
|  | 246 | # | 
|  | 247 | # If you have your own Chef Server, use the appropriate URL, which may be | 
|  | 248 | # HTTP instead of HTTPS depending on your configuration. Also change the | 
|  | 249 | # validation key to validation.pem. | 
|  | 250 | # | 
|  | 251 | # config.vm.provision "chef_client" do |chef| | 
|  | 252 | #   chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME" | 
|  | 253 | #   chef.validation_key_path = "ORGNAME-validator.pem" | 
|  | 254 | # end | 
|  | 255 | # | 
|  | 256 | # If you're using the Opscode platform, your validator client is | 
|  | 257 | # ORGNAME-validator, replacing ORGNAME with your organization name. | 
|  | 258 | # | 
|  | 259 | # If you have your own Chef Server, the default validation client name is | 
|  | 260 | # chef-validator, unless you changed the configuration. | 
|  | 261 | # | 
|  | 262 | #   chef.validation_client_name = "ORGNAME-validator" | 
|  | 263 |  | 
|  | 264 | ##### Run the Apache Thrift provisioning script (declared above) | 
|  | 265 | config.vm.provision :shell, :inline => $build_and_test | 
|  | 266 | end |