opengridcc / opengrid-dev

Open source building monitoring, analysis and control
Apache License 2.0
26 stars 21 forks source link

Docker for opengrid/release #142

Closed saroele closed 8 years ago

saroele commented 8 years ago

Hi all,

I tried to get the notebooks inside the docker container by default. I'm almost there, except that a tar command in my Dockerfile is not doing anything. When I run the command manually inside /bin/bash in the container, it works well and the files are in the right place.

I'm afraid I need a little help, maybe @wouterh can figure out what's wrong?

Thanks, Roel

coveralls commented 8 years ago

Coverage Status

Coverage remained the same at 71.958% when pulling b9cafb96bb5aea14e55c3f7e32a80925f7200949 on saroele:develop into d8fbf8c2f9aa77f586c4b9452fc88ec154d3376d on opengridcc:develop.

saroele commented 8 years ago

Ha, sometimes a lunch break is what you need. I simplified the entire Dockerfile by adding the notebooks directly in the build.

coveralls commented 8 years ago

Coverage Status

Coverage decreased (-0.3%) to 71.678% when pulling 21bc57acaa33791ce0450551dd791bd5952df428 on saroele:develop into d8fbf8c2f9aa77f586c4b9452fc88ec154d3376d on opengridcc:develop.

coveralls commented 8 years ago

Coverage Status

Coverage decreased (-0.3%) to 71.678% when pulling c17ff2512ddb4f089dacbd66c5cf9620dfd0624f on saroele:develop into d8fbf8c2f9aa77f586c4b9452fc88ec154d3376d on opengridcc:develop.

saroele commented 8 years ago

I have finalised the docker image and run scripts for the development environment. I think we should leave the release version unfinished for now. Everyone who will use this image is a developer now, and will first clone the github repo to get the run-docker-dev.sh script and start the docker.

One thing we still have to fix: where to put the data (.tmpo database, caches, ...) when using the docker image? I think the best way is to mount a second volume inside the docker with the data so it can get stored on the host. But, to find which folder you want to mount inside the docker, you would have to read the opengrid.cfg file. This is feasible, but will make the run-docker-dev.sh script a little bit heavier.

An other solution is to impose that the data folder is inside the opengrid root (where the docker-run-dev.sh lives). This is the folder that gets mounted, so we can access a /data folder there without an additional mount. By adding /data to the .gitignore, we can avoid that it gets pushed. Maybe this is currently the most elegant option: restricts the freedom where to put the data but is uniform for anyone and easy.

Any other thoughts?

coveralls commented 8 years ago

Coverage Status

Coverage remained the same at 71.958% when pulling adcfa52261e23c07dea2bbf96593dfbd91aef794 on saroele:develop into d8fbf8c2f9aa77f586c4b9452fc88ec154d3376d on opengridcc:develop.

wouterh commented 8 years ago

The path that is in the opengrid.cfg is the path within the docker container, so I would put /data in there as the path and declare that as a volume in the Dockerfile. A developer can then choose where the data is stored by choosing how the volume in /data is used (see https://docs.docker.com/engine/userguide/containers/dockervolumes/)

saroele commented 8 years ago

@wouterh good idea, I have adapted both the release and the dev Dockerfiles.

What about the docker-run-dev.sh and docker-run-release.sh scripts. Will we mount a default folder ($PWD ?) to the /data volume. Developers who want another folder to be mounted to /data will then have to adapt their shell script or use the appropriate docker run command directly in their terminal?

saroele commented 8 years ago

Current version of the pull request will mount the ./data folder to the /data folder in the container. I also updated the instructions on the docker hub: https://hub.docker.com/u/opengrid/dashboard/

coveralls commented 8 years ago

Coverage Status

Coverage remained the same at 71.958% when pulling 70930b44c5490e357082df157c986084a78b755a on saroele:develop into d8fbf8c2f9aa77f586c4b9452fc88ec154d3376d on opengridcc:develop.

wouterh commented 8 years ago

What about an environment variable? The script can check if it is set and otherwise use a default.