Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mongoose, Mongodb, Mockgoose, etc use kerberos 0.0.X and that requires libkrb5-dev #71

Closed
franky-continu opened this issue Dec 3, 2015 · 9 comments

Comments

@franky-continu
Copy link

Hi my builds are failing because I cannot build kerberos on the docker image as libkrb5-dev is missing. I've collected this info while researching the issue, I'm not an expert on kerberos or anything like it.

Seems to be a pretty common library.

@Starefossen
Copy link
Member

@franky-continu can you post your Dockerfile? Which image tag are you using?

@franky-continu
Copy link
Author

my docker file which works perfectly on all other nodejs projects but this one has something that is not letting me off the hook:

FROM node:onbuild
EXPOSE 8080

I get
npm WARN EPEERINVALID [email protected] requires a peer of kerberos@~0.0 but none was installed.

and then my tests just hang and timeout on a Company.create (mongoose schema call)

Continu API listening at http://[::]:4568
TESTS-CONFIGURING
1) "before all" hook
0 passing (2s)
1 failing
1) TESTS-CONFIGURING "before all" hook:
Error: timeout of 2000ms exceeded. Ensure the done() callback is being called in this test.

but locally, when kerberos is built:

---------------

> [email protected] install /Users/franky/Workspace/continu/continu-api/node_modules/kerberos
> (node-gyp rebuild) || (exit 0)

  CXX(target) Release/obj.target/kerberos/lib/kerberos.o
  CXX(target) Release/obj.target/kerberos/lib/worker.o
  CC(target) Release/obj.target/kerberos/lib/kerberosgss.o
../lib/kerberosgss.c:509:13: warning: implicit declaration of function 'gss_acquire_cred_impersonate_name' is invalid in C99 [-Wimplicit-function-declaration]
        maj_stat = gss_acquire_cred_impersonate_name(&min_stat,
                   ^
1 warning generated.
  CC(target) Release/obj.target/kerberos/lib/base64.o
  CXX(target) Release/obj.target/kerberos/lib/kerberos_context.o
  SOLINK_MODULE(target) Release/kerberos.node

> [email protected] install /Users/franky/Workspace/continu/continu-api/node_modules/bcrypt
> node-gyp rebuild

  CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
  CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o
  CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt_node.o
  SOLINK_MODULE(target) Release/bcrypt_lib.node

all tests run fine.

Now when I try to install kerberos in the docker image:

FROM node:onbuild
RUN apt-get update && apt-get install -y --no-install-recommends libkrb5-dev libgssapi-krb5-2
EXPOSE 8080

or

FROM node:5.1.0
RUN apt-get update && apt-get install -y --no-install-recommends libkrb5-dev

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

ONBUILD COPY package.json /usr/src/app/
ONBUILD RUN npm install
ONBUILD COPY . /usr/src/app
EXPOSE 8080
CMD [ "npm", "start" ]

if fails by:

/usr/bin/ld: cannot find -lkrb5
/usr/bin/ld: cannot find -lgssapi_krb5

> [email protected] postinstall /usr/src/app/node_modules/mongodb-prebuilt
> node install.js
/usr/src/app/node_modules/mongodb-download/index.js:127
throw new Error("unsupported release of Debian " + os.release);

and:

Status: Downloaded newer image for node:5.1.0
---> b32eea429a1a
Step 1 : RUN apt-get update && apt-get install -y --no-install-recommends libkrb5-dev
---> Running in b61ee612af65
Get:1 http://security.debian.org jessie/updates InRelease [63.1 kB]
Ign http://httpredir.debian.org jessie InRelease
Get:2 http://httpredir.debian.org jessie-updates InRelease [136 kB]
Get:3 http://httpredir.debian.org jessie Release.gpg [2373 B]
Get:4 http://security.debian.org jessie/updates/main amd64 Packages [207 kB]
Get:5 http://httpredir.debian.org jessie Release [148 kB]
Get:6 http://httpredir.debian.org jessie-updates/main amd64 Packages [3619 B]
Get:7 http://httpredir.debian.org jessie/main amd64 Packages [9035 kB]
Fetched 9596 kB in 4s (2224 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
Suggested packages:
krb5-doc
The following NEW packages will be installed:
libkrb5-dev
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 42.2 kB of archives.
After this operation, 92.2 kB of additional disk space will be used.
Get:1 http://security.debian.org/ jessie/updates/main libkrb5-dev amd64 1.12.1+dfsg-19+deb8u1 [42.2 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 42.2 kB in 0s (175 kB/s)
Selecting previously unselected package libkrb5-dev.
(Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 21063 files and directories currently installed.)
Preparing to unpack .../libkrb5-dev_1.12.1+dfsg-19+deb8u1_amd64.deb ...
Unpacking libkrb5-dev (1.12.1+dfsg-19+deb8u1) ...
Setting up libkrb5-dev (1.12.1+dfsg-19+deb8u1) ...
---> 9ae94e88bf17
Removing intermediate container b61ee612af65
Step 2 : RUN mkdir -p /usr/src/app
---> Running in 5e180e259cbe
---> c6b81c1cb6f4
Removing intermediate container 5e180e259cbe
Step 3 : WORKDIR /usr/src/app
---> Running in fbe5a8ffb3cb
---> cb5b456cbc46
Removing intermediate container fbe5a8ffb3cb
Step 4 : ONBUILD copy package.json /usr/src/app/
---> Running in 8a1727e62118
---> 705e5e9c8fea
Removing intermediate container 8a1727e62118
Step 5 : ONBUILD run npm install
---> Running in dbe8babe94a5
---> 06223a54982b
Removing intermediate container dbe8babe94a5
Step 6 : ONBUILD copy . /usr/src/app
---> Running in 83be5ca75845
---> 4deda2950b3f
Removing intermediate container 83be5ca75845
Step 7 : CMD npm start
---> Running in 9caf5da654d7
---> af7c9ed76e7d
Removing intermediate container 9caf5da654d7
Step 8 : EXPOSE 8080
---> Running in f93567e4bd48
---> bf40e4351676
Removing intermediate container f93567e4bd48
Successfully built bf40e4351676
=> Executing tests in docker-compose.test.yml
Building sut...
Step 0 : FROM node:5.1.0
---> b32eea429a1a
Step 1 : RUN apt-get update && apt-get install -y --no-install-recommends libkrb5-dev
---> Using cache
---> 9ae94e88bf17
Step 2 : RUN mkdir -p /usr/src/app
---> Using cache
---> c6b81c1cb6f4
Step 3 : WORKDIR /usr/src/app
---> Using cache
---> cb5b456cbc46
Step 4 : ONBUILD copy package.json /usr/src/app/
---> Using cache
---> 705e5e9c8fea
Step 5 : ONBUILD run npm install
---> Using cache
---> 06223a54982b
Step 6 : ONBUILD copy . /usr/src/app
---> Using cache
---> 4deda2950b3f
Step 7 : CMD npm start
---> Using cache
---> af7c9ed76e7d
Step 8 : EXPOSE 8080
---> Using cache
---> bf40e4351676
Successfully built bf40e4351676
Creating builder98263_sut_1...
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm ERR! Linux 3.13.0-68-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "test"
npm ERR! node v5.1.0
npm ERR! npm v3.3.12
npm ERR! path /usr/src/app/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/usr/src/app/package.json'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! Please include the following file with any support request:
npm ERR! /usr/src/app/npm-debug.log
Removing builder98263_sut_1...
Going to remove builder98263_sut_1
Tests in docker-compose.test.yml FAILED: 254
ERROR: Build process returned exit code 1
ERROR: Build in 'master' (0b68bc48) failed in 0:01:01

@chorrell
Copy link
Contributor

chorrell commented Dec 3, 2015

Hi,

Th onbuild image assumes you have a package.json file for installing a your app via npm. Looking at the last thing you posted, I see

npm ERR! enoent ENOENT: no such file or directory, open '/usr/src/app/package.json'

@franky-continu
Copy link
Author

it has the package.json that is why my first dockerfile works. I just can’t install libkrb5-dev
Franky Diaz-Trepat
Full Stack Engineer
+1 (720) 295-0592 / 401-1276
skype: franky.diaz.trepat
[email protected]

On Dec 3, 2015, at 7:37 AM, Christopher Horrell [email protected] wrote:

Hi,

Th onbuild image assumes you have a package.json file for installing a your app via npm. Looking at the last thing you posted, I see

npm ERR! enoent ENOENT: no such file or directory, open '/usr/src/app/package.json'

Reply to this email directly or view it on GitHub #71 (comment).

@Starefossen
Copy link
Member

I have used moongose and MongoDB without any problems with all Docker versions of Node.js. Yes, there are some warnings about kerborose but this may only be a problem if you actually use kerborose authebtication.

We inherit from Debian images and we are likely not to add any external libraries that are not required to run Node.js itself to keep the images as small as possible.

You should be able to install the kerborose library dependency in your own image, I'll try to look into that issue.

Also, check out my issue on why you should not rely on the :onbuild image for production purposes: #66

@franky-continu
Copy link
Author

Trigger 0, COPY package.json /usr/src/app/
Step 0 : COPY package.json /usr/src/app/

Franky Diaz-Trepat
Full Stack Engineer
+1 (720) 295-0592 / 401-1276
skype: franky.diaz.trepat
[email protected]

On Dec 3, 2015, at 7:42 AM, Franky Diaz-Trepat [email protected] wrote:

it has the package.json that is why my first dockerfile works. I just can’t install libkrb5-dev
Franky Diaz-Trepat
Full Stack Engineer
+1 (720) 295-0592 / 401-1276
skype: franky.diaz.trepat
[email protected] mailto:[email protected]

On Dec 3, 2015, at 7:37 AM, Christopher Horrell <[email protected] mailto:[email protected]> wrote:

Hi,

Th onbuild image assumes you have a package.json file for installing a your app via npm. Looking at the last thing you posted, I see

npm ERR! enoent ENOENT: no such file or directory, open '/usr/src/app/package.json'

Reply to this email directly or view it on GitHub #71 (comment).

@franky-continu
Copy link
Author

this Dockerfile says build ok but throws kerberos errors. Like I said in the first portion my tests only run if kerberos is installed as a peerDependency or dependency. Otherwise they just hang. I don’t use kerberos myself but there is something going on.

The Dockerfile:

FROM node:latest
RUN apt-get update && apt-get install -y libkrb5-dev

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

ONBUILD COPY package.json /usr/src/app/
ONBUILD RUN npm install
ONBUILD COPY . /usr/src/app
CMD [ "npm", "start" ]
EXPOSE 8080

The Error:

gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/usr/src/app/node_modules/mongoose/node_modules/mongodb/node_modules/kerberos/build'
  CXX(target) Release/obj.target/kerberos/lib/kerberos.o
  CXX(target) Release/obj.target/kerberos/lib/worker.o
  CC(target) Release/obj.target/kerberos/lib/kerberosgss.o
../lib/kerberosgss.c:36:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
 #pragma clang diagnostic push
 ^
../lib/kerberosgss.c:37:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
 ^
../lib/kerberosgss.c: In function 'authenticate_gss_client_wrap':
../lib/kerberosgss.c:362:19: warning: variable 'server_conf_flags' set but not used [-Wunused-but-set-variable]
   char buf[4096], server_conf_flags;
                   ^
../lib/kerberosgss.c: At top level:
../lib/kerberosgss.c:930:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
 #pragma clang diagnostic pop
 ^
  CC(target) Release/obj.target/kerberos/lib/base64.o
  CXX(target) Release/obj.target/kerberos/lib/kerberos_context.o
  SOLINK_MODULE(target) Release/obj.target/kerberos.node
/usr/bin/ld: cannot find -lkrb5
/usr/bin/ld: cannot find -lgssapi_krb5
collect2: error: ld returned 1 exit status
kerberos.target.mk:133: recipe for target 'Release/obj.target/kerberos.node' failed
make: Leaving directory '/usr/src/app/node_modules/mongoose/node_modules/mongodb/node_modules/kerberos/build'
make: *** [Release/obj.target/kerberos.node] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/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 Linux 4.1.10-boot2docker
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/src/app/node_modules/mongoose/node_modules/mongodb/node_modules/kerberos
gyp ERR! node -v v4.2.1
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 

Added code formatting by @Starefossen 2015-11-03 19:08 GMT+1

@retrohacker
Copy link
Contributor

Hi @franky-continu,

This may be a question better suited for the package maintainers for those modules. The Docker image is running npm and node as intended, but there are package specific dependencies and environment configurations missing.

@retrohacker
Copy link
Contributor

closing this as stale (several months have passed). Happy to reopen and revisit if this is still a problem and we find there is a problem with the Docker image itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants