Changes

From SME Server
Jump to navigationJump to search
324 bytes added ,  19:28, 26 January 2010
m
Some additions, minor rewrites and typos
Line 1: Line 1: −
== Template Tutorial ==
  −
   
===Overview and Description===
 
===Overview and Description===
   −
This document is meant to serve as a "plain english" description of the template system in sme server. Refer to the Developers Manual for more technical descriptions.
+
This document is meant to serve as a "plain english" description of the template system in SME server. Refer to the [[SME_Server:Documentation:Developers_Manual#Configuration_file_templates|Configuration file templates]] of the [[SME_Server:Documentation:Developers_Manual|SME Server Developer's Guide]] for more technical descriptions.
   −
The template system is unique to sme server. It is used to create the standard configuration files in /etc/.... in conjunction with the expand template event.
+
The template system is unique to SME Server. It is used to create the standard configuration files in /etc/.... in conjunction with the expand template event.
    
Templates are made up of fragments which add together to create the whole config file. The code in template fragments can have a default value in the absence of a specific db (database) value.
 
Templates are made up of fragments which add together to create the whole config file. The code in template fragments can have a default value in the absence of a specific db (database) value.
   −
To determine what db settings are supported by template fragment code, or what the default values are, refer to (ie read) the code that is in the particular template fragments or custom template fragments associated with a /etc/file.conf
+
To determine what database settings are supported by template fragment code, or what the default values are, refer to (ie read) the code that is in the particular template fragments or custom template fragments associated with a /etc/file.conf
 
   
 
   
Look in /etc/e-smith/templates/... and /etc/e-smith/templates-custom/....
+
Look in /etc/e-smith/templates/ and /etc/e-smith/templates-custom/ and subfolders and template fragments applicable to particular /etc/file.conf configuration files.
and subfolders and template fragments applicable to particular /etc/file.conf configuration files.
  −
 
     −
sme server uses the config files in /etc/xxxxxx just like any other Linux. Do not edit the /etc/xxxx config files directly (as would be done in a regular Linux distro).
+
{{Note box|SME Server uses the config files in the /etc/ folder just like any other Linux system. Do not edit the configuration files in  the /etc/ folder directly (as would be done in a regular Linux distro).}}
   −
Configuration changes are made in server manager, or by additional command line db settings, or by customising the code that generates the config settings. This code is in the templates. Templates are composed of fragments. These are not regular config files, they are the code that generates part (ie a fragment) of the config files.
+
Configuration changes are made in server manager, or by additional command line database settings, or by customizing the code that generates the configuration settings. This code is in the templates. Templates are composed of fragments. These are not regular configuration files, they are the code that generates part (i.e. a fragment) of the configuration files.
   −
The /etc/xxxx config files are created from the code in the template fragments & default values in the main template fragments in /etc/e-smith/templates/xxxx/yyyy
+
The configuration files in the /etc/ folder are created from the code in the template fragments and default values in the main template fragments and the internal configuration database in /etc/e-smith/templates/.
   −
The code in the template fragments also look up values in the various databases in /home/e-smith/db/xxxxxxx (where the code has been written to support db settings).
+
The code in the template fragments also look up values in the various databases in /home/e-smith/db/ (where the code has been written to support database settings).
   −
In addition there are custom template fragments in the /etc/e-smith/templates-custom/xxxx/yyyy folder structure.   
+
In addition there are custom template fragments in the /etc/e-smith/templates-custom/ folder structure.   
 
The code in these custom template fragments add configuration settings in addition to the settings generated by the main template fragments, or where the custom template fragments are identically named, they completely replace the settings generated by the main template fragments.
 
The code in these custom template fragments add configuration settings in addition to the settings generated by the main template fragments, or where the custom template fragments are identically named, they completely replace the settings generated by the main template fragments.
    
The config files are generated when you expand the templates using
 
The config files are generated when you expand the templates using
  expand-template /etc/xxxx/yyyy
+
  expand-template /etc/file.conf
You also need to restart affected services eg using
+
 
  sv t /service/xxxxxservicename
+
You also need to restart affected services using
Some signal events combine template expansion and service restart eg
+
  sv t /service/servicename
 +
 
 +
Some signal events combine template expansion and service restart  
 
  signal-event email-update
 
  signal-event email-update
or one of the many other signal events as appropriate for the task ypou are doing.
+
or one of the many other signal events as appropriate for the task you are doing.
    
If in doubt which template to expand and service to restart, there is a "master" command that will expand all templates and restart all services, in effect reapplying all configuration settings, and it is safe to do anytime using
 
If in doubt which template to expand and service to restart, there is a "master" command that will expand all templates and restart all services, in effect reapplying all configuration settings, and it is safe to do anytime using
Line 38: Line 36:  
  signal-event reboot
 
  signal-event reboot
   −
To make a custom template change, copy the existing fragment of interest from the /etc/e-smith/templates/xxx/yyy tree to the corresponding /etc/e-smith/templates-custom/xxxx/yyyy tree, edit the copied fragment with required changes, then expand & restart as above.
+
To make a custom template change, copy the existing fragment of interest from the /etc/e-smith/templates/ tree to the corresponding /etc/e-smith/templates-custom/ tree while keeping the same folder structure. Edit the copied fragment with required changes, then expand the configuration file and restart affected services as described above.
    
You can also create new custom template fragments when an existing one does not exist that is suitable for the job. You need to name this in a correct numerical order, so the changes you want to make will be placed in the correct location in the /etc/xxxx config file.
 
You can also create new custom template fragments when an existing one does not exist that is suitable for the job. You need to name this in a correct numerical order, so the changes you want to make will be placed in the correct location in the /etc/xxxx config file.

Navigation menu