Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## {{ UNRELEASED_VERSION }} - [{{ UNRELEASED_DATE }}]({{ UNRELEASED_LINK }})

* Updated Node support to include the latest minor versions for Node `23` (up to `23.8`), `22` (up to `22.14`), `20` (up to `20.18`), `19` (up to `19.9`), `18` (up to `18.20`), and `16` (up to `16.20`)

## v1.4.0 - [December 20, 2024](https://github.com/lando/node/releases/tag/v1.4.0)

* Added support for Node 23, 22 and 21. [#92](https://github.com/lando/node/issues/92)
Expand Down
32 changes: 31 additions & 1 deletion builders/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@ const _ = require('lodash');
// Constants
const supportedVersions = [
'23',
'23.8',
'23.7',
'23.6',
'23.5',
'23.4',
'23.3',
'23.2',
'23.1',
'22',
'22.14',
'22.13',
'22.12',
'22.11',
'22.10',
Expand All @@ -33,6 +38,15 @@ const supportedVersions = [
'21.2',
'21.1',
'20',
'20.18',
'20.17',
'20.16',
'20.15',
'20.14',
'20.13',
'20.12',
'20.11',
'20.10',
'20.9',
'20.8',
'20.7',
Expand All @@ -43,12 +57,23 @@ const supportedVersions = [
'20.2',
'20.1',
'19',
'19.9',
'19.8',
'19.7',
'19.6',
'19.5',
'19.4',
'19.3',
'19.2',
'19.1',
'18',
'18.20',
'18.19',
'18.18',
'18.17',
'18.16',
'18.15',
'18.14',
'18.13',
'18.12',
'18.11',
Expand All @@ -73,6 +98,7 @@ const supportedVersions = [
'17.2',
'17.1',
'16',
'16.20',
'16.19',
'16.18',
'16.17',
Expand Down Expand Up @@ -255,10 +281,14 @@ module.exports = {
options.ssl = true;
}

// Run as the node user if we can
// Determine the user to run as based on port requirements
if (_.min([options.port, options.sport]) >= 1024) {
// For ports 1024 and above, we can run as the node user
node.environment.LANDO_RESET_DIR = '/certs';
node.environment.LANDO_DROP_USER = 'node';
} else {
// For ports below 1024, we require root privileges to bind due to Linux's security restrictions
node.environment.LANDO_DROP_USER = 'root';
}

// Send it downstream
Expand Down
12 changes: 6 additions & 6 deletions examples/23/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ lando exec custom -- "curl http://localhost:3000 | grep tune"
# Should serve over https is ssl is set by user
lando exec custom -- "curl https://localhost | grep tune"

# Should servce over a custom https port if ssl is set to a specific port
# Should serve over a custom https port if ssl is set to a specific port
lando exec custom2 -- "curl https://localhost:4444 | grep DANCING"

# Should run as root if it needs to
lando exec defaults -- "ps -a -u root" | grep "node" | wc -l | grep 2
lando exec custom -- "ps -a -u root" | grep "node" | wc -l | grep 2
# Should run as root if using ports below 1024
lando exec defaults -- pgrep -c -u root -f "node src/app-http.js" | grep 1
lando exec custom -- pgrep -c -u root -f "node src/app-https.js" | grep 1

# Should run as node if it can
lando exec custom2 -- "ps -a -u node" | grep "node" | wc -l | grep 2
# Should run as node if using ports 1024 and above
lando exec custom2 -- pgrep -c -u node -f "node src/app-custom.js" | grep 1

# Should install global dependencies if specified by user and have them available in PATH
lando exec custom -- "gulp -v"
Expand Down
Loading