Thanks for that. I didn’t even think to look past the folders. I think I have enough information to make another pass at this.
I’m still getting something wrong. Between this topic, here, and here, nowhere just states what docker command to run. I settled on
docker run -ti -v LocalRepoPath:/src discourse/discourse_dev, which initialized a whole bunch of stuff and seemingly mounted the repo to
/src. But I can’t run
d/boot_dev --init for some reason. Even just running
ls in the repo’s top-level directory gives me:
ls: cannot access 'adminjs': Input/output error ls: cannot access 'd': Input/output error ls: cannot access 'jsapp': Input/output error
Does anyone know what’s going on here?
You might be overcomplicating this: the tutorial on the first post already has everything you need to get started.
d/* commands will do all the docker command magic so that you don’t have to. Once you have cloned the repo, the
d/boot_dev --init and the
d/unicorn commands (that you do on the host machine) should be all it takes to get http://localhost:9292 working. Those scripts will call docker to generate the container and start it for you. The
d/shutdown_dev will stop it.
If you are getting those errors while browsing the repo files on the host, then something else seems amiss with your filesystem. Did you run out of disk space perhaps?
sigh, I see. I thought those had to be run in docker. That said,
d/boot_dev --init apparently doesn’t work on Windows in Powershell (which I guess is why this docker guide only mentions Mac and Ubuntu hosts). I tried to run the command in my linux subsystem (v1), but of course that fails at the docker step since I installed docker on Windows, not on the linux subsystem.
Next I tried to run it in git bash for Windows. I couldn’t run
d/boot_dev --init (error “d/boot_dev: Is a directory”), but I was able to run
bin/docker/boot_dev --init. This got a lot further, doing a bunch of pulls, but then it failed with
C:\Program Files\Docker\Docker\resources\bin\docker.exe: Error response from daemon: Mount denied:
The source path “PathToRepo/data/postgres;C”
doesn’t exist and is not known to Docker.
I was able to get past that (I think) by escaping the mount path, per:
Docker mounted volume adds ;C to end of windows path when translating from linux style path - Stack Overflow
After that I got this error:
C:\Program Files\Docker\Docker\resources\bin\docker.exe: Error response from daemon: OCI runtime create failed: container_linux.go:346: starting container process caused “exec: “C:/Program Files/Git/sbin/boot”: stat C:/Program Files/Git/sbin/boot: no such file or directory”: unknown.
C:/Program Files/Git/sbin/boot doesn’t exist on my file system, so I guess the error’s not surprising. The only thing mentioning
sbin/boot in the
boot_dev file is this part of the docker command:
And that’s pretty much where I’m at right now… I don’t really know what to try at this point.
I’m afraid that’s how far I’m able to help you as I’m not familiar with windows.
Perhaps @rishabh is able to confirm whether this is supposed to work on windows too and update any missing steps for that (or add a note if it doesn’t).
@sam Is what I’m trying to do even a remotely supported way of running Discourse for development? In the Windows development thread you mentioned trying this, but it hasn’t been going great so far. Basic (non-Discourse) Ubuntu containers technically work, but not the specific commands in this thread’s OP.
You originally mentioned this to me:
So unless you have a suggestion to get me through the issues I’m having with Docker on Windows, it’s probably best for me to cut my losses and run it in an Ubuntu VM using something like Virtual Box.
So many of us are on the slow ring with zero issues. Games work, steam works everything works.
I do get the fear here, but it really is not a giant deal. Anyway if this is just too scary for you, I recommend a traditional VM like Hyper-V or VirtualBox. Install Docker in there and use our docker dev setup.
If this wasn’t my primary (and only) computer I would join you on the slow ring, but I just can’t risk it. So I’ll go with a traditional VM with docker. Thanks again for the advice. I hope to have something up and running soon.
What would be sufficient for disk space and RAM to allocate to the VM? I was thinking maybe 16GB of disk space and 4GB of RAM, but I wanted to check first.
That would probably be enough, best way to find the ideal recipe is to experiment
Alright, I’m close to getting this working for real. I have a local instance running using docker in an ubuntu VM. I assume that I should only run
d/boot_dev --init the very first time, and after that I’d just run
d/boot_dev. Is that accurate? The reason I ask is that
d/unicorn works when I include
--init, but doesn’t work when I omit the
d/boot_dev. When it fails to start I get the error
Could not find aws-partitions-1.270.0 in any of the sources.
bundle installto install missing gems.
But then running
bundle install fails with
actionview_precompiler-0.2.2 requires ruby version >= 2.6, which is incompatible with the current version, ruby 2.5.1p57
Is there a specific version of ruby I should update to? Or is there something else going on?
My VM is Ubuntu 18.04 (LTS) and this time I was able to directly follow the instructions in the OP, so I’m not sure where I might have gone wrong (if something is wrong).
You would not use
bundle install you would use
d/bundle install you want to install the bundle inside the container, the VM does not need Ruby.
Yeah, I had a feeling that was the case, just didn’t know what the right way of running it in the container was. Thanks again for the help!
I pulled the latest version of the repo and as usual
d/unicorn tells me “Run
bundle install to install missing gems.”. However, this time when I run
d/bundle install I get the following:
Fetching source index from https://rubygems.org/
Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from https://rubygems.org/
Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from https://rubygems.org/
Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from https://rubygems.org/
Could not fetch specs from https://rubygems.org/
So I can’t actually run Discourse at the moment. I have no idea if this is related to the pull (directly or indirectly) or if it’s something completely unrelated. Googling for the error hasn’t been particularly helpful, so I don’t know how to proceed.
We you able to reach rubygems.org?
From my Ubuntu VM I was able to ping rubygems.org. I don’t know if there’s a way to check if the docker container can. I think I only pinged the http version, not https, though. Mentioning in case the problem is related to that. (One of the pages I saw when googling suggested changing https to http, but it’s not like I can do that since the defined behavior is somewhere in the docker container.)
I’ve tried the MacOS options.
First using Option 2, Homebrew. I ran into issues though as not all dependencies were installed using the command of this guide. A complete one-by-one guide to install Docker on your Mac OS using Homebrew helped me getting a bit further.
I’m now stuck at Step 2
Migrating database... rake aborted! PG::ConnectionBad: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"? /src/lib/site_settings/db_provider.rb:61:in `table_exists?' /src/lib/site_settings/db_provider.rb:16:in `all' /src/lib/site_settings/defaults_provider.rb:29:in `db_all' /src/lib/site_setting_extension.rb:277:in `block in refresh!' /src/lib/site_setting_extension.rb:274:in `synchronize' /src/lib/site_setting_extension.rb:274:in `refresh!' /src/lib/site_setting_extension.rb:495:in `block in setup_methods' /src/config/initializers/004-message_bus.rb:120:in `<main>' /src/config/environment.rb:7:in `<main>' /usr/local/bin/bundle:23:in `load' /usr/local/bin/bundle:23:in `<main>' Tasks: TOP => db:migrate => db:load_config => environment (See full trace by running task with --trace)
I’ve then downloaded the
.dmg file but as I’m new to Docker, I don’t understand what to do from there. It would be great to have a little more detailed description of the macOS option.
On MacOS, once you install Docker from the
.dmg, just make sure it’s running — there should be an icon on the MacOS toolbar that you can use to check its status. Then literally follow the steps on the first post (clone, etc). Post here if you hit a problem going that route.
Mind, if you have installed docker with Homebrew before, it may be a good idea to uninstall that docker first or at least making sure that one is not running. I never installed docker with homebrew, so can’t advise there.
I’ve used the icon and opened the Docker dashboard. I didn’t find any containers running there on the command line I could see multiple containers running though. I was wondering if I had to sign in to use Docker dashboard? Or maybe this behaviour occurs since there are multiple versions of Docker installed Homebrew and Desktop (.dmg)?
In the meantime I’ve managed to setup Discourse on DigitalOcean which works without problems and is okay for my purposes.
The DMG installs docker, not discourse. It won’t add any containers initially.
From there you can follow the docker guide.
When running the above command (on a Mac) I get this error:
An error occurred while installing cppjieba_rb (0.3.3), and Bundler cannot continue. Make sure that `gem install cppjieba_rb -v '0.3.3' --source 'https://rubygems.org/'` succeeds before bundling.
Do you have any suggestions? I don’t understand exactly what the problem is. The separate gem install doesn’t work either (even with sudo).
Also, why do gems have to be installed when I’m running a docker image? That should have been fully pre-installed already, right?
I cloned to
~/repos/discoursebut should have been to
~/discourse. Works like a charm now.