nucypher / zerodb

*This project is no longer actively maintained. If you'd like to become the maintainer, please let us know.* ZeroDB is an end-to-end encrypted database. Data can be stored and queried on untrusted database servers without ever exposing the encryption key. Clients can execute remote queries against the encrypted data without downloading all of it or suffering an excessive performance hit.
GNU Affero General Public License v3.0
1.56k stars 102 forks source link

Experience installing from scratch (from github) #48

Closed jean closed 8 years ago

jean commented 8 years ago

We're starting from a vanilla Ubuntu Trusty image:

$ vagrant snapshot go start
$ vagrant ssh
vagrant@vagrant-ubuntu-trusty-64:~$ sudo apt-get install python-pip python-dev libssl-dev libzmq-dev libffi-dev git python-virtualenv
vagrant@vagrant-ubuntu-trusty-64:~/zerodb-server$ virtualenv venv
vagrant@vagrant-ubuntu-trusty-64:~/zerodb-server$ . venv/bin/activate
(venv)vagrant@vagrant-ubuntu-trusty-64:~/zerodb-server$ cd demo
(venv)vagrant@vagrant-ubuntu-trusty-64:~/zerodb-server/demo$ pip install -r requirements.txt
(venv)vagrant@vagrant-ubuntu-trusty-64:~/zerodb-server/demo$ zerodb-manage init_db
[...]
(venv)vagrant@vagrant-ubuntu-trusty-64:~/zerodb-server/demo$ zerodb-server &
(venv)vagrant@vagrant-ubuntu-trusty-64:~/zerodb-server/demo$ zerodb-manage console
In [1]: pubkey = get_pubkey('john', 'password')
In [2]: useradd('john', pubkey)
In [3]: import transaction
In [4]: import zerodb
In [5]: import models
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/home/vagrant/zerodb-server/venv/local/lib/python2.7/site-packages/zerodbext/server/manage.pyc in <module>()
----> 1 import models

ImportError: No module named models

In [6]: import sys
In [7]: sys.path.append('.')
In [8]: import models
In [9]: db = zerodb.DB(("localhost", 8001), username="root", password="root")
------
2016-07-14T10:46:50 INFO ZEO.zrpc.Connection('S') (127.0.0.1:34133) received handshake 'Z4'
ERROR:ZEO.zrpc.Connection('C'):(127.0.0.1:8001) invalidateTransaction() raised exception: 'BatchClientStorage' object has no attribute 'db'
Traceback (most recent call last):
  File "/home/vagrant/zerodb-server/venv/local/lib/python2.7/site-packages/ZEO/zrpc/connection.py", line 476, in handle_request
    ret = meth(*args)
  File "/home/vagrant/zerodb-server/venv/local/lib/python2.7/site-packages/ZEO/ClientStorage.py", line 1469, in invalidateTransaction
    self._process_invalidations(tid, oids)
  File "/home/vagrant/zerodb-server/venv/local/lib/python2.7/site-packages/zerodb/storage/batch.py", line 41, in _process_invalidations
    self._db.invalidate(tid, oids)
  File "/home/vagrant/zerodb-server/venv/local/lib/python2.7/site-packages/zc/zlibstorage/__init__.py", line 116, in invalidate
    return self.db.invalidate(transaction_id, oids, version)
  File "/home/vagrant/zerodb-server/venv/local/lib/python2.7/site-packages/zc/zlibstorage/__init__.py", line 53, in __getattr__
    return getattr(self.base, name)
AttributeError: 'BatchClientStorage' object has no attribute 'db'

In [10]: db
Out[10]: <zerodb.db.DB at 0x7f0b65bbc850>

In [11]: e = models.Employee(name="John", surname="Smith", salary=150000, descri
    ...: ption="Coding power")

In [12]: db.add(e)
ERROR:ZEO.zrpc.Connection('C'):(127.0.0.1:8001) invalidateTransaction() raised exception: 'BatchClientStorage' object has no attribute 'db'
Traceback (most recent call last):
  File "/home/vagrant/zerodb-server/venv/local/lib/python2.7/site-packages/ZEO/zrpc/connection.py", line 476, in handle_request
    ret = meth(*args)
  File "/home/vagrant/zerodb-server/venv/local/lib/python2.7/site-packages/ZEO/ClientStorage.py", line 1469, in invalidateTransaction
    self._process_invalidations(tid, oids)
  File "/home/vagrant/zerodb-server/venv/local/lib/python2.7/site-packages/zerodb/storage/batch.py", line 41, in _process_invalidations
    self._db.invalidate(tid, oids)
  File "/home/vagrant/zerodb-server/venv/local/lib/python2.7/site-packages/zc/zlibstorage/__init__.py", line 116, in invalidate
    return self.db.invalidate(transaction_id, oids, version)
  File "/home/vagrant/zerodb-server/venv/local/lib/python2.7/site-packages/zc/zlibstorage/__init__.py", line 53, in __getattr__
    return getattr(self.base, name)
AttributeError: 'BatchClientStorage' object has no attribute 'db'
Out[12]: 1604166222

In [13]: transaction.commit()
ERROR:ZEO.zrpc.Connection('C'):(127.0.0.1:8001) invalidateTransaction() raised exception: 'BatchClientStorage' object has no attribute 'db'
Traceback (most recent call last):
  File "/home/vagrant/zerodb-server/venv/local/lib/python2.7/site-packages/ZEO/zrpc/connection.py", line 476, in handle_request
    ret = meth(*args)
  File "/home/vagrant/zerodb-server/venv/local/lib/python2.7/site-packages/ZEO/ClientStorage.py", line 1469, in invalidateTransaction
    self._process_invalidations(tid, oids)
  File "/home/vagrant/zerodb-server/venv/local/lib/python2.7/site-packages/zerodb/storage/batch.py", line 41, in _process_invalidations
    self._db.invalidate(tid, oids)
  File "/home/vagrant/zerodb-server/venv/local/lib/python2.7/site-packages/zc/zlibstorage/__init__.py", line 116, in invalidate
    return self.db.invalidate(transaction_id, oids, version)
  File "/home/vagrant/zerodb-server/venv/local/lib/python2.7/site-packages/zc/zlibstorage/__init__.py", line 53, in __getattr__
    return getattr(self.base, name)
AttributeError: 'BatchClientStorage' object has no attribute 'db'

It looks like things are working in spite of the AttributeError.

michwill commented 8 years ago

As I said earlier, this is happening because you try to query the database from within management console (should be from a new python terminal).

Nevertheless, it will be possible when we allow multiple database instances for different users to exist at the same time https://github.com/zerodb/zerodb/issues/49

jean commented 8 years ago

Cool, thanks for the clarification! I didn't realise from the docs that this was supposed to be using a new Python terminal. If I understand correctly, this is no longer an issue anyway. :-)