turms-im / turms

🕊️ The world's most advanced open source instant messaging engine for 100K~10M concurrent users https://turms-im.github.io/docs
Apache License 2.0
1.69k stars 256 forks source link

Compose with MongoDB Volumes can't start the second time on macOS #1406

Open wukd opened 4 months ago

wukd commented 4 months ago

environmental information: OS: maxOS 14.2.1 (23C71) MongoDB: v4.4.25

Use compose to deploy and mount MongoDB related volumes. The first startup can be successful, but the second startup will fail.

volumes:
      - "../turms-volumes/mongodb-config/data/db:/data/db"
      - "../turms-volumes/mongodb-config/data/logs:/data/logs"

volumes:
      - "../turms-volumes/mongodb-shard/data/db:/data/db"
      - "../turms-volumes/mongodb-shard/data/logs:/data/logs"

volumes:
      - "../turms-volumes/mongodb-router/data/db:/data/db"
      - "../turms-volumes/mongodb-router/data/logs:/data/logs"

The failure output is as follows:

docker compose  -f docker-compose.standalone.deploy.yml up -d --force-recreate
WARN[0000] The "ENV" variable is not set. Defaulting to a blank string. 
WARN[0000] The "ENV" variable is not set. Defaulting to a blank string. 
[+] Running 3/3
 ✔ turms-admin Pulled                                                                                                                      2.1s 
 ✔ turms-gateway Pulled                                                                                                                    2.1s 
 ✔ turms-service Pulled                                                                                                                    2.0s 
[+] Running 3/8
 ✔ Container turms-mongodb-config-1  Healthy                                                                                              21.3s 
 ⠧ Container turms-mongodb-router-1  Started                                                                                              61.8s 
 ✘ Container turms-mongodb-shard-1   Error                                                                                                61.8s 
 ✔ Container turms-turms-admin-1     Started                                                                                              11.0s 
 ⠧ Container turms-redis-1           Started                                                                                              61.8s 
 ⠼ Container turms-mongodb-setup-1   Recreated                                                                                            51.4s 
 ⠸ Container turms-turms-service-1   Recreated                                                                                            51.3s 
 ⠹ Container turms-turms-gateway-1   Recreated                                                                                            51.2s 
dependency failed to start: container turms-mongodb-shard-1 is unhealthy

PS Not working in Ubuntu 20.04.1 LTS either

JamesChenX commented 4 months ago

I have no time to try it until the weekend. You can run docker logs turms-MongoDB-shard-1 to check the logs so that you can know why the container failed to start, and it should be simple to fix.