mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
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:
@@ -11,18 +11,17 @@ to rails, you are likely much better off with our **[Discourse Vagrant Developer
|
||||
3. Clone the project.
|
||||
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.
|
||||
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
|
||||
|
||||
1. `bundle install`
|
||||
2. `rake db:create`
|
||||
3. `rake db:migrate`
|
||||
4. `rake db:test:prepare`
|
||||
5. `rake db:seed_fu`
|
||||
6. Try running the specs: `bundle exec rspec`
|
||||
7. `bundle exec rails server`
|
||||
2. `rake db:migrate`
|
||||
3. `rake db:test:prepare`
|
||||
4. `rake db:seed_fu`
|
||||
5. Try running the specs: `bundle exec rspec`
|
||||
6. `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!
|
||||
|
||||
@@ -34,7 +33,7 @@ Here are the steps we used to create the **[Vagrant Virtual Machine](https://git
|
||||
|
||||
## Base box
|
||||
|
||||
Vagrant version 1.0.5. With this Vagrantfile:
|
||||
Vagrant version 1.1.2. With this Vagrantfile:
|
||||
|
||||
Vagrant::Config.run do |config|
|
||||
config.vm.box = 'precise32'
|
||||
@@ -77,8 +76,8 @@ Vagrant version 1.0.5. With this Vagrantfile:
|
||||
adduser vagrant rvm
|
||||
source /etc/profile.d/rvm.sh
|
||||
su - vagrant -c "rvm pkg install libyaml"
|
||||
su - vagrant -c "rvm install 1.9.3-p374"
|
||||
su - vagrant -c "rvm use 1.9.3-p374 --default"
|
||||
su - vagrant -c "rvm install 2.0.0-turbo"
|
||||
su - vagrant -c "rvm use 2.0.0-turbo --default"
|
||||
|
||||
echo "gem: --no-rdoc --no-ri" >> /etc/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';"
|
||||
createdb vagrant
|
||||
psql -c "CREATE EXTENSION hstore;"
|
||||
psql -c "CREATE EXTENSION pg_trgm;"
|
||||
psql -c "ALTER USER vagrant CREATEDB"
|
||||
psql -c "create database discourse_development 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 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
|
||||
|
||||
@@ -129,4 +129,3 @@ Load it (as vagrant user):
|
||||
# Press enter to accept all the defaults
|
||||
/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)
|
||||
|
||||
**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 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.
|
||||
@@ -26,9 +29,9 @@ 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.)
|
||||
|
||||
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.
|
||||
- Add it to vagrant: `vagrant box add discourse-pre /path/to/the/downloaded/discourse-pre.box`.
|
||||
If you are having **trouble** downloading the VM:
|
||||
- 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-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:
|
||||
|
||||
@@ -50,7 +53,7 @@ vagrant ssh
|
||||
|
||||
```
|
||||
`vagrant ssh` isn't available on the Windows platform. You are still able
|
||||
to SSH into the virtual machine if you get a Windows SSH client (such as
|
||||
to SSH into the virtual machine if you get a Windows SSH client (such as
|
||||
PuTTY). The authentication information is shown below:
|
||||
|
||||
Host: 127.0.0.1
|
||||
@@ -71,7 +74,7 @@ PuTTYGen to import the insecure_private_key file](http://jason.sharonandjason.co
|
||||
### Keeping your VM up to date
|
||||
|
||||
Now you're in a virtual machine is almost ready to start developing. It's a good idea to perform the following instructions
|
||||
*every time* you pull from master to ensure your environment is still up to date.
|
||||
*every time* you pull from master to ensure your environment is still up to date.
|
||||
|
||||
```
|
||||
bundle install
|
||||
@@ -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.
|
||||
|
||||
### 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
|
||||
|
||||
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
|
||||
@@ -131,7 +150,7 @@ Sent emails will be received by mailcatcher and shown in its web ui.
|
||||
|
||||
When you're done working on Discourse, you can shut down Vagrant like so:
|
||||
|
||||
```
|
||||
```
|
||||
vagrant halt
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user