Here are some rough notes on how I went about install Discourse on Bash for Windows:
Mostly a cut-and-paste job from our docker base image.
curl http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -sc)-pgdg main" | sudo tee /etc/apt/sources.list.d/postgres.list
sudo apt-get update
sudo apt-get install build-essential git build-essential git wget \
libxslt1-dev libcurl4-openssl-dev \
libssl-dev libyaml-dev libtool \
libxml2-dev gawk \
postgresql-client-9.5 libpq-dev libreadline-dev \
psmisc whois redis-server \
advancecomp jhead jpegoptim libjpeg-turbo-progs optipng libjemalloc-dev imagemagick
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
cd ~/.rbenv && src/configure && make -C src
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exit shell and start again so env is there.
rbenv install 2.3.1
echo 2.3.1 >> ~/.rbenv/version
Make this will take a while cause the filesystem is very slow.
This is required cause installing postgres is not yet supported.
git clone https://github.com/discourse/discourse.git
gem install bundler
# correct bundler permissions per http://stackoverflow.com/questions/37211007/installing-rails-on-ubuntu-bash-windows-10
chmod -R +t ~/.bundle/cache
Add the following into test and development sections:
redis-server --bind 0.0.0.0
bin/rake db:create db:migrate
At the end of this process Discourse running on Windows without ANY VM installed. This is quite impressive.
bundle exec puma
Discourse runs fine, its a little bit fiddly but all the gems install and the test suite runs.
Once booted up Discourse is quite fast and usable.
The filesystem mapping technology keeps the original files in an NTFS partition and performs internal mapping, pretending this filesystem is actually a Linux native one. Unfortunately NTFS + mapping overhead means that it is much slower than using ext4fs directly or some other native solution.
The effect of this in real terms is:
- Running our test suite is slower
Bash on Ubuntu on Windows takes 8:20 to run the test suite. My ubuntu VM takes 6:15. Same hardware.
- Installing ruby / gems and so on is a lot slower
Ruby has lots of little files, I did not time it but it feels at least twice slower to compile ruby from source.
- Booting Discourse takes more than twice longer:
# Linux VM
sam@ubuntu discourse % time bin/rails r "puts 'hi'"
# Bash on Ubuntu on Windows
sam@SAM-PC:~/discourse$ time bin/rails r "puts 'hi'"
7.12secs VS 3.05secs
This means that starting up a dev web server and opening up a rails console take much longer.
This is a huge issue, it is big enough for me to recommend against this setup for now.
There is an open ticket that once resolved will allow bash on Windows to run native filesystems, once that is implemented we should revisit these results:
Note: All tests were done on the beta version of Bash on Ubuntu on Windows that is bundled with Windows 10 anniversary edition (made public on 2nd of August 2016)