This series of articles shows how to setup a real-world development environment using Docker, Rails, Nginx, Elasticsearch, Memcached, Postgres and Redis.
There are also 2 supporting GitHub repos with fully-functional source code.
I know what you’re thinking… not another blog post about this stuff. Hang on there friend! Before you leave, let me describe my initial requirements:
- I have multiple Rails apps that access a shared database.
- My apps need access to a shared cache (Memcached).
- My apps need access to a shared Redis instance.
- My apps need access to a shared Elasticsearch instance.
- I want Nginx to serve as a reverse-proxy for all my apps.
- I want to access my apps with urls, not
- I want to use SSL with self-signed certificates.
- I want unified logs via Elasticsearch.
In addition to all this, I work on several different stacks, each with their own requirements: database types/versions, specific Elasticsearch versions, etc.
Note that I said stacks and not apps. Setting up a Docker development environment for a single, isolated application is fairly easy and there are already hundreds of blog posts showing you how to do this. I needed something much more robust and flexible.
There are 2 source code repos that support this series:
Justification for this series
There are literally hundreds of blog posts detailing how to setup a development environment with Docker. Ruby, PHP, Node, whatever. Some are very good, but I have yet to find a single source of information that provided me with a comprehensive how-to guide to setup what I really needed – and wanted.
I spent many, many hours trying things out but none of the suggested solutions ticked all my boxes. In every article I read there was always a deal-breaker for me.
As I alluded to earlier, I work on a complex platform which consists of multiple Rails applications (7 and counting!). Sometimes I need to have all the apps running, sometimes only 2 of them, sometimes only a single one. The apps need to talk to each other, sometimes via http, sometimes via Redis. You get the picture…
This is fairly easy to setup if you install everything onto your host machine i.e. without Docker. However, you are then locked into specific versions and you have a myriad of services and software polluting your host.