class ErrorListenerProject(Project):
    """
    Install SupervisorErrorListener
    """

    name = 'errorlistener'
    title = 'Install error listener'
    settings = [
        Setting('spec',
                default='requirements/errorlistener-req.txt',
                help='Specification of packages to install'),
    ]

    actions = [
        tasks.VirtualEnv(),
        tasks.InstallSpec('Install SupervisorErrorListener',
                          '{{config.spec}}'),
        tasks.EnsureFile(
            'Install supervisor listener config',
            '{{env.base_path}}/etc/supervisor.d/errorlistener.ini',
            content=errorlistener_template),
        tasks.EnsureDir('Create log directory',
                        '{{env.var}}/logs/errorlistener'),
    ]

    depends_on_projects = ['fassembler:topp', 'fassembler:supervisor']
class ScriptTranscluderProject(Project):
    """
    Install ScriptTranscluder
    """

    name = 'scripttranscluder'
    title = 'Install ScriptTranscluder'
    settings = [
        ## FIXME: there should be some higher-level sense of
        ## tag/branch/trunk, and maybe latest too:
        Setting('spec',
                default='requirements/scripttranscluder-req.txt',
                help='Specification of packages to install'),
        Setting('port',
                default='{{env.base_port+int(config.port_offset)}}',
                help='Port to install ScriptTranscluder on'),
        Setting('port_offset', default='5', help='Offset from base_port'),
        Setting('host', default='localhost', help='Host to serve on'),
    ]

    actions = [
        tasks.VirtualEnv(),
        tasks.InstallSpec('Install ScriptTranscluder', '{{config.spec}}'),
        tasks.InstallPasteConfig(
            path=
            'scripttranscluder/src/scripttranscluder/fassembler_config.ini_tmpl'
        ),
        tasks.InstallPasteStartup(),
        tasks.InstallSupervisorConfig(),
        tasks.SaveURI(path='/include.js',
                      project_local=False,
                      trailing_slash=False),
    ]

    depends_on_projects = ['fassembler:topp']
class DeliveranceProject(Project):
    """
    Install Deliverance/DeliveranceVHoster
    """

    name = 'deliverance'
    title = 'Install Deliverance/DeliveranceVHoster'
    settings = [
        Setting('spec',
                default='requirements/deliverance-req.txt',
                help='Specification of packages to install'),
        Setting(
            'openplans_hooks_repo',
            default='https://svn.openplans.org/svn/build/openplans_hooks/trunk',
            help='SVN location of openplans_hooks'),
        Setting('port',
                default='{{env.base_port+int(config.port_offset)}}',
                help='Port to install Deliverance on'),
        Setting('port_offset',
                default='0',
                help='Offset from base_port for Deliverance'),
        Setting('host', default='localhost', help='Host to serve on'),
        Setting('force_ssl',
                inherit_config=('general', 'force_ssl'),
                default='False',
                help='Redirect ssl-only paths to https'),
        Setting(
            'default_rules_repo',
            default=
            '{{project.req_settings.get("rules_repo", "https://svn.openplans.org/svn/build/rules/openplans")}}',
            help='Default svn location of deliverance rules',
        )
    ]

    actions = [
        tasks.SaveSetting('Save force_ssl setting',
                          {'force_ssl': '{{config.force_ssl}}'}),
        tasks.VirtualEnv(),
        tasks.InstallSpec('Install Deliverance', '{{config.spec}}'),
        tasks.TestLxml('{{env.base_path}}/deliverance'),
        tasks.SvnCheckout('Checkout openplans_hooks',
                          '{{config.openplans_hooks_repo}}',
                          '{{project.name}}/src/openplans_hooks'),
        tasks.SvnCheckout('Checkout default rules',
                          '{{config.default_rules_repo}}',
                          '{{env.var}}/deliverance/default_rules'),
        tasks.InstallPasteConfig(
            path='deliverance/src/deliverancevhoster/fassembler_config.ini_tmpl'
        ),
        tasks.InstallPasteStartup(),
        tasks.InstallSupervisorConfig(),
        tasks.SaveURI(path='/', theme=False),
    ]

    depends_on_projects = ['fassembler:topp']
class ZineProject(Project):
    """
    Install Zine
    """

    name = 'zine'
    title = 'Install Zine'
    settings = [
        Setting('zine_instances_directory',
                default='{{env.var}}/{{project.name}}/instances',
                help="Directory that will house all projects' Zine instances (config files and sqlite databases)",
                ),
        Setting('port',
                default='{{env.base_port+4}}',
                help='Port to install Zine on'),
        Setting('host',
                default='localhost',
                help='Host to serve on'),
        Setting('spec',
                default='requirements/zine-req.txt',
                help='Specification of packages to install'),
        Setting('shared_secret_filename',
                default='{{env.var}}/secret.txt',
                help='Path to the file containing the shared secret used to encrypt and decrypt the auth cookie'),
        Setting('admin_info_filename',
                default='{{env.var}}/admin.txt',
                help='Path to the file containing credentials of a site admin user that can be used to query projects for their security policies and memberships'),
        Setting('internal_root_url',
                default='http://localhost:{{env.base_port+1}}/openplans/',
                help='Base url path to the opencore site root; if possible this should hit Zope directly using a non-internet-wide connection, because site admin credentials are passed in the HTTP request'),
        Setting('use_pip',
                default='True',
                help="Use pip to install requirements, or easy_install"),
        ]

    actions = [
        tasks.VirtualEnv(),
        tasks.InstallSpec('Install Zine',
                          '{{config.spec}}'),
        tasks.InstallPasteConfig(path=resource_filename(
                'fassembler_projects', 'templates/zine/paste.ini_tmpl')),
        tasks.InstallPasteStartup(),
        tasks.InstallSupervisorConfig(),
        ]
class WindmillProject(Project):
    """
    Install Windmill
    """

    name = 'windmill'
    title = 'Install Windmill'

    settings = [
        Setting('spec',
                default='requirements/windmill-req.txt',
                help='Specification of packages to install'),
    ]

    actions = [
        tasks.VirtualEnv(different_python='python2.5'),
        tasks.InstallSpec('Install windmill and other dependencies',
                          '{{config.spec}}'),
    ]

    depends_on_projects = ['fassembler:topp']
class ErrorEaterProject(Project):
    """
    Install ErrorEater
    """

    name = 'erroreater'
    title = 'Install ErrorEater'
    settings = [
        Setting('spec',
                default='requirements/erroreater-req.txt',
                help='Specification of packages to install'),
        Setting('port',
                default='{{env.base_port+int(config.port_offset)}}',
                help='Port to install ErrorEater on'),
        Setting('port_offset', default='8', help='Offset from base_port'),
        Setting('host', default='localhost', help='Host to serve on'),
    ]

    actions = [
        tasks.VirtualEnv(),
        tasks.InstallSpec('Install ErrorEater', '{{config.spec}}'),
        tasks.InstallPasteConfig(
            path='erroreater/src/erroreater/fassembler_config.ini_tmpl'),
        tasks.InstallPasteStartup(),
        tasks.InstallSupervisorConfig(),
        tasks.SaveURI(path='/.debug/errors', project_local=False, theme=False),
        tasks.
        Script('Run setup-app', [
            'paster', 'setup-app',
            '{{env.base_path}}/etc/{{project.name}}/{{project.name}}.ini#main-app'
        ],
               use_virtualenv=True,
               cwd='{{env.base_path}}/{{project.name}}/src/{{project.name}}'),
        EnsureHtpasswdFile(
            'Write DevAuth htpasswd file with admin password if it does not exist'
        ),
    ]

    ## FIXME: and the listener
    depends_on_projects = ['fassembler:topp']
Beispiel #7
0
class SupervisorProject(Project):
    """
    Sets up Supervisor2 (http://www.plope.com/software/supervisor2/)
    """
    name = 'supervisor'
    title = 'Install Supervisor2'
    project_base_dir = os.path.join(os.path.dirname(__file__), 'supervisor-files')

    settings = [
        Setting('spec',
                default='requirements/supervisor-req.txt',
                help='Specification for installing Supervisor'),
        Setting('port',
                default='{{env.base_port+int(config.port_offset)}}',
                help="Port to install HTTP server on"),
        Setting('port_offset',
                default='10',
                help='Offset from base_port for HTTP server'),
        Setting('supervisor_var',
                default='{{env.var}}/supervisor',
                help="The path to use for supervisor's socket and pidfile; "
                "if you are building an instance in parallel to a running site "
                "you may want to point this elsewhere from env.var so that "
                "you can run both supervisor processes simultaneously"),
        ]
    
    actions = [
        tasks.VirtualEnv(),
        tasks.InstallSpec('Install Supervisor',
                          '{{config.spec}}'),
        tasks.CopyDir('Create config layout', project_base_dir, './'),
        tasks.EnsureDir('Ensure log directory exists',
                        '{{env.var}}/logs/supervisor'),
        tasks.EnsureDir('Ensure pid location exists',
                        '{{config.supervisor_var}}'),
        ]
class BuildBotProject(Project):
    """Buildbot base project class"""

    files_dir = os.path.join(os.path.dirname(__file__), 'buildbot-files')
    skel_dir = os.path.join(files_dir, 'skel')

    depends_on_projects = ['fassembler:topp']

    hostname, platform, version = get_host_info()

    buildslave_dirname = 'buildslave'

    settings = [
        Setting(
            'buildbot_url',
            inherit_config=('general', 'buildbot_url'),
            default='http://buildbot.socialplanning.org',
            help='Public URL of the buildbot web page',
        ),
        Setting('spec',
                default='requirements/buildbot-req.txt',
                help='Specification of packages to install'),
        Setting('buildmaster_host',
                default='localhost',
                help='Host the buildmaster runs on'),
        Setting('baseport', default='{{env.base_port}}', help="Base port"),
        Setting(
            'child_baseport',
            default='{{env.base_port +  1000}}',
            help=
            "Base port for applications built by the bots. There are multiple builders, so choose a number where you have a few hundred ports free after that!"
        ),  # It kind of sucks that the master config is in charge of this.
        Setting(
            'buildmaster_private_port',
            default='{{env.base_port+int(config.buildmaster_private_offset)}}',
            help="Port to run the private buildmaster on (force build allowed)"
        ),
        Setting('buildmaster_private_offset',
                default='20',
                help="Offset from base_port for the private build master."),
        Setting(
            'buildmaster_public_port',
            default='{{env.base_port+int(config.buildmaster_public_offset)}}',
            help=
            "Port to run the public buildmaster on (force build disallowed)"),
        Setting('buildmaster_public_offset',
                default='21',
                help="Offset from base_port for the public build master."),
        Setting('buildslave_port',
                default='{{env.base_port+int(config.buildslave_port_offset)}}',
                help="Port build slaves connect to the master on"),
        Setting(
            'buildslave_port_offset',
            default='22',
            help='Offset from base_port for the build slave connect port.'),
        Setting('buildbot_passwd',
                help="Password for buildslaves to connect to master."),
        Setting(
            'buildslave_dir',
            default='{{project.buildslave_dirname}}',
            help="Subdirectory to put the buildslave in. Must be relative"),
        Setting(
            'basedir',
            default='build',
            help='Subdirectory where slave will build stuff.',
        ),
        Setting('editwarning',
                default=editwarning,
                help='Text to warn people about editing generated files.'),
    ]

    actions = [
        tasks.VirtualEnv(),
        tasks.InstallSpec('Install buildbot dependencies', '{{config.spec}}'),
        tasks.SaveSetting('Save buildbot settings',
                          {'buildbot_url': '{{config.buildbot_url}}'},
                          section='general'),
    ]
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}}.'),
    ]
Beispiel #10
0
class FrontendProject(Project):
    """
    Install the libopencore frontend that proxies over http to opencore,
    tasktracker and wordpress, with a Deliverance theme applied to the
    tasktracker and wordpress responses.
    """

    name = 'frontend'
    title = "Install frontend"

    settings = [
        Setting('port',
                default='{{env.base_port}}',
                help='Port the frontend should listen on'),
        Setting('opencore_remote_uri',
                default='http://localhost:{{env.base_port+1}}{{if env.num_extra_zopes}}{{for i in range(env.num_extra_zopes)}} http://localhost:{{env.base_port+10*(i+1)+1}}{{endfor}}{{endif}}',
                help="Base domain and port that opencore's Zope instance is listening on"),
        Setting('tasktracker_remote_uri',
                default='http://localhost:{{env.base_port+4}}',
                help="Base domain and port that TaskTracker is listening on"),
        Setting('wordpress_remote_uri',
                default='http://localhost:{{env.base_port+3}}',
                help="Base domain and port that WordPress is listening on"),
        Setting('zine_remote_uri',
                default='http://localhost:{{env.base_port+3}}',
                help="Base domain and port that Zine is listening on"),
        Setting('use_tasktracker',
                default='1',
                help="Set to 0 if you don't have tasktracker enabled"),
        Setting('use_wordpress',
                default='1',
                help="Set to 0 if you don't have wordpress enabled"),
        Setting('use_zine',
                default='0',
                help="Set to 1 if you have zine enabled"),
        Setting('spec',
                default='requirements/frontend-req.txt',
                help='Specification of packages to install'),
        Setting('only_local_connections',
                default='0',
                help="Set to 1 if you want to restrict access to localhost (for example if you are using a proxy server as your frontmost component)"),
        Setting('static_file_root',
                default='None',
                help="(Optional) Full path to a directory on the filesystem where static files will be served from. If set, a Paste#static fileserver will be mounted on the path prefix `/++static++/`"),
        Setting('use_twirlip',
                default='1',
                help="Set to 0 if you don't have twirlip enabled"),
        Setting('shared_secret_filename',
                default='{{env.var}}/secret.txt',
                help='Path to the file containing the shared secret used to encrypt and decrypt the auth cookie'),
        Setting('twirlip_remote_uri',
                default='http://localhost:{{env.base_port+7}}',
                help="Base domain and port that Twirlip is listening on"),
        Setting("use_pip",
                default="True"),
        ]

    actions = [
        tasks.VirtualEnv(),
        tasks.InstallSpec('Install frontend', '{{config.spec}}'),
        tasks.InstallPasteConfig(path=resource_filename(
                'fassembler_projects', 'templates/frontend/paste.ini_tmpl')),
        tasks.InstallPasteStartup(),
        tasks.InstallSupervisorConfig(),
        ]
class FeedBackerProject(Project):
    """
    Install FeedBacker
    """

    name = 'feedbacker'
    title = 'Install FeedBacker'

    #XXX will depend on cabochon shortly
    #depends_on_projects = ['fassembler:topp', 'fassembler:cabochon']
    depends_on_projects = ['fassembler:topp']
    depends_on_executables = ['mysql_config']

    settings = [
        Setting(
            'db_sqlalchemy',
            default=
            'mysql://{{config.db_username}}:{{config.db_password}}@{{config.db_host}}/{{config.db_name}}?charset={{config.charset}}',
            help='Full sqlalchemy connection string for database'),
        Setting('charset', default='utf8', help='Database connection charset'),
        Setting('db_username',
                default='feedbacker',
                help='Database connection username'),
        Setting('db_password',
                default='feedbacker',
                help='Database connection password'),
        Setting('db_host',
                default='localhost',
                help='Host where database is running'),
        Setting(
            'db_name',
            default=
            '{{env.config.getdefault("general", "db_prefix", "")}}feedbacker',
            help='Name of database'),
        Setting('db_test_sqlalchemy',
                default='sqlite:///:memory:',
                help='Full sqlalchemy connection string for test database'),
        Setting('db_root_password',
                default='{{env.db_root_password}}',
                help='Database root password'),
        Setting('port',
                default='{{env.base_port+int(config.port_offset)}}',
                help='Port to install TaskTracker on'),
        Setting('port_offset',
                default='8',
                help='Offset from base_port for FeedBacker'),
        Setting('host', default='localhost', help='Host to serve on'),
        Setting('spec',
                default='requirements/feedbacker-req.txt',
                help='Specification of packages to install'),
    ]

    actions = [
        tasks.VirtualEnv(),
        tasks.InstallSpec('Install FeedBacker', '{{config.spec}}'),
        tasks.InstallPasteConfig(
            path='feedbacker/src/feedbacker/fassembler_config.ini_tmpl'),
        tasks.InstallPasteConfig(
            path='feedbacker/src/feedbacker/fassembler_who.ini_tmpl',
            ininame='who'),
        tasks.InstallPasteStartup(),
        tasks.InstallSupervisorConfig(),
        tasks.SaveURI(path='/', theme=False),
        tasks.CheckMySQLDatabase('Check database exists'),
        tasks.SaveCabochonSubscriber({'send_feed_item': ('/', 'False')})
    ]
class HengeProject(Project):
    """
    Install Henge
    """

    name = 'henge'
    title = 'Install Henge'
    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='henge',
                help='Database connection username'),
        Setting('db_password',
                default='henge',
                help='Database connection password'),
        Setting('db_host',
                default='localhost',
                help='Host where database is running'),
        Setting('db_name',
                default=
                '{{env.config.getdefault("general", "db_prefix", "")}}henge',
                help='Name of database'),
        Setting(
            'db_test_sqlobject',
            default=
            'mysql://{{config.db_username}}:{{config.db_password}}@{{config.db_host}}/{{config.db_test_name}}',
            help='Full SQLObject connection string for test database'),
        Setting('db_test_name',
                default='henge_test',
                help='Name of the test database'),
        Setting('db_root_password',
                default='{{env.db_root_password}}',
                help='Database root password'),
        #Setting('henge_repo',
        #        default='https://svn.openplans.org/svn/henge/trunk',
        #        help='svn location to install henge from'),
        Setting('port',
                default='{{env.base_port+int(config.port_offset)}}',
                help='Port to install Henge on'),
        Setting('port_offset',
                default='13',
                help='Offset from base_port for Henge'),
        Setting('host', default='localhost', help='Host to serve on'),
        Setting('spec',
                default='requirements/henge-req.txt',
                help='Specification of packages to install'),
    ]

    actions = [
        tasks.VirtualEnv(),
        tasks.InstallSpec('Install Henge', '{{config.spec}}'),
        tasks.InstallPasteConfig(
            path='henge/src/henge/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#henge'
        ],
               use_virtualenv=True,
               cwd='{{env.base_path}}/{{project.name}}/src/{{project.name}}'),
        tasks.SaveURI(path='/calendar', project_local=True),
    ]

    depends_on_projects = ['fassembler:topp']
    depends_on_executables = ['mysql_config']
class TaskTrackerProject(Project):
    """
    Install TaskTracker
    """

    name = 'tasktracker'
    title = 'Install TaskTracker'
    settings = [
        Setting('use_pip',
                default='1',
                help="Whether to install with pip or easy_install"),
        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='tasktracker',
                help='Database connection username'),
        Setting('db_password',
                default='tasktracker',
                help='Database connection password'),
        Setting('db_host',
                default='localhost',
                help='Host where database is running'),
        Setting(
            'db_name',
            default=
            '{{env.config.getdefault("general", "db_prefix", "")}}tasktracker',
            help='Name of database'),
        Setting(
            'db_test_sqlobject',
            default=
            'mysql://{{config.db_username}}:{{config.db_password}}@{{config.db_host}}/{{config.db_test_name}}',
            help='Full SQLObject connection string for test database'),
        Setting('db_test_name',
                default='tasktracker_test',
                help='Name of the test database'),
        Setting('db_root_password',
                default='{{env.db_root_password}}',
                help='Database root password'),
        #Setting('tasktracker_repo',
        #        default='https://svn.openplans.org/svn/TaskTracker/trunk',
        #        help='svn location to install TaskTracker from'),
        Setting('port',
                default='{{env.base_port+int(config.port_offset)}}',
                help='Port to install TaskTracker on'),
        Setting('port_offset',
                default='4',
                help='Offset from base_port for TaskTracker'),
        Setting('host', default='localhost', help='Host to serve on'),
        Setting('spec',
                default='requirements/tasktracker-req.txt',
                help='Specification of packages to install'),
    ]

    actions = [
        tasks.VirtualEnv(),
        tasks.InstallSpec('Install TaskTracker', '{{config.spec}}'),
        tasks.InstallPasteConfig(
            path='tasktracker/src/tasktracker/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#tasktracker'
        ],
               use_virtualenv=True,
               cwd='{{env.base_path}}/{{project.name}}/src/{{project.name}}'),
        tasks.SaveURI(path='/tasks'),
        tasks.SaveCabochonSubscriber(
            {'delete_project': '/projects/{id}/tasks/project/destroy'},
            use_base_port=True),
    ]

    depends_on_projects = ['fassembler:topp', 'fassembler:cabochon']
    depends_on_executables = ['mysql_config']
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']
class RelateMeProject(Project):
    """
    Install RelateMe
    """

    name = 'relateme'
    title = 'Install RelateMe'
    settings = [
        Setting('db_host',
                default='localhost',
                help='Host where database is running'),
        Setting('db_streetsblog_username',
                default='streetsblog',
                help='Database connection username'),
        Setting('db_streetsblog_password',
                default='sblog',
                help='Database connection password'),
        Setting('db_streetsblog_name',
                default='streetsblog',
                help='Name of database'),
        Setting('db_streetfilms_username',
                default='sfilms',
                help='Database connection username'),
        Setting('db_streetfilms_password',
                default='sfilms',
                help='Database connection password'),
        Setting('db_streetfilms_name',
                default='sfilms',
                help='Name of database'),
        Setting('db_root_password',
                default='{{env.db_root_password}}',
                help='Database root password'),
        Setting('port',
                default='{{env.base_port+int(config.port_offset)}}',
                help='Port to install RelateMe on'),
        Setting('port_offset',
                default='9',
                help='Offset from base_port for RelateMe'),
        Setting('host', default='localhost', help='Host to serve on'),
        Setting('spec',
                default='requirements/relateme-req.txt',
                help='Specification of packages to install'),
    ]

    actions = [
        tasks.VirtualEnv(),
        tasks.InstallSpec('Install RelateMe', '{{config.spec}}'),
        tasks.InstallPasteConfig(
            path='relateme/src/relateme/fassembler_config.ini_tmpl'),
        tasks.InstallPasteStartup(),
        tasks.InstallSupervisorConfig(),
        ## RelateMe uses the WordPress database, so it doesn't control anything:
        #tasks.CheckMySQLDatabase('Check database exists'),
        #tasks.Script('Run setup-app',
        #             ['paster', 'setup-app', '{{env.base_path}}/etc/{{project.name}}/{{project.name}}.ini#relateme'],
        #             use_virtualenv=True,
        #             cwd='{{env.base_path}}/{{project.name}}/src/{{project.name}}'),
        ## Currently we are not using Deliverance, so this is kind of redundant:
        #tasks.SaveURI(path='/api/relateme'),
    ]

    depends_on_projects = ['fassembler:topp']
    depends_on_executables = ['mysql_config']
class CabochonProject(Project):
    """
    Install Cabochon
    """
    depends_on_projects = ['fassembler:topp']

    name = 'cabochon'
    title = 'Install Cabochon'
    settings = [
        Setting('use_pip',
                default='1',
                help="Whether to install with pip or easy_install"),
        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='cabochon',
                help='Database connection username'),
        Setting('db_password',
                default='cabochon',
                help='Database connection password'),
        Setting('db_host',
                default='localhost',
                help='Host where database is running'),
        Setting(
            'db_name',
            default=
            '{{env.config.getdefault("general", "db_prefix", "")}}cabochon',
            help='Name of database'),
        Setting(
            'db_test_sqlobject',
            default=
            'mysql://{{config.db_username}}:{{config.db_password}}@{{config.db_host}}/{{config.db_test_name}}',
            help='Full SQLObject connection string for test database'),
        Setting('db_test_name',
                default='cabochon_test',
                help='Name of the test database'),
        Setting('db_root_password',
                default='{{env.db_root_password}}',
                help='Database root password'),
        #Setting('cabochon_repo',
        #        default='https://svn.openplans.org/svn/Cabochon/trunk',
        #        help='svn location to install Cabochon from'),
        Setting('port',
                default='{{env.base_port+int(config.port_offset)}}',
                help='Port to install Cabochon on'),
        Setting('port_offset',
                default='6',
                help='Offset from base_port for Cabochon'),
        Setting('host', default='localhost', help='Host to serve on'),
        Setting('spec',
                default='requirements/cabochon-req.txt',
                help='Specification of packages to install'),
        Setting('cabochon_user_info',
                default='{{env.var}}/cabochon-password.txt',
                help='The cabochon admin user info'),
    ]

    actions = [
        tasks.VirtualEnv(),
        tasks.InstallSpec('Install Cabochon', '{{config.spec}}'),
        tasks.InstallPasteConfig(
            path='cabochon/src/cabochon/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#cabochon'
        ],
               use_virtualenv=True,
               cwd='{{env.base_path}}/{{project.name}}/src/{{project.name}}'),
        tasks.EnsureFile('Write cabochon_user_info.txt if necessary',
                         '{{config.cabochon_user_info}}',
                         'cabochon:{{env.random_string(12, "alphanumeric")}}',
                         overwrite=False),
        tasks.SaveSetting(
            'save setting',
            {'cabochon_user_info': '{{config.cabochon_user_info}}'}),
        tasks.SaveURI(path='/', public=False),
    ]

    depends_on_projects = ['fassembler:topp']
    depends_on_executables = ['mysql_config']