Skip to content

Commit

Permalink
Incorporate suggestions by @yosifkit
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Streichardt committed Feb 26, 2016
1 parent 48c8be3 commit 85a6a48
Showing 1 changed file with 47 additions and 38 deletions.
85 changes: 47 additions & 38 deletions arangodb/content.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ ArangoDB is a multi-model, open-source database with flexible data models for do

The supported data models can be mixed in queries and allow ArangoDB to be the aggregation point for the data request you have in mind.

Dockerfile: [`Latest` (Dockerfile)](https://github.com/arangodb/arangodb-docker/blob/master/Dockerfile.templ)
> [arangodb.com](https://arangodb.com)
%%LOGO%%

## Key Features in ArangoDB

Expand All @@ -18,29 +20,36 @@ Joins and Transactions are key features for flexible, secure data designs, widel

Furthermore, ArangoDB offers a microservice framework called [Foxx](https://www.arangodb.com/foxx) to build your own Rest API with a few lines of code.

ArangoDB Documentation - [ArangoDB Documentation](https://www.arangodb.com/documentation) - [ArangoDB Tutorials](https://www.arangodb.com/tutorials)
#### ArangoDB Documentation

- [ArangoDB Documentation](https://www.arangodb.com/documentation)
- [ArangoDB Tutorials](https://www.arangodb.com/tutorials)

## How to use this image

### Start an ArangoDB instance

In order to start an ArangoDB instance run

unix> docker run -e ARANGO_RANDOM_ROOT_PASSWORD=1 -d --name arangodb-instance -d arangodb/arangodb
```console
unix> docker run -e ARANGO_RANDOM_ROOT_PASSWORD=1 -d --name arangodb-instance -d arangodb
```

Will create and launch the arangodb docker instance as background process. The Identifier of the process is printed. By default ArangoDB listen on port 8529 for request and the image includes`EXPOSE 8529`. If you link an application container it is automatically available in the linked container. See the following examples.
Will create and launch the arangodb docker instance as background process. The Identifier of the process is printed. By default ArangoDB listen on port 8529 for request and the image includes `EXPOSE 8529`. If you link an application container it is automatically available in the linked container. See the following examples.

In order to get the IP arango listens on run:

docker inspect --format '{{ .NetworkSettings.IPAddress }}' <IDENTIFIER>

(where <IDENTIFIER> is the return string of the previous start command)
```console
unix> docker inspect --format '{{ .NetworkSettings.IPAddress }}' arangodb-instance
```

### Using the instance

In order to use the running instance from an application, link the container

unix> docker run -e ARANGO_RANDOM_ROOT_PASSWORD=1 --name my-app --link arangodb-instance:db-link arangodb/arangodb
```console
unix> docker run -e ARANGO_RANDOM_ROOT_PASSWORD=1 --name my-app --link arangodb-instance:db-link arangodb
```

This will use the instance with the name `arangodb-instance` and link it into the application container. The application container will contain environment variables

Expand All @@ -56,7 +65,9 @@ These can be used to access the database.

If you want to expose the port to the outside world, run

unix> docker run -e ARANGO_RANDOM_ROOT_PASSWORD=1 -p 8529:8529 -d arangodb/arangodb
```console
unix> docker run -e ARANGO_RANDOM_ROOT_PASSWORD=1 -p 8529:8529 -d arangodb
```

ArangoDB listen on port 8529 for request and the image includes `EXPOSE
8529`. The `-p 8529:8529` exposes this port on the host.
Expand All @@ -67,65 +78,63 @@ The ArangoDB image provides several authentication methods which can be specifie

1. ARANGO_RANDOM_ROOT_PASSWORD=1

Generate a random root password when starting. The password will be printed to stdout (may be inspected later using `docker logs`)
Generate a random root password when starting. The password will be printed to stdout (may be inspected later using `docker logs`)

1. ARANGO_NO_AUTH=1
2. ARANGO_NO_AUTH=1

Disable authentication. Useful for testing.
Disable authentication. Useful for testing.

**WARNING** Doing so in production will expose all your data. Make sure that ArangoDB is not diretcly accessible from the internet!
**WARNING** Doing so in production will expose all your data. Make sure that ArangoDB is not diretcly accessible from the internet!

1. ARANGO_ROOT_PASSWORD=somepassword
3. ARANGO_ROOT_PASSWORD=somepassword

Specify your own root password.
Specify your own root password.

### Command line options

In order to get a list of supported options, run

unix> docker run -e ARANGO_RANDOM_ROOT_PASSWORD=1 arangodb/arangodb arangod --help
```console
unix> docker run -e ARANGO_RANDOM_ROOT_PASSWORD=1 arangodb arangod --help
```

## Persistent Data

ArangoDB use the volume `/var/lib/arangodb` as database directory to store the collection data and the volume `/var/lib/arangodb-apps` as apps directory to store any extensions. These directories are marked as docker volumes.

See `docker inspect --format "{{ .Config.Volumes}}" arangodb/arangodb` for all volumes.
See `docker inspect --format "{{ .Config.Volumes}}" arangodb` for all volumes.

A good explanation about persistence and docker container can be found here:[Docker In-depth: Volumes](http://container42.com/2014/11/03/docker-indepth-volumes/),[Why Docker Data Containers are Good](https://medium.com/@ramangupta/why-docker-data-containers-are-good-589b3c6c749e)
A good explanation about persistence and docker container can be found here: [Docker In-depth: Volumes](http://container42.com/2014/11/03/docker-indepth-volumes/), [Why Docker Data Containers are Good](https://medium.com/@ramangupta/why-docker-data-containers-are-good-589b3c6c749e)

### Using host directories

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 path `/tmp/arangodb` is in general not the correct place to store you persistent files - it is just an example!

unix> mkdir /tmp/arangodb
unix> docker -e ARANGO_RANDOM_ROOT_PASSWORD=1 run -p 8529:8529 -d \
-v /tmp/arangodb:/var/lib/arangodb \
arangodb
```console
unix> mkdir /tmp/arangodb
unix> docker -e ARANGO_RANDOM_ROOT_PASSWORD=1 run -p 8529:8529 -d \
-v /tmp/arangodb:/var/lib/arangodb \
arangodb
```

This will use the `/tmp/arangodb` directory of the host as database directory for ArangoDB inside the container.

### Using a data container

Alternatively you can create a container holding the data.

unix> docker create --name arangodb-persist arangodb/arangodb true
```console
unix> docker create --name arangodb-persist arangodb true
```

And use this data container in your ArangoDB container.

unix> docker run -e ARANGO_RANDOM_ROOT_PASSWORD=1 --volumes-from arangodb-persist -p 8529:8529 arangodb

If want to save a few bytes you can alternatively use[tianon/true](https://registry.hub.docker.com/u/tianon/true/) or[progrium/busybox](https://registry.hub.docker.com/u/progrium/busybox/) for creating the volume only containers. Please note that you need to provide the used volumes in this case. For example

unix> docker run -d --name arangodb-persist -v /var/lib/arangodb tianon/true true

## Building your own ArangoDB image

We are auto generating docker images via our build system so the Dockerfile is a template. To build your own ArangoDB image:

cp Dockerfile.templ Dockerfile

Adjust @VERSION@ in the Dockerfile and issue:
```console
unix> docker run -e ARANGO_RANDOM_ROOT_PASSWORD=1 --volumes-from arangodb-persist -p 8529:8529 arangodb
```

docker build -t arangodb .
If want to save a few bytes you can alternatively use [busybox](https://registry.hub.docker.com/_/busybox) or [alpine](https://registry.hub.docker.com/_/alpine) for creating the volume only containers. Please note that you need to provide the used volumes in this case. For example

This will create an image named `arangodb`.
```console
unix> docker run -d --name arangodb-persist -v /var/lib/arangodb busybox true
```

0 comments on commit 85a6a48

Please sign in to comment.