Heroku もかつては使えなかった WebSocket。Deis も v1 の最初期は使えなかったようだが、比較的早い時期にパッチが当たったらしい1。
さて、Deis は v2 になって、下層が Fleet から K8s へ変更になった。
しかし、PaaS を構成するコンテナ群には大きな変更はなく、同様に WebSocket 対応されているはず。
でも、未確認で作業を始めたあとに「実は未対応でした」となると手戻りが大きいので、試してみる。
結論から言うと、対応している。
作業ログは下記の通り。
(Heroku で Websockets with Node.js をはじめるためのメモ を参考にした。)
$ git clone https://github.com/heroku-examples/node-ws-test.git
Cloning into 'node-ws-test'...
remote: Counting objects: 41, done.
remote: Total 41 (delta 0), reused 0 (delta 0), pack-reused 41
Unpacking objects: 100% (41/41), done.
Checking connectivity... done.
$ cd node-ws-test/
$ deis create node-ws-test
Creating Application... done, created node-ws-test
Git remote deis added
remote available at ssh://git@deis-builder.deis.mo*****:2222/node-ws-test.git
$ git add .
$ git commit -m "Ready to deploy"
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
$ git push deis master
Counting objects: 41, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (39/39), done.
Writing objects: 100% (41/41), 5.24 KiB | 0 bytes/s, done.
Total 41 (delta 17), reused 0 (delta 0)
Starting build... but first, coffee!
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NPM_CONFIG_PRODUCTION=true
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): 0.10.x
engines.npm (package.json): unspecified (use default)
Resolving node version 0.10.x via semver.io...
Downloading and installing node 0.10.46...
Using default npm version: 2.15.1
-----> Restoring cache
Skipping cache restore (new runtime signature)
-----> Building dependencies
Pruning any extraneous modules
Installing node modules (package.json)
> ws@0.4.32 install /tmp/build/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)
make: Entering directory `/tmp/build/node_modules/ws/build'
CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
SOLINK_MODULE(target) Release/obj.target/bufferutil.node
COPY Release/bufferutil.node
CXX(target) Release/obj.target/validation/src/validation.o
SOLINK_MODULE(target) Release/obj.target/validation.node
COPY Release/validation.node
make: Leaving directory `/tmp/build/node_modules/ws/build'
express@4.14.0 node_modules/express
├── escape-html@1.0.3
├── array-flatten@1.1.1
├── utils-merge@1.0.0
├── cookie-signature@1.0.6
├── merge-descriptors@1.0.1
├── methods@1.1.2
├── fresh@0.3.0
├── path-to-regexp@0.1.7
├── vary@1.1.0
├── encodeurl@1.0.1
├── range-parser@1.2.0
├── parseurl@1.3.1
├── content-type@1.0.2
├── etag@1.7.0
├── cookie@0.3.1
├── content-disposition@0.5.1
├── serve-static@1.11.1
├── depd@1.1.0
├── qs@6.2.0
├── on-finished@2.3.0 (ee-first@1.1.1)
├── finalhandler@0.5.0 (unpipe@1.0.0, statuses@1.3.0)
├── debug@2.2.0 (ms@0.7.1)
├── proxy-addr@1.1.2 (forwarded@0.1.0, ipaddr.js@1.1.1)
├── send@0.14.1 (destroy@1.0.4, ms@0.7.1, statuses@1.3.0, mime@1.3.4, http-errors@1.5.0)
├── accepts@1.3.3 (negotiator@0.6.1, mime-types@2.1.11)
└── type-is@1.6.13 (media-typer@0.3.0, mime-types@2.1.11)
ws@0.4.32 node_modules/ws
├── tinycolor@0.0.1
├── commander@2.1.0
├── options@0.0.6
└── nan@1.0.0
-----> Caching build
Clearing previous node cache
Saving 2 cacheDirectories (default):
- node_modules
- bower_components (nothing to cache)
-----> Build succeeded!
├── express@4.14.0
└── ws@0.4.32
-----> Discovering process types
Default process types for Node.js -> web
-----> Compiled slug size is 7.3M
Build complete.
Launching App...
...
...
...
...
Done, node-ws-test:v2 deployed to Deis
Use 'deis open' to view this application in your browser
To learn more, use 'deis help' or visit https://deis.com/
To ssh://git@deis-builder.deis.mo*****:2222/node-ws-test.git
* [new branch] master -> master
$
-
Deis v1 での動作は未確認。 ↩