From 5d0bae65975eb7cb92543f13554f95386b50467e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Tue, 21 Mar 2017 15:01:28 +0100 Subject: Re-add the c-ares lib in the docker test images --- docker/biboumi-test/debian/Dockerfile.base | 1 + docker/biboumi-test/fedora/Dockerfile.base | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'docker') diff --git a/docker/biboumi-test/debian/Dockerfile.base b/docker/biboumi-test/debian/Dockerfile.base index e609feb..f5d061b 100644 --- a/docker/biboumi-test/debian/Dockerfile.base +++ b/docker/biboumi-test/debian/Dockerfile.base @@ -12,6 +12,7 @@ RUN apt install -y g++\ clang\ valgrind\ libudns-dev\ + libc-ares-dev\ libsqlite3-dev\ libuuid1\ libgcrypt20-dev\ diff --git a/docker/biboumi-test/fedora/Dockerfile.base b/docker/biboumi-test/fedora/Dockerfile.base index dd536e5..20984a2 100644 --- a/docker/biboumi-test/fedora/Dockerfile.base +++ b/docker/biboumi-test/fedora/Dockerfile.base @@ -10,6 +10,7 @@ RUN dnf --refresh install -y\ clang\ valgrind\ udns-devel\ + c-ares-devel\ sqlite-devel\ libuuid-devel\ libgcrypt-devel\ @@ -56,4 +57,3 @@ RUN chown -R tester:tester /home/tester/ircd RUN yes "" | openssl req -nodes -x509 -newkey rsa:4096 -keyout /home/tester/ircd/etc/ssl.key -out /home/tester/ircd/etc/ssl.pem COPY coverity /home/tester/coverity -COPY sonar-scanner-2.8 /home/tester/sonar-scanner -- cgit v1.2.3 From 7d2b8eb5268fe5b85f004eced289b7d61224e3c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Wed, 12 Apr 2017 18:26:30 +0200 Subject: Always chown biboumi /var/lib/biboumi when the docker container starts This fixes permission problems when we bind a volume that is not owned by the biboumi user. --- docker/biboumi/Dockerfile | 3 --- docker/biboumi/entrypoint.sh | 4 +++- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'docker') diff --git a/docker/biboumi/Dockerfile b/docker/biboumi/Dockerfile index 721d106..7c8d78d 100644 --- a/docker/biboumi/Dockerfile +++ b/docker/biboumi/Dockerfile @@ -35,7 +35,6 @@ RUN git clone git://git.louiz.org/biboumi && mkdir ./biboumi/build && cd ./bibou RUN useradd biboumi RUN mkdir /var/lib/biboumi -RUN chown -R biboumi:biboumi /var/lib/biboumi COPY ./biboumi.cfg /etc/biboumi/biboumi.cfg RUN chown -R biboumi:biboumi /etc/biboumi @@ -44,5 +43,3 @@ COPY ./entrypoint.sh /entrypoint.sh RUN chmod 755 /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] - -USER biboumi diff --git a/docker/biboumi/entrypoint.sh b/docker/biboumi/entrypoint.sh index eda53a4..8b9b869 100644 --- a/docker/biboumi/entrypoint.sh +++ b/docker/biboumi/entrypoint.sh @@ -5,7 +5,9 @@ sed -i s/BIBOUMI_HOSTNAME/${BIBOUMI_HOSTNAME:-biboumi.localhost}/ /etc/biboumi/b sed -i s/BIBOUMI_ADMIN/${BIBOUMI_ADMIN:-}/ /etc/biboumi/biboumi.cfg sed -i s/BIBOUMI_PASSWORD/${BIBOUMI_PASSWORD:-missing_password}/ /etc/biboumi/biboumi.cfg +chown -R biboumi:biboumi /var/lib/biboumi + echo "Running biboumi with the following conf: " cat /etc/biboumi/biboumi.cfg -/usr/bin/biboumi /etc/biboumi/biboumi.cfg +runuser -u biboumi /usr/bin/biboumi /etc/biboumi/biboumi.cfg -- cgit v1.2.3 From 4fde4d7369ff2f54f4216704a4fd51a974f53885 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Wed, 12 Apr 2017 19:27:52 +0200 Subject: =?UTF-8?q?docker:=20Run=20the=20process=20using=20=E2=80=9Cexec?= =?UTF-8?q?=E2=80=9D,=20to=20be=20able=20to=20cleanly=20receive=20signals?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/biboumi/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docker') diff --git a/docker/biboumi/entrypoint.sh b/docker/biboumi/entrypoint.sh index 8b9b869..af61260 100644 --- a/docker/biboumi/entrypoint.sh +++ b/docker/biboumi/entrypoint.sh @@ -10,4 +10,4 @@ chown -R biboumi:biboumi /var/lib/biboumi echo "Running biboumi with the following conf: " cat /etc/biboumi/biboumi.cfg -runuser -u biboumi /usr/bin/biboumi /etc/biboumi/biboumi.cfg +exec runuser -u biboumi /usr/bin/biboumi /etc/biboumi/biboumi.cfg -- cgit v1.2.3 From 06094245e9c17d10f7df835d1f9ad1a679b1bf67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Thu, 20 Apr 2017 22:44:14 +0200 Subject: Add a e2e test on alpine --- docker/biboumi-test/alpine/Dockerfile | 10 ++++++ docker/biboumi-test/alpine/Dockerfile.base | 51 ++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 docker/biboumi-test/alpine/Dockerfile create mode 100644 docker/biboumi-test/alpine/Dockerfile.base (limited to 'docker') diff --git a/docker/biboumi-test/alpine/Dockerfile b/docker/biboumi-test/alpine/Dockerfile new file mode 100644 index 0000000..ab288b6 --- /dev/null +++ b/docker/biboumi-test/alpine/Dockerfile @@ -0,0 +1,10 @@ +# This Dockerfile creates a docker image suitable to run biboumi’s build and +# tests. For example, it can be used on with gitlab-ci. + +FROM docker.louiz.org/biboumi-test-alpine-base + +# 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 && rm -rf /litesql && ldconfig || true + +WORKDIR /home/tester +USER tester diff --git a/docker/biboumi-test/alpine/Dockerfile.base b/docker/biboumi-test/alpine/Dockerfile.base new file mode 100644 index 0000000..dffa1d1 --- /dev/null +++ b/docker/biboumi-test/alpine/Dockerfile.base @@ -0,0 +1,51 @@ +# This Dockerfile creates a docker image suitable to run biboumi’s build and +# tests. For example, it can be used on with gitlab-ci. + +FROM docker.io/alpine:latest + +ENV LC_ALL C.UTF-8 + +# Needed to build biboumi +RUN apk add --no-cache g++\ + clang\ + valgrind\ + udns-dev\ + c-ares-dev\ + sqlite-dev\ + libuuid\ + util-linux-dev\ + libgcrypt-dev\ + cmake\ + make\ + expat-dev\ + libidn-dev\ + git\ + py3-lxml\ + libtool\ + py3-pip\ + python2\ + python3-dev\ + automake\ + autoconf\ + flex\ + bison\ + libltdl\ + openssl\ + libressl-dev\ + zlib-dev\ + curl + +# Install botan +RUN git clone https://github.com/randombit/botan.git && cd botan && ./configure.py --prefix=/usr && make -j8 && make install && rm -rf /botan + +# Install slixmpp, for e2e tests +RUN git clone https://github.com/saghul/aiodns.git && cd aiodns && git checkout 7ee13f9bea25784322~ && python3 setup.py build && python3 setup.py install && git clone git://git.louiz.org/slixmpp && pip3 install pyasn1 && cd slixmpp && python3 setup.py build && python3 setup.py install + +RUN adduser tester -D -h /home/tester + +# Install charybdis, for e2e tests +RUN git clone https://github.com/charybdis-ircd/charybdis.git && cd charybdis && cd /charybdis && git checkout 4f2b9a4 && sed s/113/1113/ -i /charybdis/authd/providers/ident.c && ./autogen.sh && ./configure --prefix=/home/tester/ircd --bindir=/usr/bin && make -j8 && make install && rm -rf /charybdis + +RUN chown -R tester:tester /home/tester/ircd + +RUN yes "" | openssl req -nodes -x509 -newkey rsa:4096 -keyout /home/tester/ircd/etc/ssl.key -out /home/tester/ircd/etc/ssl.pem -- cgit v1.2.3 From 3666f35e0e884068437fe520dbd5f087bea4d946 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Fri, 21 Apr 2017 11:49:23 +0200 Subject: Use alpine for the docker image, and simplify the config + run stuff MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using env variable directly used by the process, it’s easier than calling sed on the configuration file before we start the process. Also we don’t need to start as root anymore, and it’s a lot cleaner. --- docker/biboumi/Dockerfile | 35 +++++++++++++++++------------------ docker/biboumi/README.md | 16 +++++++++++----- docker/biboumi/biboumi.cfg | 8 ++++---- docker/biboumi/entrypoint.sh | 13 ------------- 4 files changed, 32 insertions(+), 40 deletions(-) delete mode 100644 docker/biboumi/entrypoint.sh (limited to 'docker') diff --git a/docker/biboumi/Dockerfile b/docker/biboumi/Dockerfile index 7c8d78d..d27421b 100644 --- a/docker/biboumi/Dockerfile +++ b/docker/biboumi/Dockerfile @@ -1,26 +1,25 @@ # This Dockerfile creates a docker image running biboumi -FROM docker.io/fedora:latest +FROM docker.io/alpine:latest -RUN dnf --refresh install -y\ - gcc-c++\ +RUN apk add --no-cache\ + g++\ cmake\ make\ - udns-devel\ - sqlite-devel\ - libuuid-devel\ - expat-devel\ - libidn-devel\ - systemd-devel\ + udns-dev\ + sqlite-dev\ + libuuid\ + util-linux-dev\ + expat-dev\ + libidn-dev\ git\ - python\ - && dnf clean all + python2 # 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 +RUN git clone https://github.com/randombit/botan.git && cd botan && ./configure.py --prefix=/usr && make -j8 && make install && 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 +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 && rm -rf /litesql # Install biboumi RUN git clone git://git.louiz.org/biboumi && mkdir ./biboumi/build && cd ./biboumi/build &&\ @@ -29,17 +28,17 @@ RUN git clone git://git.louiz.org/biboumi && mkdir ./biboumi/build && cd ./bibou -DWITH_BOTAN=1\ -DWITH_LITESQL=1\ -DWITH_LIBIDN=1\ - -DWITH_SYSTEMD=1\ && make -j8 && make install && rm -rf /biboumi -RUN useradd biboumi +RUN adduser biboumi -D -h /home/biboumi RUN mkdir /var/lib/biboumi +RUN chown -R biboumi:biboumi /var/lib/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 +WORKDIR /home/biboumi +USER biboumi -ENTRYPOINT ["/entrypoint.sh"] +CMD ["/usr/bin/biboumi", "/etc/biboumi/biboumi.cfg"] diff --git a/docker/biboumi/README.md b/docker/biboumi/README.md index e69c1b0..4b9e1e5 100644 --- a/docker/biboumi/README.md +++ b/docker/biboumi/README.md @@ -32,14 +32,12 @@ docker run --network=host \ Variables --------- -The configuration file inside the image is a template that is completed when the container is started, using the following environment variables: +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: * BIBOUMI_HOSTNAME: Sets the value of the *hostname* option. -* BIBOUMI_SECRET: Sets the value of the *password* option. +* BIBOUMI_PASSWORD: Sets the value of the *password* option. * BIBOUMI_ADMIN: Sets the value of the *admin* option. -* BIBOUMI_XMPP_SERVER_IP: Sets the value of the *xmpp_server_ip* option. The default is **xmpp**. - -All these variables are optional, but biboumi will probably fail to start if the hostname and secret are missing. +* BIBOUMI_XMPP_SERVER_IP: Sets the value of the *xmpp_server_ip* option. The default value is **xmpp**. You can also directly provide your own configuration file by mounting it inside the container using the -v option: @@ -49,6 +47,8 @@ docker run --link prosody:xmpp \ biboumi ``` +If both a custom configuration file and custom environment variables are passed to the container, the environment variables will take precedence. + Linking with the XMPP server ---------------------------- @@ -60,3 +60,9 @@ Volumes ------- The 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**. + +Note: Due to a limitation in Docker, to be able to read and write into this database, make sure this mounted directory is owned by UID and GID 1001:1001, on the host. + +``` +chown -R 1001:1001 database/ +``` diff --git a/docker/biboumi/biboumi.cfg b/docker/biboumi/biboumi.cfg index cc5df61..98c5a9f 100644 --- a/docker/biboumi/biboumi.cfg +++ b/docker/biboumi/biboumi.cfg @@ -1,6 +1,6 @@ -xmpp_server_ip=BIBOUMI_XMPP_SERVER_IP +xmpp_server_ip=127.0.0.1 port=5347 db_name=/var/lib/biboumi/biboumi.sqlite -hostname=BIBOUMI_HOSTNAME -password=BIBOUMI_PASSWORD -admin=BIBOUMI_ADMIN +hostname=xmpp +password= +admin= diff --git a/docker/biboumi/entrypoint.sh b/docker/biboumi/entrypoint.sh deleted file mode 100644 index af61260..0000000 --- a/docker/biboumi/entrypoint.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -sed -i s/BIBOUMI_XMPP_SERVER_IP/${BIBOUMI_XMPP_SERVER_IP:-xmpp}/ /etc/biboumi/biboumi.cfg -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_PASSWORD/${BIBOUMI_PASSWORD:-missing_password}/ /etc/biboumi/biboumi.cfg - -chown -R biboumi:biboumi /var/lib/biboumi - -echo "Running biboumi with the following conf: " -cat /etc/biboumi/biboumi.cfg - -exec runuser -u biboumi /usr/bin/biboumi /etc/biboumi/biboumi.cfg -- cgit v1.2.3 From 97f01d8e125c257a0011c4c275319595003a63f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Wed, 24 May 2017 13:43:49 +0200 Subject: Add biboumi-test-archlinux and biboumi-debian-packaging Dockerfiles --- docker/biboumi-test/archlinux/Dockerfile | 13 +++++++++++++ docker/packaging/debian/Dockerfile | 10 ++++++++++ 2 files changed, 23 insertions(+) create mode 100644 docker/biboumi-test/archlinux/Dockerfile create mode 100644 docker/packaging/debian/Dockerfile (limited to 'docker') diff --git a/docker/biboumi-test/archlinux/Dockerfile b/docker/biboumi-test/archlinux/Dockerfile new file mode 100644 index 0000000..20f0343 --- /dev/null +++ b/docker/biboumi-test/archlinux/Dockerfile @@ -0,0 +1,13 @@ +FROM docker.io/base/archlinux:latest + +RUN pacman -Syuuuu --noconfirm + +RUN pacman -Syu --noconfirm cmake base-devel git clang-tools-extra + +RUN useradd -m -G wheel -s /bin/bash builder + +RUN sed -i '/^# %wheel ALL=(ALL) NOPASSWD: ALL/s/^# //' /etc/sudoers + +WORKDIR /home/builder + +USER builder diff --git a/docker/packaging/debian/Dockerfile b/docker/packaging/debian/Dockerfile new file mode 100644 index 0000000..f9f4d84 --- /dev/null +++ b/docker/packaging/debian/Dockerfile @@ -0,0 +1,10 @@ +# This Dockerfile creates a docker image suitable to build a debian package + +FROM docker.io/debian:sid + +RUN apt update + +# Needed to build biboumi +RUN apt install -y \ + git \ + devscripts -- cgit v1.2.3