Re: [Zope-dev] Read-only root database doesn't work ... bug or feature?
Paul Winkler wrote: On Thu, May 20, 2004 at 10:53:35AM +0200, robert rottermann wrote: Paul Winkler wrote: I'm trying to figure out how to mount my main storage read-only with zope 2.7.0. I'm starting to suspect that it's impossible. (snip) we had a simmilar problem. Eventually we spved it by patching zope. However I am not sure whether the problem was caused by Products (we do it for a plone site ) or by Zope itself. what we changed is on a windows box that is not running under linux. thats why I do not include it here. However I can rboot that machine and send it to you if you like. Please do! That would be much appreciated. Thanks! Paul, sorry that it took so long. I just booted my server under windows to get at what adaptations we did, however I found out that I do not have the code on that computer. However it was something allong the line dieter suggested. I am however interested what your findings with Formulator is. We have a very strange problem with the CD we create. A Product of ours that is based on Archetypes is not initialized correctly. We have to first refresh Archetypes and then our product from the ZMI. If you have an idea what could be the problem he: Hints are welcome. Robert ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Read-only root database doesn't work ... bug or feature?
On Thu, May 20, 2004 at 09:12:35PM +0200, Dieter Maurer wrote: > Paul Winkler wrote at 2004-5-19 19:15 -0400: > > > >I'm trying to figure out how to mount my main storage read-only > >with zope 2.7.0. > > I fear this is not implemented... I now believe it's implemented just fine, but it's problematic because at least one product (Formulator) triggers a commit when the product is loaded. (snip) > def startup(): > (snip) > > configuration.dbtab.getDatabaseFactory('/').config.storage.config.read_only = True > > > As you can see, it is the storage (and not the database), > that must get the "read-only" declaration. Understood. I spent a little time with the debugger and determined that this is already handled by adding the "read-only on" line to the section of zope.conf. I confirmed this: ... (Pdb) n > /home/pw/Zope-2.7.0/lib/python/Zope/App/startup.py(54)startup() -> configuration = getConfiguration() (Pdb) n > /home/pw/Zope-2.7.0/lib/python/Zope/App/startup.py(55)startup() -> DB = configuration.dbtab.getDatabase('/', is_root=1) (Pdb) myconf = configuration.dbtab.getDatabaseFactory('/').config.storage.config (Pdb) p myconf.read_only True So, apparently the storage DOES get the read-only declaration. If I continue from this point, zope exits during installation of Formulator, with the aforementioned ZODB.POSException.ReadOnlyError. But if I remove everything from my Products/ , zope starts and runs just fine... I only get ReadOnlyError if I try to modify anything, as I would expect. Formulator is the only culprit I'm sure of; I can trigger the error if my Products/ contains only Formulator. Everything else (ZSyncer, ZopeVersionControl, CMFDefault & dependencies, some in-house stuff...) seems to be OK. Not sure of CMFPlone because it depends on Formulator. I have not yet found exactly how Formulator triggers a commit, but it is definitely something called by its initialize() function. -- Paul Winkler http://www.slinkp.com ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Read-only root database doesn't work ... bug or feature?
Paul Winkler wrote at 2004-5-19 19:15 -0400: > >I'm trying to figure out how to mount my main storage read-only >with zope 2.7.0. I fear this is not implemented... Because, I wanted to control this behaviour through an environment variable (and not the configuration file!), I patched "Zope/App/startup.py": def _isReadOnly(): ro= os.environ.get('ZODB_READ_ONLY') return ro and int(ro) or 0 def startup(): try: # Try to use custom storage m=imp.find_module('custom_zodb',[getConfiguration().instancehome]) except: # if there is no custom_zodb, use the config file specified databases configuration = getConfiguration() if _isReadOnly(): configuration.dbtab.getDatabaseFactory('/').config.storage.config.read_only = True As you can see, it is the storage (and not the database), that must get the "read-only" declaration. -- Dieter ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Read-only root database doesn't work ... bug or feature?
On Thu, May 20, 2004 at 10:53:35AM +0200, robert rottermann wrote: > Paul Winkler wrote: > > >I'm trying to figure out how to mount my main storage read-only > >with zope 2.7.0. I'm starting to suspect that it's impossible. (snip) > we had a simmilar problem. Eventually we spved it by patching zope. > However I am not sure whether the problem was caused by Products (we do > it for a plone site ) or by Zope itself. > > what we changed is on a windows box that is not running under linux. > thats why I do not include it here. However I can rboot that machine and > send it to you if you like. Please do! That would be much appreciated. Thanks! -- Paul Winkler http://www.slinkp.com ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Read-only root database doesn't work ... bug or feature?
Paul Winkler wrote: I'm trying to figure out how to mount my main storage read-only with zope 2.7.0. I'm starting to suspect that it's impossible. I tried a few things below - ATTEMPT #1. I find this in the zope.conf examples: # Directive: read-only-database # # Description: # This causes the main Zope FileStorage-backed ZODB to be opened in # read-only mode. # # Default: off # # Example: # # read-only-database on ... so I uncomment that line and restart. Zope starts OK but the database is evidently still writeable, I can still change anything. Is this a bug in the zope.conf examples, or a bug in zope? - ATTEMPT #2. Apparently there is another read-only flag within each database config section. So, I try that. In my zope.conf: # Main FileStorage database cache-size 2 mount-point / path $INSTANCE/var/Data.fs read-only on When I start with this config, zope dies during product initialization which apparently wants to commit: -- 2004-05-19T19:08:10 ERROR(200) Zope Couldn't install Formulator Traceback (most recent call last): File "/home/pw/Zope-2.7.0/lib/python/OFS/Application.py", line 785, in install_product get_transaction().commit() File "/home/pw/Zope-2.7.0/lib/python/ZODB/Transaction.py", line 232, in commit self._commit_begin(jars, subjars, subtransaction) File "/home/pw/Zope-2.7.0/lib/python/ZODB/Transaction.py", line 340, in _commit_begin jar.tpc_begin(self) File "/home/pw/Zope-2.7.0/lib/python/ZODB/Connection.py", line 692, in tpc_begin self._storage.tpc_begin(transaction) File "/home/pw/Zope-2.7.0/lib/python/ZODB/BaseStorage.py", line 142, in tpc_begin raise POSException.ReadOnlyError() ReadOnlyError Traceback (most recent call last): File "/home/pw/Zope-2.7.0/lib/python/Zope/Startup/run.py", line 49, in ? run() File "/home/pw/Zope-2.7.0/lib/python/Zope/Startup/run.py", line 19, in run start_zope(opts.configroot) File "/home/pw/Zope-2.7.0/lib/python/Zope/Startup/__init__.py", line 51, in start_zope starter.startZope() File "/home/pw/Zope-2.7.0/lib/python/Zope/Startup/__init__.py", line 230, in startZope Zope.startup() File "/home/pw/Zope-2.7.0/lib/python/Zope/__init__.py", line 46, in startup _startup() File "/home/pw/Zope-2.7.0/lib/python/Zope/App/startup.py", line 93, in startup OFS.Application.initialize(application) File "/home/pw/Zope-2.7.0/lib/python/OFS/Application.py", line 279, in initialize initializer.initialize() File "/home/pw/Zope-2.7.0/lib/python/OFS/Application.py", line 306, in initialize self.install_products() File "/home/pw/Zope-2.7.0/lib/python/OFS/Application.py", line 553, in install_products return install_products(app) File "/home/pw/Zope-2.7.0/lib/python/OFS/Application.py", line 584, in install_products folder_permissions, raise_exc=debug_mode) File "/home/pw/Zope-2.7.0/lib/python/OFS/Application.py", line 785, in install_product get_transaction().commit() File "/home/pw/Zope-2.7.0/lib/python/ZODB/Transaction.py", line 232, in commit self._commit_begin(jars, subjars, subtransaction) File "/home/pw/Zope-2.7.0/lib/python/ZODB/Transaction.py", line 340, in _commit_begin jar.tpc_begin(self) File "/home/pw/Zope-2.7.0/lib/python/ZODB/Connection.py", line 692, in tpc_begin self._storage.tpc_begin(transaction) File "/home/pw/Zope-2.7.0/lib/python/ZODB/BaseStorage.py", line 142, in tpc_begin raise POSException.ReadOnlyError() ZODB.POSException.ReadOnlyError - So, am I just plain S.O.L.? Is this impossible? (Note: a similar message was sent earlier to dirstorage-users, but experimentation has shown me that the storage implementation doesn't seem to matter... i get the same result with filestorage, directorystorage, or clientstorage.) we had a simmilar problem. Eventually we spved it by patching zope. However I am not sure whether the problem was caused by Products (we do it for a plone site ) or by Zope itself. what we changed is on a windows box that is not running under linux. thats why I do not include it here. However I can rboot that machine and send it to you if you like. Robert ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )