Changeset 143
- Timestamp:
- 08/10/07 13:54:50 (4 years ago)
- Location:
- cleverbox/trunk
- Files:
-
- 1 removed
- 3 modified
- 1 moved
-
README (modified) (5 diffs)
-
assets/apache.conf.multi (deleted)
-
assets/project.apache.conf (moved) (moved from cleverbox/trunk/assets/apache.conf.single) (1 diff)
-
assets/trac-defaults.ini (modified) (1 diff)
-
cleverbox/scripts/admin.py (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cleverbox/trunk/README
r141 r143 1 1 = Cleverbox = 2 3 [[PageOutline]] 2 4 3 5 The Cleverbox sits on top of [http://trac.edgewall.org Trac] and [http://subversion.tigris.org Subversion]. … … 6 8 == Features == 7 9 8 * Apache configuration templates 9 * `trac.ini` configuration templates 10 * Configuration profiles : 11 * Apache configuration templates 12 * `trac.ini` configuration template 13 * Default permissions 10 14 * Easy to setup 11 * Easy to use 15 * Easy to use 12 16 13 17 == Prerequisites == … … 79 83 == Advanced usage == 80 84 81 === Customising Apache configuration templates for your needs === 82 83 When creating a new project, the cleverbox will look for Apache configuration templates in directory referenced by `assets_dir` configuration directive. 84 85 Provided defaults work out of the box, but you may want to use custom configuration templates. 86 You just have to change the value of `assets_dir` configuration directive and the Cleverbox will look for configuration templates in this new directory. 87 88 The available configuration templates are `apache.conf.single` or `apache.conf.multi` (depending on the value of `vhost_mode` cleverbox directive). 89 90 At project creation, the selected template's variables are subtituted with concrete values : 85 === Creating your own configuration profile === 86 87 The Cleverbox comes with a default set of configuration files. It is located in ``/etc/cleverbox/profiles/default/`. 88 89 When creating a new project, the Cleverbox will ask the user what configuration profile should be used. 90 It will then look for configuration files in `/etc/cleverbox/profiles/<profile>/` 91 92 The `default` profile works out of the box, but you may want to create your own. 93 Just copy `/etc/cleverbox/profiles/default/` to `/etc/cleverbox/profiles/<profile>/` and start modifying the files until they fit to your needs. 94 95 A configuration profiles is composed of the following files : 96 97 * `project.apache.conf` : Apache configuration for a project 98 * `trac-defaults.ini` : Overriding of default Trac preferences 99 * `permissions.ini` : Default Trac permissions 100 101 Let's see how these files can be customised : 102 103 ==== `project.apache.conf` ==== 104 105 This file is used as a basis for creating project's Apache configuration. Resulting file will be stored in `/etc/cleverbox/projects-available/<client>-<project>`. 106 107 At project creation, the file is parsed and variables are substituted with concrete values : 108 91 109 * `client_name` : client's short name 92 110 * `project_name` : project's short name … … 94 112 * `authbackend_pass` : password for hypothetical authentication backend (ldap, etc) 95 113 * `trac_install_dir` : directory where Trac is installed on the server 96 * `domain_name` : if in "single" `vhost_mode`, host's domain name 97 98 === Customising `trac-defaults.ini` configuration for your needs === 99 100 This file resides in Cleverbox's `assets_dir` directory. It holds values that will override standard's trac.ini values. 101 102 For instance, you may want The webadmin plugin to be enabled by default in all new project instances. 103 You just have to add these lines to the file : 104 {{{ 105 [components] 106 webadmin.* = enabled 107 }}} 108 109 === Defining defaut permission profiles === 114 * `domain_name` : host's domain name 115 116 For instance, here's how the file provided by the `default` profile looks like : 117 118 [[Include(source:cleverbox/trunk/assets/project.apache.conf, text/plain)]] 119 120 ==== `trac-defaults.ini` ==== 121 122 This file holds values that will override generated project's standard `trac.ini` values. 123 124 At project creation, the file is parsed and variables are substituted with concrete values : 125 126 * `client_name` : client's short name 127 * `project_name` : project's short name 128 * `clients_root` : directory holding Subversion and Trac data for each project 129 * `authbackend_pass` : password for hypothetical authentication backend (ldap, etc) 130 * `trac_install_dir` : directory where Trac is installed on the server 131 * `domain_name` : host's domain name 132 133 For instance, here's how the file provided by the `default` profile looks like : 134 135 [[Include(source:cleverbox/trunk/assets/trac-defaults.ini, text/ini)]] 136 137 It rises the allowed attachment size to 10M and enables ``webadmin` and ``themeengine` plugins by default. 138 139 === `permissions.ini` === 110 140 111 141 At project creation, the Cleverbox removes the `anonymous` permission profile and creates new profiles based on the contents of the 112 `permissions.ini` file (which resides in `assets_dir` directory). Example file : 113 {{{ 114 [trac] 115 authenticated = BROWSER_VIEW CHANGESET_VIEW FILE_VIEW LOG_VIEW MILESTONE_VIEW REPORT_SQL_VIEW REPORT_VIEW ROADMAP_VIEW SEARCH_VIEW TICKET_CREATE TICKET_MODIFY TICKET_VIEW TIMELINE_VIEW WIKI_CREATE WIKI_MODIFY WIKI_VIEW 116 privileged = TRAC_ADMIN 117 }}} 142 `permissions.ini`. 143 144 For instance, here's how the file provided by the `default` profile looks like : 145 146 [[Include(source:cleverbox/trunk/assets/permissions.ini, text/ini)]] 147 148 == Design documentation == 149 150 === The environment directory === 151 152 '''Default directory is `/etc/cleverbox`'''. 153 154 This directory holds configuration information about one Cleverbox environment. It looks like this : 155 156 * `clients-available` : holds apache configuration available for every client. 157 * `clients-enabled` : contains symlinks to files located in the ''clients-available'' dir. Each file located in this directory is loaded at apache startup. 158 * `projects-available` : holds apache configuration available for every project. 159 * `projects-enabled` : contains symlinks to files located in the ''projects-available'' dir. Each file located in this directory is included by the client's apache configuration file (located in ''clients-available''). 160 * `VERSION` : this files contains the version number of the Cleverbox used to initiliaze the environment 161 * `cleverbox.ini` : this file holds configuration for the Cleverbox environment 162 163 === The data directory === 164 165 '''Default directory is `/var/cleverbox`'''. 166 167 Each client has a dedicated project environment. It looks like this : 168 169 {{{ 170 |- htdocs 171 |- <project> 172 |- logs 173 |- tmp 174 |- uploads 175 |- var 176 |- svn 177 |- <project> 178 |- trac 179 |- <project> 180 }}} 181 182 === The assets directory === 183 184 '''Default directory is `/usr/share/cleverbox/assets`'''. 185 186 It holds the files used to generate the `default` configuration profile when instanciating a new Cleverbox environment. 187 188 Usage and customisation of these files is explained in the "Advanced usage" section above. 118 189 119 190 == Roadmap == 120 191 192 === Unplanned === 193 194 * [ticket:3 Integrate import / export capabilities] 195 * [ticket:9 More integrty checking] 196 121 197 === 0.4-beta === 122 198 123 * Integrity checks prior to environment initialisation in `ìnitenv` task 124 * Better unix rights usage 125 * Integration of `cleverbox-backup.sh` script 199 * [ticket:1 trac.ini-defaults should be interpolated] 200 * [ticket:2 Rework apache templates handling] 201 * [ticket:4 Use setuptools over distutils] 202 * [ticket:10 Subversion hooks handling] 126 203 127 204 == Changelog == … … 129 206 === 2007-08-07 | trunk === 130 207 131 * removed hardcoded paths in apache configuration templates (backported to 0.3) 208 * Added documentation about design 209 * Removed hardcoded paths in apache configuration templates (backported to 0.3) 210 * Rewrote documentation for new "configuration profiles". Tried to make it a bit clearer 211 * '''[BC BREAK]''' Implemented "[ticket:2 Rework apache templates handling]" 212 * fixed [ticket:10 Subversion hooks handling] : http://trac-hacks.org/wiki/TracSvnHooksPlugin is enabled by default 132 213 133 214 === 2007-08-07 | 0.3-beta === -
cleverbox/trunk/assets/project.apache.conf
r140 r143 34 34 # -- File based authentification 35 35 # -- Users can be used using : 36 # -- htpasswd 2%(clients_root)s/%(client_name)s/var/trac/%(project_name)s/.htusers <username>36 # -- htpasswd %(clients_root)s/%(client_name)s/var/trac/%(project_name)s/.htusers <username> 37 37 AuthUserFile %(clients_root)s/%(client_name)s/var/trac/%(project_name)s/.htusers 38 38 -
cleverbox/trunk/assets/trac-defaults.ini
r129 r143 1 1 [attachment] 2 max_size = 256002 max_size = 10485760 3 3 4 4 [components] 5 5 webadmin.* = enabled 6 6 themeengine.* = enabled 7 svnhooks.svnhooks -
cleverbox/trunk/cleverbox/scripts/admin.py
r133 r143 1 1 # -*- coding: utf-8 -*- 2 2 3 import shutils 3 4 import cmd 4 5 import os … … 12 13 13 14 _defaults = { 14 'env_dir_layout' : ('clients-available', 'clients-enabled', 15 'projects-available', 'projects-enabled'), 15 'env_dir_layout' : ('clients-available', 'clients-enabled', 16 'projects-available', 'projects-enabled', 17 'profiles/default'), 16 18 'client_dir_layout' : ('htdocs', 'logs', 'tmp', 'uploads', 17 19 'var/svn', 'var/trac'), 20 'profile_files' : ('project.apache.conf', 'trac-defaults.ini', 'permissions.ini') 18 21 } 19 22 … … 133 136 collected_infos['apache_group'] = raw_input('Webserver group id [%d]> ' % d_gid).strip() or d_gid 134 137 135 # SSH user & group 136 d_uid = '1001' 137 d_gid = '1001' 138 collected_infos['ssh_user'] = raw_input('SSH user id [%s]> ' % d_uid).strip() or d_uid 139 collected_infos['ssh_group'] = raw_input('SSH group id [%s]> ' % d_gid).strip() or d_gid 140 141 # Virtual Host mode : single or multi ? 142 d_vhost_mode = 'single' 143 collected_infos['vhost_mode'] = raw_input('Virtual host mode (either "single" or "multi") [%s]> ' % d_vhost_mode).strip() or d_vhost_mode 138 # root user & group 139 # we keep the ssh_user notion for backward compatibility. 140 # this will have to disappear in a future release 141 collected_infos['ssh_user'] = 0 142 collected_infos['ssh_group'] = 0 143 144 # Host server domain name 145 collected_infos['domain'] = raw_input('Domain name > ').strip() 144 146 145 if collected_infos['vhost_mode'] == 'multi':146 collected_infos['domain'] = raw_input('Domain name > ').strip()147 148 # Cleverbox assets149 d_cleverbox_assets = '/usr/share/cleverbox'150 collected_infos['assets_dir'] = raw_input('Cleverbox assets directory [%s]> ' % d_cleverbox_assets).strip() or d_cleverbox_assets151 152 147 # Authentication backend password (if any) 153 148 collected_infos['authbackend_pass'] = raw_input('Authentication backend password (if any) []> ').strip() or '' 149 150 # Default configuration profile 151 dcp = 'default' 152 collected_infos['default_profile'] = raw_input('Default configuration profile [%s]> ' % dcp).strip() or dcp 154 153 155 154 # Write ini file … … 174 173 # Create directory structure 175 174 try: 176 print "\n\tCreating directory structure\n"175 print "\n\tCreating directory layout\n" 177 176 env_dirs = [] 178 177 for dirname in _defaults['env_dir_layout']: … … 185 184 # Create VERSION file 186 185 try: 186 print "\n\tCreating VERSION file\n" 187 187 fd = open( os.path.join(self.envname, 'VERSION'), 'w' ) 188 188 fd.write(_version) 189 189 finally: 190 190 fd.close() 191 192 # Default configuration profile 193 print "\n\tCreating default configuration profile\n" 194 for filename in _defaults['profile_files']: 195 shutils.copy('/usr/share/cleverbox/assets/' + filename, os.path.join(self.envname, 'profile', 'default')) 196 191 197 192 198 print … … 695 701 collected_infos['full_name'] = raw_input('Full Name [%s]> ' % dfn).strip() or dfn 696 702 703 print 704 print " What configuration profile should be used ?" 705 print " Those reside in %s/profiles/" % self.envname 706 print 707 708 dp = self.getConfig('default_profile', 'general') 709 collected_infos['profile'] = raw_input('Configuration profile [%s]> ' % dp).strip() or dp 710 697 711 # Project creation 698 712 print … … 751 765 TODO : clients may not be stored in 'clients_root', be careful with that. 752 766 """ 753 conf_template = open( '%s/%s.%s' % (self.getConfig('assets_dir', 'general'), 'apache.conf', self.getConfig('vhost_mode', 'general')))767 conf_template = open(os.path.join(self.envname, 'profiles', infos['profile'], 'project.apache.conf')) 754 768 conf_data = conf_template.read() % {'client_name' : infos['client'], 755 769 'project_name' : infos['short_name'], … … 841 855 # Grant default permissions 842 856 perms_config = ConfigParser.SafeConfigParser() 843 perms_config.read(os.path.join(self. getConfig('assets_dir', 'general'), 'permissions.ini'))857 perms_config.read(os.path.join(self.envname, 'profiles', infos['profile'], 'permissions.ini')) 844 858 for profile in perms_config.options('trac'): 845 859 os.system( trac_perms_cmd % {'env_path' : trac_env_path, … … 868 882 chmod g+w /$CLIENTSROOT/$CLIENTNAME/var/svn/$PROJECTNAME 869 883 chown -R www-data:dev /$CLIENTSROOT/$CLIENTNAME/var/trac/$PROJECTNAME/db 870 chown dev:www-data /$CLIENTSROOT/$CLIENTNAME/var/trac/conf/trac.ini871 chmod g+w /$CLIENTSROOT/$CLIENTNAME/var/trac/conf/trac.ini884 chown dev:www-data /$CLIENTSROOT/$CLIENTNAME/var/trac/conf/trac.ini 885 chmod g+w /$CLIENTSROOT/$CLIENTNAME/var/trac/conf/trac.ini 872 886 """ 873 887 … … 909 923 910 924 def _project_trac_defaultconf(self, infos): 925 """ 926 Overrides project's default trac.ini with values provided in configuration profile. 927 """ 928 911 929 # New defaults 912 930 tracdefaults_config = ConfigParser.SafeConfigParser() 913 tracdefaults_config.read(os.path.join(self. getConfig('assets_dir', 'general'), 'trac-defaults.ini'))931 tracdefaults_config.read(os.path.join(self.envname, 'profiles', infos['profile'], 'trac-defaults.ini')) 914 932 915 933 # Trac base config file 916 project_config_path = os.path.join( '%s/%s/var/trac/%s/conf/trac.ini' % (self.getConfig('clients_root', 'general'), infos['client'], infos['short_name']))934 project_config_path = os.path.join(self.getConfig('clients_root', 'general', infos['client'], 'var', 'trac', infos['short_name'], 'conf', 'trac.ini')) 917 935 tracproject_config = ConfigParser.SafeConfigParser() 918 936 tracproject_config.read(project_config_path)
