-
Notifications
You must be signed in to change notification settings - Fork 443
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
Marking default config files as noreplace in RPMs #572
Comments
+1 |
Please use the github reactions for +1 ones, doesn't clutter the stream that much then ;) If someone would like to do a pull request, this would be a way to introduce this feature a small configuration plugin.
This may look like import sbt._
object LinuxNoReplaceConfig extends AutoPlugin {
override def requires = RpmPlugin // only useful for rpm
override def projectSettings: Seq[Setting[_]] = inConfig(Rpm)(Seq(
linuxPackageMappings := configWithNoReplace(linuxPackageMappings.value)
))
def configWithNoReplace(mappings: Seq[LinuxPackageMapping]): Seq[LinuxPackageMapping] = {
mappings.map {
case mapping if mapping.fileData.config != "false" => mapping.withConfig("noreplace")
case mapping => mapping
}
}
} With some documentation and a small test, this would be it. |
I finally gave this a try. I wrote a |
You must depend on the |
Thanks for giving this a shot :) |
Does that mean, the Plugin will stop working without the JavaServerApp? Because, generally, it would also make sense for normal App packages. Am 13. Oktober 2016 03:01:30 MESZ, schrieb Nepomuk Seiler notifications@github.com:
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet. |
I guess so. You're right that this would be not ideal. The other option would be to provide a helper method ( there is already a LinuxMappingsDSL ) trait that provides some utility methods. Adding a method there would leave the user with something like the project settings in my suggestion above. |
Just to make sure that I get it right: You mean instead of providing a plugin that marks configs as noreplace, one could provide a helper method and the user would manually map over linux package mappings using that helper method from within his own build.sbt? That step would then be performed after all other plugins have run, so that all config files are correctly mapped? |
OK, it's the other way around, if I depend on the JavaServerAppPackaging, it seems to be added automatically by sbt. |
That behaviour can be turned off by setting Thinking more about this. A helper method in the LinuxMappingsDSL would be a better way. We could even write unit tests for this. |
Yep, that's actually the way I started to implement right now. However, I could imagine to keep the Plugin as well, as I think in most cases you want this functionality for server apps. So making config files |
Why not make this behavior a default one? It seems to be reasonable. |
In RPMs this seems no to be the default behaviour, so it might be better to require this to be enabled explicitly in builds. I could also set |
* First try at #572. Config files from the `universal/conf` directory are correctly marked as `noconfig`, but `/etc/default` files provided by JavaServerApp archetype not. * Added a RpmConfigNoReplacePlugin that depends on the Rpm and ServerAppPackaging plugins. It marks all config files as "noreplace" in the RPM, thus preventing them from being replaced during updates. The main method was added to the LinuxMappingDSL and can also be used in build.sbt for non server projects. * Fixed formatting. * Removed RpmConfigNoReplace plugin in favour of the DSL. Added docs for the DSL.
Currently, the config files get replaced during an rpm update. However, at least for production deployments it is very likely that the default configs have been modified on disk, so that replacing them with the defaults during an update will actually make the services not run correctly (which might even result in serious problems obviously). For rpms there is the option to mark files as "config(noreplace)" in order to tell rpm not to update the files on disk automatically, but to copy the default config (if it has changed) to a new file called .rpmnew. The RPM plugin already supports this, only the default mappings need to be changed AFAICT.
see also: https://groups.google.com/forum/#!topic/sbt-native-packager/SjdgGI1deZk
The text was updated successfully, but these errors were encountered: