-
Notifications
You must be signed in to change notification settings - Fork 6
Setup
Discourse uses Vagrant for setting up its development environment. If you're not familiar with this style of development, there can be a bit of a learning curve. Here are some notes for getting up-to-speed quickly in OS X.
- Install VirtualBox
- Install Vagrant
Note On Mavericks, make sure you have VirtualBox 4.3.2 installed, which requires Vagrant > 1.3.5.
You'll need to clone Discourse from the github repo, then provision a new virtual server.
$ mkdir -p ~/projects
$ cd projects
$ git clone https://github.com/discourse/discourse.git
$ cd discourse
$ vagrant upGrab some coffee...this takes a while the first time.
If you run in to issues (which should be resolved in the VirtualBox 4.3.2 version), consult the fixes at Fixing Vagrant after an OSX Mavericks update.
When you run vagrant up, vagrant will create a new virtual server and set up the project for you. You will be prompted for your admin password (your user account password) to mount you local files via an NFS mount.
After the virtual server has booted, you can connect to the server with the vagrant ssh command to log on to the server with root permissions (from the ~/projects/discourse directory, if you're following the
Discourse Developer Install Guide (Vagrant).
Be sure to occasionally pull from the discourse repository and run bundle install and bundle exec rake db:migrate to make sure you've got the latest changes.
$ bundle install
$ bundle exec rake db:migrateOnce you're VM is updated, start a rails instance from the server (vagrant ssh):
$ bundle exec rails sThis takes a few seconds, but will start rails so you can access it via a web browser at (http://localhost:4000)[http://localhost:4000]. If you can get to that page, everything worked!
Note: You may notice that the console output in vagrant tells you that rails is running on port 3000; vagrant uses port forwarding so port 3000 on the VM is displayed as port 4000 on your machine (just in case you're running another rails application on the default port somewhere else).
When you're done working, you can shut down Discourse with the halt command (assuming you've exited the ssh session):
$ exit
$ vagrant haltTo get everything working in the virtual environment, you'll also need to install the MySQL server and then you can add the data dump. Assuming you've logged on to the virtual server (vagrant ssh), you'll need to install with these commands:
$ sudo apt-get install mysql-serverDuring the installation process, you'll be prompted to create a root password for your system. Choose whatever you want, just remember it. If you do forget, you can reset the root password.
Now you can create a database with the following:
$ mysqladmin -u root -p create <database_name>You can then check to make sure your database was created properly:
$ mysql -u root -p
> show databases;
> \qThis information needs to go in to the config/import_bbpress.yml file.
First you need to get a dump of the data. On the "production" server, create a dump of the SQL:
$ mysqldump -h <database_host> -u <username> -p <database_name> | bzip2 -z9 > ~/database.sql.bzYou can scp it to your local machine, then restore the database locally.
$ bzcat database.sql.bz | mysql -u <username> -p <local_database>Note: This is just one of the many (many) ways to do this; if you have a way you like better, use it.