-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
60 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
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,18 @@ | ||
# kubectl warp NodeJS example | ||
This is an example of using `kubectl warp` for developing NodeJS app "real-time" in Kubernetes cluster. | ||
|
||
`kubectl warp` start temporary _Pod_ and keep your local files insync so that you can make changes to files locally, but run the actual code in the Kubernetes cluster. | ||
|
||
## Prerequisites | ||
- Install [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) | ||
- Install [kubectl warp](https://github.com/ernoaapa/kubectl-warp#install) | ||
|
||
Here we | ||
1. start official `node` Docker image in Kubernetes | ||
2. sync current directory to the container | ||
3. run `npm install` | ||
4. start watching changes with `npm run watch` command | ||
|
||
```shell | ||
kubectl warp -i -t --image node nodejs-example -- npm install && npm run watch | ||
``` |
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,6 @@ | ||
|
||
var startTime = new Date(); | ||
|
||
setInterval(function () { | ||
console.log('Hello world! (started at ' + startTime.toISOString() + ')') | ||
}, 1000); |
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,30 @@ | ||
{ | ||
"name": "kubectl-warp-example", | ||
"version": "1.0.0", | ||
"description": "Example NodeJS project for demostrating kubectl warp command", | ||
"main": "index.js", | ||
"scripts": { | ||
"start": "node index.js", | ||
"watch": "nodemon index.js", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/ernoaapa/kubectl-warp.git" | ||
}, | ||
"keywords": [ | ||
"kubernetes", | ||
"kubectl", | ||
"warp", | ||
"rsync" | ||
], | ||
"author": "Erno Aapa <[email protected]>", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/ernoaapa/kubectl-warp/issues" | ||
}, | ||
"homepage": "https://github.com/ernoaapa/kubectl-warp#readme", | ||
"dependencies": { | ||
"nodemon": "^1.18.9" | ||
} | ||
} |