zokradonh / kopano-docker

Unofficial Kopano Docker images for all Kopano services.
MIT License
59 stars 37 forks source link

Come up with a way to run z-push-gabsync #121

Closed fbartels closed 5 years ago

fbartels commented 5 years ago

as raised in #116. some comments are already in the ticket.

For the moment I am going to assume that @mhoffmann75 is still busy with this.

mhoffmann75 commented 5 years ago

Totally right @fbartels. Currently I'm investigating if a scheduler container with docker "client" and supercronic, that you mentioned, in it might work for triggering all the schedules in various containers. This would include gab sync in the already running z-push container. As this container is never reachable from outside it should be safe to connect it to the docker socket.

mhoffmann75 commented 5 years ago

Can you have a look @fbartels, please? https://github.com/mhoffmann75/kopano-docker/commit/ab08a4f9f1efb9e0ab040e3a3bac99998793a174

I created a separate container with docker tools and Supercronic in it. Also added gab sync packets to zpush image and run gab sync via cron.

I guess this is quite flexible since we can use the scheduler for all kind for recurring tasks within the containers. The downside is that one has to adapt crontab to actual container names (no docker-compose!) and that this scheduler is able to do all kind of things with all containers on the same host. Could be a security problems somewhere?! Also the gab sync stuff is always installed in the z-push image. However we don't need a complete second z-push container just to add this litte script :-)

Please feel free to comment on this approach aswell.

fbartels commented 5 years ago

ah, nice that looks way cleaner.

You could use docker-compose in there as well, though: https://github.com/zokradonh/kopano-docker/blob/master/build/Dockerfile but that would then still require that you mount the current dir into the container as well.

I also see some minor improvements to the dockerfile, like setting cmd in the dockerfile so you don't need to do that in compose.

The crontab file could also be generated from env variables.

Lastly the docker image should be built through the Makefile.

I could take care of the last three things if you like.

mhoffmann75 commented 5 years ago

I already thought of adding docker-compose but mapping the whole directory with all its password variables and such into the container actually controlling the docker socket just did not feel right. So if we can do it without docker-compose I would prefer that.

You're right, scheduler container could have its CMD instead of setting this in docker-compose.yml

And absolutely yes, please make the changes to crontab and Makefile and integrate it into master.

mhoffmann75 commented 5 years ago

Just move command into Dockerfile - see https://github.com/mhoffmann75/kopano-docker/commit/c78627408298f5d5b4c9e90ea0f866bef18fd505