My Hybrid Docker & Ruby Development Environment | deanpcmad

submited by
Style Pass
2022-09-23 20:00:05

After fucking up my install of MySQL last year by trying to move from MariaDB to MySQL as I wanted to try JSON support out, I set out to find a better way of developing my Rails apps, instead of resorting to using something like Vagrant which would create separate VMs for each project.

Running Rails apps inside of Docker can be slow and cumbersome, so I found a way which I think is a better way; Running the databases in Docker instead.

I develop and maintain a number of Rails apps, ranging in Ruby and Rails versions. This means that some older Rails versions may not work properly with the new versions of MySQL or MariaDB.

I then use .env files with the dotenv-rails gem loaded in development and test environments to set the required env variables:

You may see that I’m using hostnames here. I’m using a Docker container called docker-hoster to set these in the hosts file. I have a docker-compose.yml file in /opt with the following contents:

Leave a Comment