Web-server – How to maintain configuration files on a server

tomcatweb-server

I regularly install a product (Atlassian Confluence, which is Tomcat + a few files) on my server. For each upgrade, after unpacking the tar.gz, I need to change the following files:

  • conf/server.xml -> Add JNDI declarations and change port
  • confluence/WEB-INF/classes/confluence-init.properties -> Change one property
  • confluence/WEB-INF/web.xml -> Require HTTPS
  • confluence/WEB-INF/classes/log4j.properties -> Change log level
  • Move activation.jar and mail.jar from confluence/WEB-INF/libs to lib/
  • Add postgres.jar to lib/

Is there a canonical way to perform this configuration?

  • Any way to perform an "overlay" to a directory?
  • I've tried git, but git isn't good at moving files.
  • I've tried writing a script, but it cannot be contained in 1 file, since I need to have patch files. If we're going this way, is there a way to write a bash script which contains the patches, so it's self-contained?
  • Do all sysadmins just write an ad-hoc script every time, using 'patch' and 'move' to edit the files? Isn't there a better tool?

Thank you

Best Answer

Configuration management tools like puppet. chef, ansible etc are the tools of choice for the modern sysadmin.