From c0bea125e65706e3f247bc585abb3655782d2dab Mon Sep 17 00:00:00 2001 From: David Cook Date: Tue, 7 Feb 2023 21:48:59 +1100 Subject: [PATCH] Recommend using Nodenv for development environments As per https://github.com/openfoodfoundation/openfoodnetwork/pull/10366 --- Development-Environment-Setup:-OS-X.md | 24 +++++++++++++++++------- Development-Environment-Setup:-Ubuntu.md | 2 ++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/Development-Environment-Setup:-OS-X.md b/Development-Environment-Setup:-OS-X.md index 8e65ca5..fc4537b 100644 --- a/Development-Environment-Setup:-OS-X.md +++ b/Development-Environment-Setup:-OS-X.md @@ -112,15 +112,25 @@ OFN will require a specific version of Ruby. The ruby version required is stored If you are still getting openssl issues here despite installing rvm with autolibs enabled, see the troubleshooting section below. -## Step 7. Verify environment +## Step 7. Installing the required version of Node +It's recommended to use [Nodenv](https://github.com/nodenv/nodenv) to manage the Node version, based on the `.node-version` file. + +Use the [installation instructions in the readme](https://github.com/nodenv/nodenv#installation), ensuring you follow all steps. + +Once installed, you can install the current version: + + $ nodenv install + +## Step 8. Verify environment Run each of the following just to check that you get sensible numbers out of each of them: $ git --version $ rvm -v $ ruby -v + $ node -v -## Step 8: Installing And Setting up Postgres +## Step 9: Installing And Setting up Postgres We now have ruby and rails installed, but we still require postgres, which can be installed with Homebrew: $ brew update @@ -134,7 +144,7 @@ Postgres can be stopped with: `$ brew services stop postgresql` but don't do thi If, for some reason, this doesn't work for you, see how to manage postgres with lunchy at the troubleshooting section at the bottom of this page. -## Step 9. Adding OFN users (roles) to postgres +## Step 10. Adding OFN users (roles) to postgres Postgres should have been set up with your current user as the default postgres admin user, meaning that you should be able to set up new postgres users directly in the command prompt. YOU MAY NEED TO RESTART TERMINAL HERE. You are good to go if: $ which createuser @@ -153,7 +163,7 @@ Next add the development and test databases (open_food_network_dev and open_food $ createdb open_food_network_dev --owner=ofn $ createdb open_food_network_test --owner=ofn -## Step 10. Redis +## Step 11. Redis Now, we need to install Redis for Sidekiq to store background jobs. You can do so with: @@ -166,7 +176,7 @@ Like we did with postgres, you should be able to start the redis server with lau $ brew services start redis -## Step 10. Other things you should install +## Step 12. Other things you should install Headless Chrome: make sure Google Chrome is installed so that you can run feature tests. @@ -179,7 +189,7 @@ Karma: a test runner for pure javascript (which we use to test our AngularJS) [Karma Guide](https://github.com/openfoodfoundation/openfoodnetwork/wiki/Karma) -## Step 11. Done +## Step 13. Done Now you are ready to follow the [GETTING STARTED guide](https://github.com/openfoodfoundation/openfoodnetwork/blob/master/GETTING_STARTED.md) # Troubleshooting @@ -278,4 +288,4 @@ You should now be able to start the postgres server with: $ lunchy start postgres -Postgres can be stopped with: `$ lunchy stop postgres` but don't do this now. \ No newline at end of file +Postgres can be stopped with: `$ lunchy stop postgres` but don't do this now. diff --git a/Development-Environment-Setup:-Ubuntu.md b/Development-Environment-Setup:-Ubuntu.md index 70eefcc..4be1d9c 100644 --- a/Development-Environment-Setup:-Ubuntu.md +++ b/Development-Environment-Setup:-Ubuntu.md @@ -6,6 +6,8 @@ This section is based on instructions [here (22.04)](https://gorails.com/setup/u The version of Ruby used in OFN is [shown here](https://github.com/openfoodfoundation/openfoodnetwork/blob/master/.ruby-version). At the time of writing it is 3.0.3. If it has changed, the commands below starting with `rbenv` will need to be adjusted ([and this guide updated](https://github.com/openfoodfoundation/openfoodnetwork/blob/master/CONTRIBUTING.md)). +The version of Node is [shown here](https://github.com/openfoodfoundation/openfoodnetwork/blob/master/.node-version). It's recommended to install [nodenv](https://github.com/nodenv/nodenv) to ensure you have the matching version (please update this page if you do it successfully). Alternatively you can install as per below. + sudo apt install curl curl -sL https://deb.nodesource.com/setup_lts.x | sudo -E bash - curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -