Updated Vagrantfile to support Vagrant 1.1.2 - you will probably need to download
Vagrant again! http://downloads.vagrantup.com/
This commit is contained in:
		
							parent
							
								
									73b2d6f076
								
							
						
					
					
						commit
						ddff23cc27
					
				|  | @ -3,8 +3,8 @@ | ||||||
| # See https://github.com/discourse/discourse/blob/master/docs/VAGRANT.md | # See https://github.com/discourse/discourse/blob/master/docs/VAGRANT.md | ||||||
| # | # | ||||||
| Vagrant.configure("2") do |config| | Vagrant.configure("2") do |config| | ||||||
|   config.vm.box = 'discourse-pre' |   config.vm.box = 'discourse-0.8.4' | ||||||
|   config.vm.box_url = 'http://www.discourse.org/vms/discourse-pre.box' |   config.vm.box_url = 'http://www.discourse.org/vms/discourse-0.8.4.box' | ||||||
| 
 | 
 | ||||||
|   # Make this VM reachable on the host network as well, so that other |   # Make this VM reachable on the host network as well, so that other | ||||||
|   # VM's running other browsers can access our dev server. |   # VM's running other browsers can access our dev server. | ||||||
|  | @ -49,7 +49,6 @@ Vagrant.configure("2") do |config| | ||||||
|     chef.cookbooks_path = chef_cookbooks_path |     chef.cookbooks_path = chef_cookbooks_path | ||||||
|     chef.add_recipe "recipe[apt]" |     chef.add_recipe "recipe[apt]" | ||||||
|     chef.add_recipe "recipe[build-essential]" |     chef.add_recipe "recipe[build-essential]" | ||||||
|     chef.add_recipe "recipe[phantomjs]" |  | ||||||
|     chef.add_recipe "recipe[vim]" |     chef.add_recipe "recipe[vim]" | ||||||
|   end |   end | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -5,6 +5,5 @@ site 'http://community.opscode.com/api/v1' | ||||||
| 
 | 
 | ||||||
| cookbook 'apt' | cookbook 'apt' | ||||||
| cookbook 'vim' | cookbook 'vim' | ||||||
| cookbook 'phantomjs' |  | ||||||
| cookbook 'build-essential' | cookbook 'build-essential' | ||||||
| cookbook 'omnibus_updater' | cookbook 'omnibus_updater' | ||||||
|  |  | ||||||
|  | @ -4,13 +4,11 @@ SITE | ||||||
|     apt (1.8.4) |     apt (1.8.4) | ||||||
|     build-essential (1.3.4) |     build-essential (1.3.4) | ||||||
|     omnibus_updater (0.1.2) |     omnibus_updater (0.1.2) | ||||||
|     phantomjs (0.0.10) |  | ||||||
|     vim (1.0.2) |     vim (1.0.2) | ||||||
| 
 | 
 | ||||||
| DEPENDENCIES | DEPENDENCIES | ||||||
|   apt (>= 0) |   apt (>= 0) | ||||||
|   build-essential (>= 0) |   build-essential (>= 0) | ||||||
|   omnibus_updater (>= 0) |   omnibus_updater (>= 0) | ||||||
|   phantomjs (>= 0) |  | ||||||
|   vim (>= 0) |   vim (>= 0) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,6 +0,0 @@ | ||||||
| phantomjs CHANGELOG |  | ||||||
| =================== |  | ||||||
| 
 |  | ||||||
| v.0.0.6 |  | ||||||
| ------- |  | ||||||
| - Initial CHANGELOG created |  | ||||||
|  | @ -1,27 +0,0 @@ | ||||||
| phantomjs Cookbook |  | ||||||
| ================== |  | ||||||
| [](http://travis-ci.org/customink-webops/phantomjs) |  | ||||||
| 
 |  | ||||||
| Installs the phantomjs cookbook and necessary packages. This repository also features a full test suite! |  | ||||||
| 
 |  | ||||||
| Attributes |  | ||||||
| ---------- |  | ||||||
| - `default['phantomjs']['version']` - the version number to install |  | ||||||
| 
 |  | ||||||
| Contributing |  | ||||||
| ------------ |  | ||||||
| 1. Fork the project |  | ||||||
| 2. Create a feature branch (i.e. `add_feature_x`) |  | ||||||
| 3. Make your changes |  | ||||||
| 4. Write or change specs as necessary |  | ||||||
| 5. Ensure the specs pass: |  | ||||||
| 
 |  | ||||||
|     $ bundle exec rspec |  | ||||||
| 
 |  | ||||||
| 6. Submit a pull request on github |  | ||||||
| 
 |  | ||||||
| License and Authors |  | ||||||
| ------------------- |  | ||||||
| Author: [Seth Vargo](https://github.com/sethvargo) |  | ||||||
| 
 |  | ||||||
| Copyright 2012, CustomInk, LLC |  | ||||||
|  | @ -1,3 +0,0 @@ | ||||||
| default['phantomjs'] = { |  | ||||||
|   'version' => '1.7.0' |  | ||||||
| } |  | ||||||
|  | @ -1,52 +0,0 @@ | ||||||
| { |  | ||||||
|   "name": "phantomjs", |  | ||||||
|   "description": "Installs/Configures phantomjs", |  | ||||||
|   "long_description": "phantomjs Cookbook\n==================\n[](http://travis-ci.org/customink-webops/phantomjs)\n\nInstalls the phantomjs cookbook and necessary packages. This repository also features a full test suite!\n\nAttributes\n----------\n- `default['phantomjs']['version']` - the version number to install\n\nContributing\n------------\n1. Fork the project\n2. Create a feature branch (i.e. `add_feature_x`)\n3. Make your changes\n4. Write or change specs as necessary\n5. Ensure the specs pass:\n\n    $ bundle exec rspec\n\n6. Submit a pull request on github\n\nLicense and Authors\n-------------------\nAuthor: [Seth Vargo](https://github.com/sethvargo)\n\nCopyright 2012, CustomInk, LLC\n", |  | ||||||
|   "maintainer": "CustomInk", |  | ||||||
|   "maintainer_email": "webops@customink.com", |  | ||||||
|   "license": "Apache 2.0", |  | ||||||
|   "platforms": { |  | ||||||
|     "amazon": ">= 0.0.0", |  | ||||||
|     "centos": ">= 0.0.0", |  | ||||||
|     "debian": ">= 0.0.0", |  | ||||||
|     "fedora": ">= 0.0.0", |  | ||||||
|     "oracle": ">= 0.0.0", |  | ||||||
|     "rhel": ">= 0.0.0", |  | ||||||
|     "scientific": ">= 0.0.0", |  | ||||||
|     "ubuntu": ">= 0.0.0" |  | ||||||
|   }, |  | ||||||
|   "dependencies": { |  | ||||||
|   }, |  | ||||||
|   "recommendations": { |  | ||||||
|   }, |  | ||||||
|   "suggestions": { |  | ||||||
|   }, |  | ||||||
|   "conflicting": { |  | ||||||
|   }, |  | ||||||
|   "providing": { |  | ||||||
|   }, |  | ||||||
|   "replacing": { |  | ||||||
|   }, |  | ||||||
|   "attributes": { |  | ||||||
|     "version": { |  | ||||||
|       "display_name": "Version", |  | ||||||
|       "description": "The Version of phantomjs to install", |  | ||||||
|       "default": "1.7.0", |  | ||||||
|       "choice": [ |  | ||||||
| 
 |  | ||||||
|       ], |  | ||||||
|       "calculated": false, |  | ||||||
|       "type": "string", |  | ||||||
|       "required": "optional", |  | ||||||
|       "recipes": [ |  | ||||||
| 
 |  | ||||||
|       ] |  | ||||||
|     } |  | ||||||
|   }, |  | ||||||
|   "groupings": { |  | ||||||
|   }, |  | ||||||
|   "recipes": { |  | ||||||
|     "phantomjs::default": "Install phantomjs binary" |  | ||||||
|   }, |  | ||||||
|   "version": "0.0.10" |  | ||||||
| } |  | ||||||
|  | @ -1,18 +0,0 @@ | ||||||
| name 'phantomjs' |  | ||||||
| maintainer 'CustomInk' |  | ||||||
| maintainer_email 'webops@customink.com' |  | ||||||
| license 'Apache 2.0' |  | ||||||
| description 'Installs/Configures phantomjs' |  | ||||||
| long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) |  | ||||||
| version '0.0.10' |  | ||||||
| 
 |  | ||||||
| recipe 'phantomjs::default', 'Install phantomjs binary' |  | ||||||
| 
 |  | ||||||
| %w(amazon centos debian fedora oracle rhel scientific ubuntu).each do |os| |  | ||||||
|   supports os |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| attribute 'version', |  | ||||||
|   :display_name => 'Version', |  | ||||||
|   :description => 'The Version of phantomjs to install', |  | ||||||
|   :default => '1.7.0' |  | ||||||
|  | @ -1,52 +0,0 @@ | ||||||
| # |  | ||||||
| # Cookbook Name:: phantomjs |  | ||||||
| # Recipe:: default |  | ||||||
| # |  | ||||||
| # Copyright 2012, CustomInk |  | ||||||
| # |  | ||||||
| # Licensed 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. |  | ||||||
| # |  | ||||||
| 
 |  | ||||||
| # Packages |  | ||||||
| case node['platform_family'] |  | ||||||
| when 'debian' |  | ||||||
|   %w(fontconfig libfreetype6).each do |package| |  | ||||||
|     package package |  | ||||||
|   end |  | ||||||
| when 'fedora','rhel' |  | ||||||
|   %w(fontconfig freetype).each do |package| |  | ||||||
|     package package |  | ||||||
|   end |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| basename = "phantomjs-#{node['phantomjs']['version']}-linux-#{node['kernel']['machine']}" |  | ||||||
| 
 |  | ||||||
| # Download the tarball |  | ||||||
| remote_file "/usr/local/src/#{basename}.tar.bz2" do |  | ||||||
|   action :create_if_missing |  | ||||||
|   backup false |  | ||||||
|   mode '0644' |  | ||||||
|   checksum node['phantomjs']['checksum'] if node['phantomjs']['checksum'] |  | ||||||
|   source "https://phantomjs.googlecode.com/files/#{basename}.tar.bz2" |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| # Install phantomjs |  | ||||||
| execute 'Install phantomjs' do |  | ||||||
|   command "tar -xvjf /usr/local/src/#{basename}.tar.bz2 -C /usr/local/" |  | ||||||
|   not_if "test -d /usr/local/#{basename}" |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| # Set up the symbolic link |  | ||||||
| link '/usr/local/bin/phantomjs' do |  | ||||||
|   to "/usr/local/#{basename}/bin/phantomjs" |  | ||||||
| end |  | ||||||
|  | @ -11,18 +11,17 @@ to rails, you are likely much better off with our **[Discourse Vagrant Developer | ||||||
| 3. Clone the project. | 3. Clone the project. | ||||||
| 4. Create development and test databases in postgres. | 4. Create development and test databases in postgres. | ||||||
| 5. Copy `config/database.yml.sample` and `config/redis.yml.sample` to `config/database.yml` and `config/redis.yml` and input the correct values to point to your postgres and redis instances. | 5. Copy `config/database.yml.sample` and `config/redis.yml.sample` to `config/database.yml` and `config/redis.yml` and input the correct values to point to your postgres and redis instances. | ||||||
| 6. We recommend starting with seed data to play around in your development environment. [Download Seed SQL Data](http://www.discourse.org/vms/dev-discourse-seed.sql). Install it into postgres using a command like this: `psql -d discourse_development < dev-discourse-seed.sql`. | 6. Install the seed data to set up an admin account and meta topic: `psql DATABASE_NAME < pg_dumps/production-image.sql` | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| ## Before you start Rails | ## Before you start Rails | ||||||
| 
 | 
 | ||||||
| 1. `bundle install` | 1. `bundle install` | ||||||
| 2. `rake db:create` | 2. `rake db:migrate` | ||||||
| 3. `rake db:migrate` | 3. `rake db:test:prepare` | ||||||
| 4. `rake db:test:prepare` | 4. `rake db:seed_fu` | ||||||
| 5. `rake db:seed_fu` | 5. Try running the specs: `bundle exec rspec` | ||||||
| 6. Try running the specs: `bundle exec rspec` | 6. `bundle exec rails server` | ||||||
| 7. `bundle exec rails server` |  | ||||||
| 
 | 
 | ||||||
| You should now be able to connect to rails on http://localhost:3000 - try it out! The seed data includes a pinned topic that explains how to get an admin account, so start there! Happy hacking! | You should now be able to connect to rails on http://localhost:3000 - try it out! The seed data includes a pinned topic that explains how to get an admin account, so start there! Happy hacking! | ||||||
| 
 | 
 | ||||||
|  | @ -34,7 +33,7 @@ Here are the steps we used to create the **[Vagrant Virtual Machine](https://git | ||||||
| 
 | 
 | ||||||
| ## Base box | ## Base box | ||||||
| 
 | 
 | ||||||
| Vagrant version 1.0.5. With this Vagrantfile: | Vagrant version 1.1.2. With this Vagrantfile: | ||||||
| 
 | 
 | ||||||
|     Vagrant::Config.run do |config| |     Vagrant::Config.run do |config| | ||||||
|       config.vm.box     = 'precise32' |       config.vm.box     = 'precise32' | ||||||
|  | @ -77,8 +76,8 @@ Vagrant version 1.0.5. With this Vagrantfile: | ||||||
|     adduser vagrant rvm |     adduser vagrant rvm | ||||||
|     source /etc/profile.d/rvm.sh |     source /etc/profile.d/rvm.sh | ||||||
|     su - vagrant -c "rvm pkg install libyaml" |     su - vagrant -c "rvm pkg install libyaml" | ||||||
|     su - vagrant -c "rvm install 1.9.3-p374" |     su - vagrant -c "rvm install 2.0.0-turbo" | ||||||
|     su - vagrant -c "rvm use 1.9.3-p374 --default" |     su - vagrant -c "rvm use 2.0.0-turbo --default" | ||||||
| 
 | 
 | ||||||
|     echo "gem: --no-rdoc --no-ri" >> /etc/gemrc |     echo "gem: --no-rdoc --no-ri" >> /etc/gemrc | ||||||
|     su - vagrant -c "echo 'gem: --no-rdoc --no-ri' >> ~/.gemrc" |     su - vagrant -c "echo 'gem: --no-rdoc --no-ri' >> ~/.gemrc" | ||||||
|  | @ -93,6 +92,7 @@ Configure so that the vagrant user doesn't need to provide username and password | ||||||
|     psql -c "ALTER USER vagrant WITH PASSWORD 'password';" |     psql -c "ALTER USER vagrant WITH PASSWORD 'password';" | ||||||
|     createdb vagrant |     createdb vagrant | ||||||
|     psql -c "CREATE EXTENSION hstore;" |     psql -c "CREATE EXTENSION hstore;" | ||||||
|  |     psql -c "CREATE EXTENSION pg_trgm;" | ||||||
|     psql -c "ALTER USER vagrant CREATEDB" |     psql -c "ALTER USER vagrant CREATEDB" | ||||||
|     psql -c "create database discourse_development owner vagrant encoding 'UTF8' TEMPLATE template0;" |     psql -c "create database discourse_development owner vagrant encoding 'UTF8' TEMPLATE template0;" | ||||||
|     psql -c "create database discourse_test        owner vagrant encoding 'UTF8' TEMPLATE template0;" |     psql -c "create database discourse_test        owner vagrant encoding 'UTF8' TEMPLATE template0;" | ||||||
|  | @ -109,11 +109,11 @@ Edit /etc/postgresql/9.1/main/pg_hba.conf to have this: | ||||||
|     host all all ::1/128 trust |     host all all ::1/128 trust | ||||||
|     host all all 0.0.0.0/0 trust # wide-open |     host all all 0.0.0.0/0 trust # wide-open | ||||||
| 
 | 
 | ||||||
| Download a database image from [http://discourse.org/vms/dev-discourse-seed.sql][seed_download]. | Load the seed data (as vagrant user): | ||||||
| 
 | 
 | ||||||
| Load it (as vagrant user): |     psql -d discourse_development < pg_dump/development-image.sql | ||||||
| 
 | 
 | ||||||
|     psql -d discourse_development < dev-discourse-seed.sql | (You may wish to try the `production-image.sql` file for a good seed for a production database.) | ||||||
| 
 | 
 | ||||||
| ## Redis | ## Redis | ||||||
| 
 | 
 | ||||||
|  | @ -129,4 +129,3 @@ Load it (as vagrant user): | ||||||
|     # Press enter to accept all the defaults |     # Press enter to accept all the defaults | ||||||
|     /etc/init.d/redis_6379 start |     /etc/init.d/redis_6379 start | ||||||
| 
 | 
 | ||||||
| [seed_download]: (http://discourse.org/vms/dev-discourse-seed.sql) |  | ||||||
|  |  | ||||||
|  | @ -1,5 +1,8 @@ | ||||||
| # Discourse Developer Install Guide (Vagrant) | # Discourse Developer Install Guide (Vagrant) | ||||||
| 
 | 
 | ||||||
|  | **We require Vagrant 1.1.2+ for our Vagrant image to work. You may have to upgrade if you are running | ||||||
|  | an earlier release.** | ||||||
|  | 
 | ||||||
| If you'd like to set up a development environment for Discourse, the easiest way is by using a virtual machine. | If you'd like to set up a development environment for Discourse, the easiest way is by using a virtual machine. | ||||||
| If you have experience setting up Rails projects, you might want to take a look at our **[Discourse Advanced Developer Guide](https://github.com/discourse/discourse/blob/master/docs/DEVELOPER-ADVANCED.md)**. | If you have experience setting up Rails projects, you might want to take a look at our **[Discourse Advanced Developer Guide](https://github.com/discourse/discourse/blob/master/docs/DEVELOPER-ADVANCED.md)**. | ||||||
| It also contains instructions on building your own Vagrant VM. | It also contains instructions on building your own Vagrant VM. | ||||||
|  | @ -27,8 +30,8 @@ Vagrant will prompt you for your admin password. This is so it can mount your lo | ||||||
| (The first time you do this, it will take a while as it downloads the VM image and installs it. Go grab a coffee.) | (The first time you do this, it will take a while as it downloads the VM image and installs it. Go grab a coffee.) | ||||||
| 
 | 
 | ||||||
| If you are having **trouble** downloading the VM: | If you are having **trouble** downloading the VM: | ||||||
| - Download this file: http://www.discourse.org/vms/discourse-pre.box using your favorite web browser/download tool. | - Download this file: http://www.discourse.org/vms/discourse-0.8.4.box using your favorite web browser/download tool. | ||||||
| - Add it to vagrant: `vagrant box add discourse-pre /path/to/the/downloaded/discourse-pre.box`. | - Add it to vagrant: `vagrant box add discourse-0.8.4 /path/to/the/downloaded/discourse-0.8.4.box virtualbox`. | ||||||
| 
 | 
 | ||||||
| **Note to OSX/Linux users**: Vagrant will mount your local files via an NFS share. Therefore, make sure that NFS is installed or else you'll receive the error message: | **Note to OSX/Linux users**: Vagrant will mount your local files via an NFS share. Therefore, make sure that NFS is installed or else you'll receive the error message: | ||||||
| 
 | 
 | ||||||
|  | @ -91,6 +94,22 @@ In a few seconds, rails will start serving pages. To access them, open a web bro | ||||||
| 
 | 
 | ||||||
| You can now edit files on your local file system, using your favorite text editor or IDE. When you reload your web browser, it should have the latest changes. | You can now edit files on your local file system, using your favorite text editor or IDE. When you reload your web browser, it should have the latest changes. | ||||||
| 
 | 
 | ||||||
|  | ### Changing the Seed Data | ||||||
|  | 
 | ||||||
|  | By default, the Vagrant virtual machine comes seeded with test data. You'll have a few topics to play around with | ||||||
|  | and some user accounts. If you'd like to use the default production seed data instead you can execute the following | ||||||
|  | commands: | ||||||
|  | 
 | ||||||
|  | ``` | ||||||
|  | vagrant ssh | ||||||
|  | cd /vagrant | ||||||
|  | psql discourse_development < pg_dumps/production-image.sql | ||||||
|  | rake db:migrate | ||||||
|  | rake db:test:prepare | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | If you change your mind and want to use the test data again, just execute the above but using `pg_dumps/development-image.sql` instead. | ||||||
|  | 
 | ||||||
| ### Guard + Rspec | ### Guard + Rspec | ||||||
| 
 | 
 | ||||||
| If you're actively working on Discourse, we recommend that you run Guard. It'll automatically run our unit tests over and over, and includes support | If you're actively working on Discourse, we recommend that you run Guard. It'll automatically run our unit tests over and over, and includes support | ||||||
|  |  | ||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Loading…
	
		Reference in New Issue