-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for node 14 and 16, mark older versions legacy (#66)
* Add support for node 14 and 16, remove some stone age node configs * Mark node 12 also as legacy * Set node 14 as default version for now * Use a patch version of node that actually exists * Upgrade dependencies to the most recent for node 14 * Add an example for node16 * Use correct node versions in README * Add node 16.13 point version * Add all node tests to github workflow * Node 16 README should have 16 in header so that leia can generate node16 test * Make node 16 custom config use node 17 like we do in the test * Add node 17 to list of supported version so that brave people can work with dev versions of node * Add node-10-example test back * Node10 test should use node10 and not the new default node version
- Loading branch information
Showing
24 changed files
with
3,539 additions
and
9 deletions.
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
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.