

One of my resolutions this year is to use Docker as the single source of truth for all my development environments. So instead of installing the required software, like databases or development libraries, directly into my path I will be leveraging Docker and Docker Compose to have everything always working locally.
The main problem I currently face is my development setup. I ditched Linux about 7 years ago and migrated completely to macOS, and since Docker Mac is still a work in progress having a development environment based on Docker is a challenge.
The biggest issue is shared volumes, the performance is not the same compared to the Linux version. I spent some time researching about how to get the best performance with the current available tools, and after testing several tools I settle with d4m-nfs that internally uses NFS for sharing the volumes.
The keys to remember when using Docker and D4M are:
/tmp/
only. See the README.etc/d4m-nfs-mounts.txt
, make sure its contents are something like:/Users/<username>:/Users/<username>
root:wwheel
to automatically make the folders, I tried it but did not work for me.d4m-nfs.sh
again.Part of this exercise for me was to update my share-activerecord-models gem, the one I introduced in the post Sharing ActiveRecord models between projects. The idea is simple, to use docker-compose
for building the gem without installing anything else but docker
.
Consider taking a look at the change that introduced the Dockerization, important bits are:
With that I can easily interact with the gem by doing something like:
docker-compose up
docker-compose run gem bundle exec rails generate migration create_my_table
docker-compose run gem bundle exec rails generate scenic:view my_materialized_table --materialized
docker-compose down