So, at the end, do you edit code right in the ~/workspace/discourse
and get your running instance updated automatically instantly?
More or less…
You have to restart the sidekiq and rails s servers each time you make a change to the code.
Hi Tarek - thanks for sharing this howto. I really appreciate it. I’ve tried following your instructions and noticed there are a few interim steps that are required. These become obvious as you move along but I thought I’d share them for the benefit of those who follow (including most likely myself… ;-)). I also found it helpful to review this discourse blog post about discourse as your first rails app while setting up virtualbox on my mac.
- after step 1, also install git as instructed when you try to clone the discourse repo.
- after installing git, follow these directions to also generate a new ssh key and add it to the ssh agent, then add to your github settings.
This is a good news, bad news post. Where I get stuck is on step 3. It hangs and eventually times out. I know this is a virtualbox/vagrant issue or even a hardware issue, but I’d be grateful for any advice. Here’s as far as I have come -
I followed these instructions found on stack overflow to add some lines to Vagrantinfo file, to turn on the gui so I can see what’s causing the holdup:
config.vm.provider :virtualbox do |vb|
vb.gui = true
end
This is what I found:
I am puzzled because I have a newish 2015 macbook pro with retina display, and am fairly certain it supports hardware acceleration. Also not getting entirely why I’d need such a thing for a discourse dev box. Anyhoo, now off to try this on a different laptop…
Hi Tobias,
Thank you for your comments. I’m not able to edit my first post for some reason (probably time), so unfortunately people will have to find your comments.
Regarding the virtualization, I know nothing of Apple devices, but usually that is turned ON in BIOS. Alternatively, you can turn off the setting (which would result in slower performance). Turn off the setting in System > Acceleration here:
I did a few web searches and see there is some discussion about how to enable in Macbooks. I won’t post them here so as not to misguide without testing, but please do post when you get it.
Thank you : )
I’ve wikified your topic so that you may update the OP with any new information that has come along
As noted in a few other places (that I can’t find at the moment), the Vagrantfile has been removed. Since I have to work on my plugin (replyto-individual), I will get this going again and submit another pull request. I will also update the first post as needed.
I have updated the Vagrantfile
so that it creates a proper machine with Ubuntu 18.04 and the most recent (2018-10-23) Discourse. I’ve submitted a pull request with the new Vagrantfile
and the screen file in the docs.
@erlend_sh: Will you consider putting the vagrant file back into the main repository?
I appreciate this but we would need to take ownership of this image and maintenance, this is not a bite I want to chew.
Instead the recommendation is to use:
https://github.com/discourse/discourse/tree/master/bin/docker
It is fast an easy.
Thank you for this, @sam. I could easily make it so it uses a Vagrant stock image and then does the work I did in the image (it would use ansible). At that point, you can easily host a stock image that would take a few minutes to assemble.
Regarding development with docker, I don’t know how to do this, so I will take a look. I can’t speak to the main advantages of Vagrant vs. Docker for development, so perhaps others can.
The final decision as per @sam is to decline and close the pull request as per here.
As such, this Vagrant branch can be merged over top of any currently existing discourse pull with the following method:
git remote add vagrant-tarek git@github.com:tareko/discourse.git
git merge vagrant-tarek/master
@Sam suggests that we should be using a docker dev environment, so perhaps if you have never done Discourse development on Vagrant, then look at that first and make sure you want this unsupported method if not.
I’d suggest building the vagrant file alongside a script that also pulls and mounts discourse up separately (or as a submodule) - that might make it easier for you to maintain a repository for vagrant-ing your Discourse workflow.
It should be be pretty simple to set up from what you’ve got so far, and that way you wouldn’t have to deal with maintaining a straight up fork.
Thank you for the advice. I’ll look at how to do this more rationally when I have a bit of time for it. In the meantime, I managed to fix my plugin, so glad I was at least able to get the environment going. If nothing else, the familiar Vagrant is ideal for idiots like me who want to drop in very occasionally without learning a new dev setup.
I’ve seen you recommend this several times. Perhaps this topic (and other development topics) should be edited to include this recommendation. I just recommended it to someone and it was hard to find.
I’ll be creating a separate howto topic for the Docker-based development setup in the next few days, thanks for the tip
EDIT: Here’s the new topic: Beginners Guide to Install Discourse for Development using Docker
Thank you for doing this. I also took @sam’s advice and figured out docker development. WOW, huge improvement!
Fails at the bundle exec rake
step with Discourse requires Ruby 2.5.2 or up
. The box is based on Ubuntu 18.04 which has Ruby 2.5.1.
I recommend using the docker setup, closing this topic, vagrant setup is unmaintained and broken