Unfortunately, dear colleagues, I gave up on docker for now. Main factors:
Also we hired two DevOps guys, who have quite a bit of docker experience, if they will come up, how to (painlessly!) introduce docker in our company for both hosting and development, I will be happy to revise this topic.
[OLD POST]
As a new version utilising native OSX hypervisor is now available, I've decided to try pushing all my Ruby/Rails/JS development to the docker containers. I've played quite a bit on a fresh El Capitan installation, by trying to dockerize a few private gems we have and our monolith Rails application.
There are a few questions, I was hoping our community may help to solve.
The goal - everything works and host has only iTerm, git, Sublime, SourceTree and Docker installed (nothing is carved in stone, if some additional dependency(-ies) may improve/make the workflow significantly easier, I will be happy to review the options)
Requirements
GEM_PATH
, bundler
in each container will install gems there. Application bundler
should take care of loading the right versions.guard
process in the container and related tests are executedQuestions
guard
, easier debugging, launching arbitrary processes in the same run)docker-compose.yml
(volumes) or defined inside a different docker file that inherits from the base one ?Other thoughts
I am also fine trying out commercial or none-commercial tool, that wraps/bundles the described tooling. So far I've found a thing called http://wercker.com), the thing I don't like about it, it seems like it requires you to setup dev env anyways, which kill the purpose of the whole endeavour.
Feel free to down vote this question if it was posted before and answered clearly. On the other hand I would be happy if this thread will produce guides, links, suggestions to get it done smoothly, I am pretty sure this interests quite a few devs these days.
Docker is great at setting up a local development environment because it easily adds the running process without duplicating the virtualized resource. Second, it's more modular. Docker makes it easy to run multiple versions or instances of the same program without configuration headaches and port collisions.
Docker is a containerization platform that is free and open source. It allows developers to package programs into containers, which are standardized executable components that combine application source code with the OS libraries and dependencies needed to run that code in any environment.
Docker run starts a new container and runs a program inside: -it : attaches your terminal process with the container. -v $PWD:/opt/app : binds your host machine current directory to the container, so files created inside are visible in your machine.
Compatibility and Maintainability Parity, in terms of Docker, means that your images run the same no matter which server or whose laptop they are running on. For your developers, this means less time spent setting up environments, debugging environment-specific issues, and a more portable and easy-to-set-up codebase.
Consider orats (opinionated rails application templates):
The goal is to provide you an excellent base application that you can use on your next Rails project.
And:
It also happens to use Docker so that your app can be ran on any major platform -- even without needing Ruby installed.
To some of your other requirements:
my keys ... I should be able to reuse the ones that are on my host machine
Specify keys in your docker-compose.yml
but omit the value.
putting breakpoints and interacting with debugger
When starting a service, instead of docker-compose up
, use docker-compose run --service-ports
. This will allow e.g. binding.pry
to work.
When executing Cucumber/Selenium tests I should be able to see what's happening in the browsers.
This is tricky. For a workaround consider using save_screenshot
, and (the important part) save it to a directory which is mounted to a volume on the Docker host. Open that directory on the host and you'll be able to see an updating screenshot.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With