CouchDB

Infrastructure

Apache CouchDB is an open-source document-oriented NoSQL database, implemented in Erlang.

Setup CouchDB

Level: Easy
Deploys a NoSQL database using Docker NOTE: All database data is stored in the current working folder.
docker run --rm \
    --name my-couchdb \
    -e COUCHDB_USER=admin \
    -e COUCHDB_PASSWORD=password \
    -e COUCHDB_ERLANG_COOKIE=33595219-bc56-43ca-9df6-a9b4145f1e49 \
    -p 127.0.0.1:5984:5984 \
    -v $(pwd):/opt/couchdb/data \
    couchdb:3.3.1
For PRODUCTION deployments, you can make the server run "permanently". --rm (remove this flag) -d --restart unless-stopped (replace with these flags)
Deploys a NoSQL database using Docker Compose NOTE: All database data is stored in the current working folder.
services:
  couchdb:
    image: couchdb
    container_name: couchdb
    restart: unless-stopped
    ports:
      - '127.0.0.1:5984:5984'
      - '127.0.0.1:4369:4369'
      - '127.0.0.1:9100:9100'
    environment:
      - COUCHDB_USER=${COUCHDB_USER} # change this to match your system's ENV
      - COUCHDB_PASSWORD=${COUCHDB_PASSWORD} # change this to match your system's ENV
    volumes:
      - ./data:/opt/couchdb/data
    logging: # apply better controls to Docker overlay folder
      driver: 'json-file'
      options:
        max-file: '5'
        max-size: '10m'
networks:
  couchdb-network:
    driver: bridge
Add a New User NOTE: TBD...
curl -X PUT http://localhost:5984/_users/org.couchdb.user:new_username \
    -H "Accept: application/json" \
    -H "Content-Type: application/json" \
    -d '{"name": "new_username", "password": "new_password", "roles": [], "type": "user"}'