Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

added dockerfile #623

Merged
merged 1 commit into from
Aug 31, 2016
Merged

added dockerfile #623

merged 1 commit into from
Aug 31, 2016

Conversation

n7down
Copy link
Contributor

@n7down n7down commented Aug 10, 2016

Create docker image for hospital run front-end

Changes proposed in this pull request:

  • Added a dockerfile to create the hospital run front-end image
  • Able to link couch database to the container
  • Modified script files to support this change
  • Added instructions to the readme.md

Note: pull requests without proper descriptions may simply be closed without further discussion. We appreciate your contributions, but need to know what you are offering in clearly described format. Thanks! (you can delete this text)

cc @HospitalRun/core-maintainers

@jkleinsc
Copy link
Member

@n7down thanks for the PR! When I test this it looks like the hospitalrun-frontend container stops running because of the following error:

docker logs hospitalrun-frontend
""
{"ok":true}
{"ok":true}
{"ok":true}
{"ok":true}
{"ok":true}
""
"false"
{"ok":true,"id":"org.couchdb.user:hradmin","rev":"1-a9b58fac0922e403a5951fd03e145960"}

[email protected] start /usr/src/app
./script/server

Checking CouchDB...Starting ember server
Missing binding /usr/src/app/node_modules/ember-cli-sass/node_modules/broccoli-sass-source-maps/node_modules/node-sass/vendor/linux-x64-46/binding.node
Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 4.x

Found bindings for the following environments:

  • OS X 64-bit with Node.js 4.x

This usually happens because your environment has changed since running npm install.
Run npm rebuild node-sass to build the binding for your current environment.
Error: Missing binding /usr/src/app/node_modules/ember-cli-sass/node_modules/broccoli-sass-source-maps/node_modules/node-sass/vendor/linux-x64-46/binding.node
Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 4.x

Found bindings for the following environments:

  • OS X 64-bit with Node.js 4.x

This usually happens because your environment has changed since running npm install.
Run npm rebuild node-sass to build the binding for your current environment.
at Object. (/usr/src/app/node_modules/ember-cli-sass/node_modules/broccoli-sass-source-maps/node_modules/node-sass/lib/index.js:15:11)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (/usr/src/app/node_modules/ember-cli-sass/node_modules/broccoli-sass-source-maps/index.js:5:16)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)

npm ERR! Linux 4.4.15-moby
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! node v4.5.0
npm ERR! npm v3.10.6
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: ./script/server
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script './script/server'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the hospitalrun package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ./script/server
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs hospitalrun
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls hospitalrun
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /usr/src/app/npm-debug.log

@jkleinsc jkleinsc added the in progress indicates that issue/pull request is currently being worked on label Aug 18, 2016
@n7down n7down force-pushed the dockerfile branch 3 times, most recently from 71a466e to bb41d09 Compare August 18, 2016 17:26
@n7down
Copy link
Contributor Author

n7down commented Aug 18, 2016

I am not able to reproduce the issue, below is the message I see without any issues:

➜  hospitalrun-frontend dockerfile ✓ docker logs hospitalrun-frontend
""
{"ok":true}
{"ok":true}
{"ok":true}
{"ok":true}
{"ok":true}
""
"false"
{"ok":true,"id":"org.couchdb.user:hradmin","rev":"1-6009b03561f50f66721fc845c7ac516f"}

> [email protected] start /usr/src/app
> ./script/server

Checking CouchDB...Starting ember server
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
DEPRECATION: ember-cli-htmlbars-inline-precompile is opting out of caching due to an AST plugin that does not provide a caching strategy: `remove-configuration-html-comments`.
DEPRECATION: ember-cli-htmlbars is opting out of caching due to an AST plugin that does not provide a caching strategy: `remove-configuration-html-comments`.
Livereload server on http://localhost:49152
Serving on http://localhost:4200/
➜  hospitalrun-frontend dockerfile ✓

According to your logs it looks as though there was a change since npm install was run. I changed where npm install is ran in the Dockerfile. Please delete all containers and images and try again.

@jkleinsc
Copy link
Member

@n7down I am now getting an error running docker build -t hospitalrun-frontend . I am curious what the intended use of this docker image is? If it is for running HospitalRun in a deployment environment, it would be better to do so using https://github.com/HospitalRun/hospitalrun-server instead of the frontend, because the frontend setup instructions are meant for developement use not deployement use.

Here is the error I am seeing:

npm ERR! Linux 4.4.15-moby
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! node v4.5.0
npm ERR! npm v3.10.6
npm ERR! path /usr/src/app/node_modules/ember-suave/node_modules/jscs-ember-deprecations/node_modules/cst/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine
npm ERR! code EXDEV
npm ERR! errno -18
npm ERR! syscall rename

npm ERR! EXDEV: cross-device link not permitted, rename '/usr/src/app/node_modules/ember-suave/node_modules/jscs-ember-deprecations/node_modules/cst/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine' -> '/usr/src/app/node_modules/amdefine'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request:
npm ERR! /usr/src/app/npm-debug.log
The command '/bin/sh -c npm install' returned a non-zero code: 238

@n7down
Copy link
Contributor Author

n7down commented Aug 24, 2016

I submitted this pull request because it looked like this was attempted in another pull request pr #552 that was unsuccessful and I happen to have a solution. I am still not able to reproduce your errors. When I run it I don't have any issues.. just to verify are you deleting all of the images and containers (ubuntu:14.04, hospitalrun-frontend, couchdb, and any none images)?

@jkleinsc
Copy link
Member

Thanks @n7down for getting back to me. I just tried removing all images and containers using the following from https://techoverflow.net/blog/2013/10/22/docker-remove-all-images-and-containers/:

# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)

I still get the following error when running docker build -t hospitalrun-frontend .
**npm WARN checkPermissions Missing write access to /usr/src/app/node_modules/hospitalrun-server-routes**
I'm not sure why it is getting a permissions error here when it seems to be writing other files to /usr/src/app/node_modules? Maybe it is my version of Docker or my OS? I am running
Docker version 1.12.0, build 8eab29e on OSX 10.10.5

@n7down
Copy link
Contributor Author

n7down commented Aug 29, 2016

I'm running with Docker version 1.12.0, build 8eab29e on OSX 10.11.6 and its running fine without any issues. I'm am not sure of what is causing the issue.

@n7down
Copy link
Contributor Author

n7down commented Aug 29, 2016

It also works for me on Docker version 1.11.1, build 5604cbe on Windows.

@jkleinsc
Copy link
Member

@n7down I was able to get it working by pulling hospitalrun-frontend into a new directory vs my existing working directory. Also, I completely removed Docker and reinstalled so between the two things it fixed the error I was getting.

The only other thing I ran into was the following message when running docker-machine ip default:
Host does not exist: "default"

As far as I can tell this is because I didn't create a docker machine, which isn't in the instructions. I was however able to run hospitalrun at 0.0.0.0:4200 and it appeared to be running from the docker image.

@n7down
Copy link
Contributor Author

n7down commented Aug 29, 2016

Terrific! I just noticed that docker updated that on OSX. The docker-machine command seems to be a feature for windows docker toolbox. With OSX you just use localhost:4200 I believe. Ill update the readme tonight.

@n7down
Copy link
Contributor Author

n7down commented Aug 30, 2016

@jkleinsc I went ahead and updated the readme to include the changes to docker and how to run the container with or without docker toolbox.

@jkleinsc
Copy link
Member

Excellent @n7down ! I am going to go ahead and merge this.

@jkleinsc jkleinsc merged commit 8966639 into HospitalRun:master Aug 31, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
in progress indicates that issue/pull request is currently being worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants