├── .gitignore ├── README.md ├── Vagrantfile ├── pio └── provision.sh /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vagrant/ 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Bring Up PredictionIO 0.9.x VM with Vagrant 2 | =========================================== 3 | 4 | Vagrant is an open source tool for simplifying the download and setup steps of 5 | a virtual machine (VM) with VirtualBox. It is recommended for a quick 6 | PredictionIO installation in a testing or development environment, as it will 7 | save you from many of the common pitfalls of the installation process. 8 | 9 | Please refer to the 10 | [documentation site](http://docs.prediction.io/current/) 11 | for detailed usage and setup. 12 | 13 | Installation 14 | ============ 15 | 16 | Please refer to the [Installing PredictionIO with Vagrant (VirtualBox)](http://docs.prediction.io/install/install-vagrant/) for installation instructions. 17 | 18 | Support 19 | ======= 20 | 21 | https://groups.google.com/group/predictionio-user 22 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! 5 | VAGRANTFILE_API_VERSION = "2" 6 | 7 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 8 | # All Vagrant configuration is done here. The most common configuration 9 | # options are documented and commented below. For a complete reference, 10 | # please see the online documentation at vagrantup.com. 11 | 12 | # Every Vagrant virtual environment requires a box to build off of. 13 | config.vm.box = "ubuntu/trusty64" 14 | 15 | # The URL that the configured box can be found at. 16 | # If the box is not installed on the system, it will be retrieved from this URL when vagrant up is run. 17 | #config.vm.box_url = "http://files.vagrantup.com/trusty64.box" 18 | 19 | # see http://www.virtualbox.org/manual/ch08.html#vboxmanage-modifyvm 20 | config.vm.provider "virtualbox" do |v| 21 | v.customize ["modifyvm", :id, "--cpuexecutioncap", "90", "--memory", "2048"] 22 | end 23 | 24 | # The url from where the 'config.vm.box' box will be fetched if it 25 | # doesn't already exist on the user's system. 26 | # config.vm.box_url = "http://domain.com/path/to/above.box" 27 | 28 | # PredictionIO provision script 29 | config.vm.provision "shell", run: "always" do |s| 30 | s.path = "provision.sh" 31 | s.privileged = false 32 | end 33 | 34 | config.vm.network :forwarded_port, guest: 7070, host: 7070 35 | config.vm.network :forwarded_port, guest: 7077, host: 7077 36 | config.vm.network :forwarded_port, guest: 8000, host: 8000 37 | config.vm.network :forwarded_port, guest: 8080, host: 8080 38 | config.vm.network :forwarded_port, guest: 9000, host: 9000 39 | 40 | # Create a forwarded port mapping which allows access to a specific port 41 | # within the machine from a port on the host machine. In the example below, 42 | # accessing "localhost:8080" will access port 80 on the guest machine. 43 | # config.vm.network :forwarded_port, guest: 80, host: 8080 44 | 45 | # Create a private network, which allows host-only access to the machine 46 | # using a specific IP. 47 | # config.vm.network :private_network, ip: "192.168.33.10" 48 | 49 | # Create a public network, which generally matched to bridged network. 50 | # Bridged networks make the machine appear as another physical device on 51 | # your network. 52 | # config.vm.network :public_network 53 | 54 | # If true, then any SSH connections made will enable agent forwarding. 55 | # Default value: false 56 | # config.ssh.forward_agent = true 57 | 58 | # Share an additional folder to the guest VM. The first argument is 59 | # the path on the host to the actual folder. The second argument is 60 | # the path on the guest to mount the folder. And the optional third 61 | # argument is a set of non-required options. 62 | # config.vm.synced_folder "../data", "/vagrant_data" 63 | 64 | # Provider-specific configuration so you can fine-tune various 65 | # backing providers for Vagrant. These expose provider-specific options. 66 | # Example for VirtualBox: 67 | # 68 | # config.vm.provider :virtualbox do |vb| 69 | # # Don't boot with headless mode 70 | # vb.gui = true 71 | # 72 | # # Use VBoxManage to customize the VM. For example to change memory: 73 | # vb.customize ["modifyvm", :id, "--memory", "1024"] 74 | # end 75 | # 76 | # View the documentation for the provider you're using for more 77 | # information on available options. 78 | 79 | # Enable provisioning with Puppet stand alone. Puppet manifests 80 | # are contained in a directory path relative to this Vagrantfile. 81 | # You will need to create the manifests directory and a manifest in 82 | # the file base.pp in the manifests_path directory. 83 | # 84 | # An example Puppet manifest to provision the message of the day: 85 | # 86 | # # group { "puppet": 87 | # # ensure => "present", 88 | # # } 89 | # # 90 | # # File { owner => 0, group => 0, mode => 0644 } 91 | # # 92 | # # file { '/etc/motd': 93 | # # content => "Welcome to your Vagrant-built virtual machine! 94 | # # Managed by Puppet.\n" 95 | # # } 96 | # 97 | # config.vm.provision :puppet do |puppet| 98 | # puppet.manifests_path = "manifests" 99 | # puppet.manifest_file = "init.pp" 100 | # end 101 | 102 | # Enable provisioning with chef solo, specifying a cookbooks path, roles 103 | # path, and data_bags path (all relative to this Vagrantfile), and adding 104 | # some recipes and/or roles. 105 | # 106 | # config.vm.provision :chef_solo do |chef| 107 | # chef.cookbooks_path = "../my-recipes/cookbooks" 108 | # chef.roles_path = "../my-recipes/roles" 109 | # chef.data_bags_path = "../my-recipes/data_bags" 110 | # chef.add_recipe "mysql" 111 | # chef.add_role "web" 112 | # 113 | # # You may also specify custom JSON attributes: 114 | # chef.json = { :mysql_password => "foo" } 115 | # end 116 | 117 | # Enable provisioning with chef server, specifying the chef server URL, 118 | # and the path to the validation key (relative to this Vagrantfile). 119 | # 120 | # The Opscode Platform uses HTTPS. Substitute your organization for 121 | # ORGNAME in the URL and validation key. 122 | # 123 | # If you have your own Chef Server, use the appropriate URL, which may be 124 | # HTTP instead of HTTPS depending on your configuration. Also change the 125 | # validation key to validation.pem. 126 | # 127 | # config.vm.provision :chef_client do |chef| 128 | # chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME" 129 | # chef.validation_key_path = "ORGNAME-validator.pem" 130 | # end 131 | # 132 | # If you're using the Opscode platform, your validator client is 133 | # ORGNAME-validator, replacing ORGNAME with your organization name. 134 | # 135 | # If you have your own Chef Server, the default validation client name is 136 | # chef-validator, unless you changed the configuration. 137 | # 138 | # chef.validation_client_name = "ORGNAME-validator" 139 | end 140 | -------------------------------------------------------------------------------- /pio: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Wrapper for the pio command in Vagrant 3 | 4 | CURRENT_DIR="$(pwd)" 5 | 6 | cd $(dirname $0) 7 | SCRIPT_DIR="$(pwd)" 8 | 9 | CHDIR=${CURRENT_DIR/$SCRIPT_DIR/"/vagrant"} 10 | 11 | echo "Running command:" 12 | echo "cd $CHDIR && sudo /opt/PredictionIO/bin/pio $*" 13 | 14 | read -p "Do you wish to run this command on the Vagrant machine? [y/N] " yn 15 | case $yn in 16 | [Yy]* ) 17 | vagrant ssh -c "cd $CHDIR && sudo /opt/PredictionIO/bin/pio $*";; 18 | [Nn]* ) exit;; 19 | * ) echo "Please answer yes or no.";; 20 | esac -------------------------------------------------------------------------------- /provision.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | SETUP_DIR=$HOME/.pio 4 | INSTALLED_FLAG=$SETUP_DIR/installed 5 | 6 | mkdir -p $SETUP_DIR 7 | 8 | if [ ! -f $INSTALLED_FLAG ]; then 9 | 10 | echo "Installing PredictionIO..." 11 | bash -e -c "$(curl -s https://install.prediction.io/install.sh)" 0 -y 12 | if [ $? -ne 0 ]; then 13 | 14 | echo "ERROR: PredictionIO installation failed." 15 | echo "ERROR: Please try to destory and re-setup VM again by running (in the same current directory):" 16 | echo "ERROR: $ vagrant destroy" 17 | echo "ERROR: (enter y) followed by" 18 | echo "ERROR: $ vagrant up" 19 | echo "ERROR: If problem persists, please use this forum for support:" 20 | echo "ERROR: https://groups.google.com/forum/#!forum/predictionio-user" 21 | exit 1 22 | 23 | else 24 | 25 | echo "Finish PredictionIO installation." 26 | touch $INSTALLED_FLAG 27 | 28 | fi 29 | 30 | else 31 | echo "PredictionIO already installed. Skip installation." 32 | pio-start-all 33 | echo "--------------------------------------------------------------------------------" 34 | echo -e "\033[1;32mPredictionIO VM is up!\033[0m" 35 | echo "You could run 'pio status' inside VM ('vagrant ssh' to VM first) to confirm if PredictionIO is ready." 36 | echo -e "\033[1;33mIMPORTANT: You still have to start the eventserver manually (inside VM):\033[0m" 37 | echo -e "Run: '\033[1mpio eventserver --ip 0.0.0.0\033[0m'" 38 | echo "--------------------------------------------------------------------------------" 39 | fi 40 | --------------------------------------------------------------------------------