示例#1
0
    def configure(self, template=None):

        if template is None:
            template = [_('nginx/%(domain)s.conf'), 'nginx/default.conf']

        super(Nginx, self).configure()

        self.update_static_files()  #added static_files var for fab.env

        upload_first(template,
                     fab.env.os.path.join(self.sites_dir,
                                          _('%(domain)s.conf')),
                     fab.env,
                     use_sudo=True,
                     use_jinja=True)

        os = fab.env.os
        log_dir = os.path.join(self.log_dir, _('%(user)s'))
        os.mkdir(log_dir, sudo=True)
        os.change_owner(log_dir, self.log_user, 'adm')

        self.disable_site('%(domain)s.conf' % self.env)
        self.enable_site('%(domain)s.conf' % self.env)

        if hasattr(fab.env, 'logrotate'):
            fab.env.logrotate.add_script('nginx/logrotate', 'nginx')
示例#2
0
    def configure(self, template=None):

        if template is None:
            template = [_('nginx/%(domain)s.conf'),
                        'nginx/default.conf']

        super(Nginx, self).configure()

        self.update_static_files() #added static_files var for fab.env

        upload_first(template,
                     fab.env.os.path.join(self.sites_dir, _('%(domain)s.conf') ),
                     fab.env,
                     use_sudo=True,
                     use_jinja=True)

        os = fab.env.os
        log_dir = os.path.join(self.log_dir, _('%(user)s'))
        os.mkdir(log_dir, sudo=True)
        os.change_owner(log_dir, self.log_user, 'adm', sudo=True)

        self.disable_site('%(domain)s.conf' % self.env)
        self.enable_site('%(domain)s.conf' % self.env)

        if hasattr(fab.env, 'logrotate'):
            fab.env.logrotate.add_script('nginx/logrotate', 'nginx')
示例#3
0
 def supervisor_configure(self):
     upload_first([_('uwsgi/%(domain)s.supervisor.conf'),
                   'uwsgi/supervisor.conf',
                  ],
                  _('%(remote_dir)s/etc/supervisor/uwsgi.conf'),
                  fab.env,
                  use_jinja=True)
示例#4
0
 def supervisor_configure(self):
     upload_first([_('gunicorn/%(domain)s.supervisor.conf'),
                   'gunicorn/supervisor.conf',
                  ],
                  _('%(remote_dir)s/etc/supervisor/gunicorn.conf'),
                  fab.env,
                  use_jinja=True)
示例#5
0
 def supervisor_configure(self):
     upload_first([
         _('uwsgi/%(domain)s.supervisor.conf'),
         'uwsgi/supervisor.conf',
     ],
                  _('%(remote_dir)s/etc/supervisor/uwsgi.conf'),
                  fab.env,
                  use_jinja=True)
示例#6
0
 def supervisor_configure(self):
     upload_first([
         _('gunicorn/%(domain)s.supervisor.conf'),
         'gunicorn/supervisor.conf',
     ],
                  _('%(remote_dir)s/etc/supervisor/gunicorn.conf'),
                  fab.env,
                  use_jinja=True)
示例#7
0
    def configure(self):
        self.start_command()

        upload_first([_('gunicorn/%(domain)s.conf'),
                      _('nginx/%(domain)s.gunicorn.conf'),
                      'gunicorn/default.conf'],
                     _('%(remote_dir)s/etc/gunicorn/conf.py'),
                     fab.env,
                     use_jinja=True)
示例#8
0
    def configure(self):
        self.start_command()

        upload_first([
            _('gunicorn/%(domain)s.conf'),
            _('nginx/%(domain)s.gunicorn.conf'), 'gunicorn/default.conf'
        ],
                     _('%(remote_dir)s/etc/gunicorn/conf.py'),
                     fab.env,
                     use_jinja=True)
示例#9
0
    def configure(self):
        if fab.env.project.use_django:
            if fab.env.project.django.HAS_WSGI:
                default_template = 'uwsgi/django.ini'
            else:
                default_template = 'uwsgi/django_old.ini'
        else:
            default_template = 'uwsgi/default.ini'

        upload_first([_('uwsgi/%(domain)s.conf'),
                      _('nginx/%(domain)s.uwsgi.conf'),
                      default_template],
                     _('%(remote_dir)s/etc/uwsgi/conf.ini'),
                     fab.env,
                     use_jinja=True)
示例#10
0
    def configure(self):
        if fab.env.project.use_django:
            if fab.env.project.django.HAS_WSGI:
                default_template = 'uwsgi/django.ini'
            else:
                default_template = 'uwsgi/django_old.ini'
        else:
            default_template = 'uwsgi/default.ini'

        upload_first([
            _('uwsgi/%(domain)s.conf'),
            _('nginx/%(domain)s.uwsgi.conf'), default_template
        ],
                     _('%(remote_dir)s/etc/uwsgi/conf.ini'),
                     fab.env,
                     use_jinja=True)
示例#11
0
    def configure(self):
        upload_first([_('nginx/%(domain)s-sh.fcgi'),
                      'fcgi/wrapper-sh.fcgi'],
                     _(self.fcgi_path) + 'wrapper.fcgi',
                     fab.env,
                     mode=0755,
                     use_jinja=True)

        upload_first([_('nginx/%(domain)s.fcgi'),
                      'fcgi/wrapper.fcgi'],
                     _('%(remote_dir)s/http/wrapper.fcgi'),
                     fab.env,
                     mode=0755,
                     use_jinja=True)

        upload_first([_('nginx/%(domain)s.htaccess'),
                      'fcgi/.htaccess'],
                     _('%(remote_dir)s/http/.htaccess'),
                     fab.env,
                     use_jinja=True)

        if self.use_project_media:
            with fab.cd(_('%(remote_dir)s/http')):
                with fab.settings(warn_only=True):
                    fab.run('ln -s ../media/static')
                    fab.run('ln -s ../media/media')
示例#12
0
    def configure(self):
        upload_first([_('nginx/%(domain)s-sh.fcgi'), 'fcgi/wrapper-sh.fcgi'],
                     _(self.fcgi_path) + 'wrapper.fcgi',
                     fab.env,
                     mode=0755,
                     use_jinja=True)

        upload_first([_('nginx/%(domain)s.fcgi'), 'fcgi/wrapper.fcgi'],
                     _('%(remote_dir)s/http/wrapper.fcgi'),
                     fab.env,
                     mode=0755,
                     use_jinja=True)

        upload_first([_('nginx/%(domain)s.htaccess'), 'fcgi/.htaccess'],
                     _('%(remote_dir)s/http/.htaccess'),
                     fab.env,
                     use_jinja=True)

        #XXX
        with fab.cd(_('%(remote_dir)s/http')):
            with fab.settings(warn_only=True):
                fab.run('ln -s ../media/static')
                fab.run('ln -s ../media/media')