-
Notifications
You must be signed in to change notification settings - Fork 417
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
fix(vhosts): better cleanup solution #266
base: master
Are you sure you want to change the base?
Conversation
Best reviewed: commit by commit
Optimal code review plan
|
Hello, thanks for you report.
Could you give us more details about those problems? because I run the states in the following order and don't have this problem
In fact, I saw that too. It's not really a problem because Nginx don't use them but in fact it could be improved. Generally, I think this formula needs some work to make it better, in a more standardized, logical and simpler way (see my comment here for example #194 (comment)) but I'm not sure about the change you propose: the |
My setup is :
with the configuration :
With this setup, new vhosts are created, then the cleanup is ran, which deletes all vhosts. Plus, cleaning & recreating all files generetes IO. All files have the creation / modification time updated. Not modified files should not be touched. |
@Yoda-BZH Thanks for this contribution
|
a116e71
to
12f5bce
Compare
Sometimes, the cleanup process happend AFTER vhosts are installed, which resulted in no vhost declared. Parsing declared vhosts in pillar and comparing to present files on the server allows to remove only unwanted files. Plus, files are kept in sites-available, and removed only in sites-enabled.
12f5bce
to
ff9a5b3
Compare
There are actually two problems with this formula:
I finally managed to reproduce these problems. Let's try to solve them separately because 1. is directly related to this formula but for me 2. is either a salt giant bug (with As I said previously, at work we don't call directly
Do you think you can try to edit nginx/init.sls to put this list in this order and tell me if it solves problem 1? Thanks |
Hi, Using this list of state fixes the problem, yes. But each time salt runs, all files are deleted and recreated, even if no modification has to be made. This causes unecessary salt steps to be made, and unecessary I/Os on disk. Checks based on file age (for example) cannot be made. File that are not modified should not be touched/removed&recreated. This PR removes only no-longer-needed files. |
Hello, any news ? Thank you |
Hi, I'm interested in this patch as well, but it seems to be missing an |
Sometimes, the cleanup process happend AFTER vhosts are installed, which
resulted in no vhost declared.
Parsing declared vhosts in pillar and comparing to present files on the
server allows to remove only unwanted files.
Plus, files are kept in sites-available, and removed only in
sites-enabled.
PR progress checklist (to be filled in by reviewers)
What type of PR is this?
Primary type
[build]
Changes related to the build system[chore]
Changes to the build process or auxiliary tools and libraries such as documentation generation[ci]
Changes to the continuous integration configuration[feat]
A new feature[fix]
A bug fix[perf]
A code change that improves performance[refactor]
A code change that neither fixes a bug nor adds a feature[revert]
A change used to revert a previous commit[style]
Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.)Secondary type
[docs]
Documentation changes[test]
Adding missing or correcting existing testsDoes this PR introduce a
BREAKING CHANGE
?No.
Related issues and/or pull requests
#263
Describe the changes you're proposing
Instead of purging sites-available / sites-enabled, remove only non-declared files.
Pillar / config required to test the proposed changes
Debug log showing how the proposed changes work
Before (with cleanup after installing vhosts files) :
after :
Previous vhosts are not purged, only unwanted file tests1.conf is removed
The code is inspired by apache.vhosts.cleanup https://github.com/saltstack-formulas/apache-formula/blob/master/apache/vhosts/cleanup.sls#L10-L40
Documentation checklist
README
(e.g.Available states
).pillar.example
.Testing checklist
state_top
).Additional context