CouchDB

CouchDB is a document-oriented noSQL database program.

In our example, we use the SSH access and consider the following information:

  • Account name: [account]
  • CouchDB directory: /home/[account]/couchdb/

Note

Feel free to adjust according to your needs.

Installation

Downloading and Compiling

[account]@ssh:~$ mkdir couchdb
[account]@ssh:~$ cd couchdb
[account]@ssh:~/couchdb$ wget -O- https://dlcdn.apache.org/couchdb/source/3.4.1/apache-couchdb-3.4.1.tar.gz | tar -xz --strip-components=1
[account]@ssh:~/couchdb$ ./configure --spidermonkey-version 78
[account]@ssh:~/couchdb$ make release

Choose the tar.gz package of the latest version available from the official CouchDB site.

Configuring

Create a local.ini file in the /home/[account]/couchdb directory with the following directives:

[admins]
admin = mysuperpassword

[couchdb]
single_node = true

[chttpd]
bind_address = ::
port = 5984

Note

Replace mysuperpassword with the password of your choice.

Public Cloud users will need to point the service to a port between 8300 and 8499 and modify this value in the configuration file.

Service launch

Create a service with following details:

  • Command: ./bin/couchdb -couch_ini /home/[account]/couchdb/local.ini
  • Working directory: /home/[account]/couchdb/rel/couchdb

The address to connect to the CouchDB instance will be services-[account].alwaysdata.net:[port]. For example, to list the databases:

$ curl -X GET http://admin:mysuperpassword@services-[account].alwaysdata.net:[port]/_all_dbs

Note

Replace [port] with the port indicated in the local.ini file.

Firewall rule creation

Private Cloud users will need to open the port by creating a firewall rule if they want to access it from the external network:

Title Value
Protocol UDP/TCP
Type ACCEPT
Direction Input
Hosts <specify nothing>
Ports 5984
IP version IPv4/IPv6