-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request moby#11870 from dekobon/master
11558 - Documentation fixes and improvements for Riak Dockerfile
- Loading branch information
Showing
3 changed files
with
76 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Riak | ||
# | ||
# VERSION 0.1.1 | ||
|
||
# Use the Ubuntu base image provided by dotCloud | ||
FROM ubuntu:trusty | ||
MAINTAINER Hector Castro [email protected] | ||
|
||
# Install Riak repository before we do apt-get update, so that update happens | ||
# in a single step | ||
RUN apt-get install -q -y curl && \ | ||
curl -sSL https://packagecloud.io/install/repositories/basho/riak/script.deb | sudo bash | ||
|
||
# Install and setup project dependencies | ||
RUN apt-get update && \ | ||
apt-get install -y supervisor riak=2.0.5-1 | ||
|
||
RUN mkdir -p /var/log/supervisor | ||
|
||
RUN locale-gen en_US en_US.UTF-8 | ||
|
||
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf | ||
|
||
# Configure Riak to accept connections from any host | ||
RUN sed -i "s|listener.http.internal = 127.0.0.1:8098|listener.http.internal = 0.0.0.0:8098|" /etc/riak/riak.conf | ||
RUN sed -i "s|listener.protobuf.internal = 127.0.0.1:8087|listener.protobuf.internal = 0.0.0.0:8087|" /etc/riak/riak.conf | ||
|
||
# Expose Riak Protocol Buffers and HTTP interfaces | ||
EXPOSE 8087 8098 | ||
|
||
CMD ["/usr/bin/supervisord"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,61 +15,54 @@ Create an empty file called `Dockerfile`: | |
|
||
Next, define the parent image you want to use to build your image on top | ||
of. We'll use [Ubuntu](https://registry.hub.docker.com/_/ubuntu/) (tag: | ||
`latest`), which is available on [Docker Hub](https://hub.docker.com): | ||
`trusty`), which is available on [Docker Hub](https://hub.docker.com): | ||
|
||
# Riak | ||
# | ||
# VERSION 0.1.0 | ||
|
||
# VERSION 0.1.1 | ||
# Use the Ubuntu base image provided by dotCloud | ||
FROM ubuntu:latest | ||
FROM ubuntu:trusty | ||
MAINTAINER Hector Castro [email protected] | ||
|
||
After that, we install and setup a few dependencies: | ||
After that, we install the curl which is used to download the repository setup | ||
script and we download the setup script and run it. | ||
|
||
# Install Riak repository before we do apt-get update, so that update happens | ||
# in a single step | ||
RUN apt-get install -q -y curl && \ | ||
curl -sSL https://packagecloud.io/install/repositories/basho/riak/script.deb | sudo bash | ||
|
||
- `curl` is used to download Basho's APT | ||
repository key | ||
- `lsb-release` helps us derive the Ubuntu release | ||
codename | ||
- `openssh-server` allows us to login to | ||
containers remotely and join Riak nodes to form a cluster | ||
- `supervisor` is used manage the OpenSSH and Riak | ||
processes | ||
Then we install and setup a few dependencies: | ||
|
||
- `supervisor` is used manage the Riak processes | ||
- `riak=2.0.5-1` is the Riak package coded to version 2.0.5 | ||
|
||
<!-- --> | ||
|
||
# Install and setup project dependencies | ||
RUN apt-get update && apt-get install -y curl lsb-release supervisor openssh-server | ||
RUN apt-get update && \ | ||
apt-get install -y supervisor riak=2.0.5-1 | ||
|
||
RUN mkdir -p /var/run/sshd | ||
RUN mkdir -p /var/log/supervisor | ||
|
||
RUN locale-gen en_US en_US.UTF-8 | ||
|
||
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf | ||
|
||
RUN echo 'root:basho' | chpasswd | ||
|
||
Next, we add Basho's APT repository: | ||
|
||
RUN curl -sSL http://apt.basho.com/gpg/basho.apt.key | apt-key add -- | ||
RUN echo "deb http://apt.basho.com $(lsb_release -cs) main" > /etc/apt/sources.list.d/basho.list | ||
After that, we modify Riak's configuration: | ||
|
||
After that, we install Riak and alter a few defaults: | ||
|
||
# Install Riak and prepare it to run | ||
RUN apt-get update && apt-get install -y riak | ||
RUN sed -i.bak 's/127.0.0.1/0.0.0.0/' /etc/riak/app.config | ||
RUN echo "ulimit -n 4096" >> /etc/default/riak | ||
# Configure Riak to accept connections from any host | ||
RUN sed -i "s|listener.http.internal = 127.0.0.1:8098|listener.http.internal = 0.0.0.0:8098|" /etc/riak/riak.conf | ||
RUN sed -i "s|listener.protobuf.internal = 127.0.0.1:8087|listener.protobuf.internal = 0.0.0.0:8087|" /etc/riak/riak.conf | ||
|
||
Then, we expose the Riak Protocol Buffers and HTTP interfaces, along | ||
with SSH: | ||
|
||
# Expose Riak Protocol Buffers and HTTP interfaces, along with SSH | ||
EXPOSE 8087 8098 22 | ||
# Expose Riak Protocol Buffers and HTTP interfaces | ||
EXPOSE 8087 8098 | ||
|
||
Finally, run `supervisord` so that Riak and OpenSSH | ||
are started: | ||
Finally, run `supervisord` so that Riak is started: | ||
|
||
CMD ["/usr/bin/supervisord"] | ||
|
||
|
@@ -84,16 +77,14 @@ Populate it with the following program definitions: | |
|
||
[supervisord] | ||
nodaemon=true | ||
|
||
[program:sshd] | ||
command=/usr/sbin/sshd -D | ||
stdout_logfile=/var/log/supervisor/%(program_name)s.log | ||
stderr_logfile=/var/log/supervisor/%(program_name)s.log | ||
autorestart=true | ||
|
||
|
||
[program:riak] | ||
command=bash -c ". /etc/default/riak && /usr/sbin/riak console" | ||
pidfile=/var/log/riak/riak.pid | ||
command=bash -c "/usr/sbin/riak console" | ||
numprocs=1 | ||
autostart=true | ||
autorestart=true | ||
user=riak | ||
environment=HOME="/var/lib/riak" | ||
stdout_logfile=/var/log/supervisor/%(program_name)s.log | ||
stderr_logfile=/var/log/supervisor/%(program_name)s.log | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[supervisord] | ||
nodaemon=true | ||
|
||
[program:riak] | ||
command=bash -c "/usr/sbin/riak console" | ||
numprocs=1 | ||
autostart=true | ||
autorestart=true | ||
user=riak | ||
environment=HOME="/var/lib/riak" | ||
stdout_logfile=/var/log/supervisor/%(program_name)s.log | ||
stderr_logfile=/var/log/supervisor/%(program_name)s.log |