mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-04-05 03:00:15 -04:00
install-reddit: Use netcat to determine if services are up.
This is more robust than the previous method which slept for 30 seconds and ended up being simultaneously optimistic and pessimistic.
This commit is contained in:
@@ -148,6 +148,21 @@ cassandra
|
||||
haproxy
|
||||
PACKAGES
|
||||
|
||||
###############################################################################
|
||||
# Wait for all the services to be up
|
||||
###############################################################################
|
||||
# check each port for connectivity
|
||||
echo "Waiting for services to be available, see source for port meanings..."
|
||||
# 11211 - memcache
|
||||
# 5432 - postgres
|
||||
# 5672 - rabbitmq
|
||||
# 9160 - cassandra
|
||||
for port in 11211 5432 5672 9160; do
|
||||
while ! nc -vz localhost $port; do
|
||||
sleep 1
|
||||
done
|
||||
done
|
||||
|
||||
###############################################################################
|
||||
# Install the reddit source repositories
|
||||
###############################################################################
|
||||
@@ -169,9 +184,6 @@ fi
|
||||
###############################################################################
|
||||
# Configure Cassandra
|
||||
###############################################################################
|
||||
# wait a bit to make sure all the servers come up
|
||||
sleep 30
|
||||
|
||||
if ! echo | cassandra-cli -h localhost -k reddit > /dev/null 2>&1; then
|
||||
echo "create keyspace reddit;" | cassandra-cli -h localhost -B
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user