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

Electrode explorer in docker problems #8

Closed
LeeFrancis opened this issue Nov 16, 2016 · 6 comments
Closed

Electrode explorer in docker problems #8

LeeFrancis opened this issue Nov 16, 2016 · 6 comments
Assignees
Labels

Comments

@LeeFrancis
Copy link

When I build and deploy to Docker and when I hit
http://localhost:3000/api/update/REPO/component
I get an error :

Error encountered: ENOENT: no such file or directory, open '/usr/src/app/data/REPO/component.json'

as a response.

I added a bit of logging and I see that update handlers fetchRepo is trying to read :
/usr/src/app/data/REPO/component.json and is complaining because it does not exist.
I dump out my meta data from the github call and that looks complete.

The message after these logs are
module info stderr npm info it worked if it ends with ok
npm info using npm@3.10.9
npm info using node@v4.6.2
npm info attempt registry request try #1 at 7:00:44 PM
npm http request GET https://registry.npmjs.org/react-intl
npm http 304 https://registry.npmjs.org/react-intl
npm info ok

Pretty sure my env variables are correct and that all my github tokens and npmrc file is there.
Also, this works fine running on my local machine not in a Docker container.

Any ideas?

Thanks,

Lee.

@caoyangs
Copy link
Contributor

caoyangs commented Nov 16, 2016

Thank you for checking out explorer. I was unable to reproduce the issue.

The file /usr/src/app/data/REPO/component.json should have been created here https://github.com/electrode-io/electrode-explorer/blob/master/server/component-api/check-dependencies.js#L88

which is invoked by method fetchRepo
https://github.com/electrode-io/electrode-explorer/blob/example/server/component-api/update-handler.js#L76
https://github.com/electrode-io/electrode-explorer/blob/example/server/component-api/fetch-repo.js#L56

Basically the file should exist after fetchRepo call, can you check from there why the file wasn't created?

@LeeFrancis
Copy link
Author

Looks like your latest commit fixed my problem.
57fd73a

Thanks for the great work, this whole project is awesome.

@LeeFrancis
Copy link
Author

LeeFrancis commented Nov 17, 2016

OK, my mistake..
Seems like it is still failing.
I see the following in the docker container logs :

error getting module dependencies [Error: npm info it worked if it ends with ok
npm info using npm@3.10.9
npm info using node@v4.5.0
npm info attempt registry request try #1 at 11:10:16 PM
npm http request GET https://registry.npmjs.org/gulp
npm http 200 https://registry.npmjs.org/gulp
npm info ok 
]

Looks like it is not even getting to
https://github.com/electrode-io/electrode-explorer/blob/master/server/component-api/check-dependencies.js#L88
Tried running node --debug and stepping through the code. I can hit the initial breakpoint in update_handler but cannot make it break in check_dependencies.

When I attach to the running container and run :

/usr/src/app/scripts/info-module.sh gulp

it works just fine.

Running docker on mac - Docker version 1.12.3, build 6b644ec

This is my Dockerfile

FROM node:4.5
RUN npm i -g npm@3
RUN apt-get update && apt-get install -y --no-install-recommends cron
RUN chmod 644 /etc/crontab
EXPOSE 3000
ENV DIR /usr/src/app
RUN mkdir -p $DIR
WORKDIR $DIR
COPY . $DIR
COPY .npmrc /root
RUN npm install
RUN $DIR/node_modules/.bin/gulp build
ENV GHACCESS_TOKEN xxxxxxxxxxxxxxxxxx
ENV NODE_ENV production
CMD node server

Sorry to reopen.. Still a great project!

@LeeFrancis LeeFrancis reopened this Nov 17, 2016
@LeeFrancis
Copy link
Author

As a follow up I commented out the stderr check ignoring the whole block and it worked.

https://github.com/electrode-io/electrode-explorer/blob/master/server/component-api/check-dependencies.js#L22

@caoyangs
Copy link
Contributor

caoyangs commented Nov 18, 2016

Glad to know you like it.

You may want to check why npm info fails, does it have right access? But anyway this shouldn't be blocking, can you check out this commit be57d16 It should let you go through despite npm error.

@LeeFrancis
Copy link
Author

Yes.. That worked. Not sure why npm info fails, it works fine when I attach to the docker image and run by hand.
Thanks for this fix.

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

No branches or pull requests

3 participants