-
-
Notifications
You must be signed in to change notification settings - Fork 215
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
nextcloud: add default config for maintenance_window_start
#2659
nextcloud: add default config for maintenance_window_start
#2659
Conversation
However, I'll test the dailies as soon as this is in master. |
added to wiki documentation |
It's been a while since we've made a config change, but I'm pretty sure the change you've made here will only effect new installs. Is this something we should be adding for existing installs as well? |
Yes, of course. Should I put it in autoconfig instead? |
No, that has the same issue. Honestly, I don't think we've ever been in a situation like this, where ideally we'd patch the current config to have a default value, but the user should also be able to override it. The only thing even close is where we twiddle the redis config. But we don't care if the user set that to something else, because the snap isn't designed for that to be configurable by the user: we just set it directly. In this case... we do care. I need to mull this over a bit, but I'm leaning toward using our migrations capability for this. Thoughts? |
Using that migrations capability seems to be perfect for this! I assume they will be called whenever the snap package version is same or higher then the folder version and then it calls every file in alphabetical order? However, I'm absolutely not fimilar with python. |
You can see how it works here. It's run via the post-refresh hook. As you can see, we only have one migration so far. Let's use it to understand how this works. In snap version 19.0.3snap3, we changed the logging strategy, logging to completely different files. We didn't want to leave old logs lying around, and we wanted the new logs to include the old data, so as part of installing 19.0.3snap3, we wanted to move the old logs to the new location. First rule: if you have a snap version VERSION where you know that an upgrade from anything older has to have something happen to it in order to be compatible with VERSION, create a new directory within the Second rule: there could be multiple migrations that need to happen in this situation. You can create multiple scripts within the VERSION directory, and they will be run in order (so number them to specify order). Then, run-snap-migrations will compare the version of the snap before it refreshed, OLD_VERSION, to each of the migration directories. It will run the migrations for any directory in there that represents a snap version NEWER than OLD_VERSION. Does that make sense? So if we know that this is required for snap version My hook knowledge is rusty, but I think I just realized a hairy aspect of this: I'm pretty sure post-refresh runs before services are fired back up, so our ability to use |
Thanks for the explination! :) Seems to work mostly like I thought.
While maintenance mode we still could edit configs. But if the services aren't even running, we can only modify the file |
e78e1a9
to
868b424
Compare
I added such a script. Well, the condition is that we publish a release for the upcomming nc28.0.2. But I am confident with that because the errors in the log are not anymore present in that mass, just after ending maintenance mode. As long as we get the other PR with the javascript mime type done, we can beta-test and probably make a release sooner or later. And if needed, we can always rename the folder, if needed. I can not test the script today, need to do that tomorrow. Feel free to test the script yourself. But it should work™. That means, this is ready for review! :) |
src/migrations/migrations/28.0.2snap1/1_add-maintenance-window-start.sh
Outdated
Show resolved
Hide resolved
a43d46d
to
bde8bbd
Compare
The script works on my prod instance when executing it manually. |
bde8bbd
to
e300676
Compare
src/migrations/migrations/28.0.2snap1/1_add-maintenance-window-start.sh
Outdated
Show resolved
Hide resolved
I'd like to see it tested for real, though, in the hooks. It will probably require building this locally, are you setup for that? Also, given the risk of sedding config files, I'd like to see shellspec tests for this. |
Doesn't that requie a package named like "28.0.0snap1" or higher? Even if built locally? (Sorry, don't have enought knowledge to answer that myself.)
I built the snap manually two times in the past. But I always had problems I would need to setup everything again, so I avoid it where I can. 🤐
😳😥 However, I'm going to take a look into both, test and specs. But sadly I have no free time this week left and can't test it until next week (probably Monday/Tuestday). ;) If someone have too many time left, feel free to take over. Otherwise, sorry for the delay. :/ |
e300676
to
4d86f0f
Compare
Hi @Pilzinsel64 ! Will you have time to check this now that 28.0.4 has been released? Thanks! |
@pachulo, don't know if this is relevant, but I did test "set maintenance window" in #2704 as per FAQ is that not default?... not sure what else needs to be done? added this to testing script also |
501505d
to
1cad268
Compare
Oh, I am so sorry. I absolutely lost this our of my mind. Also I was werey busy the last weeks. |
42a7a20
to
d59f98a
Compare
I'm done. Tests are happy, the script does what it should do and the git history is cleaned. If you have any other suggestions I missed (not unlikely if you can't see the forest for the trees), just tell me. |
bc6f300
to
bc7a7dd
Compare
Ok, tested now and only a fresh install works. Seems like the script doesn't get executed on an upgrade. |
I think that the |
Oh come on... Yea, that's it. Will fix it later. 🤦 Thanks! |
bc7a7dd
to
4ab1298
Compare
All my tests were successful! 😃 Now I want to request review form one of you once again. |
My opinion is that we can already merge this and then make a call for testing in https://forum.snapcraft.io/, what do you think @kyrofa ? Besides, to properly test this myself I need for it to be merged and then build into the Thanks a lot for your tenacity @Pilzinsel64 ! |
gently ping @kyrofa |
Yes, this looks excellent, sorry for sending you on a wild goose chase here, but I think we've arrived at the proper solution.
Just to confirm, one of these last two tested that we don't overwrite an existing |
0da210d
to
83b94dd
Compare
Yes, tested this too. I used config value
No, it doesn't. It just return an exit code |
Oh, you mean in the Nextcloud log? No, there isn't an error. Also, that even would be increadible as the same function behind is used by Nextcloud itself covered in a function to get the default value if null. And btw, no error in the fixer log. :) |
Awesome, let's ship it. |
Fix #2658
Requiredfor #2641