-
-
Notifications
You must be signed in to change notification settings - Fork 178
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
💡 Document "provisioning" crons on deploy #482
Comments
working yaml if you want || need the crons to be setup as part of the deploy chain.
- name: Setup WP system cron using crontab
shell: |
(crontab -l 2>/dev/null || echo '') | grep -v "{{ item.key }} WordPress cron" | crontab -
(crontab -l; echo "*/{{ item.value.cron_interval | default('5') }} * * * * cd {{ www_root }}/{{ item.value.current_path | default('current') }} && wp cron event run --due-now > /dev/null 2>&1 # {{ item.key }} WordPress cron") | crontab -
loop: "{{ wordpress_sites | dict2items }}"
loop_control:
label: "{{ item.key }}"
when: not item.value.multisite.enabled
- name: Setup WP Multisite system cron using crontab
shell: |
(crontab -l 2>/dev/null || echo '') | grep -v "{{ item.key }} WordPress network cron" | crontab -
(crontab -l; echo "*/{{ item.value.cron_interval_multisite | default('10') }} * * * * cd {{ www_root }}/{{ item.value.current_path | default('current') }} && (wp site list --field=url | xargs -n1 -I \\% wp --url=\\% cron event run --due-now) > /dev/null 2>&1 # {{ item.key }} WordPress network cron") | crontab -
loop: "{{ wordpress_sites | dict2items }}"
loop_control:
label: "{{ item.key }}"
when: item.value.multisite.enabled |
@chrillep is this something you want to contribute? Even a basic starting page on this would be appreciated. No reason not to document it. |
Ive started a new job where we only use laravel so im kinda out of the WP world however this is more of CD/CI so sure :) I see now that the specific YAML i posted #482 (comment) was specifically created for kinsta since they don't let you edit cron via file, you have to use crontab to get around it. Still works in general but thats the reason for |
Summary
One could argue that crons should be part of the deploy. 😄
How do we accomplish this?
It would really help me if this was part of the trellis docs. 🙏🏼
AC: (feel free to change them) ❤️
Docs
Additional context
On most of our servers we dont have root access, so we only use the deploy part of trellis.
This is from what i gather a common practice?
It would be simpler (for us 😄 ) if the cron was part of the deploy.
It would be simpler (for us 😄 ) if the user owning the crons was the deploy user.
refs
The text was updated successfully, but these errors were encountered: