Database-driven daemon to extend CouchDB and Couchapps with asynchronous events handling and scheduling.
Can be used to extend Couchapps capabilities with tasks like:
-
interact with third party APIs:
- authorize/receive Paypal payments
- authorize/receive Stripe payments
- get any HTML page on the internet, parse it and react accordingly
-
schedule http requests at regular intervals:
- to have a daily backup of your database
- to automatically generate a weekly newsletter from your database documents, and send it via e-mail
- to generate a monthly report from your documents, and send it via e-mail
-
interact with your own database: by retrieving documents, list or views, or executing actions to modify its state
-
transactions or chains: to update multiple documents at-once, or more generally, to chain multiple tasks/requests, such as:
- if user Pippo registers:
- create the user document org.couchdb.user:pippo,
- create a new database named db-pippo,
- secure db-pippo to be accessed by pippo only,
- replicate initial data/couchapps from an external db to db-pippo
- check pippo's ranking on Stackoverflow and store it within his user document
- if user Pippo registers:
All applications within the Smileupps store come with couch-daemon-triggerjob preinstalled. All you need is to configure your couchapps.
- Install one of the CouchDB Hosting upps to get CouchDB Hosting service
- Wait your upp activation e-mail
- Proceed to Couchapp Configuration
Prerequisites
-
npm install -g iriscouch/follow
Steps
-
Download triggerjob.js file to your CouchDB machine
-
Grant execute permissions
-
Within your CouchDB configuration create a new parameter:
section: os_daemons parameter: triggerjob value: /usr/bin/node /path/to/your/triggerjob.js
-
Proceed to Couchapp Configuration
To let daemon interact with your documents stored in database X, you will need to:
- install couchapp-triggerjob to database X
- set CouchDB configuration parameter triggerjob->job_path to /X/_design/trigger/_rewrite