-
-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for node 14 and 16, mark older versions legacy #66
Merged
reynoldsalec
merged 14 commits into
lando:main
from
badrange:feature/support-node-14-16
Nov 23, 2021
Merged
Changes from 12 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
b4b3a0c
Add support for node 14 and 16, remove some stone age node configs
badrange c32364c
Mark node 12 also as legacy
badrange 0e26ae5
Set node 14 as default version for now
badrange 934c4aa
Use a patch version of node that actually exists
badrange cc4445a
Upgrade dependencies to the most recent for node 14
badrange 5c63fd0
Add an example for node16
badrange e6bc595
Use correct node versions in README
badrange 45ade27
Add node 16.13 point version
badrange 4175e74
Add all node tests to github workflow
badrange 906e5e7
Node 16 README should have 16 in header so that leia can generate nod…
badrange 2456e5e
Make node 16 custom config use node 17 like we do in the test
badrange b03ab87
Add node 17 to list of supported version so that brave people can wor…
badrange 2c23673
Add node-10-example test back
badrange e6f7bc2
Node10 test should use node10 and not the new default node version
badrange File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
nodejs 12.16.1 | ||
nodejs 14.18.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name: solo-base | ||
services: | ||
node: | ||
type: node:12 | ||
type: node:14 | ||
tooling: | ||
node: | ||
service: node |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
*.log | ||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: lando-node-14 | ||
services: | ||
defaults: | ||
type: node:14 | ||
build: | ||
- yarn | ||
command: /app/node_modules/.bin/nodemon src/app-http.js --watch src --ignore *.test.js | ||
cli: | ||
type: node | ||
compass: | ||
type: node:14 | ||
globals: | ||
grunt-cli: latest | ||
build_as_root: | ||
- apt-get update -y | ||
- apt-get install ruby-full -y | ||
- gem install compass | ||
custom: | ||
type: node:16 | ||
ssl: true | ||
globals: | ||
gulp-cli: latest | ||
port: 3000 | ||
build: | ||
- yarn | ||
command: /app/node_modules/.bin/nodemon src/app-https.js --watch src --ignore *.test.js | ||
custom2: | ||
type: node:14.18 | ||
ssl: 4444 | ||
port: 3000 | ||
build: | ||
- yarn | ||
command: /app/node_modules/.bin/nodemon src/app-custom.js --watch src --ignore *.test.js | ||
patch: | ||
type: node:14.18.1 | ||
tooling: | ||
ruby: | ||
service: compass | ||
compass: | ||
service: compass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
Node 14 Example | ||
=============== | ||
|
||
This example exists primarily to test the following documentation: | ||
|
||
* [Node 14-16 Service](https://docs.devwithlando.io/tutorials/node.html) | ||
* [Installing compass in your node service](https://docs.lando.dev/guides/using-compass-on-a-lando-node-service.html) | ||
|
||
Start up tests | ||
-------------- | ||
|
||
Run the following commands to get up and running with this example. | ||
|
||
```bash | ||
# Should start up successfully | ||
lando poweroff | ||
lando start | ||
``` | ||
|
||
Verification commands | ||
--------------------- | ||
|
||
Run the following commands to validate things are rolling as they should. | ||
|
||
```bash | ||
# Should use 14.x as the default version | ||
lando ssh -s defaults -c "env | grep NODE_VERSION=14." | ||
|
||
# Should use a user specified version if given | ||
lando ssh -s custom -c "env | grep NODE_VERSION=16." | ||
|
||
# Should use a user specified patch version if given | ||
lando ssh -s patch -c "env | grep NODE_VERSION=14.18.1" | ||
|
||
# Should serve over port 80 by default | ||
lando ssh -s defaults -c "curl http://localhost | grep tune" | ||
|
||
# Should set NODE_EXTRA_CA_CERTS with lando domain CA | ||
lando ssh -s defaults -c \'env | grep NODE_EXTRA_CA_CERTS | grep "$LANDO_CA_CERT"\' | ||
|
||
# Should only serve over http by default | ||
lando ssh -s defaults -c "curl https://localhost" || echo $? | grep 1 | ||
|
||
# Should serve over specified ports if given | ||
lando ssh -s custom -c "curl http://localhost:3000 | grep tune" | ||
|
||
# Should serve over https is ssl is set by user | ||
lando ssh -s custom -c "curl https://localhost | grep tune" | ||
|
||
# Should servce over a custom https port if ssl is set to a specific port | ||
lando ssh -s custom2 -c "curl https://localhost:4444 | grep DANCING" | ||
|
||
# Should run as root if it needs to | ||
lando ssh -s defaults -c "ps -a -u root" | grep "node" | wc -l | grep 2 | ||
lando ssh -s defaults -c "ls -lsa /certs" | grep "root root" | wc -l | grep 10 | ||
lando ssh -s custom -c "ps -a -u root" | grep "node" | wc -l | grep 2 | ||
lando ssh -s custom -c "ls -lsa /certs" | grep "root root" | wc -l | grep 10 | ||
|
||
# Should run as node if it can | ||
lando ssh -s custom2 -c "ps -a -u node" | grep "node" | wc -l | grep 2 | ||
lando ssh -s custom2 -c "ls -lsa /certs" | grep "node" | wc -l | grep 8 | ||
|
||
# Should install global dependencies if specified by user and have them available in PATH | ||
lando ssh -s custom -c "gulp -v" | ||
lando ssh -s custom -c "which gulp | grep /var/www/.npm-global" | ||
|
||
# Should PATH prefer node dependency binaries installed in /app/node_modules over global ones | ||
lando ssh -s custom -c "npm install gulp-cli --no-save" | ||
lando ssh -s custom -c "gulp -v" | ||
lando ssh -s custom -c "which gulp | grep /app/node_modules/.bin" | ||
lando ssh -s custom -c "npm uninstall gulp-cli" | ||
lando ssh -s custom -c "which gulp | grep /var/www/.npm-global" | ||
|
||
# Should not serve port for cli | ||
lando ssh -s cli -c "curl http://localhost" || echo $? | grep 1 | ||
|
||
# Should install ruby and compass on the compass service | ||
lando ruby -v | ||
lando compass -v | ||
``` | ||
|
||
Destroy tests | ||
------------- | ||
|
||
Run the following commands to trash this app like nothing ever happened. | ||
|
||
```bash | ||
# Should be destroyed with success | ||
lando destroy -y | ||
lando poweroff | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"name": "node-lando", | ||
"version": "1.0.0", | ||
"description": "Node example for Lando", | ||
"main": "app.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/lando/lando/tree/master/examples/node" | ||
}, | ||
"keywords": [ | ||
"node", | ||
"docker", | ||
"localdev" | ||
], | ||
"author": "Mike Pirog", | ||
"license": "MIT", | ||
"dependencies": { | ||
"express": "^4.15.3" | ||
}, | ||
"devDependencies": { | ||
"grunt-contrib-compass": "^1.1.1", | ||
"nodemon": "^2.0.15" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* Lando node express example | ||
* | ||
* @name taylorswift | ||
*/ | ||
|
||
'use strict'; | ||
|
||
// Load modules | ||
const fs = require('fs'); | ||
const http = require('http'); | ||
const https = require('https'); | ||
const express = require('express'); | ||
const app = express(); | ||
|
||
// Create our HTTPS server options | ||
const key = fs.readFileSync('/certs/cert.key'); | ||
const cert = fs.readFileSync('/certs/cert.crt'); | ||
|
||
// Create our servers | ||
https.createServer({key, cert}, app).listen(4444); | ||
http.createServer(app).listen(3000); | ||
|
||
// Basic HTTP response | ||
app.get('/', (req, res) => { | ||
res.header('Content-type', 'text/html'); | ||
return res.end('<h1>DANCING DANCING STARLIGHT</h1>'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* Lando node express example | ||
* | ||
* @name taylorswift | ||
*/ | ||
|
||
'use strict'; | ||
|
||
// Load modules | ||
const http = require('http'); | ||
const express = require('express'); | ||
const app = express(); | ||
|
||
// Create our server | ||
http.createServer(app).listen(80); | ||
|
||
// Basic HTTP response | ||
app.get('/', (req, res) => { | ||
res.header('Content-type', 'text/html'); | ||
return res.end('<h1>I said "Oh my!" What a marvelous tune!!!</h1>'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* Lando node express example | ||
* | ||
* @name taylorswift | ||
*/ | ||
|
||
'use strict'; | ||
|
||
// Load modules | ||
const fs = require('fs'); | ||
const http = require('http'); | ||
const https = require('https'); | ||
const express = require('express'); | ||
const app = express(); | ||
|
||
// Create our HTTPS server options | ||
const key = fs.readFileSync('/certs/cert.key'); | ||
const cert = fs.readFileSync('/certs/cert.crt'); | ||
|
||
// Create our servers | ||
https.createServer({key, cert}, app).listen(443); | ||
http.createServer(app).listen(3000); | ||
|
||
// Basic HTTP response | ||
app.get('/', (req, res) => { | ||
res.header('Content-type', 'text/html'); | ||
return res.end('<h1>I said "Oh my!" What a marvelous tune!!!</h1>'); | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spoke with Pirog and he wants us to keep all the legacy version options available/tested. Let's keep the node-10-example tests @badrange
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, makes sense! I pushed an update, let's hope the CI/CD pipeline works.