Skip to content

CouchDB design document, to add asynchronous background events to CouchDB.

License

Notifications You must be signed in to change notification settings

JeffCave/couchapp-triggerjob

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

couchapp-triggerjob

CouchDB design document to be used with couch-daemon-triggerjob external daemon, to add asynchronous background events to CouchDB.

Installation

  1. Install couch-daemon-triggerjob to your CouchDB instance

  2. Download this couchapp to your local disk

  3. With your preferred Couchapp Deployment tool, upload the downloaded couchapp folder to your CouchDB instance, using app as database name

  4. To let the daemon know the path to your couchapp, create the following CouchDB _config parameter:

     section: triggerjob
     parameter: job_path
     value: /app/_design/trigger/_rewrite
    

    If you are going to watch multiple databases, use comma as separator:

     value: /app1/_design/trigger/_rewrite,/app2/_design/trigger/_rewrite
    
  5. If your CouchDB instance is admin password protected (no more in Admin Party), create the following _config parameter:

     section: triggerjob
     parameter: job_authorization
     value: adminusername:adminpassword
    

    Don't use your regular admin credentials: create a new pair for daemon-use only:

     section: admins
     parameter: daemon-username
     value: daemon-password
    

How to Use

You can monitor daemon status and messages using the CouchDB _log handler, or using the Log feature within Fauxton administration interface.

Examples

Have a look at Smileupps for some trigger use case examples

How it works

This couchapp works by:

  • forwarding daemon requests from /follow/changes to a filtered CouchDB changes handler: used by the daemon to continuously listen for new triggers
  • forwarding daemon requests from /trigger to an update function updates/trigger.js: this lets the daemon update your CouchDB database, with trigger results and execution status
  • forwarding any other daemon request to your main couchapp application stored in _design/app: this lets you implement your own application behaviour. For secure and easy couchapp development, you can follow the action-based write approach described within the Chatty couchdb tutorial.

About

CouchDB design document, to add asynchronous background events to CouchDB.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%