CouchDB Notes
Installation
Installation of couchdb is performed through puppet. The manifest file for the host contains the setting of the couchdb instance. E.g. in manifests/vh03/v0403.vh03.softxs.ch.pp:
node "v0403.vh03.softxs.ch" { ... class { 'couchdb': admins => { "couchdbadmin" => "-pbkdf2-276118ad0f1ce800d055df9cfbb3dc0fd173bbde,06b166f91b616576130dc3519d59e251,10" } } ... }
Notes:
We will use always couchdbadmin as couchdb server admin user. It is very recommended to keep it separately from the admin users of the individual databases. The server admin user can create and delete databases and users, but can not access the individual databases with security set.
The encrypted password above our commonly use password. This info will be written in /etc/couchdb/local.ini in the [admins] section. The password in the file could be also unencrypted, in that case it will be encrypted at next couchdb restart. To aviod, that puppet always rewrites the file, we should use the encrypted password here.
Configuration
- The databases are created currently manually (later we will do it from the RFID application). Log in into Futon as server admin and create the database, set also the security info: set role for admins "{db_name}-admin" and members "{db_name}-user".
Overview How Inspector, RFID & CouchDB Are Configured
- Assumed the following environment:
Setting
Example
RFID system URL
CouchDB URL (external)
http://alarp.works-organiser.com/cdb/rfid_alarp_ch_urt_production
CouchDB URL (internal, from RFID Rails server)
CouchDB admin name
couchdbadmin
CouchDB admin password
*****
Sitename (determines the form settings directory - lib/forms/{site})
urt
RFID has to be installed with the following settings on config/settings.local.yml:
SXS: Couchdb: Server: http://localhost:5984 Database: rfid_alarp_ch_urt_production UseAuth: true Admin: couchdbadmin AdminPwd: ***** SiteName: urt
Sign up in RFID, the first user will be automatically admin user. At signing up the user with the user name {email address}-{db name} and the same password will be created (or updated if the user already exists) in couchdb.
Log in into RFID and use the function CouchDB/Create database to create the CouchDB database with the security settings (admin and member user and roles)
Log in into RFID and use the function CouchDB Forms Upload to upload meta-forms and meta-fields into the appropriate couchdb database.
- Start the Inspector App and set the preferences:
PouchDB Server: http://alarp.works-organiser.com/cdb/rfid_alarp_ch_urt_production SQL Server: http://apps.alarp.ch/urt/ User Name: The email address used at signing up Password: Your password set at signing up
Perform Synchronize/Download to download meta-forms and meta-fields into the local database. Notes:
- If the user request "Password Reset Instructions" in RFID, than his password will be changed in CouchDB also.
- The CouchDB users automatically gets the role "{db-name}-user". If we want, that a user could upload design documents (it makes easier to use Futon for us), then add the role "{db-name}-admin" to the user in Futon/Database/Security as CouchDB admin.