Commit b1f850b6 authored by louiz’'s avatar louiz’

Update the docker images to enable postgresql, and document them

parent 8a12b547
...@@ -32,7 +32,8 @@ RUN apk add --no-cache g++\ ...@@ -32,7 +32,8 @@ RUN apk add --no-cache g++\
openssl\ openssl\
libressl-dev\ libressl-dev\
zlib-dev\ zlib-dev\
curl curl\
postgresql-dev
# Install botan # Install botan
RUN git clone https://github.com/randombit/botan.git && cd botan && ./configure.py --prefix=/usr && make -j8 && make install && 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
......
...@@ -39,7 +39,8 @@ RUN apt install -y g++\ ...@@ -39,7 +39,8 @@ RUN apt install -y g++\
openssl\ openssl\
zlib1g-dev\ zlib1g-dev\
libssl-dev\ libssl-dev\
curl curl\
libpq-dev
# Install botan # Install botan
RUN git clone https://github.com/randombit/botan.git && cd botan && ./configure.py --prefix=/usr && make -j8 && make install && 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
......
...@@ -39,6 +39,7 @@ RUN dnf --refresh install -y\ ...@@ -39,6 +39,7 @@ RUN dnf --refresh install -y\
openssl-devel\ openssl-devel\
which\ which\
java-1.8.0-openjdk\ java-1.8.0-openjdk\
postgresql-devel\
&& dnf clean all && dnf clean all
# Install botan # Install botan
......
...@@ -13,6 +13,7 @@ RUN apk add --no-cache\ ...@@ -13,6 +13,7 @@ RUN apk add --no-cache\
make\ make\
udns-dev\ udns-dev\
sqlite-dev\ sqlite-dev\
postgresql-dev\
libuuid\ libuuid\
util-linux-dev\ util-linux-dev\
expat-dev\ expat-dev\
...@@ -30,6 +31,7 @@ RUN git clone git://git.louiz.org/biboumi && mkdir ./biboumi/build && cd ./bibou ...@@ -30,6 +31,7 @@ RUN git clone git://git.louiz.org/biboumi && mkdir ./biboumi/build && cd ./bibou
-DWITH_BOTAN=1\ -DWITH_BOTAN=1\
-DWITH_SQLITE3=1\ -DWITH_SQLITE3=1\
-DWITH_LIBIDN=1\ -DWITH_LIBIDN=1\
-DWITH_POSTGRESQL=1\
&& make -j8 && make install && rm -rf /biboumi && make -j8 && make install && rm -rf /biboumi
RUN adduser biboumi -D -h /home/biboumi RUN adduser biboumi -D -h /home/biboumi
......
...@@ -38,6 +38,7 @@ The configuration file inside the image contains only a few default values. To ...@@ -38,6 +38,7 @@ The configuration file inside the image contains only a few default values. To
* BIBOUMI_PASSWORD: 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_ADMIN: Sets the value of the *admin* option.
* BIBOUMI_XMPP_SERVER_IP: Sets the value of the *xmpp_server_ip* option. The default value is **xmpp**. * BIBOUMI_XMPP_SERVER_IP: Sets the value of the *xmpp_server_ip* option. The default value is **xmpp**.
* 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.
You can also directly provide your own configuration file by mounting it inside the container using the -v option: You can also directly provide your own configuration file by mounting it inside the container using the -v option:
...@@ -59,7 +60,7 @@ If you want to connect to the XMPP server running on the host machine, use the * ...@@ -59,7 +60,7 @@ If you want to connect to the XMPP server running on the host machine, use the *
Volumes 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**. 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**.
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. 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.
...@@ -67,3 +68,25 @@ Note: Due to a limitation in Docker, to be able to read and write into this data ...@@ -67,3 +68,25 @@ Note: Due to a limitation in Docker, to be able to read and write into this data
chown -R 1000:1000 database/ chown -R 1000:1000 database/
chmod 777 database/ chmod 777 database/
``` ```
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
```
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment