Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker image #1116

Open
tsukhani opened this issue Aug 18, 2022 · 4 comments
Open

Docker image #1116

tsukhani opened this issue Aug 18, 2022 · 4 comments

Comments

@tsukhani
Copy link

Can someone provide instructions/documentation to create a docker image for the latest 3.x releases?

@pma
Copy link

pma commented Aug 18, 2022

Hi,

Below is what I used with some success (of note remains an issue with the 'riak' user in the container, which runs the process, not mapping correctly to a 'riak' user in the host).

Some additional notes about the Dockerfile:

  • Files mapping-FoldToASCII.txt and mapping-ISOLatin1Accent.txt were missing in the installation directory and Solr was not happy about it so I added them after installing from the deb packages.
  • The riak.conf is changed to set some settings specifics to Search and are most likely not optimal
  • The riak.conf is enabling inter-cluster replication
  • The riak-kv-docker.sh startup script is used to set the nodename based on the fqdn of the machine, and also setting the advertised IP of the node for the inter-cluster replication module (this bit in a way very specific to my environment).

Dockerfile

FROM ubuntu:focal

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update && apt-get install -y --no-install-recommends apt-utils && \
    apt-get update && apt-get -y --no-install-recommends dist-upgrade && \
    apt-get install -y --no-install-recommends curl apt-transport-https ca-certificates && \
    apt-get install -y --no-install-recommends openjdk-8-jdk-headless locales logrotate sudo && \
    rm -rf /var/lib/apt/lists/* /tmp/*

RUN curl -O https://files.tiot.jp/riak/kv/3.0/3.0.10/ubuntu/focal64/riak_3.0.10-yokozuna-OTP22.3_amd64.deb && \
    dpkg -i riak_3.0.10-yokozuna-OTP22.3_amd64.deb && \
    rm -f riak_3.0.10-yokozuna-OTP22.3_amd64.deb

ENV DEBIAN_FRONTEND teletype \
    TERM=xterm \
    LANG en_US.UTF-8

ADD riak-kv-docker.sh /usr/bin/riak-docker

RUN chmod +x /usr/bin/riak-docker && \
    locale-gen en_US en_US.UTF-8 && \
    echo "ulimit -n 200000" >> /etc/default/riak && \
    echo "riak soft nofile 65536" >> /etc/security/limits.conf && \
    echo "riak hard nofile 200000" >> /etc/security/limits.conf && \
    echo "buckets.default.allow_mult = true" >> /etc/riak/riak.conf && \
    echo "log.syslog.level = warning" >> /etc/riak/riak.conf && \
    sed -i 's/127.0.0.1/0.0.0.0/' /etc/riak/advanced.config && \
    sed -i 's/listener.http.internal = 127.0.0.1/listener.http.internal = 0.0.0.0/' /etc/riak/riak.conf && \
    sed -i 's/listener.protobuf.internal = 127.0.0.1/listener.protobuf.internal = 0.0.0.0/' /etc/riak/riak.conf && \
    sed -i 's/search = off/search = on/' /etc/riak/riak.conf && \
    sed -i 's/storage_backend = bitcask/storage_backend = leveled/' /etc/riak/riak.conf && \
    sed -i 's/leveldb.maximum_memory.percent = 70/leveldb.maximum_memory.percent = 10/' /etc/riak/riak.conf && \
    sed -i 's/## ring_size = 64/ring_size = 64/' /etc/riak/riak.conf && \
    sed -i 's/search.solr.jvm_options = -Xms1g -Xmx1g/search.solr.jvm_options = -Xms4g -Xmx4g/' /etc/riak/riak.conf && \
    sed -i 's/log.console = file/log.console = console/' /etc/riak/riak.conf && \
    sed -i '/log.syslog = off/alog.syslog.ident = riak-kv' /etc/riak/riak.conf && \
    sed -i 's/log.syslog = off/log.syslog = on/' /etc/riak/riak.conf && \
    sed -i 's/log.console = file/log.console = off/' /etc/riak/riak.conf && \
    sed -i 's/leveled.compaction_top_hour = 23/leveled.compaction_top_hour = 6/' /etc/riak/riak.conf && \
    sed -i 's/mdc.cluster_manager = 127.0.0.1:9080/mdc.cluster_manager = 0.0.0.0:9080/' /etc/riak/riak.conf && \
    sed -i 's/leveled.log_level = info/leveled.log_level = warning/' /etc/riak/riak.conf && \
    sed -i 's/log.console.level = info/log.console.level = warning/' /etc/riak/riak.conf && \
    sed -i "/search = on/asearch.anti_entropy.throttle.tier1.solrq_queue_length = 0\n\
  search.anti_entropy.throttle.tier1.delay = 50ms\n\
  search.anti_entropy.throttle.tier2.solrq_queue_length = 50\n\
  search.anti_entropy.throttle.tier2.delay = 500ms\n\
  search.anti_entropy.throttle.tier3.solrq_queue_length = 100\n\
  search.anti_entropy.throttle.tier3.delay = 5000ms\n\
  search.anti_entropy.throttle.tier4.solrq_queue_length = 250\n\
  search.anti_entropy.throttle.tier4.delay = 10000ms" /etc/riak/riak.conf && \
    sed -i 's/## search.queue.high_watermark.purge_strategy = purge_one/search.queue.high_watermark.purge_strategy = purge_one/' /etc/riak/riak.conf && \
    sed -i 's/## search.queue.high_watermark = 1000/search.queue.high_watermark = 1000/' /etc/riak/riak.conf && \
    sed -i 's/## search.queue.batch.minimum = 10/search.queue.batch.minimum = 100/' /etc/riak/riak.conf && \
    sed -i 's/## search.queue.batch.maximum = 500/search.queue.batch.maximum = 1000/' /etc/riak/riak.conf && \
    sed -i 's/## search.queue.batch.flush_interval = 500ms/search.queue.batch.flush_interval = 5000ms/' /etc/riak/riak.conf && \
    sed -i 's/## leveled_reload_recalc = enabled/leveled_reload_recalc = enabled/' /etc/riak/riak.conf

ADD mapping-FoldToASCII.txt /usr/lib/riak/lib/yokozuna-riak_kv-2.9.1+build.1543.ref1be8760/priv/conf/
ADD mapping-ISOLatin1Accent.txt /usr/lib/riak/lib/yokozuna-riak_kv-2.9.1+build.1543.ref1be8760/priv/conf/

VOLUME /var/lib/riak

EXPOSE 8087 8098 9080

ENTRYPOINT ["/usr/bin/riak-docker"]

riak-kv-docker.sh

#!/bin/bash

NODENAME=$(hostname)
IP=$(hostname -I | tr " " "\n" | grep 192.168)
IP=${IP:=127.0.0.1}

sed -i "s/nodename = riak@127.0.0.1/nodename = riak@$NODENAME/" /etc/riak/riak.conf
sed -i "s/mdc.cluster_manager = 0.0.0.0:9080/mdc.cluster_manager = $IP:9080/" /etc/riak/riak.conf
sed -i "s/\"0.0.0.0\", 9080/\"$IP\", 9080/" /etc/riak/advanced.config

riak foreground

@bbqchickenrobot
Copy link

Why isn't basho doing this? This makes me think that ultimately the project maybe be dying or not have enough resources to handle basic things like docker containers. I was going to push Riak to the engineering manager but how can I explain they don't even have a container image?~?~~?

@pma
Copy link

pma commented Mar 4, 2023

@bbqchickenrobot 2018 was a long time ago...
Riak is opensource. Feel free to contribute with a docker image

@bbqchickenrobot
Copy link

Ah, I didn't realize the history - shame.

alexdutton added a commit to alexdutton/riak-kv-docker that referenced this issue Apr 25, 2023
Seeded from @pma's Dockerfile in basho/riak#1116

Differences:

* added the referenced Solr mapping files
* split `foreground` from entrypoint to cmd
* exeute riak with `exec` in entrypoint script
* pass through args from entrypoint with $@
* uplifted to newest Riak on the referenced deb package site
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants