Update redis example to use alpine:3.4

This commit is contained in:
Manuel de Brito Fontes
2016-02-17 18:37:35 -03:00
parent bc6c66d4d4
commit e1fb51436f
9 changed files with 23 additions and 16 deletions

View File

@@ -12,13 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
FROM redis:2.8
RUN apt-get update
RUN apt-get install -yy -q python
FROM alpine:3.4
RUN apk add -U redis sed bash && rm -rf /var/cache/apk/*
COPY redis-master.conf /redis-master/redis.conf
COPY redis-slave.conf /redis-slave/redis.conf
COPY run.sh /run.sh
CMD [ "/run.sh" ]
ENTRYPOINT [ "sh", "-c" ]
ENTRYPOINT [ "bash", "-c" ]

View File

@@ -61,7 +61,8 @@ tcp-backlog 511
# Examples:
#
# bind 192.168.1.100 10.0.0.1
# bind 127.0.0.1
bind 0.0.0.0
# Specify the path for the Unix socket that will be used to listen for
# incoming connections. There is no default, so Redis will not listen

View File

@@ -61,7 +61,8 @@ tcp-backlog 511
# Examples:
#
# bind 192.168.1.100 10.0.0.1
# bind 127.0.0.1
bind 0.0.0.0
# Specify the path for the Unix socket that will be used to listen for
# incoming connections. There is no default, so Redis will not listen

View File

@@ -19,7 +19,7 @@ function launchmaster() {
echo "Redis master data doesn't exist, data won't be persistent!"
mkdir /redis-master-data
fi
redis-server /redis-master/redis.conf
redis-server /redis-master/redis.conf --protected-mode no
}
function launchsentinel() {
@@ -45,8 +45,9 @@ function launchsentinel() {
echo "sentinel down-after-milliseconds mymaster 60000" >> ${sentinel_conf}
echo "sentinel failover-timeout mymaster 180000" >> ${sentinel_conf}
echo "sentinel parallel-syncs mymaster 1" >> ${sentinel_conf}
echo "bind 0.0.0.0"
redis-sentinel ${sentinel_conf}
redis-sentinel ${sentinel_conf} --protected-mode no
}
function launchslave() {
@@ -66,9 +67,9 @@ function launchslave() {
echo "Connecting to master failed. Waiting..."
sleep 10
done
perl -pi -e "s/%master-ip%/${master}/" /redis-slave/redis.conf
perl -pi -e "s/%master-port%/6379/" /redis-slave/redis.conf
redis-server /redis-slave/redis.conf
sed -i "s/%master-ip%/${master}/" /redis-slave/redis.conf
sed -i "s/%master-port%/6379/" /redis-slave/redis.conf
redis-server /redis-slave/redis.conf --protected-mode no
}
if [[ "${MASTER}" == "true" ]]; then