@@ -57,46 +57,6 @@ check_php_fpm() {
5757 log_error " Failed to start PHP-FPM after $max_attempts attempts"
5858}
5959
60- check_redis () {
61- log_info " Checking Redis connection..."
62- local max_attempts=5
63- local attempt=0
64- local redis_host=${REDIS_HOST:- localhost}
65- local redis_port=${REDIS_PORT:- 6379}
66- local redis_password=${REDIS_PASSWORD:- " " }
67-
68- while [ $attempt -lt $max_attempts ]; do
69- if [ -n " $redis_password " ]; then
70- if redis-cli -h $redis_host -p $redis_port -a $redis_password ping 2> /dev/null | grep -q " PONG" ; then
71- log_success " Redis connection successful"
72- return 0
73- fi
74- else
75- if redis-cli -h $redis_host -p $redis_port ping 2> /dev/null | grep -q " PONG" ; then
76- log_success " Redis connection successful"
77- return 0
78- fi
79- fi
80-
81- log_info " Redis not responding... (Attempt $(( attempt+ 1 )) /$max_attempts )"
82-
83- if [ " $redis_host " = " localhost" ] || [ " $redis_host " = " 127.0.0.1" ]; then
84- log_info " Attempting to start Redis locally..."
85- if command -v redis-server > /dev/null 2>&1 ; then
86- redis-server --daemonize yes
87- log_info " Redis server started"
88- else
89- log_info " Redis server not installed, cannot start automatically"
90- fi
91- fi
92-
93- sleep 3
94- attempt=$(( attempt+ 1 ))
95- done
96-
97- log_error " Failed to connect to Redis after $max_attempts attempts"
98- }
99-
10060echo -e " \n${YELLOW} Lerama: Starting${NC} \n"
10161
10262# Set timezone
@@ -129,9 +89,6 @@ DB_USER=${MYSQL_USERNAME:-root}
12989DB_PASS=${MYSQL_PASSWORD:- root}
13090ADMIN_USERNAME=${ADMIN_USERNAME:- admin}
13191ADMIN_PASSWORD=${ADMIN_PASSWORD:- admin}
132- REDIS_HOST=${REDIS_HOST:- localhost}
133- REDIS_PORT=${REDIS_PORT:- 6379}
134- REDIS_PASSWORD=${REDIS_PASSWORD:- }
13592EOL
13693
13794log_success " Environment variables set in /app/.env"
@@ -205,10 +162,6 @@ if [ ! -d /var/run/php ]; then
205162 log_success " PHP-FPM directory created"
206163fi
207164
208- # Check Redis connection
209- log_info " Checking Redis service..."
210- check_redis
211-
212165echo -e " \n${GREEN} Lerama: Initialized ===${NC} \n"
213166
214167wait -n
0 commit comments