forked from agessaman/meshinfo-lite
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker_setup.sh
More file actions
executable file
·57 lines (46 loc) · 1.58 KB
/
docker_setup.sh
File metadata and controls
executable file
·57 lines (46 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
# Docker Setup Script for MeshInfo-Lite
# This script can be run inside the Docker container to set up database privileges
set -e
echo "=== MeshInfo-Lite Docker Database Setup ==="
# Wait for database to be ready
echo "Waiting for database to become available..."
for i in {1..30}; do
if mysql -h mariadb -u root -ppassw0rd -e "SELECT 1" >/dev/null 2>&1; then
echo "✓ Database is available"
break
fi
if [ $i -eq 30 ]; then
echo "✗ Database failed to become available"
exit 1
fi
echo "Database not ready yet (attempt $i/30)..."
sleep 2
done
# Grant privileges
echo "Setting up database privileges..."
mysql -h mariadb -u root -ppassw0rd << EOF
-- Grant RELOAD privilege for query cache operations
GRANT RELOAD ON *.* TO 'meshdata'@'%';
-- Grant PROCESS privilege for monitoring
GRANT PROCESS ON *.* TO 'meshdata'@'%';
-- Apply changes
FLUSH PRIVILEGES;
EOF
echo "✓ Granted RELOAD privilege for query cache operations"
echo "✓ Granted PROCESS privilege for monitoring"
echo "✓ Privileges flushed"
# Test privileges
echo "Testing privileges..."
if mysql -h mariadb -u meshdata -ppassw0rd meshdata -e "FLUSH QUERY CACHE" >/dev/null 2>&1; then
echo "✓ RELOAD privilege verified"
else
echo "⚠ RELOAD privilege test failed"
fi
if mysql -h mariadb -u meshdata -ppassw0rd meshdata -e "SHOW PROCESSLIST" >/dev/null 2>&1; then
echo "✓ PROCESS privilege verified"
else
echo "⚠ PROCESS privilege test failed"
fi
echo "=== Docker Setup Complete ==="
echo "The MeshInfo-Lite application should now have full functionality"