-
-
Notifications
You must be signed in to change notification settings - Fork 724
Development Environment Setup: Windows
This guide will help you set up a development environment for OFN on Windows 10 or 11. It uses the Windows Subsystem for Linux, which uses virtualisation to run a Linux distribution (mostly) seamlessly within Windows. It is similar to a virtual machine, but with lower system resource usage and more integrated with the host OS.
WSL is usually included with Windows, but may be out of date. Older versions didn't have the ability to use systemd, the system that controls services in Ubuntu. To update WSL, open a command prompt as administrator and enter:
wsl --update
If this command fails, WSL may not be installed. You can install the current version from the Microsoft App Store.
Install the most recent LTS version of Ubuntu with
wsl --install -d Ubuntu
Open Ubuntu from your start menu. The first time you open it, you will need to configure a username and password. To configure Ubuntu to use systemd, enter the following in the Ubuntu shell
echo '[boot]' | sudo tee -a /etc/wsl.conf
echo 'systemd=true' | sudo tee -a /etc/wsl.conf
You will then need to restart WSL. From a command prompt as administrator:
wsl --shutdown
Then restart Ubuntu from the start menu.
You can now follow the instructions in the guide for Ubuntu from the Ubuntu shell. Note that you can install (some) GUI apps in the Ubuntu shell, including Chromium. The Ubuntu shell has its own IP address (different to the host Windows IP address) which can change, so it may be more convenient to run a copy of Chromium from Ubuntu for testing than to try to connect a Windows-installed browser to the dev server. Start Chromium with chromium &
.
You can access the Ubuntu file system from Windows at \\wsl$\Ubuntu
If you have RubyMine installed on your Windows host, you can debug projects installed on WSL. Start RubyMine and open the project from \\wsl$\Ubuntu\home\YOUR_USERNAME\openfoodnetwork. From File > Settings, navigate to Languages & Frameworks > Ruby SDK and Gems. Click the + icon and pick Remote Interpreter or Version Manager. Select WSL, then pick Ubuntu. The Ruby or version manager path is at /home/YOUR_USERNAME/.rbenv/bin/rbenv. Click OK then pick the correct version of Ruby from the list (3.0.3 at the time of writing). Lastly click the radio button next to the Remote-rbenv option you just created and then OK.
That loads the project correctly in RubyMine. To configure debugging, from Run > Edit Configurations... click + to add a new configuration. Choose Gem Command and set the following options:
- Gem name: foreman
- Executable name: foreman
- Arguments: start
- Environment variables: NODE_OPTIONS=--openssl-legacy-provider
You can name the configuration whatever you like. Click OK. You can now run the debug configuration and it will start the dev server on Ubuntu in WSL.
Development environment setup
- Pipeline development process
- Bug severity
- Feature template (epic)
- Internationalisation (i18n)
- Dependency updates
Development
- Developer Guidelines
- The process of review, test, merge and deploy
- Making a great commit
- Making a great pull request
- Code Conventions
- Database migrations
- Testing and Rspec Tips
- Automated Testing Gotchas
- Rubocop
- Angular and OFN
- Feature toggles
- Stimulus and Turbo
Testing
- Testing process
- OFN Testing Documentation (Handbooks)
- Continuous Integration
- Parallelized test suite with knapsack
- Karma
Releasing
Specific features
Data and APIs
Instance-specific configuration
External services
Design