Same meaning for psycopg2, but removing explicit localhost allows unix domain user...
[oweals/karmaworld.git] / Vagrantfile
1 # -*- mode: ruby -*-
2 # vi: set ft=ruby :
3
4 # This file is for use by Vagrant (http://www.vagrantup.com/).
5 # It will establish a debian-based (Ubuntu) virtual machine for development.
6
7 # The virtual machine environment attempts to match the production environment 
8 # as closely as possible.
9
10 # This file was generated by `vagrant up` and consequently modified.
11
12 # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
13 VAGRANTFILE_API_VERSION = "2"
14
15 # Install fabric so that the KarmaWorld fabfile may be run.
16
17 # build a shell script that installs prereqs, configures the database, sets up
18 # the user/group associations, pulls in the code from the host machine, and
19 # then runs fabric.
20 shellscript = <<SCRIPT
21 apt-get update
22 apt-get upgrade -y
23 apt-get install -y python-pip postgresql python-virtualenv virtualenvwrapper \
24                    git nginx postgresql-server-dev-9.1 libxslt1-dev \
25                    libxml2-dev libmemcached-dev python-dev
26
27 echo "CREATE USER vagrant WITH CREATEROLE LOGIN; CREATE DATABASE karmaworld OWNER vagrant;" | su postgres -c "psql"
28
29 mkdir -m 775 -p /var/www
30 chown -R :www-data /var/www
31 usermod -a -G www-data vagrant
32
33 su vagrant -c "git clone /vagrant karmaworld"
34
35 pip install fabric
36 #su vagrant -c "cd karmaworld; fab here first_deploy"
37 SCRIPT
38 # end of script
39
40 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
41   # All Vagrant configuration is done here. The most common configuration
42   # options are documented and commented below. For a complete reference,
43   # please see the online documentation at vagrantup.com.
44
45   # Every Vagrant virtual environment requires a box to build off of.
46   config.vm.box = "Official Ubuntu 12.04 daily Cloud Image i386"
47   #config.vm.box = "Official Ubuntu 12.04 daily Cloud Image amd64"
48   #config.vm.box = "Official Ubuntu 12.10 daily Cloud Image i386"
49   #config.vm.box = "Official Ubuntu 12.10 daily Cloud Image amd64"
50   #config.vm.box = "Official Ubuntu 13.04 daily Cloud Image i386"
51   #config.vm.box = "Official Ubuntu 13.04 daily Cloud Image amd64"
52   #config.vm.box = "Official Ubuntu 13.10 daily Cloud Image i386"
53   #config.vm.box = "Official Ubuntu 13.10 daily Cloud Image amd64"
54
55   # The url from where the 'config.vm.box' box will be fetched if it
56   # doesn't already exist on the user's system.
57   config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-i386-vagrant-disk1.box"
58   #config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box"
59   #config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/quantal/current/quantal-server-cloudimg-i386-vagrant-disk1.box"
60   #config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/quantal/current/quantal-server-cloudimg-amd64-vagrant-disk1.box"
61   #config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/raring/current/raring-server-cloudimg-i386-vagrant-disk1.box"
62   #config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/raring/current/raring-server-cloudimg-amd64-vagrant-disk1.box"
63   #config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/saucy/current/saucy-server-cloudimg-i386-vagrant-disk1.box"
64   #config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/saucy/current/saucy-server-cloudimg-amd64-vagrant-disk1.box"
65
66   # Create a forwarded port mapping which allows access to a specific port
67   # within the machine from a port on the host machine. In the example below,
68   # accessing "localhost:8080" will access port 80 on the guest machine.
69   # config.vm.network :forwarded_port, guest: 80, host: 8080
70
71   # OM (sanskrit) KW (KarmaWorld) on a phone: 66 59
72   config.vm.network :forwarded_port, guest: 80, host: 6659, auto_correct: true
73
74   # Create a private network, which allows host-only access to the machine
75   # using a specific IP.
76   #config.vm.network :private_network, ip: "192.168.66.59"
77
78   # Create a public network, which generally matched to bridged network.
79   # Bridged networks make the machine appear as another physical device on
80   # your network.
81   # Used to directly access the internet for downloading updates and so forth.
82   config.vm.network :public_network
83
84   # If true, then any SSH connections made will enable agent forwarding.
85   # Default value: false
86   # config.ssh.forward_agent = true
87
88   # Share an additional folder to the guest VM. The first argument is
89   # the path on the host to the actual folder. The second argument is
90   # the path on the guest to mount the folder. And the optional third
91   # argument is a set of non-required options.
92   # config.vm.synced_folder "../data", "/vagrant_data"
93
94   # Setup scripts
95   config.vm.provision "shell", inline: shellscript
96
97   # Provider-specific configuration so you can fine-tune various
98   # backing providers for Vagrant. These expose provider-specific options.
99   # Example for VirtualBox:
100   #
101   # config.vm.provider :virtualbox do |vb|
102   #   # Don't boot with headless mode
103   #   vb.gui = true
104   #
105   #   # Use VBoxManage to customize the VM. For example to change memory:
106   #   vb.customize ["modifyvm", :id, "--memory", "1024"]
107   # end
108   #
109   # View the documentation for the provider you're using for more
110   # information on available options.
111
112   # Enable provisioning with Puppet stand alone.  Puppet manifests
113   # are contained in a directory path relative to this Vagrantfile.
114   # You will need to create the manifests directory and a manifest in
115   # the file base.pp in the manifests_path directory.
116   #
117   # An example Puppet manifest to provision the message of the day:
118   #
119   # # group { "puppet":
120   # #   ensure => "present",
121   # # }
122   # #
123   # # File { owner => 0, group => 0, mode => 0644 }
124   # #
125   # # file { '/etc/motd':
126   # #   content => "Welcome to your Vagrant-built virtual machine!
127   # #               Managed by Puppet.\n"
128   # # }
129   #
130   # config.vm.provision :puppet do |puppet|
131   #   puppet.manifests_path = "manifests"
132   #   puppet.manifest_file  = "site.pp"
133   # end
134
135   # Enable provisioning with chef solo, specifying a cookbooks path, roles
136   # path, and data_bags path (all relative to this Vagrantfile), and adding
137   # some recipes and/or roles.
138   #
139   # config.vm.provision :chef_solo do |chef|
140   #   chef.cookbooks_path = "../my-recipes/cookbooks"
141   #   chef.roles_path = "../my-recipes/roles"
142   #   chef.data_bags_path = "../my-recipes/data_bags"
143   #   chef.add_recipe "mysql"
144   #   chef.add_role "web"
145   #
146   #   # You may also specify custom JSON attributes:
147   #   chef.json = { :mysql_password => "foo" }
148   # end
149
150   # Enable provisioning with chef server, specifying the chef server URL,
151   # and the path to the validation key (relative to this Vagrantfile).
152   #
153   # The Opscode Platform uses HTTPS. Substitute your organization for
154   # ORGNAME in the URL and validation key.
155   #
156   # If you have your own Chef Server, use the appropriate URL, which may be
157   # HTTP instead of HTTPS depending on your configuration. Also change the
158   # validation key to validation.pem.
159   #
160   # config.vm.provision :chef_client do |chef|
161   #   chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME"
162   #   chef.validation_key_path = "ORGNAME-validator.pem"
163   # end
164   #
165   # If you're using the Opscode platform, your validator client is
166   # ORGNAME-validator, replacing ORGNAME with your organization name.
167   #
168   # If you have your own Chef Server, the default validation client name is
169   # chef-validator, unless you changed the configuration.
170   #
171   #   chef.validation_client_name = "ORGNAME-validator"
172 end