diff options
author | Andrew Brookins <andrew.brookins@redislabs.com> | 2020-07-08 17:18:11 -0700 |
---|---|---|
committer | Andrew Brookins <andrew.brookins@redislabs.com> | 2020-07-08 17:18:11 -0700 |
commit | bd1d7936c11b3fd750a3e48a2e554f2f0b317d19 (patch) | |
tree | ce55d2e38f5e4055ec9ed4d8367e7f70cba46ab3 | |
parent | e7f9e3fce5d01929527d14b6b5938dd8daef8836 (diff) | |
download | redis-py-bd1d7936c11b3fd750a3e48a2e554f2f0b317d19.tar.gz |
Revert build_tools to Vagrant versions
-rwxr-xr-x | build_tools/bootstrap.sh | 3 | ||||
-rwxr-xr-x | build_tools/build_redis.sh | 7 | ||||
-rwxr-xr-x | build_tools/install_redis.sh | 16 | ||||
-rwxr-xr-x | build_tools/install_sentinel.sh | 17 | ||||
-rw-r--r-- | build_tools/redis-configs/001-master | 1 | ||||
-rw-r--r-- | build_tools/redis-configs/002-slave | 1 | ||||
-rwxr-xr-x | build_tools/redis_vars.sh | 41 | ||||
-rw-r--r-- | build_tools/sentinel-configs/001-1 | 1 | ||||
-rw-r--r-- | build_tools/sentinel-configs/002-2 | 1 | ||||
-rw-r--r-- | build_tools/sentinel-configs/003-3 | 1 | ||||
-rwxr-xr-x | build_tools/start.sh | 9 |
11 files changed, 65 insertions, 33 deletions
diff --git a/build_tools/bootstrap.sh b/build_tools/bootstrap.sh index 7125326..a5a0d2c 100755 --- a/build_tools/bootstrap.sh +++ b/build_tools/bootstrap.sh @@ -1,5 +1,4 @@ #!/usr/bin/env bash # need make to build redis -apt-get update -apt-get install -y make apt-utils wget build-essential +sudo apt-get install make diff --git a/build_tools/build_redis.sh b/build_tools/build_redis.sh index f530bf0..379c6cc 100755 --- a/build_tools/build_redis.sh +++ b/build_tools/build_redis.sh @@ -1,8 +1,11 @@ #!/usr/bin/env bash -source /build_tools/redis_vars.sh +source /home/vagrant/redis-py/build_tools/redis_vars.sh -pushd /tmp +pushd /home/vagrant + +uninstall_all_sentinel_instances +uninstall_all_redis_instances # create a clean directory for redis rm -rf $REDIS_DIR diff --git a/build_tools/install_redis.sh b/build_tools/install_redis.sh index 0e9d4b2..fd53a1c 100755 --- a/build_tools/install_redis.sh +++ b/build_tools/install_redis.sh @@ -1,25 +1,28 @@ #!/usr/bin/env bash -source /build_tools/redis_vars.sh +source /home/vagrant/redis-py/build_tools/redis_vars.sh -for filename in `ls $BUILD_REDIS_CONF_DIR`; do +for filename in `ls $VAGRANT_REDIS_CONF_DIR`; do # cuts the order prefix off of the filename, e.g. 001-master -> master PROCESS_NAME=redis-`echo $filename | cut -f 2- -d -` echo "======================================" echo "INSTALLING REDIS SERVER: $PROCESS_NAME" echo "======================================" + # make sure the instance is uninstalled (it should be already) + uninstall_instance $PROCESS_NAME + # base config mkdir -p $REDIS_CONF_DIR cp $REDIS_BUILD_DIR/redis.conf $REDIS_CONF_DIR/$PROCESS_NAME.conf # override config values from file - cat $BUILD_REDIS_CONF_DIR/$filename >> $REDIS_CONF_DIR/$PROCESS_NAME.conf + cat $VAGRANT_REDIS_CONF_DIR/$filename >> $REDIS_CONF_DIR/$PROCESS_NAME.conf # replace placeholder variables in init.d script - cp $BUILD_DIR/redis_init_script /etc/init.d/$PROCESS_NAME + cp $VAGRANT_DIR/redis_init_script /etc/init.d/$PROCESS_NAME sed -i "s/{{ PROCESS_NAME }}/$PROCESS_NAME/g" /etc/init.d/$PROCESS_NAME # need to read the config file to find out what port this instance will run on - port=`grep port $BUILD_REDIS_CONF_DIR/$filename | cut -f 2 -d " "` + port=`grep port $VAGRANT_REDIS_CONF_DIR/$filename | cut -f 2 -d " "` sed -i "s/{{ PORT }}/$port/g" /etc/init.d/$PROCESS_NAME chmod 755 /etc/init.d/$PROCESS_NAME @@ -28,4 +31,7 @@ for filename in `ls $BUILD_REDIS_CONF_DIR`; do # save the $PROCESS_NAME into installed instances file echo $PROCESS_NAME >> $REDIS_INSTALLED_INSTANCES_FILE + + # start redis + /etc/init.d/$PROCESS_NAME start done diff --git a/build_tools/install_sentinel.sh b/build_tools/install_sentinel.sh index 0aa21ef..0597208 100755 --- a/build_tools/install_sentinel.sh +++ b/build_tools/install_sentinel.sh @@ -1,26 +1,28 @@ #!/usr/bin/env bash -source /build_tools/redis_vars.sh +source /home/vagrant/redis-py/build_tools/redis_vars.sh - -for filename in `ls $BUILD_SENTINEL_CONF_DIR`; do +for filename in `ls $VAGRANT_SENTINEL_CONF_DIR`; do # cuts the order prefix off of the filename, e.g. 001-master -> master PROCESS_NAME=sentinel-`echo $filename | cut -f 2- -d -` echo "=========================================" echo "INSTALLING SENTINEL SERVER: $PROCESS_NAME" echo "=========================================" + # make sure the instance is uninstalled (it should be already) + uninstall_instance $PROCESS_NAME + # base config mkdir -p $REDIS_CONF_DIR cp $REDIS_BUILD_DIR/sentinel.conf $REDIS_CONF_DIR/$PROCESS_NAME.conf # override config values from file - cat $BUILD_SENTINEL_CONF_DIR/$filename >> $REDIS_CONF_DIR/$PROCESS_NAME.conf + cat $VAGRANT_SENTINEL_CONF_DIR/$filename >> $REDIS_CONF_DIR/$PROCESS_NAME.conf # replace placeholder variables in init.d script - cp $BUILD_DIR/sentinel_init_script /etc/init.d/$PROCESS_NAME + cp $VAGRANT_DIR/sentinel_init_script /etc/init.d/$PROCESS_NAME sed -i "s/{{ PROCESS_NAME }}/$PROCESS_NAME/g" /etc/init.d/$PROCESS_NAME # need to read the config file to find out what port this instance will run on - port=`grep port $BUILD_SENTINEL_CONF_DIR/$filename | cut -f 2 -d " "` + port=`grep port $VAGRANT_SENTINEL_CONF_DIR/$filename | cut -f 2 -d " "` sed -i "s/{{ PORT }}/$port/g" /etc/init.d/$PROCESS_NAME chmod 755 /etc/init.d/$PROCESS_NAME @@ -29,4 +31,7 @@ for filename in `ls $BUILD_SENTINEL_CONF_DIR`; do # save the $PROCESS_NAME into installed instances file echo $PROCESS_NAME >> $SENTINEL_INSTALLED_INSTANCES_FILE + + # start redis + /etc/init.d/$PROCESS_NAME start done diff --git a/build_tools/redis-configs/001-master b/build_tools/redis-configs/001-master index cd1c984..8591f1a 100644 --- a/build_tools/redis-configs/001-master +++ b/build_tools/redis-configs/001-master @@ -6,4 +6,3 @@ unixsocket /tmp/redis_master.sock unixsocketperm 777 dbfilename master.rdb dir /var/lib/redis/backups -logfile /var/log/redis-master diff --git a/build_tools/redis-configs/002-slave b/build_tools/redis-configs/002-slave index b51cb84..13eb77e 100644 --- a/build_tools/redis-configs/002-slave +++ b/build_tools/redis-configs/002-slave @@ -6,6 +6,5 @@ unixsocket /tmp/redis-slave.sock unixsocketperm 777 dbfilename slave.rdb dir /var/lib/redis/backups -logfile /var/log/redis-slave slaveof 127.0.0.1 6379 diff --git a/build_tools/redis_vars.sh b/build_tools/redis_vars.sh index b80ff55..c52dd4c 100755 --- a/build_tools/redis_vars.sh +++ b/build_tools/redis_vars.sh @@ -1,10 +1,10 @@ #!/usr/bin/env bash -BUILD_DIR=/build_tools -BUILD_REDIS_CONF_DIR=$BUILD_DIR/redis-configs -BUILD_SENTINEL_CONF_DIR=$BUILD_DIR/sentinel-configs +VAGRANT_DIR=/home/vagrant/redis-py/build_tools +VAGRANT_REDIS_CONF_DIR=$VAGRANT_DIR/redis-configs +VAGRANT_SENTINEL_CONF_DIR=$VAGRANT_DIR/sentinel-configs REDIS_VERSION=3.2.0 -REDIS_DOWNLOAD_DIR=/tmp/redis-downloads +REDIS_DOWNLOAD_DIR=/home/vagrant/redis-downloads REDIS_PACKAGE=redis-$REDIS_VERSION.tar.gz REDIS_BUILD_DIR=$REDIS_DOWNLOAD_DIR/redis-$REDIS_VERSION REDIS_DIR=/var/lib/redis @@ -13,3 +13,36 @@ REDIS_CONF_DIR=$REDIS_DIR/conf REDIS_SAVE_DIR=$REDIS_DIR/backups REDIS_INSTALLED_INSTANCES_FILE=$REDIS_DIR/redis-instances SENTINEL_INSTALLED_INSTANCES_FILE=$REDIS_DIR/sentinel-instances + +function uninstall_instance() { + # Expects $1 to be the init.d filename, e.g. redis-nodename or + # sentinel-nodename + + if [ -a /etc/init.d/$1 ]; then + + echo "======================================" + echo "UNINSTALLING REDIS SERVER: $1" + echo "======================================" + + /etc/init.d/$1 stop + update-rc.d -f $1 remove + rm -f /etc/init.d/$1 + fi; + rm -f $REDIS_CONF_DIR/$1.conf +} + +function uninstall_all_redis_instances() { + if [ -a $REDIS_INSTALLED_INSTANCES_FILE ]; then + cat $REDIS_INSTALLED_INSTANCES_FILE | while read line; do + uninstall_instance $line; + done; + fi +} + +function uninstall_all_sentinel_instances() { + if [ -a $SENTINEL_INSTALLED_INSTANCES_FILE ]; then + cat $SENTINEL_INSTALLED_INSTANCES_FILE | while read line; do + uninstall_instance $line; + done; + fi +} diff --git a/build_tools/sentinel-configs/001-1 b/build_tools/sentinel-configs/001-1 index d12979f..eccc3d1 100644 --- a/build_tools/sentinel-configs/001-1 +++ b/build_tools/sentinel-configs/001-1 @@ -1,7 +1,6 @@ pidfile /var/run/sentinel-1.pid port 26379 daemonize yes -logfile /var/log/redis-sentinel-1 # short timeout for sentinel tests sentinel down-after-milliseconds mymaster 500 diff --git a/build_tools/sentinel-configs/002-2 b/build_tools/sentinel-configs/002-2 index 9ab8934..0cd2801 100644 --- a/build_tools/sentinel-configs/002-2 +++ b/build_tools/sentinel-configs/002-2 @@ -1,7 +1,6 @@ pidfile /var/run/sentinel-2.pid port 26380 daemonize yes -logfile /var/log/redis-sentinel-2 # short timeout for sentinel tests sentinel down-after-milliseconds mymaster 500 diff --git a/build_tools/sentinel-configs/003-3 b/build_tools/sentinel-configs/003-3 index b971b2f..c7f4fcd 100644 --- a/build_tools/sentinel-configs/003-3 +++ b/build_tools/sentinel-configs/003-3 @@ -1,7 +1,6 @@ pidfile /var/run/sentinel-3.pid port 26381 daemonize yes -logfile /var/log/redis-sentinel-3 # short timeout for sentinel tests sentinel down-after-milliseconds mymaster 500 diff --git a/build_tools/start.sh b/build_tools/start.sh deleted file mode 100755 index c394b94..0000000 --- a/build_tools/start.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -/etc/init.d/redis-master start -/etc/init.d/redis-slave start -/etc/init.d/sentinel-1 start -/etc/init.d/sentinel-2 start -/etc/init.d/sentinel-3 start - -tail -f /var/log/redis-master /var/log/redis-slave /var/log/redis-sentinel-1 /var/log/redis-sentinel-2 /var/log/redis-sentinel-3 |