| Summary: | Failed to wake up idled app via websocket request | ||
|---|---|---|---|
| Product: | OpenShift Online | Reporter: | chunchen <chunchen> |
| Component: | Containers | Assignee: | Jhon Honce <jhonce> |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | libra bugs <libra-bugs> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 2.x | CC: | wsun, xtian |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2013-10-17 13:29:35 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
|
Description
chunchen
2013-09-18 06:07:30 UTC
Feature enabled in https://github.com/openshift/origin-server/pull/3677 For testing you require a websocket enabled server and client...
Add dependency to package.json:
:
.
"dependencies": {
"ws" : ">0.4.30"
},
Replace server.js to support web sockets:
var host = process.env.OPENSHIFT_NODEJS_IP;
var port = process.env.OPENSHIFT_NODEJS_PORT || 8080;
var WebSocketServer = require('ws').Server,
wss = new WebSocketServer({host: host, port: port});
wss.on('connection', function(ws) {
ws.on('message', function(message) {
console.log('received: %s', message);
});
ws.send('something');
});
For a client:
wscat -c ws://node001-honcenet.dev.rhcloud.com:8000/ -p 8
Every message you type, should be logged in /var/lib/openshift/<uuid>/nodejs/logs/node.log.
Merged onto master by https://github.com/openshift/origin-server/pull/3688 It's fixed, verified on devenv_3817, please refer to the following results:
1. Create a nodejs app
rhc app create nod1 nodejs-0.6
2. Replace server.js to support web sockets:
var host = process.env.OPENSHIFT_NODEJS_IP;
var port = process.env.OPENSHIFT_NODEJS_PORT || 8080;
var WebSocketServer = require('ws').Server,
wss = new WebSocketServer({host: host, port: port});
wss.on('connection', function(ws) {
ws.on('message', function(message) {
console.log('received: %s', message);
});
ws.send('something');
});
3. Add dependency to package.json:
:
.
"dependencies": {
"ws" : ">0.4.30"
},
4. Push the changes
5. SSH into instance and idle this app
oo-admin-ctl-gears idlegear 52415129b723cc8c72000039
6. Access this app via websocket
wscat -c wss://nod1-cdm.dev.rhcloud.com:8443/ -p 8
or
wscat -c ws://nod1-cdm.dev.rhcloud.com:8000/ -p 8
7. Check the state of this app
# rhc app show -a nod1 --state
Cartridge nodejs-0.6 is started
|