telepat-io / telepat-api

This is the Telepat API where HTTP calls are made. CRUD operations are not processed here directly. Messages are sent to the Telepat workers where CRUD operations are being taken care of along with client communication (notifications).
http://telepat.io
Other
332 stars 21 forks source link

Windows or Docker support for telepat-api #9

Open jakobrosenberg opened 8 years ago

jakobrosenberg commented 8 years ago

Does either exist?

andreimarinescu commented 8 years ago

@jakobrosenberg could you detail your question a bit? telepat-api is an Express NodeJS application, so it's compatible with both Windows and Docker deployments. We also ship Dockerfiles with each Telepat component, however the images available in the Docker Registry are a little old, so I'd recommend rebuilding from Dockerfile.

jakobrosenberg commented 8 years ago

That was swift, so excuse my late reply.

I've been trying to npm install to no avail. Countless compile errors.

I'll try cloning a fresh copy and see what errors I get and report them back here.

andreimarinescu commented 8 years ago

One issue to check here is your NodeJS version. Because we're still waiting on some of our dependencies to become compatible with the latest NodeJS versions, right now we're still doing most of our work on the 0.12 branch. Official tests with the LTS version are scheduled and should be coming in the week or so.

jakobrosenberg commented 8 years ago
PS C:\Users\jakob\www\kitchensink\telepati> git clone https://github.com/telepat-io/telepat-api.git
Cloning into 'telepat-api'...
remote: Counting objects: 2528, done.
Receiving objects: 100% (2528/2528), 525.51 KiB | 426.00 KiB/s, done.
Resolving deltas:  48% (801/1664)
Resolving deltas: 100% (1664/1664), done.
Checking connectivity... done.
PS C:\Users\jakob\www\kitchensink\telepati> cd .\telepat-api\
PS C:\Users\jakob\www\kitchensink\telepati\telepat-api> npm install
WARN engine elasticsearch@5.0.0: wanted: {"node":">=0.8 <=0.12","iojs":">=1.5"} (current: {"node":"4.2.6","npm":"2.14.12"})
npm WARN optional dep failed, continuing node-syslog@1.2.0

> bcrypt@0.8.5 install C:\Users\jakob\www\kitchensink\telepati\telepat-api\node_modules\bcrypt
> node-gyp rebuild

\
C:\Users\jakob\www\kitchensink\telepati\telepat-api\node_modules\bcrypt>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_mod
ules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  blowfish.cc
  bcrypt.cc
  bcrypt_node.cc
..\src\blowfish.cc(47): fatal error C1083: Cannot open include file: 'sys/types.h': No such file or directory [C:\Users\jakob\www\kitchensink\telepati\telepat-api\node_modules\bcrypt\bui
ld\bcrypt_lib.vcxproj]
c:\users\jakob\.node-gyp\4.2.6\include\node\uv-errno.h(25): fatal error C1083: Cannot open include file: 'errno.h': No such file or directory (compiling source file ..\src\bcrypt_node.cc
) [C:\Users\jakob\www\kitchensink\telepati\telepat-api\node_modules\bcrypt\build\bcrypt_lib.vcxproj]
..\src\bcrypt.cc(48): fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory [C:\Users\jakob\www\kitchensink\telepati\telepat-api\node_modules\bcrypt\build\bcr
ypt_lib.vcxproj]
gyp ERR! build error
 ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.11082
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
 C:\Users\jakob\www\kitchensink\telepati\telepat-api\node_modules\bcrypt
gyp ERR! node -v v4.2.6
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok

> hiredis@0.4.0 install C:\Users\jakob\www\kitchensink\telepati\telepat-api\node_modules\hiredis
> node-gyp rebuild

|
C:\Users\jakob\www\kitchensink\telepati\telepat-api\node_modules\hiredis>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_mo
dules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  sds.c
  read.c
  win_delay_load_hook.c
-..\..\deps\hiredis\read.c(34): fatal error C1083: Cannot open include file: 'string.h': No such file or directory [C:\Users\jakob\www\kitchensink\telepati\telepat-api\node_modules\hiredi

..\..\deps\hiredis\sds.c(31): fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory [C:\Users\jakob\www\kitchensink\telepati\telepat-api\node_modules\hiredis\
build\deps\hiredis-c.vcxproj]
C:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h(31): fatal error C1083: Cannot open include file: 'ctype.h': No such file or directory (compiling source file C:\Program Files\
nodejs\node_modules\npm\node_modules\node-gyp\src\win_delay_load_hook.c) [C:\Users\jakob\www\kitchensink\telepati\telepat-api\node_modules\hiredis\build\deps\hiredis-c.vcxproj]
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.11082
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\jakob\www\kitchensink\telepati\telepat-api\node_modules\hiredis
gyp ERR! node -v v4.2.6
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
-
> snappy@4.1.1 install C:\Users\jakob\www\kitchensink\telepati\telepat-api\node_modules\telepat-models\node_modules\kafka-node\node_modules\snappy
> node-gyp rebuild

C:\Users\jakob\www\kitchensink\telepati\telepat-api\node_modules\telepat-models\node_modules\kafka-node\node_modules\snappy>if not defined npm_config_node_gyp (node "C:\Program Files\node
js\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  snappy-sinksource.cc
  snappy-stubs-internal.cc
  snappy.cc
c:\users\jakob\www\kitchensink\telepati\telepat-api\node_modules\telepat-models\node_modules\kafka-node\node_modules\snappy\deps\snappy\snappy-1.1.2\snappy.h(42): fatal error C1083: Cann
ot open include file: 'stddef.h': No such file or directory (compiling source file ..\..\..\deps\snappy\snappy-1.1.2\snappy.cc) [C:\Users\jakob\www\kitchensink\telepati\telepat-api\node_
modules\telepat-models\node_modules\kafka-node\node_modules\snappy\build\deps\snappy\snappy.vcxproj]
..\..\..\deps\snappy\snappy-1.1.2\snappy-sinksource.cc(29): fatal error C1083: Cannot open include file: 'string.h': No such file or directory [C:\Users\jakob\www\kitchensink\telepati\te
lepat-api\node_modules\telepat-models\node_modules\kafka-node\node_modules\snappy\build\deps\snappy\snappy.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\crtdefs.h(10): fatal error C1083: Cannot open include file: 'corecrt.h': No such file or directory (compiling source file .
.\..\..\deps\snappy\snappy-1.1.2\snappy-stubs-internal.cc) [C:\Users\jakob\www\kitchensink\telepati\telepat-api\node_modules\telepat-models\node_modules\kafka-node\node_modules\snappy\bu
ild\deps\snappy\snappy.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.11082
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\jakob\www\kitchensink\telepati\telepat-api\node_modules\telepat-models\node_modules\kafka-node\node_modules\snappy
gyp ERR! node -v v4.2.6
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm ERR! Windows_NT 10.0.11082
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v4.2.6
npm ERR! npm  v2.14.12
npm ERR! code ELIFECYCLE

npm ERR! bcrypt@0.8.5 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt@0.8.5 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the bcrypt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls bcrypt
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\jakob\www\kitchensink\telepati\telepat-api\npm-debug.log
PS C:\Users\jakob\www\kitchensink\telepati\telepat-api> cd ..
PS C:\Users\jakob\www\kitchensink\telepati>
jakobrosenberg commented 8 years ago

I'll try remove some of the binary dependencies from the global dir and see if that helps.

andreimarinescu commented 8 years ago

The issue here is that our own dependencies are not installing correctly on node 4.2.6. You shouldn't have issues with the 0.12 branch of node. We'll try to prioritize proper support at least for the LTS versions of node.

jakobrosenberg commented 8 years ago

Was finally able to run npm install without getting the dreaded node-gyp errors.

PS C:\Users\jakob\www\kitchensink\telepati\telepat-api> npm install
npm WARN optional Skipping failed optional dependency /telepat-models/node-syslog:
npm WARN notsup Not compatible with your operating system or architecture: node-syslog@1.2.0

I then had to change the start script in package.json to node bin/www to make it work in Windows.

Then I get the following error:

PS C:\Users\jakob\www\kitchensink\telepati\telepat-api> npm run start

> telepat-api@0.2.8 start C:\Users\jakob\www\kitchensink\telepati\telepat-api
> node bin/www

module.js:338
    throw err;
          ^
Error: Cannot find module 'node-syslog'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
Mayhem93 commented 8 years ago

Unfortunately, we didn't do any tests under Windows. telepat-models dynamically loads every implemented loggers under telepat-models/lib/logger and syslogger is there (this should only work for Linux environments). node-syslog is an optional dependency that's why npm install passed.

It will be fixed sometime in the future so that platform dependent adapters will not crash telepat if used (but it should be fine if you load the adapter as long as it doesn't try to require the node package that's build upon, node-syslog in the case of the syslog adapter).

For a quick workaround, you can try to delete the _sysloglogger.js script as you'll never be using it.

jakobrosenberg commented 8 years ago

Thanks. I'll give it a try.

By the way, you might want to look at your npm start script and bin/www file if you're planning to support Windows.

Mayhem93 commented 8 years ago

node_syslog will be replaced by winston in the next release (which is a few days away) https://github.com/telepat-io/telepat-models/commit/0b3ed95004d2456d910564c4316d37c286a9fe52