class NYMapProject(Project): """ Install NYMap """ name = 'nymap' title = 'Install NYMap' settings = [ Setting('svn', default='http://svn.opengeo.org/vespucci/branches/woonerf/', help='Location of nymap svn repository'), # Setting('geoserver_url', # default='http://artois.openplans.org/geoserver/ows/', # help='Location where GeoServer is running'), ] actions = [ tasks.SvnCheckout('Checkout nymap', repository='{{config.svn}}', dest='{{env.base_path}}/{{project.name}}/src/nymap'), tasks.Script('Run build script', ['./build', '-f'], cwd='{{env.base_path}}/{{project.name}}/src/nymap/build'), tasks.SaveURI( path='/maps', uri='file://{{env.base_path}}/{{project.name}}/src/nymap', project_local=False, ## FIXME: this should be themable, but currently ## is not (see #2172): theme=False, ), ] depends_on_projects = ['fassembler:topp']
class BuildMasterProject(BuildBotProject): """Install Buildbot master that controls our automated builds & tests. """ name = 'buildmaster' title = 'Installs a buildbot master' config_template = 'master.cfg_tmpl' settings = BuildBotProject.settings + [ Setting('master_dir', default='{{os.path.join(env.base_path, project.name)}}', help="Directory to put the build master in."), Setting( 'stack_to_build', default='openplans', help="Which stack to build (choose one of: openplans, almanac)"), ] actions = BuildBotProject.actions + [ tasks.Script( 'Make a buildbot master', ['bin/buildbot', 'create-master', '{{config.master_dir}}'], cwd='{{config.master_dir}}'), tasks.EnsureFile( 'Overwrite the buildbot master.cfg file', '{{os.path.join(config.master_dir, "master.cfg")}}', content_path= '{{os.path.join(project.skel_dir, config.stack_to_build)}}_master.cfg_tmpl', force_overwrite=True, svn_add=False), ]
class BuildSlaveProject(BuildBotProject): """Install a Buildbot slave to connect to our build master""" name = BuildBotProject.buildslave_dirname title = 'Installs a buildbot slave' settings = BuildBotProject.settings + [ Setting('buildslave_name', help="Name of this build slave."), Setting( 'buildslave_description', default= '{{project.platform}} {{project.version}} running on {{project.hostname}}', help="Public description of your build slave's platform.", ) ] actions = BuildBotProject.actions + [ tasks.EnsureDir('Make sure src directory exists', '{{os.path.join(config.buildslave_dir, "src")}}', svn_add=False), tasks.EnsureFile( 'Install the accept_certificates script', '{{os.path.join(config.buildslave_dir, "bin", "accept_certificates.sh")}}', content_path= '{{os.path.join(project.skel_dir, "accept_certificates.sh")}}', force_overwrite=True, svn_add=False, executable=True), tasks.SourceInstall( 'Install the port killer script', 'https://svn.socialplanning.org/svn/standalone/portutils/trunk/', 'portutils'), tasks.Script( 'Move aside the old config if it exists', 'test -f {{config.buildslave_dir}}/buildbot.tac && mv -f {{config.buildslave_dir}}/buildbot.tac {{config.buildslave_dir}}/buildbot.tac.old || echo nothing to move', cwd='{{env.base_path}}', shell=True), tasks.Script( 'Make a buildbot slave', [ 'bin/buildbot', 'create-slave', '--keepalive=60', # Jeff warns that they lose connection at default '--umask=002', # it's 077 by default. '.', '{{config.buildmaster_host}}:{{config.buildslave_port}}', '{{config.buildslave_name}}', '{{config.buildbot_passwd}}' ], cwd='{{os.path.join(env.base_path, config.buildslave_dir)}}'), tasks.EnsureFile( 'Overwrite the buildslave host info file', '{{os.path.join(config.buildslave_dir, "info", "host")}}', content_path='{{os.path.join(project.skel_dir, "host_tmpl")}}', force_overwrite=True, svn_add=False), tasks.EnsureFile( 'Overwrite the buildslave admin info file', '{{os.path.join(config.buildslave_dir, "info", "admin")}}', content_path='{{os.path.join(project.skel_dir, "admin_tmpl")}}', force_overwrite=True, svn_add=False), ]
class BrainpowerProject(Project): """Brainpower base project class""" name = 'brainpower' title = 'Installs Brainpower' depends_on_projects = ['fassembler:topp'] def get_req_setting(self, setting): return self.req_settings.get(setting, '') settings = [ Setting( 'port_offset', default='11', help='Port offset from base_port to run the dev django server on'), Setting('port', default='{{env.base_port+int(config.port_offset)}}', help="Port to run the dev django server on"), Setting('db_engine', default='mysql', help="Engine to use for django's database"), Setting('db_host', default='', help="Database host"), Setting('db_username', default='root', help="Database user"), Setting('db_password', default='', help="Database password"), Setting('db_root_password', default='', help="Database root password"), Setting('db_name', default='brainpower', help="Database name"), Setting('test_db_name', default='brainpower_test', help="Scratch database name for tests"), Setting( 'secret_key', default= '{{maker.ask_password("Enter secret key for Django or press enter for a random one")}}', help="Django's secret key"), Setting('spec', default='requirements/brainpower-req.txt', help='Specification of packages to install'), Setting( 'django_tarball_url', default='{{project.get_req_setting("django_tarball_url")}}', help='Where to download the django source', ), Setting( 'django_tarball_version', default='{{project.get_req_setting("django_tarball_version")}}', help='Version of Django to install', ), Setting( 'python', default='{{project.build_properties.get("virtualenv_python")}}', help='Where our Python gets installed', ), Setting( 'flunc', default= '{{project.build_properties.get("virtualenv_bin_path") + "/flunc"}}', help="Where our Flunc executable is installed.", ) ] actions = [ tasks.VirtualEnv(), tasks.InstallSpec('Install brainpower dependencies', '{{config.spec}}'), InstallDjango(), tasks.CheckMySQLDatabase('Check main brainpower database exists'), tasks.CheckMySQLDatabase('Check test brainpower database exists', db_name='{{config.test_db_name}}'), tasks.SaveSetting('Save brainpower settings', { 'django_tarball_version': '{{config.django_tarball_version}}', 'django_tarball_url': '{{config.django_tarball_url}}', 'dev_port': '{{config.port}}', 'python': '{{config.python}}', 'flunc': '{{config.flunc}}', 'db_engine': '{{config.db_engine}}', 'db_username': '******', 'db_password': '******', 'db_host': '{{config.db_host}}', 'db_name': '{{config.db_name}}', 'secret_key': '{{config.secret_key}}', }, section='brainpower'), tasks.Script('Initialize brainpower database', ['brainpower/bin/manage.py', 'syncdb', '--noinput']), # Order of arguments matters here! Watch out for # django bug http://code.djangoproject.com/ticket/7595 tasks.Script('Initialize brainpower test database', [ 'brainpower/bin/manage.py', 'syncdb', '--settings=brainpower.test_settings', '--noinput' ]), tasks.EnsureFile( 'Copy mod_python handler to bin directory', dest= '{{project.build_properties["virtualenv_bin_path"]}}/brainpower_handler.py', content_path= '{{project.build_properties["virtualenv_path"]}}/src/brainpower/brainpower_handler.py', executable=True, ), MediaLinks('Link media directories into {{task.htdocs}}.'), ]
class WordPressProject(Project, ApacheMixin): """ Install WordPress """ name = 'wordpress' title = 'Install WordPress' required_modules = ('mime', 'dir', 'rewrite') settings = [ Setting('port', default='{{env.base_port+int(config.port_offset)}}', help="Port to install Apache/WordPress on"), Setting('port_offset', default='3', help='Offset from base_port for Apache/WordPress'), Setting('host', default='localhost', help='Interface/host to serve Apache/WordPress on'), Setting('wordpress_repo', default='{{project.req_settings.get("wordpress_repo", \ "https://svn.github.com/socialplanning/opencore-wordpress-mu")}}', help='Location of WordPress MU repository'), Setting( 'wordpress_scripts_repo', default= 'https://svn.github.com/socialplanning/opencore-wordpress-mu-scripts', help='Location of scripts for WordPress'), Setting('apache_exec', default='{{project.apache_exec()}}', help='Location of apache executable'), Setting('apache_module_dir', default='{{project.apache_module_dir()}}', help='Location of apache modules'), Setting('php_cgi_exec', default='{{project.php_cgi_exec()}}', help='Location of php cgi executable'), Setting('server_admin', default='{{env.environ["USER"]}}@{{env.fq_hostname}}', help='Server admin for Apache'), Setting( 'db_name', default= '{{env.config.getdefault("general", "db_prefix", "")}}wordpress', help='Database name'), Setting('db_username', default='wordpress', help='Database user'), Setting('db_password', default='wordpress', help='Database password'), Setting('db_host', default='localhost', help='Database host'), Setting('db_root_password', default='{{env.db_root_password}}', help='Database root password'), Setting( 'topp_wordpress_theme', default= '{{project.req_settings.get("topp_wordpress_theme", "openplans")}}', help='Theme for wordpress (template option)'), ] skel_dir = os.path.join(os.path.dirname(__file__), 'wordpress-files', 'skel') actions = [ tasks.SaveSetting( 'Save the wordpress theme (template)', {'topp_wordpress_theme': '{{config.topp_wordpress_theme}}'}, section='applications'), CheckPHP('{{config.php_cgi_exec}}'), CheckApache(('mime', 'dir', 'rewrite', 'php')), tasks.CopyDir('Create layout', skel_dir, './'), tasks.SvnCheckout('Checkout wordpress-mu', '{{config.wordpress_repo}}', '{{env.base_path}}/wordpress/src/wordpress-mu'), tasks.SvnCheckout('Checkout scripts', '{{config.wordpress_scripts_repo}}', '{{env.base_path}}/wordpress/src/scripts'), tasks.EnsureFile( 'Fill in wp-config.php', '{{env.base_path}}/wordpress/src/wordpress-mu/wp-config.php', content_path= '{{env.base_path}}/wordpress/src/wordpress-mu/wp-config.php_tmpl', svn_add=False, overwrite=True), tasks.InstallSupervisorConfig(), tasks.EnsureDir('Create var subdirectory', '{{env.var}}/wordpress'), tasks.CheckMySQLDatabase('Check database'), tasks.Script('Setup database tables', [ '{{config.php_cgi_exec}}', '-f', 'dbsetup.php', '{{project.secret()}}' ], cwd='{{env.base_path}}/wordpress/src/wordpress-mu'), tasks.SaveURI(path='/blog'), DeleteExtraWPSiteRows(db='{{config.db_name}}', user='******', passwd='{{config.db_password}}'), ] depends_on_projects = ['fassembler:topp'] depends_on_executables = [('httpd', 'apache2')] def secret(self): f = open(self.environ.config.get('general', 'topp_secret_filename'), 'rb') c = f.read() f.close() return c
class BureauProject(Project): """ Install Bureau """ name = 'bureau' title = 'Install Bureau' settings = [ Setting( 'db_sqlobject', default= 'mysql://{{config.db_username}}:{{config.db_password}}@{{config.db_host}}/{{config.db_name}}?charset=utf8', help='Full SQLObject connection string for database'), Setting('db_username', default='piwik', help='Database connection username'), Setting('db_password', default='piwik', help='Database connection password'), Setting('db_host', default='localhost', help='Host where database is running'), Setting('db_name', default='piwik', help='Name of database'), Setting('db_root_password', default='{{env.db_root_password}}', help='Database root password'), Setting('bureau_repo', default='https://svn.openplans.org/svn/bureau/trunk', help='svn location to install Bureau from'), Setting('port', default='{{env.base_port+int(config.port_offset)}}', help='Port to install Bureau on'), Setting('port_offset', default='12', help='Offset from base_port for Bureau'), Setting('host', default='localhost', help='Host to serve on'), Setting('spec', default='requirements/bureau-req.txt', help='Specification of packages to install'), ] actions = [ tasks.VirtualEnv(), tasks.InstallSpec('Install Bureau', '{{config.spec}}'), tasks.InstallPasteConfig( path='bureau/src/bureau/fassembler_config.ini_tmpl'), tasks.InstallPasteStartup(), tasks.InstallSupervisorConfig(), tasks.CheckMySQLDatabase('Check database exists'), tasks.Script( 'Run setup-app', [ 'paster', 'setup-app', '{{env.base_path}}/etc/{{project.name}}/{{project.name}}.ini' ], use_virtualenv=True, cwd='{{env.base_path}}/{{project.name}}/src/{{project.name}}'), tasks.SaveURI(path='/tasks'), ] depends_on_projects = ['fassembler:topp'] depends_on_executables = ['mysql_config']