File size: 993 Bytes
26488bb
5552216
26488bb
4f4c931
65f68f6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/bin/bash
set -e

echo "Starting MongoDB..."
# mongod --config /etc/mongod.conf &

# # Wait for MongoDB to be ready
# echo "Waiting for MongoDB to start..."
# max_attempts=30
# attempt=1

# echo $(ls -l /data/)

# while ! mongosh --quiet --eval "db.version()" > /dev/null 2>&1; do
#     if [ $attempt -gt $max_attempts ]; then
#         echo "MongoDB failed to start. Showing logs:"
#         cat /var/log/mongodb.log
#         exit 0
#     fi
#     echo "Attempt $attempt of $max_attempts: MongoDB not ready yet..."
#     sleep 2
#     attempt=$((attempt + 1))
# done

# echo "MongoDB started successfully"

# # Initialize replica set
# echo "Initializing replica set..."
# mongosh --eval 'rs.initiate({_id: "rs01", members: [{_id: 0, host: "localhost:27017"}]})' || {
#     echo "Failed to initialize replica set"
#     exit 0
# }

# echo "Waiting for replica set to initialize..."
# sleep 5

# # Start Rocket.Chat
# echo "Starting Rocket.Chat..."
# cd /opt/Rocket.Chat
# exec node main.js