Skip to content

Latest commit

 

History

History
70 lines (46 loc) · 2.83 KB

README.md

File metadata and controls

70 lines (46 loc) · 2.83 KB

couch-daemon-triggerjob

Database-driven daemon to extend CouchDB and Couchapps with asynchronous events handling and scheduling.

Use cases

Can be used to extend Couchapps capabilities with tasks like:

  • send e-mails

  • send SMS

  • 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

Installation

The easy, fast install

All applications within the Smileupps store come with couch-daemon-triggerjob preinstalled. All you need is to configure your couchapps.

  1. Install one of the CouchDB Hosting upps to get CouchDB Hosting service
  2. Wait your upp activation e-mail
  3. Proceed to Couchapp Configuration

Manual install

Prerequisites

Steps

  1. Download triggerjob.js file to your CouchDB machine

  2. Grant execute permissions

  3. Within your CouchDB configuration create a new parameter:

     section: os_daemons
     parameter: triggerjob
     value: /usr/bin/node /path/to/your/triggerjob.js
    
  4. Proceed to Couchapp Configuration

Couchapp Configuration

To let daemon interact with your documents stored in database X, you will need to:

  1. install couchapp-triggerjob to database X
  2. set CouchDB configuration parameter triggerjob->job_path to /X/_design/trigger/_rewrite