Does discourse support docker on windows?

docker

(zh99998) #1

docker is officially support windows platform now (via vbox)
https://docs.docker.com/windows/step_three/

can discourse run in docker on windows? and how to do it


(omfg) #2

I don’t think Discourse knows where Docker runs.


(Jeff Atwood) #3

Does not matter, huge swaths of Ruby and common gems are incompatible with Windows. Not to mention the other stuff in the stack. Won’t work.


(omfg) #4

It’s Docker on Windows, but inside of Docker it’s Ubuntu, as far as I can tell.


(Sam Saffron) #5

I think the way the windows one works is similar to mac, the client runs in windows but the docker server runs in a VM.

launcher uses tons of bash so you would not be able to run unless it had cygwin (which it seems to be mucking with)

Try it out and see if it works, I don’t know.

Worst case, you have a VM running docker anyway, so log in to it and run launcher there.


(RBoy) #10

Did anyone try this? Did installing Discourse on Docker for Windows work? .


(Ionuț Staicu) #11

Pretty late at the party, but… here is my experience with docker on windows: (tl;dr: don’t work. yet)

  1. Last Windows 10 update allows you to run windows executables from bash (and probably viceversa)
  2. So in theory you only need to replace all docker commands with docker.exe. Yay!
  3. Unfortunately, this won’t work though, because it seems that some paths are lost in translation. Nay!
/mnt/s/discourse$ ./bin/docker/boot_dev --init
Using source in: /mnt/s/discourse
Using data in:   /mnt/s/discourse/data/postgres
e5cc992eb5220a72c28016ea4c41de0a78cb3a37278be5284956047df63a11f4
Installing gems...
unable to setup input stream: unable to set IO streams as raw terminal: The handle is invalid.

So I tried to get all boot_dev commands converted to windows cmd (I’m assuming that the repo is cloned in s:\discourse):

mkdir "s:\discourse\data\postgres"
docker run -d -p 1080:1080 -p 3000:3000 -v "s:\discourse\data\postgres:/shared/postgres_data:delegated" -v "s:\discourse:/src:delegated" --hostname=discourse --name=discourse_dev --restart=always discourse/discourse_dev:release /sbin/boot
docker exec -it -u discourse:discourse discourse_dev /bin/bash -c "cd /src && ls -la && RAILS_ENV=development bundle install"

Until this point, I don’t get any errors. Things looks good!

Let’s do the migration:

docker exec -it -u discourse:discourse discourse_dev /bin/bash -c "cd /src && RUBY_GLOBAL_METHOD_CACHE_SIZE=131072 LD_PRELOAD=/usr/lib/libjemalloc.so RAILS_ENV=development bundle exec rake db:migrate"
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"?

Oh, no! Postgres is installed? Yes, it is! But for some reasons this is where i’m stuck. If I try to connect dirrectly fails, as the DB is not compatible:

λ postgres.exe --config-file=S:\discourse\data\postgres\postgresql.conf
2018-06-01 12:17:00.063 UTC [25588] LOG:  listening on IPv6 address "::1", port 5432
2018-06-01 12:17:00.064 UTC [25588] LOG:  listening on IPv4 address "127.0.0.1", port 5432
2018-06-01 12:17:00.073 UTC [25588] FATAL:  database files are incompatible with server
2018-06-01 12:17:00.073 UTC [25588] DETAIL:  The database cluster was initialized with USE_FLOAT8_BYVAL but the server was compiled without USE_FLOAT8_BYVAL.
2018-06-01 12:17:00.073 UTC [25588] HINT:  It looks like you need to recompile or initdb.
2018-06-01 12:17:00.076 UTC [25588] LOG:  database system is shut down

So I assume my version isn’t compatible with Discourse.

λ postgres.exe --version
postgres (PostgreSQL) 10.4

(also tried with 9.x but I had pretty much the same result)


Other stuff:

postgresql.conf have errors that are not compatible with Windows:

dynamic_shared_memory_type = posix	# the default is the first option


lc_monetary = 'en_US.UTF-8'			# locale for monetary formatting
lc_numeric = 'en_US.UTF-8'			# locale for number formatting
lc_time = 'en_US.UTF-8'				# locale for time formatting

So for now it’s a dead end for me. Maybe in the future i’ll have enough patience to go through all of these again, but today was enough :smiley: