Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] Remove cron from container #253

Closed
J0WI opened this issue Feb 8, 2018 · 7 comments
Closed

[RFC] Remove cron from container #253

J0WI opened this issue Feb 8, 2018 · 7 comments

Comments

@J0WI
Copy link
Contributor

J0WI commented Feb 8, 2018

The current behavior of Cron inside the NextCloud image does not make much sense to me.
In the current example the whole NextCloud container is started in a second instance, that runs Cron. But I can also use a very lightweight php-cli container and run the PHP command with an additional sleep.
Since most containers are running on a host system or Kubernetes it's even simpler to create a cronjob or Systemd timer on the host that runs docker exec -u www-data my-nextcloud php cron.php.

Would you accept a PR to remove Cron from the image and update docs and examples?

@Greek64
Copy link
Contributor

Greek64 commented Feb 8, 2018

I would be against that.
The whole reason of using Docker or LXC (or at least, one big reason) is to be host independent.
Meaning that anyone can just execute a "docker-compose up -d" and it just works, without further configurations.
And you are now trying to make it again host dependent. That kind of defeats the purpose (IMO)

@J0WI
Copy link
Contributor Author

J0WI commented Feb 8, 2018

By default NextCloud uses AJAX Cron anyway. So docker-compose up -d will still work for you as before.

A lot of certified images are actually working like this. Some examples:
docker-library/official-images#1203 (comment)
docker-library/wordpress#157 (comment)
docker-library/postgres#353 (comment)

@Greek64
Copy link
Contributor

Greek64 commented Feb 8, 2018

By default NextCloud uses AJAX Cron anyway

That I do know.
I was referring to the

create a cronjob or Systemd timer on the host

part, which I strongly disagree, for the aforementioned reasons.

@tilosp
Copy link
Member

tilosp commented Feb 8, 2018

@J0WI
why would you use a lightweight php-cli container.
The lightweight container needs at least all the nextcloud dependencies. If you for example use the php:7.1-cli image and install the dependencies you add about 150MB, which i would not call lightweight.

If you add cron to the image it adds about 2MB. Which should not be a big problem for the people who do not use it.

@J0WI
Copy link
Contributor Author

J0WI commented Feb 8, 2018

@tilosp you're right, that fails. But how do you think about the docker exec solution?

@tilosp
Copy link
Member

tilosp commented Feb 27, 2018

But how do you think about the docker exec solution?

I see it as an option.
But there are situations were you do not have access to system cron or do not want to use it.
So the extra 2MB won't hurt anyone. And by the way on alpine it only adds 62 Bytes, because busybox is installed on the alpine base image.

@tilosp tilosp closed this as completed Feb 27, 2018
@meonkeys
Copy link
Contributor

Also worth considering: with the current design, cron.php executes background tasks directly (e.g. sending mail), so it needs access to all the same code, volumes (data), and networks (e.g. mail server) as the main (nextcloud) container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants