After having setup several systems with a discourse development environment using Vagrant, I thought I would write a quick guide here, which I really should submit as a README. This setup was tested on a virgin installation of 18.04, and uses Eclipse with Aptana Studio 3.
- Install requirements
sudo apt install vagrant virtualbox virtualbox-dkms git
- Follow these directions to also generate a new ssh key and add it to the ssh agent, then add to your github settings. (Thank you @tobiaseigen)
- Get Discourse source
cd ~/workspace git clone email@example.com:discourse/discourse.git # git clone https://github.com/discourse/discourse.git # If you prefer HTTPS
- Merge Vagrantfile
cd discourse git remote add vagrant-tarek firstname.lastname@example.org:tareko/discourse.git git merge vagrant-tarek/master
Go to Relevant directory
Finish setup of environment
bundle install bundle exec rake db:create db:migrate db:test:prepare
- Create an admin account
cd /vagrant rake admin:create
- Start Server. NOTE: You will need to execute all three of these commands every time!
mailcatcher --ip 0.0.0.0
bundle exec rails s -b 0.0.0.0
bundle exec sidekiq -l log/sidekiq.log -q critical -q default -q low
- Note: If you make changes in your code, please Ctrl-C both the rails server and sidekiq.
- Note: You’ll need two consoles to run both sidekiq and the rails server.
Optional Install Eclipse, egit and Aptana
- Get eclipse from Eclipse Downloads | The Eclipse Foundation - I usually get Eclipse for PHP developers
- Add egit by adding the following repository to eclipse: http://download.eclipse.org/egit/updates
- Add Aptana Studio by adding the following repository to Eclipse: http://download.aptana.com/studio3/plugin/install
Creating a vagrant box:
These instructions are only for use if you are creating a vagrant box if this one goes bad.
Get a generic vagrant box from Vagrant cloud. In this case, I used generic/ubuntu1804
Use that box in the
Start the vagrant instance with
vagrant upthen enter with
sudo apt update; sudo apt upgrade
a. Add VBox guest additions:
sudo apt install virtualbox-guest-dkms virtualbox-guest-utils
b. Add ipv6 as per this bug report.
Set locale appropriately:
localedef -v -c -i en_US -f UTF-8 en_US.UTF-8. Do this before installing postgresql or else you’ll have to delete and recreate the cluster.