https://github.com/atomantic/hapi_playground
Playground and testbed for Hapi server
https://github.com/atomantic/hapi_playground
Last synced: 10 months ago
JSON representation
Playground and testbed for Hapi server
- Host: GitHub
- URL: https://github.com/atomantic/hapi_playground
- Owner: atomantic
- Created: 2014-09-17T18:28:58.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2018-07-25T21:17:32.000Z (almost 8 years ago)
- Last Synced: 2025-02-01T03:43:06.338Z (over 1 year ago)
- Language: JavaScript
- Size: 18.6 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Hapi.js Playground
## Testing PM2 issue 744
https://github.com/Unitech/PM2/issues/744
Currently testing PM2 watch with Hapi on CentOS 6.5 (seems to be working on OSX fine)
```
# setup
npm install git://github.com/Unitech/pm2#master -g
node -v # should be 0.10.32
pm2 -v # should be 0.11.0
tail -f ~/.pm2/pm2.log&
# app
git clone git://github.com/atomantic/hapi_playground.git
cd hapi_playground
npm install
pm2 start process.json
# test
curl -m 5 http://localhost:46100
sed -i 's/Hello Hapi/Hello Hapi 1/' index.js
curl -m 5 http://localhost:46100
sed -i 's/Hello Hapi 1/Hello Hapi 2/' index.js
curl -m 5 http://localhost:46100
```
So far, all good...
But now, let's wipe it and try again...
```
pm2 kill;
cd ../;
rm -rf hapi_playground;
git clone git://github.com/atomantic/hapi_playground.git
cd hapi_playground
npm install
pm2 start process.json
curl -m 5 http://localhost:46100
sed -i 's/Hello Hapi/Hello Hapi 1/' index.js
curl -m 5 http://localhost:46100
```
This time the curl fails:
```
curl: (28) Operation timed out after 5000 milliseconds with 0 bytes received
```
If it doesn't, let's try another modification:
Let's add memcached:
```
pm2 kill
git checkout index.js;
sed -i 's/\/\/var memcached/var memcached/' index.js
pm2 start process.json
curl -m 5 http://localhost:46100
sed -i 's/Hello Hapi/Hello Hapi 1/' index.js
curl -m 5 http://localhost:46100
```
Curls should work without returning (do they?):
```
curl: (28) Operation timed out after 5000 milliseconds with 0 bytes received
```
## Testing memory leaks (OSX)
```
git clone git://github.com/atomantic/hapi_playground.git
cd hapi_playground
npm install
npm install -g pm2 node-inspector
gulp test
pm2 start process.json
pm2 monit
```
in another terminal type
```
brew install watch
watch curl http://localhost:3666
```
see if the memory increases on every request
## or Debug
```
node --debug index.js && node-inspector
open http://127.0.0.1:8080/debug?port=5858
```
https://github.com/felixge/node-memory-leak-tutorial