Docker image to set up a development environment easily


(Flaburgan) #1

From this discussion, we’d like to have a docker image to ease the installation of a development environment, so the first step to contribution is easier for new comers.

@csammy already create a docker image. This image needs to be official so we can recommend it in the guides and everywhere else. What we need to do to achieve this is:

  • Find long term maintainers. I knew @koehn is familiar with docker as he already maintains an unofficial diaspora docker image for his production setup so I proposed him to join and he looks okay
  • Check the current state of the image, I don’t know how clean it is, if it does everything we want. Opinions there please?
  • Move the repository to the github.com/diaspora/ so it is clearly marked as official, give permissions there to CSammy and Koehn, and to the current core team I guess (so at least @denschub, @jhass and @supertux88)
  • Edit the wiki to change the guide pages and the getting started page to indicate that the easiest way is now to use the docker image

Did I miss something?

It would be nice to have that done before the publication of our blog post calling for contributors.


(Dennis Schubert) #2

As @csammy wrote below your post on diaspora*, he is willing to continue and finish the work. Let’s give him the time he needs, it doesn’t really matter if we wait a few months more. As for making anything official, I usually like postponing even thinking about that to a point where we actually have something to make official:wink:

The following has to be taken with some grains of salt (and pepper), as I only started understanding and learning Docker recently (a year ago or so) and the amount of Docker images I produced for actual use is still single-digit, so I may be missing something in terms of maintainability etc.

We want to have something for development, so there are a few things I particularly dislike about @koehn’s container. The implementation may be fine for someone to use in production (although I still feel bad about this, but that’s a different discussion), but it is not suitable for a development env:

  • Brads image has the sources inside the container. On build time, you pass in a Git URL, which the script will then clone inside the container. If someone wants to run a custom code base, they either have to commit it to some Git repo (which makes testing a pain) or manually bind the sources from a local directory inside the container (which requires knowledge of Docker). Sammys image always makes a git clone into a local directory, mounts the directory into the container and runs from there. Therefore, editing the source files is easy, and even auto-reloading works.
  • The only reason we have people install RVM in production is so that we can control the Ruby version. For Docker, there are base images for every Ruby version out there, so that is not needed. Using the Ruby base images makes it much easier to update Ruby if needed, and also test with different versions.
  • As for database support, Brads image only supports PG. This, again, is okay for production, but there are valid cases where we need to switch to MySQL for development. Sammys image sets up both, and decides which DB server to start based on the current database.yml. For developers, all they have to do is change their database config and run docker-compose restart.
  • The wrapper script makes it easy to run common commands like running tests or migrating the database inside the container without any hassle.

Ultimately, Brads image is fine for production installations if someone feels like it, but IMO, Sammys approach is much more suitable for providing a development environment. That’s probably because Brad designed the image for production setups, while Sammy designed a development environment, eh… :slight_smile: I’d even go so far to say that we could tell someone with zero Docker experience to “clone this repo, run this script, and do development work” without any issues whatsoever, as the wrapper resolves all the points where someone would actually need to know Docker.

As Sammy started, and clearly states he is interested in finishing the work, I see no reason why we shouldn’t let him do that. If we have to wait a few months before publishing the blog post, so be it. It’s not like we have something to lose.


(Brad Koehn) #3

I really have nothing to disagree about with @denschaub’s assessment. I’m happy to help @csammy with his work. The image I made follows the official Debian instructions (hence rvm) and goes out of its way to remove everything not needed for production use, to keep the image size small and to reduce the attack footprint.


(Balaco) #4

When you all talk about “Docker image” here, are you talking about this?


(Flaburgan) #5

@denschub sorry if my post made you think I wanted to start from koehn image, that’s not what I was trying to say. I was saying we use CSammy image, and that koehn could help improve / maintain it, as one of your concern was finding long term maintainers.

@balacobaco yes


(Benjamin Neff) #6

Sammys image is almost done, I think the only thing that’s still open is testing how/if it works with spring, or if there are any problems related to spring (or maybe we can just ignore spring, but it would be cool to have faster restarts and tests). But I’m not sure anymore. Otherwise this image is very much optimized for development and the wrapper script has all commands needed for development.

About making it official: I told Sammy to create a PR when he thinks it’s ready, because I want the wrapper-script to be inside the main repo, so you only need to clone the repo (the main repo or your fork) and are ready to go. You don’t need to clone two repos and link them somehow together. But Sammy isn’t ready yet, that’s why there is no PR yet (but as @denschub said, there is no need to rush).

About maintaining it: I don’t think it would need much maintenance when it’s done, because it just works as a local dev env, and I don’t need to change much there either. So I think in the rare event that something needs to be changed, I need to do it to my dev env too, so I probably could fix it in the container at the same time if nobody else can maintain it (I already contributed a bit to the container :slight_smile: ). I think it’s useful when you have development experience to maintain it, so you know what’s needed for a development container. That’s why I gave Sammy a lot of feedback in the beginning, about what’s needed for the wrapper script to be useful as a dev container (because it’s mostly very much the opposite of a production container).


(CSammy) #7

So, I finally got around to it and created a pull request. I’m looking forward to your comments, suggestions and contributions.

Specifically, I’m having trouble with making the Docker-setup-specific YAML config files maintainable in a better way. After struggling with it for >6h I decided to go with the simple approach and hope somebody else will come up with a better idea :slight_smile:


(Flaburgan) #8

Small “up” to CSammy post above, he feels the PR is currently ready to be merged. If anyone wants to do some final feedback, it’s right now :wink: @koehn maybe?


(Eric Wright) #9

I’d like to put in a tid-bit from something I experienced a bit earlier. Please have your docker request the user to enter the ports they’re listening on, as some users (like myself) have more than one ruby on rails instance and more than four or five different websites running on their servers that need specific identification. Docker just runs through its settings if the user doesn’t have the chance to configure them before-hand. While understandably one could simply edit the docker config file itself, I’m asking on behalf of the ‘noob-ish’ new sys admins for whom the docker image is created for in the first place :slight_smile:


(Benjamin Neff) #10

The docker image is neither created to be run on servers nor is it created for sysadmins. It’s created for developers.

Maybe it’s useful to change the port for development too, but I think it’s only a nice to have, and if it is really needed one can still change the docker-compose file. But maybe we can add a parameter to the script?


(CSammy) #11

The Docker image is marked “ONLY FOR DEVELOPMENT” in so many places, I don’t even know how often. I was warned that people may try to use it for production in spite, and did not really believe it. You have made me a believer.

Do me a favour, and forget about the Docker image. It does not exist for anything else than local testing and development.


(Eric Wright) #12

I’m fairly confident that my request should apply for both development and production. It should be noted that developers can also have other platforms for development as well, also utilizing a docker image.


(Dennis Schubert) #13

I am fairly confident that this thread is called “Docker image to set up a development environment easily”.

The current implementation linked in this thread is marked for development environments and that’s the way it is for now. There are several concerns about using Docker for production pods, like the fact that nobody has figured out how to run Postgres updates in a reliable manner, nobody did come up with a mechanism to make sure manual update steps are completed before starting up a half-updated instance and thus breaking everything, nobody has figured out how to teach podmins about the security concerns about running Docker in production on a server with direct internet access, and a lot of other concerns that you can find by using the search feature here and on GitHub.

Given the number and the size of those concerns, which get even more weight given a Docker container promoted as production-ready would attract more podmins who are not sure what they are actually doing because they just need to run a couple of commands to set everything up, results in no-one in the core team being willing to support a production Docker container at this time.