Skip to content

Commit

Permalink
Initialize redis cluster during build
Browse files Browse the repository at this point in the history
  • Loading branch information
kremso committed Sep 28, 2015
1 parent 5f6a51e commit 3afcd31
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
11 changes: 9 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ FROM phusion/baseimage:0.9.16

MAINTAINER Luigis Box <[email protected]>

CMD ["/sbin/my_init"]

RUN add-apt-repository -y ppa:rwky/redis
RUN apt-get update -qq && apt-get install -qq redis-server

Expand All @@ -30,4 +28,13 @@ ADD /nodes/8003/start.sh /etc/service/redis-8003/run
ADD /nodes/8004/start.sh /etc/service/redis-8004/run
ADD /nodes/8005/start.sh /etc/service/redis-8005/run

RUN apt-get install -qq ruby
RUN gem install redis --no-ri --no-rdoc
ADD bootstrap.sh /bootstrap.sh
ADD redis-trib.rb /redis-trib.rb

RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN /sbin/my_init -- /bootstrap.sh

CMD ["/sbin/my_init"]
3 changes: 2 additions & 1 deletion bootstrap.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#!/bin/sh
echo "yes" | ruby redis-trib.rb create --replicas 1 127.0.0.1:8000 127.0.0.1:8001 127.0.0.1:8002 127.0.0.1:8003 127.0.0.1:8004 127.0.0.1:8005
echo "Creating redis cluster..."
echo "yes" | ruby /redis-trib.rb create --replicas 1 127.0.0.1:8000 127.0.0.1:8001 127.0.0.1:8002 127.0.0.1:8003 127.0.0.1:8004 127.0.0.1:8005

0 comments on commit 3afcd31

Please sign in to comment.