lava / dockermail

Ready-to-use email server + (optional) web mail + (optional) caldav, carddav and a kitchen sink in a docker container
MIT License
301 stars 59 forks source link

improvements #15

Open n00dl3 opened 9 years ago

n00dl3 commented 9 years ago

Hello,

first, thanks for this job that saved me a lot of time! I've seen some things that I find a bit strange:

I had a look at the base-mail/Dockerfile, you are adding a lot of new sources but I don't think they are that useful (I cloned your repo and changed the base to debian:stable, and then removed all the sources, (of course,) and I didn't need to change anything else). Actually, I don't find the mail-base image that useful...

Also, some things like owncloud/public_url or mail-base/domains could just be environment variables, that would be more flexible than a small plain text file added at build time.

Last, you are using make to build the images, why not using docker-compose instead ?

I'm not that familiar with mail servers, but when I'll get a decent internet connection (may the 13th, normally) I'll try to improve these and make a pull request, if you are interested in.

lava commented 9 years ago

Hi, thanks for your interest.

When I first wrote this the only way to share variables over multiple containers was to create some files in a "base"-image and stick them in there, that's why mail-base exists. If I remember correctly I didn't spend a lot of time trying to minimize it, so if you verified that some of the repositories are unnecessary, I'd be happy to accept a pull request.

I like make because it's installed everywhere, it's easy to debug, and it's possible to add non-docker-related tasks if desired, so unless docker-compose adds some substantial benefits that are impossible to get otherwise, I'd prefer to keep it.

I'm not sure I understand your suggestion of using environment variables. Are they supposed to be set inside the container, or on the host when running docker run?

n00dl3 commented 9 years ago

Hi, Take a look at mysql official docker image : to specify the root password, you append -e MYSQL_ROOT_PASSWORD=my-secret-pw to the docker run command, this is the way every official containers are working, and it is IMHO more flexible than setting things in static files at build time, because if you change something, when you use environment vars, you don't have to build the whole container again.

I don't know if docker-compose is better than make, I talked about it because according to its doc, it is designed for this...

Compose is a tool for defining and running complex applications with Docker. With Compose, you define a multi-container application in a single file, then spin your application up in a single command which does everything that needs to be done to get it running

However, I didn't see this when I talked about it :

Compose is great for development environments, staging servers, and CI. We don't recommend that you use it in production yet.

lava commented 9 years ago

The technique looks nice, but I'm still not sure what exactly you are proposing. Surely, all of the stuff still has to be written inside some text file, so you don't have to remember everything when you want to restart the container. So I guess you want to read the contents of that text file from inside the make command? I think it would be helpful to see this implemented in order to actually what kind of changes would need to be made.

n00dl3 commented 9 years ago

No, I'm not talking about reading files from the makecommand . What I think is that using text files which are static and part of the image is against the docker philosophy. What is really nice in Docker is portability and flexibility, so writing static files inside the image is kind of a non-sense. Let's talk about dovecot's image, once the file is written, if you want to add an alias, or change a password then you have to rebuild the whole image.

A docker container should be run "as is" via a single docker run command whatever is the environement you are using when you start your container, you should not rebuild the whole thing when you want to make trivial things like changing a password, adding an alias, or whatever...

What I mean is the static-file created at build time approach trully lacks flexibility and portability, maybe using a mysql container for managing vmail would be a better choice, and passing variable things via env variables would be really more flexible.

lava commented 9 years ago

I don't disagree that building static files into the image is not ideal, but it's hard to evaluate potentially better alternatives abstractly, without seeing how an implementation would look like. In particular, I cannot imagine that adding an additional mysql container would make the setup easier.

n00dl3 commented 9 years ago

I'm working on it. Using mysql I am now able to use postfixadmin in another container, and, for the moment, it's not that hard...