~singpolyma/biboumi

6c35f49dd8c0a8f8add13c177660e65c64e649eb — louiz’ 6 years ago 679bf94
Add a biboumi Dockerfile
A docker/biboumi/Dockerfile => docker/biboumi/Dockerfile +45 -0
@@ 0,0 1,45 @@
# This Dockerfile creates a docker image running biboumi

FROM docker.io/fedora:latest

RUN dnf --refresh install -y\
    gcc-c++\
    cmake\
    make\
    udns-devel\
    sqlite-devel\
    libuuid-devel\
    expat-devel\
    libidn-devel\
    systemd-devel\
    git\
    python\
    && dnf clean all

# Install botan
RUN git clone https://github.com/randombit/botan.git && cd botan && ./configure.py --prefix=/usr && make -j8 && make install && ldconfig && rm -rf /botan

# Install litesql
RUN git clone git://git.louiz.org/litesql && mkdir /litesql/build && cd /litesql/build && cmake .. -DCMAKE_INSTALL_PREFIX=/usr && make -j8 &&  cd /litesql/build && make install && ldconfig && rm -rf /litesql

# Install biboumi
RUN git clone git://git.louiz.org/biboumi && mkdir ./biboumi/build && cd ./biboumi/build &&\
   cmake .. -DCMAKE_INSTALL_PREFIX=/usr\
            -DCMAKE_BUILD_TYPE=Release\
            -DWITH_BOTAN=1\
            -DWITH_LITESQL=1\
            -DWITH_LIBIDN=1\
            -DWITH_SYSTEMD=1\
   && make -j8 && make install && rm -rf /biboumi

RUN useradd biboumi

COPY ./biboumi.cfg /etc/biboumi/biboumi.cfg
RUN chown -R biboumi:biboumi /etc/biboumi

COPY ./entrypoint.sh /entrypoint.sh
RUN chmod 755 /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]

USER biboumi

A docker/biboumi/README.rst => docker/biboumi/README.rst +51 -0
@@ 0,0 1,51 @@
Biboumi Docker Image
====================

Running
-------

This image does not embed any XMPP server. You need to have a running XMPP
server (as an other docker container for example) first.

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.

```
docker run --link prosody:xmpp \
    -e BIBOUMI_PASSWORD=P4SSW0RD \
    -e BIBOUMI_HOSTNAME=irc.example.com \
    -e BIBOUMI_ADMIN=blabla \
    biboumi
```

Variables
---------

The configuration file inside the image is a template that is completed when
the container is started, using the following environment variables:

* BIBOUMI_HOSTNAME: Sets the value of the *hostname* option.
* BIBOUMI_SECRET: Sets the value of the *password* option.
* BIBOUMI_ADMIN: Sets the value of the *admin* option.

All these variables are optional, but biboumi will probably fail to start if
the hostname and secret are missing.

You can also directly provide your own configuration file by mounting it
inside the container using the -v option:

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

Linking with the XMPP server
----------------------------

You can use the --link option to connect to any server, but it needs to be
called *xmpp*. For example, if you are using a container named ejabberd, you
would use the option *--link ejabberd:xmpp*.

A docker/biboumi/biboumi.cfg => docker/biboumi/biboumi.cfg +6 -0
@@ 0,0 1,6 @@
xmpp_server_ip=xmpp
port=5347
db_name=/var/lib/biboumi/biboumi.sqlite
hostname=BIBOUMI_HOSTNAME
password=BIBOUMI_PASSWORD
admin=BIBOUMI_ADMIN

A docker/biboumi/entrypoint.sh => docker/biboumi/entrypoint.sh +10 -0
@@ 0,0 1,10 @@
#!/bin/bash

sed -i s/BIBOUMI_HOSTNAME/${BIBOUMI_HOSTNAME:-biboumi.localhost}/ /etc/biboumi/biboumi.cfg
sed -i s/BIBOUMI_ADMIN/${BIBOUMI_ADMIN:-}/ /etc/biboumi/biboumi.cfg
sed -i s/BIBOUMI_SECRET/${BIBOUMI_SECRET:-missing_secret}/ /etc/biboumi/biboumi.cfg

echo "Running biboumi with the following conf: "
cat /etc/biboumi/biboumi.cfg

/usr/bin/biboumi /etc/biboumi/biboumi.cfg