Skip to content

Commit d3dbbb2

Browse files
committed
Merge pull request #495 from klaemo/couchdb
Add CouchDB documentation
2 parents 8ccd2c2 + 2307451 commit d3dbbb2

File tree

4 files changed

+94
-0
lines changed

4 files changed

+94
-0
lines changed

couchdb/README-short.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CouchDB is a database that uses JSON for documents, JavaScript for MapReduce and HTTP for its API.

couchdb/content.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# What is Apache CouchDB?
2+
3+
CouchDB is a database that completely embraces the web. Store your data with JSON documents. Access your documents and query your indexes with your web browser, via HTTP. Index, combine, and transform your documents with JavaScript. CouchDB works well with modern web and mobile apps. You can even serve web apps directly out of CouchDB. And you can distribute your data, or your apps, efficiently using CouchDB’s incremental replication. CouchDB supports master-master setups with automatic conflict detection.
4+
5+
CouchDB comes with a suite of features, such as on-the-fly document transformation and real-time change notifications, that makes web app development a breeze. It even comes with an easy to use web administration console. You guessed it, served up directly out of CouchDB! We care a lot about distributed scaling. CouchDB is highly available and partition tolerant, but is also eventually consistent. And we care a lot about your data. CouchDB has a fault-tolerant storage engine that puts the safety of your data first.
6+
7+
> [couchdb.apache.org](https://couchdb.apache.org)
8+
9+
%%LOGO%%
10+
11+
## How to use this image
12+
13+
### Start a CouchDB instance
14+
15+
```console
16+
$ docker run -d --name my-couchdb %%REPO%%
17+
```
18+
19+
This image includes `EXPOSE 5984` (the CouchDB port), so standard container linking will make it automatically available to the linked containers.
20+
21+
### Using the instance
22+
23+
In order to use the running instance from an application, link the container
24+
25+
```console
26+
$ docker run --name my-couchdb-app --link my-couchdb:couch %%REPO%%
27+
```
28+
29+
See the [official docs](http://docs.couchdb.org/en/1.6.1/) for infomation on using and configuring CouchDB.
30+
31+
### Exposing the port to the outside world
32+
33+
If you want to expose the port to the outside world, run
34+
35+
```console
36+
$ docker run -p 5984:5984 -d %%REPO%%
37+
```
38+
39+
CouchDB listens on port 5984 for requests and the image includes `EXPOSE 5984`. The flag `-p 5984:5984` exposes this port on the host.
40+
41+
## Persistent Data
42+
43+
There are several ways to store data used by applications that run in Docker containers. We encourage users of the `%%REPO%%` images to familiarize themselves with the options available, including:
44+
45+
- Let Docker manage the storage of your database data [by writing the database files to disk on the host system using its own internal volume management](https://docs.docker.com/userguide/dockervolumes/#adding-a-data-volume). This is the default and is easy and fairly transparent to the user. The downside is that the files may be hard to locate for tools and applications that run directly on the host system, i.e. outside containers.
46+
- Create a data directory on the host system (outside the container) and [mount this to a directory visible from inside the container](https://docs.docker.com/userguide/dockervolumes/#mount-a-host-directory-as-a-data-volume). This places the database files in a known location on the host system, and makes it easy for tools and applications on the host system to access the files. The downside is that the user needs to make sure that the directory exists, and that e.g. directory permissions and other security mechanisms on the host system are set up correctly.
47+
48+
CouchDB uses `/usr/local/var/lib/couchdb` to store its data. This directory is marked as a docker volume.
49+
50+
### Using host directories
51+
52+
You can map the container's volumes to a directory on the host, so that the data is kept between runs of the container. This example uses your current directory, but that is in general not the correct place to store your persistent data!
53+
54+
```console
55+
$ docker run -d -v $(pwd):/usr/local/var/lib/couchdb --name my-couchdb %%REPO%%
56+
```
57+
58+
## Using your own CouchDB configuration file
59+
60+
The CouchDB configuration is specified in `.ini` files in `/usr/local/etc/couchdb`. Take a look at the [CouchDB configuration documentation](http://docs.couchdb.org/en/1.6.1/config/index.html) to learn more about CouchDBs configuration structure.
61+
62+
If you want to use a customized CouchDB configuration, you can create your configuration file in a directory on the host machine and then mount that directory as `/usr/local/etc/couchdb/local.d` inside the `%%REPO%%` container.
63+
64+
```console
65+
$ docker run --name my-couchdb -v /my/custom-config-dir:/usr/local/etc/couchdb/local.d -d %%REPO%%
66+
```
67+
68+
You can also use `couchdb` as the base image for your own couchdb instance and provie your own version of the `local.ini` config file:
69+
70+
Example Dockerfile:
71+
72+
FROM %%REPO%%:latest
73+
74+
COPY local.ini /usr/local/etc/couchdb/
75+
76+
and then build and run
77+
78+
```console
79+
$ docker build -t you/awesome-couchdb .
80+
$ docker run -d -p 5984:5984 you/awesome-couchdb
81+
```
82+
83+
## Logging
84+
85+
By default containers run from this image only log to `stdout`. This means that the `/_log` endpoint is not available. You can enable logging to file in the [configuration](http://docs.couchdb.org/en/1.6.1/config/logging.html).
86+
87+
For example in `local.ini`:
88+
89+
```ini
90+
[log]
91+
file = /usr/local/var/log/couchdb/couch.log
92+
```

couchdb/license.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Apache CouchDB is licensed under the [Apache License](https://github.com/apache/couchdb/blob/master/LICENSE).

couchdb/logo.png

4.47 KB
Loading

0 commit comments

Comments
 (0)