roots / trellis

WordPress LEMP stack with PHP 8.2, Composer, WP-CLI and more
https://roots.io/trellis/
MIT License
2.51k stars 607 forks source link

cron missing #1498

Closed LucasDemea closed 1 year ago

LucasDemea commented 1 year ago

Version

1.21.0

What did you expect to happen?

Trellis checks that cron is installed

What actually happens?

On some systems (a CI env in my case), cron could be missing by default, causing wordpress-setup job to fail on Setup WP system cron task.

Steps to reproduce

Provision a server.

System info

No response

Log output

No response

Please confirm this isn't a support request.

Yes

swalkinshaw commented 1 year ago

On some systems (a CI env in my case),

Any more details on this system? Trellis requires Ubuntu which should always come with cron.

LucasDemea commented 1 year ago

This happens with a custom docker image based on cimg/php:8.1.21-browsers. Cron was not missing in the 8.1.9 version. This image is itself based on cimg/base which is on an ubuntu base.

LucasDemea commented 1 year ago

docker run -it ubuntu:22.04 crontab =>

docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "crontab": executable file not found in $PATH: unknown.
strarsis commented 1 year ago

+1, I encountered the same issue with a minimal Ubuntu 22.04 LTS install. Manually installing the cron package fixed the issue.

However, the current Ubuntu 22.04 LTS minimal installation does not contain cron, so for Trellis supporting the default Ubuntu 22.04 LTS minimal install, Trellis should also ensure that the cron package is being present? There are golden images for Ubuntu 22.04 LTS minimal that also contain cron, but these being custom additions by the image creator/cloud provider. And there were images for Ubuntu LTS minimal in the past that contained additional services that actually interfered with the Trellis setup. IMHO only the default Ubuntu minimal system should be considered authoritative. And just ensuring the presence of the cron package should not interfere with systems with cron already installed.

Edit: I used the Ubuntu 22.04 LTS server ISO (ubuntu-22.04.3-live-server-amd64 (Ubuntu 22.04.3 LTS (Jammy Jellyfish) release images page, Server install image) and selected the "Ubuntu Server (minimized)" base. Also enabled "Install OpenSSH server" option, left all listed, featured server snaps unselected.

swalkinshaw commented 1 year ago

@strarsis was cron the only other package missing when using the minimal version?

strarsis commented 1 year ago

@swalkinshaw: Yes, after cron was installed the provisioning worked fine.

swalkinshaw commented 1 year ago

Seems reasonable to add then in that case 👍

strarsis commented 1 year ago

@swalkinshaw: On first glance, it should be sufficient to add cron to apt_packages_default?

swalkinshaw commented 1 year ago

Yep that should be it 👍

strarsis commented 1 year ago

@swalkinshaw: https://github.com/roots/trellis/pull/1506 https://github.com/roots/trellis/pull/1499

strarsis commented 1 year ago

IMHO, as the PR is now merged, this issue can be closed.

strarsis commented 1 year ago

(Note: I just noticed that there is another, similar PR, which is probably now redundant: https://github.com/roots/trellis/pull/1499)