mirror of
https://github.com/stoatchat/stoatchat.git
synced 2026-07-06 03:06:04 +00:00
Compare commits
1 Commits
v0.13.0
...
feat/repls
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d9643ebd8d |
@@ -4,7 +4,7 @@
|
||||
[database]
|
||||
# MongoDB connection URL
|
||||
# Defaults to the container name specified in self-hosted
|
||||
mongodb = "mongodb://127.0.0.1:27017"
|
||||
mongodb = "mongodb://127.0.0.1:27017?directConnection=true&replicaSet=rs0"
|
||||
# Redis connection URL
|
||||
# Defaults to the container name specified in self-hosted
|
||||
redis = "redis://127.0.0.1:6379/"
|
||||
|
||||
19
compose.yml
19
compose.yml
@@ -8,10 +8,29 @@ services:
|
||||
# MongoDB
|
||||
database:
|
||||
image: mongo
|
||||
command: ["--replSet", "rs0", "--bind_ip_all"]
|
||||
ports:
|
||||
- "27017:27017"
|
||||
volumes:
|
||||
- ./.data/db:/data/db
|
||||
- ./scripts/mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
|
||||
healthcheck:
|
||||
test: >
|
||||
mongosh --quiet --eval "
|
||||
try {
|
||||
const status = rs.status();
|
||||
if (status.ok === 1 && status.members[0].stateStr === 'PRIMARY') {
|
||||
quit(0);
|
||||
} else {
|
||||
quit(1);
|
||||
}
|
||||
} catch (e) {
|
||||
quit(1);
|
||||
}"
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
ulimits:
|
||||
nofile:
|
||||
soft: 65536
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[database]
|
||||
mongodb = "mongodb://localhost"
|
||||
mongodb = "mongodb://localhost?directConnection=true&replicaSet=rs0"
|
||||
redis = "redis://localhost/"
|
||||
|
||||
[rabbit]
|
||||
|
||||
@@ -4,7 +4,7 @@ disable_events_dont_use = false
|
||||
[database]
|
||||
# MongoDB connection URL
|
||||
# Defaults to the container name specified in self-hosted
|
||||
mongodb = "mongodb://database"
|
||||
mongodb = "mongodb://database?directConnection=true&replicaSet=rs0"
|
||||
# Redis connection URL
|
||||
# Defaults to the container name specified in self-hosted
|
||||
redis = "redis://redis/"
|
||||
|
||||
5
scripts/mongo-init.js
Normal file
5
scripts/mongo-init.js
Normal file
@@ -0,0 +1,5 @@
|
||||
try {
|
||||
rs.status();
|
||||
} catch (e) {
|
||||
rs.initiate({ _id: "rs0", members: [{ _id: 0, host: "localhost:27017" }] });
|
||||
}
|
||||
Reference in New Issue
Block a user