Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
zotero_dataserver [2011/04/25 07:02] – [Config.inc.php] lemaxx | zotero_dataserver [2011/07/15 04:05] – simonth | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Disclaimer ====== | + | == Deprecated, go to: == |
- | + | http:// | |
- | This guide was written based in part on information found on zitation.org (unreachable when I was writing this tutorial) as well as the indications found on zotero.org. Some steps may be unnecessary or wrong but keep in mind that this is a first version. Any help or comment is welcome. | + | |
- | + | ||
- | Some items may seem obvious but I detail some steps not to forget my next installation. | + | |
- | This installation was done on Ubuntu 10.10 desktop running in a virtual machine. This allows me to use an unmodified version of Zotero 2.1 | + | |
- | + | ||
- | ====== Dependencies: | + | |
- | + | ||
- | ===== Required ===== | + | |
- | + | ||
- | * PHP | + | |
- | * PHP modules (?) | + | |
- | * Apache | + | |
- | * Apache modules/ | + | |
- | * MySQL with root access | + | |
- | * MongoDB | + | |
- | * ability | + | |
- | * subversion client | + | |
- | + | ||
- | ===== Optional ===== | + | |
- | + | ||
- | * Solr | + | |
- | * Memcached | + | |
- | * Amazon S3 | + | |
- | * Webdav | + | |
- | + | ||
- | Download Zotero dataserver sources | + | |
- | Use your subversion client to pull down the sources from Zotero’s repository. If using the command-line:
svn co https:// | + | |
- | + | ||
- | < | + | |
- | dataserver/ | + | |
- | trunk/ | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | + | ||
- | These files can be anywhere but this guide will assume they are located in / | + | |
- | + | ||
- | ====== Configure Apache and Host ====== | + | |
- | + | ||
- | ===== Host ===== | + | |
- | + | ||
- | We need to define two hostnames, the “sync” and “api” hosts. For testing on one machine this can be done via an /etc/hosts entry | + | |
- | In this exemple i use zotero.org domain because i use a virtual machine and i don’t use a custom Zotero plugin. | + | |
- | If you want to use your own domain you need to edit the plugin (see below) | + | |
- | < | + | |
- | 127.0.0.1 sync.zotero.org api.zotero.org</ | + | |
- | + | ||
- | After that when you ping sync.zotero.org you will see it is resolving to 127.0.0.1 | + | |
- | + | ||
- | ===== Apache ===== | + | |
- | + | ||
- | From web only HTDOCS folder must be accessible. So you can use a virtual host | + | |
- | Your sync server need a ssl connection you have to create two config files in / | + | |
- | + | ||
- | < | + | |
- | < | + | |
- | + | ||
- | | + | |
- | | + | |
- | + | ||
- | | + | |
- | + | ||
- | < | + | |
- | | + | |
- | | + | |
- | Order allow, | + | |
- | Allow from all | + | |
- | </ | + | |
- | + | ||
- | | + | |
- | + | ||
- | </ | + | |
- | </ | + | |
- | + | ||
- | < | + | |
- | < | + | |
- | < | + | |
- | + | ||
- | | + | |
- | | + | |
- | + | ||
- | | + | |
- | + | ||
- | < | + | |
- | | + | |
- | | + | |
- | Order allow, | + | |
- | Allow from all | + | |
- | </ | + | |
- | + | ||
- | | + | |
- | + | ||
- | # | + | |
- | | + | |
- | + | ||
- | | + | |
- | | + | |
- | + | ||
- | < | + | |
- | | + | |
- | </ | + | |
- | < | + | |
- | | + | |
- | </ | + | |
- | + | ||
- | | + | |
- | | + | |
- | | + | |
- | # MSIE 7 and newer should be able to use keepalive | + | |
- | | + | |
- | + | ||
- | </ | + | |
- | </ | + | |
- | + | ||
- | </ | + | |
- | + | ||
- | ====== Create and configure database ====== | + | |
- | + | ||
- | ===== Mongo ===== | + | |
- | + | ||
- | + | ||
- | Install MongoDB and Mongo php driver | + | |
- | + | ||
- | use / | + | |
- | + | ||
- | ===== Mysql ===== | + | |
- | + | ||
- | + | ||
- | To understand how database must be set i used the script « test_reset » locate in « Misc » folder (you can use this script to setup your database). I use the same database name. | + | |
- | + | ||
- | In this folder you will find every *.sql files need for this installation. | + | |
- | + | ||
- | You have to create 7 Mysql database. Some of them are used only when you run Zotero server in test mode, for other I do not know yet their use. | + | |
- | + | ||
- | * zotero_cache > use cache.sql | + | |
- | * zotero_www (this name is hardcoded) > see below | + | |
- | * zotero_www_test (this name is hardcoded) > see below | + | |
- | * zoterotest_ids > use ids.sql | + | |
- | * zoterotest_master > use master.sql and after coredata.sql | + | |
- | * zoterotest1 > use shard.sql and after trigger.sql | + | |
- | * zoterotest2 > use shard.sql and after trigger.sql | + | |
- | + | ||
- | There is no .sql files to set up zotero_www and zotero_www_test so use as describe on zotero.org/ | + | |
- | + | ||
- | <code mysql> | + | |
- | CREATE TABLE `users` ( | + | |
- | `userID` | + | |
- | `username` | + | |
- | `slug` | + | |
- | `password` | + | |
- | `email` | + | |
- | `openid` | + | |
- | `role` | + | |
- | ' | + | |
- | `resetValidationKey` char(40) | + | |
- | `resetValidationExp` int NULL, | + | |
- | `emailValidationKey` char(10) | + | |
- | `emailValidated` | + | |
- | `hasImage` | + | |
- | `lastUpdated` | + | |
- | `dateRegistered` | + | |
- | PRIMARY KEY (`userID`), | + | |
- | UNIQUE KEY (`username`), | + | |
- | UNIQUE KEY (`slug`), | + | |
- | UNIQUE KEY (`email`), | + | |
- | UNIQUE KEY (`resetValidationKey`) | + | |
- | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; | + | |
- | + | ||
- | </ | + | |
- | + | ||
- | You need to add specific user in Mysql | + | |
- | If you want to personalize those user you have to change value in shard info (see below) | + | |
- | <code mysql> | + | |
- | + | ||
- | CREATE USER zoterotest0@localhost IDENTIFIED BY ' | + | |
- | CREATE USER zoterotest1@localhost IDENTIFIED BY ' | + | |
- | CREATE USER zoterotest2@localhost IDENTIFIED BY ' | + | |
- | CREATE USER zoterotest_ids@localhost IDENTIFIED BY ' | + | |
- | CREATE USER zoterotest_ids@localhost IDENTIFIED BY ' | + | |
- | CREATE USER zoterotest_www@localhost IDENTIFIED BY ' | + | |
- | + | ||
- | </ | + | |
- | + | ||
- | note: give acces on sync.zotero.org too | + | |
- | + | ||
- | Give Grant access | + | |
- | + | ||
- | <code mysql> | + | |
- | + | ||
- | GRANT SELECT ON zoterotest_master.* TO zoterotest1@localhost; | + | |
- | GRANT SELECT ON zoterotest_master.* TO zoterotest2@localhost; | + | |
- | GRANT SELECT, INSERT, UPDATE, DELETE, CREATE TEMPORARY TABLES ON zoterotest1.* TO zoterotest1@localhost; | + | |
- | GRANT SELECT, INSERT, UPDATE, DELETE, CREATE TEMPORARY TABLES ON zoterotest2.* TO zoterotest2@localhost; | + | |
- | GRANT SELECT, | + | |
- | GRANT SELECT, | + | |
- | GRANT SELECT ON zotero_www_test.* TO zoterotest_www@localhost; | + | |
- | </ | + | |
- | + | ||
- | Set up shard info | + | |
- | + | ||
- | <code mysql> | + | |
- | INSERT INTO shardHosts VALUES (1, ' | + | |
- | INSERT INTO shardHosts VALUES (2, ' | + | |
- | INSERT INTO shards VALUES (1, 1, ' | + | |
- | INSERT INTO shards VALUES (2, 1, ' | + | |
- | </ | + | |
- | Initial users and groups for tests | + | |
- | + | ||
- | <code mysql> | + | |
- | INSERT INTO libraries VALUES (1, ' | + | |
- | INSERT INTO libraries VALUES (2, ' | + | |
- | INSERT INTO libraries VALUES (3, ' | + | |
- | INSERT INTO users VALUES (1, 1, ' | + | |
- | INSERT INTO users VALUES (2, 2, ' | + | |
- | INSERT INTO groups VALUES (1, 3, 'Test Group', | + | |
- | INSERT INTO groupUsers VALUES (1, 1, ' | + | |
- | + | ||
- | INSERT INTO users VALUES (1, ' | + | |
- | INSERT INTO users VALUES (2, ' | + | |
- | INSERT INTO shardLibraries VALUES (1, ' | + | |
- | INSERT INTO shardLibraries VALUES (2, ' | + | |
- | INSERT INTO shardLibraries VALUES (3, ' | + | |
- | </ | + | |
- | + | ||
- | when you sync use ‘testuser’ or ‘testuser2′ password ‘testuser’ | + | |
- | + | ||
- | ====== Config Zotero data server ====== | + | |
- | + | ||
- | + | ||
- | Copy the sample config files under include/ | + | |
- | fill out credentials and paths in config files. | + | |
- | + | ||
- | ===== dbconnect.inc.php ===== | + | |
- | + | ||
- | + | ||
- | db master: | + | |
- | + | ||
- | db id1 and id2: zoterotest_ids | + | |
- | + | ||
- | db www1 and www2: zotero_www | + | |
- | + | ||
- | db cache: zotero_cache | + | |
- | + | ||
- | ===== Config.inc.php ===== | + | |
- | + | ||
- | + | ||
- | TODO explain values | + | |
- | + | ||
- | <code php> | + | |
- | + | ||
- | <? | + | |
- | class Z_CONFIG { | + | |
- | public static $API_ENABLED = true; | + | |
- | public static $SYNC_ENABLED = true; | + | |
- | public static $PROCESSORS_ENABLED = true; | + | |
- | public static $MAINTENANCE_MESSAGE = ' | + | |
- | + | ||
- | public static $TESTING_SITE = false; | + | |
- | public static $DEV_SITE = false; | + | |
- | public static $AUTH_URI =''; | + | |
- | public static $BASE_URI = ' | + | |
- | + | ||
- | public static $AUTH_SALT = ''; | + | |
- | public static $API_SUPER_USERNAME = ''; | + | |
- | public static $API_SUPER_PASSWORD = ''; | + | |
- | + | ||
- | public static $API_BASE_URI = ' | + | |
- | public static $API_BASE_URI_WWW =''; | + | |
- | + | ||
- | public static $S3_BUCKET = ''; | + | |
- | public static $S3_ACCESS_KEY = ''; | + | |
- | public static $S3_SECRET_KEY = ''; | + | |
- | + | ||
- | public static $MEMCACHED_ENABLED = false; | + | |
- | public static $MEMCACHED_SERVERS = array( | + | |
- | ' | + | |
- | ); | + | |
- | public static $MEMCACHED_SERVER_NAME_PREFIX_MAP = array( | + | |
- | ' | + | |
- | ); | + | |
- | + | ||
- | public static $MONGO_SERVERS = array( | + | |
- | ' | + | |
- | ); | + | |
- | public static $MONGO_DB = " | + | |
- | public static $MONGO_SAFE_NUM = 2; | + | |
- | + | ||
- | public static $SOLR_SERVER = " | + | |
- | + | ||
- | public static $CITE_SERVERS = array( | + | |
- | " | + | |
- | ); | + | |
- | + | ||
- | public static $LOG_TO_SCRIBE = false; | + | |
- | public static $LOG_ADDRESS = ''; | + | |
- | public static $LOG_PORT = 1463; | + | |
- | public static $LOG_TIMEZONE = ' | + | |
- | public static $LOG_TARGET_DEFAULT = ' | + | |
- | + | ||
- | public static $PROCESSOR_PORT_DOWNLOAD = 3455; | + | |
- | public static $PROCESSOR_PORT_UPLOAD = 3456; | + | |
- | public static $PROCESSOR_PORT_ERROR = 3457; | + | |
- | public static $PROCESSOR_PORT_INDEX = 3458; | + | |
- | + | ||
- | public static $PROCESSOR_LOG_TARGET_DOWNLOAD = ' | + | |
- | public static $PROCESSOR_LOG_TARGET_UPLOAD = ' | + | |
- | public static $PROCESSOR_LOG_TARGET_ERROR = ' | + | |
- | public static $PROCESSOR_LOG_TARGET_INDEX = ' | + | |
- | + | ||
- | public static $SYNC_DOWNLOAD_SMALLEST_FIRST = false; | + | |
- | public static $SYNC_UPLOAD_SMALLEST_FIRST = false; | + | |
- | + | ||
- | // Set some things manually for running via command line | + | |
- | public static $CLI_PHP_PATH = '/ | + | |
- | public static $CLI_DOCUMENT_ROOT = "/ | + | |
- | public static $CLI_SERVER_NAME = " | + | |
- | public static $CLI_SERVER_PORT = " | + | |
- | + | ||
- | public static $SYNC_ERROR_PATH = '/ | + | |
- | public static $API_ERROR_PATH = '/ | + | |
- | } | + | |
- | ?> | + | |
- | </ | + | |
- | ===== Launch daemon ===== | + | |
- | + | ||
- | + | ||
- | There are for daemons, each in its own directory under the processor directory. Fire up for shells and run each independently in the foreground. | + | |
- | + | ||
- | <code bash> | + | |
- | + | ||
- | cd processor/ | + | |
- | php daemon.php | + | |
- | cd processor/ | + | |
- | php daemon.php | + | |
- | cd processor/ | + | |
- | php daemon.php | + | |
- | cd processor/ | + | |
- | php daemon.php | + | |
- | + | ||
- | </ | + | |
- | In all cases you should see the output similar to this (the daemon name will vary) | + | |
- | + | ||
- | <code bash> | + | |
- | + | ||
- | Starting sync download processor daemon | + | |
- | 0 processors, 0 queued processes | + | |
- | Waiting for command | + | |
- | </ | + | |
- | + | ||
- | ====== Use zotero in your virtual machine to sync. ====== | + | |
- | + | ||
- | If your ssl is auto signed you must accept certificate before the first synchronization | + | |
- | In Firefox open https:// | + | |
- | + | ||
- | in Zotero preferences use login= testuser password= testuser and launch sync | + | |
- | + | ||
- | ====== Miscellaneous ====== | + | |
- | ===== Add new user ===== | + | |
- | + | ||
- | + | ||
- | You must add new entries in zotero_www (or zotero_www_test if in test mode). | + | |
- | + | ||
- | * Necessary fields should be userID, username, password, slug. | + | |
- | * Password entries are generated by taking a sha1 hash of the user’s password concatenated to the salt. | + | |
- | * Slugs are generated by taking the username and trimming whitespace, lowercasing, | + | |
- | + | ||
- | ===== Create group ===== | + | |
- | + | ||
- | + | ||
- | As shown in ‘test_reset’ file: | + | |
- | + | ||
- | TODO explain values | + | |
- | + | ||
- | <code mysql> | + | |
- | INSERT INTO libraries VALUES (3, ' | + | |
- | INSERT INTO groups VALUES (1, 3, 'Test Group', | + | |
- | INSERT INTO groupUsers VALUES (1, 1, ' | + | |
- | INSERT INTO shardLibraries VALUES (3, ' | + | |
- | </ | + | |
- | + | ||
- | ===== Custom Zotero ===== | + | |
- | + | ||
- | TODO explain how edit zotero.jar | + | |
- | + | ||
- | If you want to use your own domain you need to edit the plugin. | + | |
- | Edit zotero.js and change SYNC_URL and API_URL with your domain. | + | |
- | + | ||
- | <code javascript> | + | |
- | const ZOTERO_CONFIG = { | + | |
- | GUID: ' | + | |
- | DB_REBUILD: | + | |
- | REPOSITORY_URL: | + | |
- | REPOSITORY_CHECK_INTERVAL: | + | |
- | REPOSITORY_RETRY_INTERVAL: | + | |
- | BASE_URI: ' | + | |
- | WWW_BASE_URL: | + | |
- | SYNC_URL: ' | + | |
- | API_URL: ' | + | |
- | }; | + | |
- | + | ||
- | + | ||
- | </ | + | |
- | + | ||
- | ====== Untested / Not working / Todo====== | + | |
- | + | ||
- | ===== Untested ===== | + | |
- | * Webdav to use files attachment. | + | |
- | * API: i don’t know how use it or configure it. | + | |
- | + | ||
- | ===== Not working ===== | + | |
- | * Change user privileges in groups only work if the user performs a restore from the server | + | |
- | * Sync attachment files in My Library using Zotero server (i suppose you need Amazon S3) | + | |
- | * Sync attachment files in group using Zotero server (i suppose you need Amazon S3) | + | |
- | + | ||
- | ===== Todo ===== | + | |
- | * Create SQL script to install database in one step | + | |
- | * Create interface to add/manage users and groups | + | |
- | * Test with webdav to use files attachment | + | |
- | + | ||
- | + | ||
- | + |