-
Notifications
You must be signed in to change notification settings - Fork 352
Add custom logrotate config #251
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
Conversation
5191c79
to
c3eb055
Compare
@alessfg Are these test failures related to my changes? It seems there is a problem with |
They are related to your changes (tests on master are passing), but I can't quite place where the issue is 🤔 |
I have just run logrotate on Alpine and CentOS in tests and it gets failed because there is some problems in |
There's a bunch of warning messages, but those won't make the build fail. The actual error seems to be |
@alessfg I think it's because of:
|
That could be related, yeah. Maybe when logrotate tries to run it can't read the NGINX PID? If you run the PR against an Alpine/CentOS(or RHEL) VM does it work (besides the warning messages)? If it works then it could be an issue related to the Docker images for Alpine/CentOS. |
I'm not enough familiar with Apline/CentOS and I don't know whats going wrong. Do you have any idea about it? |
I'm trying to debug it on my end but it might take some time before I find a solution. Looks like the issue is indeed caused by a PID error, but everything works fine on master, so lograte must have messed up NGINX's PID in Alpine and CentOS somehow. I'm no logrotate expert myself but I'll see if I can figure out what's causing the issue per se. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add two spaces before the # comment in defaults/main/logrotate.yaml line 14
And for the template, change it to this
{% for path in nginx_logrotate_conf.paths %}
{{ path }}
{% endfor %}
{
{% for option in nginx_logrotate_conf.options %}
{{ option }}
{% endfor %}
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
run-parts /etc/logrotate.d/httpd-prerotate; \
fi \
endscript
postrotate
{% if ansible_os_family == "Debian" %}
invoke-rc.d nginx rotate >/dev/null 2>&1
{% elif ansible_os_family == "RedHat" %}
{% if ansible_distribution_major_version == "6" %}
service nginx start
service nginx reload
{% else %}
systemctl start nginx
systemctl reload nginx
{% endif %}
{% elif ansible_os_family == "Alpine" %}
service nginx start
service nginx reload
{% else %}
nginx -s reopen
{% endif %}
endscript
}
The changes above should resolve the issues and pass the tests. The nginx service isn't running yet, so no pid is there...and thus the error. |
Works fine |
I added a task to use |
@alessfg Wasn't that better to add |
I don't know that it would necessarily be better but yep that would've worked too 😄 |
Oh okay. I thought the |
Proposed changes
Closes: #250
Checklist
defaults/main/
andREADME.md
)