Exemplo n.º 1
0
    def bootstrap(self, python='pypy'):
        # Create the user only if it does not already exist
        if fails('/usr/bin/id {}'.format(self.serviceUser)):
            if not hasSudoCapabilities():
                abort("User {} doesn't exist and we can't create it.".format(
                    self.serviceUser))
            sudo(
                '/usr/sbin/useradd --base-dir {} --groups service --user-group '
                '--create-home --system --shell /bin/bash '
                '{}'.format(self.baseServicesDirectory, self.serviceUser))

        with settings(user=self.serviceUser):
            # Install twisted
            pip.install('twisted')

            # Create base directory setup
            run('/bin/mkdir -p {} {} {}'.format(self.runDir, self.logDir,
                                                self.binDir))

            # Create stop script
            stopFile = FilePath(__file__).sibling('stop')
            put(stopFile.path, '{}/stop'.format(self.binDir), mode=0755)

            readme = self._generateReadme()
            put(StringIO(readme), 'README')
Exemplo n.º 2
0
    def task_install(self):
        """
        Install trac.
        """
        self.bootstrap(python='system')

        with settings(user=self.serviceUser):
            pip.install('psycopg2', python='system')
            self.update(_installDeps=True)

            run('/bin/mkdir -p ~/svn')
            run('/bin/ln -nsf ~/svn {}/trac-env/svn-repo'.format(self.configDir))

            run('/bin/mkdir -p ~/attachments')
            run('/bin/ln -nsf ~/attachments {}/trac-env/files/attachments'.format(
                self.configDir))

            run('/bin/ln -nsf {} {}/trac-env/log'.format(self.logDir, self.configDir))

            run('/bin/ln -nsf {}/start {}/start'.format(self.configDir, self.binDir))

            cron.install(self.serviceUser, '{}/crontab'.format(self.configDir))

            # Create an empty password file if not present.
            run('/usr/bin/touch config/htpasswd')

        # FIXME: Make these idempotent.
        postgres.createUser('trac')
        postgres.createDb('trac', 'trac')
Exemplo n.º 3
0
    def task_install(self):
        """
        Install trac.
        """
        self.bootstrap(python='system')

        # FIXME: Make these idempotent.
        postgres.createUser('trac')
        postgres.createDb('trac', 'trac')

        with settings(user=self.serviceUser):
            pip.install('psycopg2 pygments', python='system')
            self.update(_installDeps=True)
            # Note that this has to be after trac is installed, to get the right version
            pip.install('TracAccountManager==0.4.3', python='system')

            run('/bin/mkdir -p ~/svn')
            run('/bin/ln -nsf ~/svn {}/trac-env/svn-repo'.format(self.configDir))

            run('/bin/mkdir -p ~/attachments')
            run('/bin/ln -nsf ~/attachments {}/trac-env/attachments'.format(
                self.configDir))

            run('/bin/ln -nsf ~/website/trac-files {}/trac-env/htdocs'.format(
                self.configDir))

            run('/bin/ln -nsf {} {}/trac-env/log'.format(self.logDir, self.configDir))

            run('/bin/ln -nsf {}/start {}/start'.format(self.configDir, self.binDir))

            cron.install(self.serviceUser, '{}/crontab'.format(self.configDir))
Exemplo n.º 4
0
    def task_install(self):
        """
        Install trac.
        """
        self.bootstrap(python='system')

        # FIXME: Make these idempotent.
        postgres.createUser('trac')
        postgres.createDb('trac', 'trac')

        with settings(user=self.serviceUser):
            pip.install('psycopg2 pygments', python='system')
            self.update(_installDeps=True)
            # Note that this has to be after trac is installed, to get the right version
            pip.install('TracAccountManager==0.4.3', python='system')

            run('/bin/mkdir -p ~/svn')
            run('/bin/ln -nsf ~/svn {}/trac-env/svn-repo'.format(self.configDir))

            run('/bin/mkdir -p ~/attachments')
            run('/bin/ln -nsf ~/attachments {}/trac-env/files/attachments'.format(
                self.configDir))

            run('/bin/ln -nsf ~/website/trac-files {}/trac-env/htdocs'.format(
                self.configDir))

            run('/bin/ln -nsf {} {}/trac-env/log'.format(self.logDir, self.configDir))

            run('/bin/ln -nsf {}/start {}/start'.format(self.configDir, self.binDir))

            cron.install(self.serviceUser, '{}/crontab'.format(self.configDir))
Exemplo n.º 5
0
    def bootstrap(self, python='pypy'):
        # Create the user only if it does not already exist
        if fails('/usr/bin/id {}'.format(self.serviceUser)):
            if not hasSudoCapabilities():
                abort("User {} doesn't exist and we can't create it."
                      .format(self.serviceUser))
            sudo('/usr/sbin/useradd --base-dir {} --groups service --user-group '
                 '--create-home --system --shell /bin/bash '
                 '{}'.format(self.baseServicesDirectory, self.serviceUser))

        with settings(user=self.serviceUser):
            # Install twisted
            pip.install('twisted')

            # Create base directory setup
            run('/bin/mkdir -p {} {} {}'.format(
                self.runDir,
                self.logDir,
                self.binDir))

            # Create stop script
            stopFile = FilePath(__file__).sibling('stop')
            put(stopFile.path, '{}/stop'.format(self.binDir), mode=0755)

            readme = self._generateReadme()
            put(StringIO(readme), 'README')
Exemplo n.º 6
0
    def task_install(self):
        """
        Install t-web, a Twisted Web based server.
        """
        # Bootstrap a new service environment
        self.bootstrap()

        # Add to www-data group. Mailman depends on this.
        sudo('/usr/sbin/usermod -a -g www-data -G t-web {}'.format(self.serviceUser))

        # Setup authbind
        authbind.allow(self.serviceUser, 80)
        authbind.allow(self.serviceUser, 443)

        # Install httpd equiv, so apt doesn't try to install apache ever
        equivs.installEquiv(self.serviceName, 'httpd')

        with settings(user=self.serviceUser):
            pip.install('txsni', python='pypy')
            run('/bin/ln -nsf {}/start {}/start'.format(self.configDir, self.binDir))
            run('/bin/ln -nsf {}/start-maintenance {}/start-maintenance'.format(self.configDir, self.binDir))
            self.update()
            cron.install(self.serviceUser, '{}/crontab'.format(self.configDir))

            run('/bin/mkdir -p ~/data')
            if env.get('installPrivateData'):
                self.task_installTLSKeys()
                run('/usr/bin/touch {}/production'.format(self.configDir))
            else:
                run('/bin/rm -f {}/production'.format(self.configDir))
Exemplo n.º 7
0
 def update(self, _installDeps=False):
     """
     Update config.
     """
     with settings(user=self.serviceUser):
         git.branch('https://github.com/twisted-infra/amptrac-config', self.configDir)
         amptracSource = 'git+https://github.com/twisted-infra/amptrac-server'
         if _installDeps:
             pip.install('{}'.format(amptracSource))
         else:
             pip.install('--no-deps --upgrade {}'.format(amptracSource))
Exemplo n.º 8
0
 def update(self, _installDeps=False):
     """
     Update config.
     """
     with settings(user=self.serviceUser):
         git.branch('https://github.com/twisted-infra/amptrac-config',
                    self.configDir)
         amptracSource = 'git+https://github.com/twisted-infra/amptrac-server'
         if _installDeps:
             pip.install('{}'.format(amptracSource))
         else:
             pip.install('--no-deps --upgrade {}'.format(amptracSource))
Exemplo n.º 9
0
    def task_install(self):
        """
        Install buildslave for testing.
        """
        self.bootstrap()

        with settings(user=self.serviceUser):
            pip.install('buildbot-slave', python='python')
            put(
                os.path.join(self.serviceLocalDir, 'start'),
                self.binDir,
                mirror_local_mode=True)
            execute(self.update)
Exemplo n.º 10
0
    def task_install(self):
        """
        Install kenaan, an irc bot.
        """
        # Bootstrap a new service environment
        self.bootstrap()

        with settings(user=self.serviceUser):
            pip.install('amptrac')
            run('/bin/ln -nsf {}/start {}/start'.format(self.configDir, self.binDir))
            for bin in ['alert', 'commit', 'message', 'ticket']:
                run('/bin/ln -nsf {1}/{0} {2}/{0}'.format(bin, self.configDir, self.binDir))
            execute(self.update)
            cron.install(self.serviceUser, '{}/crontab'.format(self.configDir))
Exemplo n.º 11
0
    def task_install(self):
        """
        Install codespeed, a benchmark reporting tool
        """
        # Bootstrap a new service environment
        self.bootstrap(python='system')

        self.update()

        with settings(user=self.serviceUser):
            run('/bin/ln -nsf {}/start {}/start'.format(self.configDir, self.binDir))
            run('mkdir -p ~/data')
            pip.install('-r ~/codespeed/requirements.txt', python='system')
            execute(self.update)
            cron.install(self.serviceUser, '{}/crontab'.format(self.configDir))
            self.task_generateSecretKey()
Exemplo n.º 12
0
    def update(self, _installDeps=False):
        """
        Update trac config.
        """
        with settings(user=self.serviceUser):
            git.branch('https://github.com/twisted-infra/trac-config', self.configDir)
            git.branch('https://github.com/twisted-infra/t-web', '~/website')

            pip.install('trac==1.0.1', python='system')

            if _installDeps:
                pip.install('git+https://github.com/twisted-infra/twisted-trac-plugins.git', python='system')
            else:
                pip.install('--no-deps --upgrade git+https://github.com/twisted-infra/twisted-trac-plugins.git', python='system')
            pip.install('spambayes==1.1b1', python='system')
            # This was the latest version at the time it was added.
            pip.install('svn+https://svn.edgewall.org/repos/trac/plugins/1.0/spam-filter@13100', python='system')
    def update(self, _installDeps=False):
        """
        Update
        """
        with settings(user=self.serviceUser):
            git.branch('https://github.com/twisted-infra/twisted-buildbot-configuration', self.configDir)
            buildbotSource = os.path.join(self.configDir, 'buildbot-source')
            git.branch('https://github.com/twisted-infra/buildbot', buildbotSource)
            if _installDeps:
                pip.install('{}'.format(os.path.join(buildbotSource, 'master')),
                        python='python')
            else:
                pip.install('--no-deps --upgrade {}'.format(os.path.join(buildbotSource, 'master')),
                        python='python')

            if env.get('installPrivateData'):
                self.task_updatePrivateData()
Exemplo n.º 14
0
    def task_install(self):
        """
        Install codespeed, a benchmark reporting tool
        """
        # Bootstrap a new service environment
        self.bootstrap(python='system')

        package.install(['python-svn'])

        with settings(user=self.serviceUser):
            run('/bin/ln -nsf {}/start {}/start'.format(self.configDir, self.binDir))
            run('mkdir -p ~/data')
            pip.install('Django==1.2.7', python='system')
            self.update()
            cron.install(self.serviceUser, '{}/crontab'.format(self.configDir))
            if env.get('installTestData'):
                self.task_installTestData()
            self.task_generateSecretKey()
    def task_install(self):
        """
        Install buildbot.
        """
        self.bootstrap()

        with settings(user=self.serviceUser):
            pip.install('sqlalchemy==0.7.10')
            self.update(_installDeps=True)
            run('/bin/ln -nsf {}/start {}/start'.format(self.configDir, self.binDir))
            run('/bin/mkdir -p ~/data')
            run('/bin/mkdir -p ~/data/build_products')
            run('/bin/ln -nsf ~/data/build_products {}/master/public_html/builds'.format(self.configDir))

            # TODO: install dependencies
            if env.get('installTestData'):
                self.task_installTestData()

            cron.install(self.serviceUser, '{}/crontab'.format(self.configDir))
Exemplo n.º 16
0
    def bootstrap(self, python='pypy'):
        # Create the user only if it does not already exist
        users.createService(self.serviceUser)

        with settings(user=self.serviceUser):
            # Install twisted
            pip.install('twisted', python=python)

            # Create base directory setup
            run('/bin/mkdir -p {} {} {}'.format(
                self.runDir,
                self.logDir,
                self.binDir))

            # Create stop script
            stopFile = FilePath(__file__).sibling('stop')
            put(stopFile.path, '{}/stop'.format(self.binDir), mode=0755)

            readme = self._generateReadme()
            put(StringIO(readme), 'README')
    def task_install(self):
        """
        Install buildbot.
        """
        self.bootstrap()

        with settings(user=self.serviceUser):
            pip.install('sqlalchemy==0.7.10')
            self.update(_installDeps=True)
            run('/bin/ln -nsf {}/start {}/start'.format(
                self.configDir, self.binDir))
            run('/bin/mkdir -p ~/data')
            run('/bin/mkdir -p ~/data/build_products')
            run('/bin/ln -nsf ~/data/build_products {}/master/public_html/builds'
                .format(self.configDir))

            # TODO: install dependencies
            if env.get('installTestData'):
                self.task_installTestData()

            cron.install(self.serviceUser, '{}/crontab'.format(self.configDir))
    def update(self, _installDeps=False):
        """
        Update
        """
        with settings(user=self.serviceUser):
            git.branch(
                'https://github.com/twisted-infra/twisted-buildbot-configuration',
                self.configDir)
            buildbotSource = os.path.join(self.configDir, 'buildbot-source')
            git.branch('https://github.com/twisted-infra/buildbot',
                       buildbotSource)
            if _installDeps:
                pip.install('{}'.format(os.path.join(buildbotSource,
                                                     'master')),
                            python='python')
            else:
                pip.install('--no-deps --upgrade {}'.format(
                    os.path.join(buildbotSource, 'master')),
                            python='python')

            if env.get('installPrivateData'):
                self.task_updatePrivateData()
Exemplo n.º 19
0
    def update(self, _installDeps=False):
        """
        Update trac config.
        """
        # TODO
        with settings(user=self.serviceUser):
            git.branch('https://github.com/twisted-infra/trac-config', self.configDir)
            git.branch('https://github.com/twisted-infra/t-web', '~/website')

            if _installDeps:
                pip.install('git+https://github.com/twisted-infra/twisted-trac-source.git', python='system')
                pip.install('git+https://github.com/twisted-infra/twisted-trac-plugins.git', python='system')
            else:
                pip.install('--no-deps --upgrade git+https://github.com/twisted-infra/twisted-trac-source.git', python='system')
                pip.install('--no-deps --upgrade git+https://github.com/twisted-infra/twisted-trac-plugins.git', python='system')
Exemplo n.º 20
0
    def update(self, _installDeps=False):
        """
        Update trac config.
        """
        with settings(user=self.serviceUser):
            git.branch('https://github.com/twisted-infra/trac-config',
                       self.configDir)
            git.branch('https://github.com/twisted-infra/t-web', '~/website')

            pip.install('trac==1.0.1', python='system')

            if _installDeps:
                pip.install(
                    'git+https://github.com/twisted-infra/twisted-trac-plugins.git',
                    python='system')
            else:
                pip.install(
                    '--no-deps --upgrade git+https://github.com/twisted-infra/twisted-trac-plugins.git',
                    python='system')
            pip.install('spambayes==1.1b1', python='system')
            # This was the latest version at the time it was added.
            pip.install(
                'svn+https://svn.edgewall.org/repos/trac/plugins/1.0/spam-filter@13100',
                python='system')
Exemplo n.º 21
0
    def update(self, _installDeps=False):
        """
        Update
        """
        with settings(user=self.serviceUser):
            run('mkdir -p ' + self.configDir)
            put(
                os.path.dirname(__file__) + '/*', self.configDir,
                mirror_local_mode=True)
            buildbotSource = os.path.join(self.configDir, 'buildbot-source')
            git.branch('https://github.com/twisted-infra/buildbot', buildbotSource)
            if _installDeps:
                # sqlalchemy-migrate only works with a specific version of
                # sqlalchemy.
                pip.install('sqlalchemy==0.7.10 {}'.format(os.path.join(buildbotSource, 'master')),
                        python='python')
            else:
                pip.install('--no-deps --upgrade {}'.format(os.path.join(buildbotSource, 'master')),
                        python='python')

            if env.get('installPrivateData'):
                self.task_updatePrivateData()
            else:
                execute(self.task_installTestData)
Exemplo n.º 22
0
    def update(self, _installDeps=False):
        """
        Update config.
        """
        with settings(user=self.serviceUser):
            run('mkdir -p ' + self.configDir)
            put(
                os.path.dirname(__file__) + '/*', self.configDir,
                mirror_local_mode=True)

            # amptrac needs an older pg8000
            pip.install('pg8000==1.9.14')

            amptracSource = 'git+https://github.com/twisted-infra/amptrac-server'
            if _installDeps:
                pip.install('{}'.format(amptracSource))
            else:
                pip.install('--no-deps --upgrade {}'.format(amptracSource))
Exemplo n.º 23
0
        # rpmbuild
        # subunit

        # Create home directory in default dir to avoid selinux issues.
        users.createService(self.serviceUser, base=None, groups=[])
        users.uploadLaunchpadKeys(self.serviceUser, 'tom.prince')

        pipPath = '~/.local/bin/pip'
        with settings(user='******'):
            pip.bootstrap(pipPath)

        self.bootstrap(python='system')

        with settings(user='******'):
            pip.install('bzr-svn', pip=pipPath)
            pip.install('buildbot-slave', pip=pipPath)
            pip.install(" ".join([
                'pydoctor==0.5b2',
                'pep8==1.3.3',
                'pylint==0.25.1',
                'logilab-astng==0.23.1',
                'logilab-common==0.59.0',
                #'https://launchpad.net/pyflakes/main/0.5.0/+download/pyflakes-0.5.0.tar.gz',
                'pyflakes==0.7.3',
                'cffi',
                ]), pip=pipPath)

            tacFile = FilePath(__file__).sibling('buildbot.tac')
            upload_template(tacFile.path, path.join(self.runDir, 'buildbot.tac'),
                    context={
Exemplo n.º 24
0
    def update(self, _installDeps=False):
        """
        Update trac config.
        """
        with settings(user=self.serviceUser):
            run('mkdir -p ' + self.configDir)
            put(os.path.dirname(__file__) + '/*', self.configDir,
                mirror_local_mode=True)

            pip.install('trac==1.0.9', python='system')
            pip.install('pygments==1.6', python='system')

            if _installDeps:
                pip.install('git+https://github.com/twisted-infra/twisted-trac-plugins.git', python='system')
            else:
                pip.install('--no-deps --upgrade git+https://github.com/twisted-infra/twisted-trac-plugins.git', python='system')
            pip.install('spambayes==1.1b2', python='system')

            pip.install('TracAccountManager==0.4.4', python='system')
            pip.install('svn+https://trac-hacks.org/svn/defaultccplugin/tags/0.2/', python='system')
            pip.install('svn+https://svn.edgewall.org/repos/trac/plugins/1.0/spam-filter@14340', python='system')
Exemplo n.º 25
0
            'expat-devel',
            'sqlite-devel',
            'zlib-devel',
            'bzip2-devel',
            ])

        # rpmbuild
        # subunit

        # Create home directory in default dir to avoid selinux issues.
        users.createService(self.serviceUser, base=None, groups=[])
        users.uploadLaunchpadKeys(self.serviceUser, 'tom.prince')
        self.bootstrap(python='system')

        with settings(user='******'):
            pip.install('bzr-svn', python='system')
            pip.install('buildbot-slave', python='system')
            pip.install('--upgrade --force-reinstall bzr+https://code.launchpad.net/~mwhudson/pydoctor/dev@600#egg=pydoctor', python='system')
            pip.install(" ".join([
                'pep8==1.3.3',
                'pylint==0.25.1',
                'logilab-astng==0.23.1',
                'logilab-common==0.59.0',
                #'https://launchpad.net/pyflakes/main/0.5.0/+download/pyflakes-0.5.0.tar.gz',
                'pyflakes',
                ]), python='system')

            tacFile = FilePath(__file__).sibling('buildbot.tac')
            upload_template(tacFile.path, path.join(self.runDir, 'buildbot.tac'),
                    context={
                        'buildmaster': buildmaster,