165 """ |
165 """ |
166 config = self.config |
166 config = self.config |
167 if not automatic: |
167 if not automatic: |
168 print underline_title('Configuring the repository') |
168 print underline_title('Configuring the repository') |
169 config.input_config('email', inputlevel) |
169 config.input_config('email', inputlevel) |
170 # ask for pyro configuration if pyro is activated and we're not |
|
171 # using a all-in-one config, in which case this is done by the web |
|
172 # side command handler |
|
173 if config.pyro_enabled() and config.name != 'all-in-one': |
|
174 config.input_config('pyro', inputlevel) |
|
175 print '\n'+underline_title('Configuring the sources') |
170 print '\n'+underline_title('Configuring the sources') |
176 sourcesfile = config.sources_file() |
171 sourcesfile = config.sources_file() |
177 # hack to make Method('default_instance_id') usable in db option defs |
172 # hack to make Method('default_instance_id') usable in db option defs |
178 # (in native.py) |
173 # (in native.py) |
179 sconfig = SourceConfiguration(config, |
174 sconfig = SourceConfiguration(config, |
319 class RepositoryStopHandler(CommandHandler): |
314 class RepositoryStopHandler(CommandHandler): |
320 cmdname = 'stop' |
315 cmdname = 'stop' |
321 cfgname = 'repository' |
316 cfgname = 'repository' |
322 |
317 |
323 def poststop(self): |
318 def poststop(self): |
324 """if pyro is enabled, ensure the repository is correctly unregistered |
319 pass |
325 """ |
|
326 if self.config.pyro_enabled(): |
|
327 from cubicweb.server.repository import pyro_unregister |
|
328 pyro_unregister(self.config) |
|
329 |
|
330 |
320 |
331 # repository specific commands ################################################ |
321 # repository specific commands ################################################ |
332 |
322 |
333 def createdb(helper, source, dbcnx, cursor, **kwargs): |
323 def createdb(helper, source, dbcnx, cursor, **kwargs): |
334 if dbcnx.logged_user != source['db-user']: |
324 if dbcnx.logged_user != source['db-user']: |
687 |
677 |
688 |
678 |
689 class StartRepositoryCommand(Command): |
679 class StartRepositoryCommand(Command): |
690 """Start a CubicWeb RQL server for a given instance. |
680 """Start a CubicWeb RQL server for a given instance. |
691 |
681 |
692 The server will be remotely accessible through pyro or ZMQ |
682 The server will be remotely accessible through ZMQ |
693 |
683 |
694 <instance> |
684 <instance> |
695 the identifier of the instance to initialize. |
685 the identifier of the instance to initialize. |
696 """ |
686 """ |
697 name = 'start-repository' |
687 name = 'start-repository' |
707 'help': 'debug if -D is set, error otherwise', |
697 'help': 'debug if -D is set, error otherwise', |
708 }), |
698 }), |
709 ('address', |
699 ('address', |
710 {'short': 'a', 'type': 'string', 'metavar': '<protocol>://<host>:<port>', |
700 {'short': 'a', 'type': 'string', 'metavar': '<protocol>://<host>:<port>', |
711 'default': '', |
701 'default': '', |
712 'help': ('specify a ZMQ URI on which to bind, or use "pyro://"' |
702 'help': ('specify a ZMQ URI on which to bind'), |
713 'to create a pyro-based repository'), |
|
714 }), |
703 }), |
715 ) |
704 ) |
716 |
705 |
717 def create_repo(self, config): |
706 def create_repo(self, config): |
718 address = self['address'] |
707 address = self['address'] |
719 if not address: |
708 if not address: |
720 address = config.get('zmq-repository-address') or 'pyro://' |
709 address = config.get('zmq-repository-address') |
721 if address.startswith('pyro://'): |
710 from cubicweb.server.utils import TasksManager |
722 from cubicweb.server.server import RepositoryServer |
711 from cubicweb.server.cwzmq import ZMQRepositoryServer |
723 return RepositoryServer(config), config['host'] |
712 repo = Repository(config, TasksManager()) |
724 else: |
713 return ZMQRepositoryServer(repo), address |
725 from cubicweb.server.utils import TasksManager |
|
726 from cubicweb.server.cwzmq import ZMQRepositoryServer |
|
727 repo = Repository(config, TasksManager()) |
|
728 return ZMQRepositoryServer(repo), address |
|
729 |
714 |
730 def run(self, args): |
715 def run(self, args): |
731 from logilab.common.daemon import daemonize, setugid |
716 from logilab.common.daemon import daemonize, setugid |
732 from cubicweb.cwctl import init_cmdline_log_threshold |
717 from cubicweb.cwctl import init_cmdline_log_threshold |
733 print 'WARNING: Standalone repository with pyro or zmq access is deprecated' |
718 print 'WARNING: Standalone repository with pyro or zmq access is deprecated' |