README.md 4.31 KB
Newer Older
louiz’'s avatar
louiz’ committed
1 2 3 4 5 6
Biboumi Docker Image
====================

Running
-------

7
This image does not embed any XMPP server. You need to have a running XMPP server first: as an other docker image, or running on the host machine.
louiz’'s avatar
louiz’ committed
8

9
Assuming you have a running [prosody](https://hub.docker.com/r/prosody/prosody/) container already running and [properly configured](https://prosody.im/doc/components#adding_an_external_component) you can use the following command to start your biboumi container.
louiz’'s avatar
louiz’ committed
10 11 12

```
docker run --link prosody:xmpp \
13
    -v $PWD/database:/var/lib/biboumi \
louiz’'s avatar
louiz’ committed
14 15 16 17 18 19
    -e BIBOUMI_PASSWORD=P4SSW0RD \
    -e BIBOUMI_HOSTNAME=irc.example.com \
    -e BIBOUMI_ADMIN=blabla \
    biboumi
```

20
If instead you already have an XMPP server running on the host machine, you can start the biboumi container like this:
21 22 23 24 25 26 27 28 29 30 31

```
docker run --network=host \
    -v $PWD/database:/var/lib/biboumi \
    -e BIBOUMI_PASSWORD=P4SSW0RD \
    -e BIBOUMI_HOSTNAME=irc.example.com \
    -e BIBOUMI_ADMIN=blabla \
    -e BIBOUMI_XMPP_SERVER_IP=127.0.0.1 \
    biboumi
```

louiz’'s avatar
louiz’ committed
32 33 34
Variables
---------

35
The configuration file inside the image contains only a few default values.  To be able to run, biboumi needs additional configuration.  Additional options can be passed using environment variables.  Any configuration option can be customized this way (see biboumi’s doc), but the main are listed here for convenience:
louiz’'s avatar
louiz’ committed
36 37

* BIBOUMI_HOSTNAME: Sets the value of the *hostname* option.
38
* BIBOUMI_PASSWORD: Sets the value of the *password* option.
louiz’'s avatar
louiz’ committed
39
* BIBOUMI_ADMIN: Sets the value of the *admin* option.
40
* BIBOUMI_XMPP_SERVER_IP: Sets the value of the *xmpp_server_ip* option. The default value is **xmpp**.
41
* BIBOUMI_DB_NAME: Sets the database name to be used by biboumi: a filesystem path pointing at a Sqlite3 file, or a postgresql URI (starting with “postgresql://”). See below to learn how to mount a host directory (to save your Sqlite3 database) or how to link with a postgresql docker container.
louiz’'s avatar
louiz’ committed
42

43
You can also directly provide your own configuration file by mounting it inside the container using the -v option:
louiz’'s avatar
louiz’ committed
44 45 46 47 48 49 50

```
docker run --link prosody:xmpp \
    -v $PWD/biboumi.cfg:/etc/biboumi/biboumi.cfg \
    biboumi
```

51 52
If both a custom configuration file and custom environment variables are passed to the container, the environment variables will take precedence.

louiz’'s avatar
louiz’ committed
53 54 55
Linking with the XMPP server
----------------------------

56
You can use the --link option to connect to any server running in a docker container, but it needs to be called *xmpp*, or the custom value set for the **BIBOUMI_XMPP_SERVER_IP** option. For example, if you are using a container named ejabberd, you would use the option *--link ejabberd:xmpp*.
57

58
If you want to connect to the XMPP server running on the host machine, use the **--network=host** option.
59

60 61 62
Volumes
-------

63
By default, a sqlite3 database is stored in the /var/lib/biboumi/ directory. If you don’t bind a local directory to it, the database will be lost when the container is stopped. If you want to keep your database between each run, bind it with the -v option, like this: **-v /srv/biboumi/:/var/lib/biboumi**.
64

65
Note: Due to a limitation in Docker, to be able to read and write into this database, make sure this mounted directory has the proper read and write permissions on the host: it can be owned by UID and GID 1000:1000, or use chmod to give permissions to everyone, for example.
66 67

```
68 69
chown -R 1000:1000 database/
chmod 777 database/
70
```
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92

Linking with a PostgreSQL container
-----------------------------------

If you want to use a PostgreSQL database, you need to either access the host database (run the biboumi container with --network=host), or link with a [postgresql docker image](https://hub.docker.com/_/postgres/).

To do that, start the PostgreSQL container like this:

```
docker run --name postgres postgres:latest
```

This will run a postgresql instance with a configured superuser named “postgres”, with no password and a database named “postgres” as well. If you want different values, please refer to the PostgreSQL’s image documentation.

Then start your biboumi container, by linking with this PostgreSQL container, and by specifying the correct db_name value (of course, also specify all the other options, like the XMPP hostname and password):

```
docker run --name biboumi \
    --link=postgres \
    -e BIBOUMI_DB_NAME=postgres://postgres@postgres/postgres \
    biboumi
```