So you want to set up development environment for Discourse on Windows 10? You can do it easily using Windows Subsystem for Linux feature. It is faster too .
This setup needs Windows 10 Anniversary Update. We’ll assume that you already installed Windows Subsystem for Linux (Ubuntu) on your Windows 10 system. Let’s begin!
Initially follow the steps from the topic Beginners Guide to Install Discourse on Ubuntu for Development until the step Clone Discourse.
Before setting up the database you have to start PostgreSQL service & Redis server manually using following commands
sudo service postgresql start redis-server --daemonize yes
Then go through the remaining steps.
Now your development environment is almost ready. The only problem is every time when you open Ubuntu on Windows you have to start PostgreSQL service & Redis server manually. Don’t worry we can have a work around for this by creating a custom command .
Create a new file using the command
nano start-discourse and paste the content below then save and exit.
#!/bin/bash # to start PostgreSQL sudo service postgresql start # to start redis server redis-server --daemonize yes
Now modify the CHMOD using below command
chmod +x start-discourse
And copy the file to your bin folder
sudo cp start-discourse /usr/bin/
It’s done. Now whenever you open the Ubuntu bash just run the command below and start developing