Finally, I started working on openshift, albeit with the simplest configuration. Here are the basic steps:
- Use the openshift cartridge
DIYto get websocket support, which provides an external port 8000and is redirected to the internal port 8080to the virtual IP address specified OPENSHIFT_DIY_IP. - mosquitto ,
config.mk, openshift: WITH_TLS, WITH_TLS_PSK, WITH_THREADING, WITH_BRIDGE, WITH_SRV, WITH_UUID, WITH_DOCS, WITH_SOCKS. Makefile mosquitto, DOCSDIR. , WITH_DOCS , DOCSDIR.WITH_WEBSOCKETS config.mk.src/webockets.c. mosq_websockets_init() 625 info.iface = listener->host; , info.user = user;. , IP- . mosquitto 0.0.0.0 IP-. , libwebosockets.libwebsockets libwebsockets-devel.make, .- , mosquitto
../mosrun. . make prefix= DESTDIR=$(pwd)/../mosrun install. ../mosrun sbin. cd ../mosrun/sbin cp /usr/lib/libwebsockets.so.7 .. libwebsockets lib.https://github.com/jpmens/simple-mqtt-websocket-example. mosrun/sbin/simpleweb.mosrun/sbin/simpleweb/config.js, , DIY, 8000. javascript DIY- .- mosquitto
mosrun/sbin/mosquitto.conf, : listener 8080 <OPENSHIFT_DIY_IP>, protocol websockets, http_dir simpleweb connection_messages. IP- DIY <OPENSHIFT_DIY_OP>. - -.
- DIY , .
- openshift
.openshift/action_hooks/start .../stop, . . , . - mosquitto
mosrun/sbin. LD_LIBRARY_PATH=. ./mosquitto -c mosquitto.conf -v, mosquitto.diy-yourdomain.rhcloud.com:8000/index.html. mqtt websockets, jpmen github repo.
DIY git. -, . script, , config.js mosquitto.conf .
, : jpman .