codeforhuntsville / Frontier

A civic app for finding whats near me
http://codeforhuntsville.com/
MIT License
9 stars 7 forks source link

localhost:8080 doesn't give an error but doesn't display the list either on ubuntu14.04 #21

Open git-madhav opened 9 years ago

git-madhav commented 9 years ago

Chad,

if I use the https://6f615fd.ngrok.com on windows chrome browser, pointing to virtual box / ubuntu14, it works fine.

if I do the same on virtual box / ubuntu firefox browser, it doesn't display the list, and it doesn't give an error either. Debug window doesn't show much.

I just noticed, it might be firefox browser issue. I tried to use firefox on windows, it did not work either.

Any ideas?

-Madhav.

chadxz commented 9 years ago

firefox 37.0.2 on OS X 10.10.3 works for me. Does it only happen on windows/linux?

git-madhav commented 9 years ago

So far the two machines I have tried, yes it happens with windows and Linux.

Regards, Madhav.

Sent from iPhone!

On May 13, 2015, at 9:09 PM, Chad McElligott notifications@github.com wrote:

firefox 37.0.2 on OS X 10.10.3 works for me. Does it only happen on windows/linux?

— Reply to this email directly or view it on GitHub.

git-madhav commented 9 years ago

Once bower gets installed, restaurant list gets populated.

npm install -g bower and bower install in Frontier directory should fix this issue.

Thanks to Dusty for this fix.

-Madhav.

chadxz commented 9 years ago

for what it's worth, the bower dependencies should have automatically been installed when you do npm install. The fact that they were not is strange to me. Might be worth looking into if this ever happens again.

chadxz commented 9 years ago

It came to light that @git-madhav was using the Docker instructions for running the app, so there may be an issue with running bower in the npm postinstall script due to the docker environment. Looking into that now.

chadxz commented 9 years ago

So i figured out what caused this issue.

  1. if you run make build when you have already installed your node_modules, it will just copy those files over in the COPY . /frontier step of the Dockerfile. The subsequent command RUN npm install will then do pretty much nothing since all the modules are already there. This causes an issue if you are, for example, running boot2docker on OSX and the node_modules have platform-specific things in them. In this case, the download of the ngrok binary looks at your architecture and platform to determine which binary to download. Since I already had installed node_modules prior to running make build, it copied my OSX ngrok binary over into the image, and when it tried to require('ngrok') inside the docker image it exploded because the binary it was trying to run was compiled for OSX not Ubuntu. This was also causing some weirdness with detecting the issue with the bower_components installation, since the docker image that I had built already had the bower_components installed, it was initially unclear to me how the bower_components existed even though they were failing to install.
  2. The bower install npm postinstall script was failing with the message

    npm WARN cannot run in wd Frontier@1.0.0 bower install --config.interactive=false --allow-root (wd=/frontier)

    This was because npm doesn't like being run as root user. I can fix this temporarily by passing the command line flag --unsafe-perm to npm to get it to force the install, but it's generally considered bad practice.

  3. Even with --unsafe-perm passed to npm, bower doesn't like being run as root. To get it to run anyway, you can pass --allow-root to it to get it to run.

So the takeaways here are that the Dockerfile needs to:

chadxz commented 9 years ago

@clarkda said he's planning to submit a pr to address these issues with the Dockerfile

chadxz commented 9 years ago

26 removes the bower dependency so no need for any Dockerfile changes related to that

chadxz commented 9 years ago

34 addresses the node_modules being accidentally included in the docker image, so we really just need for the npm install to not be run as root to close this ticket.