explicitClick to confirm you are 18+

How to Set Up a Minds Development Environment on Windows 10

JimOct 1, 2019, 10:14:48 PM
thumb_up148thumb_downmore_vert

This post offers a step-by-step guide on how to set up a Minds development environment on Windows 10.  Due to the current set-up of the Minds docker containers utilizing mounted volumes this can prove a bit tricky under Windows.  This guide assumes you have access to a version of Windows 10 that supports the Windows Subsystem for Linux (WSL).  WSL requires a 64-bit version of Windows 10.

Requirements

1) Windows 10 (64-bit) and WSL (Optional: WSL2, see below)

2) Minds Development Requirements


1) Install WSL

(Optional: there may be some performance gains by using WSL2, but this requires upgrading to an insider fast lane build of Windows.  Personally I use WSL2 but this guide will work for WSL just as well.  Follow this guide to install WSL2)

Follow the steps in this guide choosing the latest Ubuntu LTS.  As of this writing I am using Ubuntu 18.04 LTS.

Once installed you can open the Ubuntu "app" and you are presented with a full Ubuntu terminal.


2) Install Docker under WSL

This step is important!  The recommended way to develop for Minds is to set up a Docker development environment.  Unfortunately mounted volumes don't play well on a Windows environment and they also don't play well if mounted from a drive that was mounted from Windows into WSL.  This may sound confusing but it comes down to Docker not playing well with the Windows filesystem.  What we need to do instead is install Minds under a directory that isn't mounted from a Windows drive.  To do this, we need to install Docker in WSL rather than use Docker Desktop or Docker Toolbox.  You could alternatively set up a Linux VM on which to install Docker but the added layer of complexity is a headache I'd rather not deal with.

Follow the official Docker CE for Ubuntu installation guide to install Docker on WSL Ubuntu.

After you've installed Docker on Ubuntu you'll need to start the Docker service each time WSL boots up (WSL will stay up after you first open a terminal window until explicitly shutdown or you reboot).  You can follow parts of this guide starting with "Starting Docker’s Service with Windows" to automatically start Docker.  I personally did not set up the Docker service to start with Windows startup but that part is up to your personal preferences.


3) Set Up the Minds Development Environment in WSL

The important part of this section is where we install the Minds project.  WSL will automatically mount all of your Windows drives under /mnt/[drive letter] e.g. the C:\ drive is accessible as /mnt/c.


The directories highlighted in green are mounted from Windows.

We DO NOT want to install Minds under any of these Windows-mounted drives as it will cause issues during the Minds installation process.

Personally, I installed Minds under ~/dev/minds.

Making sure the Docker service is running, follow the full development installation guide for Minds keeping in mind that we are installing it to a Linux environment (and don't skip the setting up elasticsearch step.)


4) Set up VSCode to connect to WSL

Visual Studio Code is a free and open source editor from Microsoft that runs on Windows, Mac, and Linux.  You may have noticed that we've installed Minds under a directory that is inaccessible to Windows.  If you're thinking this means you need to develop using a Linux environment allow me to introduce you do VSCode's WSL development feature.

IMPORTANT: Install Visual Studio Code under Windows.

After installation, and if you still have your WSL engine running, VSCode will detect WSL and ask to connect.  Each time you open VSCode it will connect automatically.  You can open a terminal with [Ctrl + Shift + `].  Navigate to where you installed Minds (e.g. ~/dev/minds) and type the following:

code .

VSCode will automatically connect to these directories and allow you to modify these files under Windows.


5) Wrapping Up

You may notice that VSCode complains about too many files being watched.  This is because all of the third party libraries used are being watched by the editor.  This is completely unnecessary and a cause for performance issues.  To fix this do the following:

1) Follow the link in the pop-up for instructions on how to increase the number of file watches allowed by VSCode.

2) Hide third party dependency folders such as /node_modules and /vendor from VSCode.  To do so go to File -> Preferences -> Settings. Type in "files:exclude" and set it up to match this screenshot:


That's it!  You should be good to go with a fully functional Minds development environment on Windows*! (* with a little Linux help)
Thanks for reading and if you have any feedback or run into trouble let me know in the comments below.
Happy coding!