2.13. Configuration Versioning

You may have seen the following message when you restarted helloserver: Changes to configuration 'helloserver.properties' archived. This is part of BundleWorks' automatic versioning of configuration changes. BundleWorks looks for changes to configuration (as defined in a bundle's 'info' file) and saves them, providing a complete history of all changes.

Let change the port number for the 'dev' installation of 'helloserver' to see the automatic versioning in action. Using vi, or your favorite text editor, change the port number from 31001 to 31011 in the following file:

$HOME/works/environments/dev/helloserver/work/config/helloserver.properties

Restart helloserver and you should see the message: Changes to configuration 'helloserver.properties' archived.

use dev
helloserver restart

BundleWorks provides some commands for accessing its configuration archives. Try typing helloserver cfghistory. You will see output similar to the following:

$ helloserver cfghistory
File: '/Users/admin/works/environments/dev/helloserver/work/config/helloserver.properties'
2007-10-12 19:33:36 (Fri, 12 Oct 2007) [revision 2]
2007-10-12 19:30:19 (Fri, 12 Oct 2007) [revision 1]
File: '/Users/admin/works/environments/dev/helloserver/work/config/logging.properties'
2007-10-12 19:30:19 (Fri, 12 Oct 2007) [revision 1]

This shows the history for both properties files used by 'helloserver'. To see a history of differences for helloserver.properties, type helloserver cfgdiff helloserver.properties. You will see output similar to the following, which shows the change made earlier:

$ helloserver cfgdiff helloserver.properties
--------------------------------------------------------------------------------
< helloserver.properties [revision 1, 2007-10-12 19:30:19 (Fri, 12 Oct 2007)]
> helloserver.properties [revision 2, 2007-10-12 19:33:36 (Fri, 12 Oct 2007)]
1c1
< port=31001
---
> port=31011

To view a configuration file as it once was, you can use the bw cfgview command. For example, to see the original helloserver.properties, type helloserver cfgview helloserver.properties 1 to see revision #1.

$ helloserver cfgview helloserver.properties 1
port=31001

Finally, to restore a configuration file to an earlier revision, you can use the bw cfgrestore command. Let's revert back to the original helloserver.properties by typing:

helloserver cfgrestore helloserver.properties 1
helloserver restart

Point netcat or telnet to port 31001 to verify that the configuration was restored to its original state.

nc localhost 31001
-or-
telnet localhost 31001