Skip to content

go-ds-mongo#468

Merged
sanderpick merged 6 commits intomasterfrom
sander/go-ds-mongo
Dec 6, 2020
Merged

go-ds-mongo#468
sanderpick merged 6 commits intomasterfrom
sander/go-ds-mongo

Conversation

@sanderpick
Copy link
Copy Markdown
Contributor

Allows the use of go-ds-mongo for all needed persistence.

Signed-off-by: Sander Pick <sanderpick@gmail.com>
Signed-off-by: Sander Pick <sanderpick@gmail.com>
Signed-off-by: Sander Pick <sanderpick@gmail.com>
@sanderpick sanderpick self-assigned this Dec 4, 2020
Signed-off-by: Sander Pick <sanderpick@gmail.com>
@sanderpick sanderpick marked this pull request as ready for review December 5, 2020 07:30
Copy link
Copy Markdown
Contributor

@jsign jsign left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Left some comments to think about.

Comment on lines +34 to +36
/usr/bin/mongod --fork --logpath /var/log/mongod.log --bind_ip_all --replSet rs0
mongo --eval 'rs.initiate({_id: "rs0", version: 1, members: [{ _id: 0, host: "mongo:27017" }]})'
tail -f /var/log/mongod.log
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, what we chated in the other PR. 👍🏼

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I added a little test util package in go-ds-mongo... makes it easy to start the replica set for tests: https://github.com/textileio/go-ds-mongo/blob/master/mongo_test.go#L20

threadsd/main.go Outdated
keepAliveInterval := fs.Duration("keepAliveInterval", time.Second*5, "Websocket keepalive interval (must be >= 1s)")
enableNetPubsub := fs.Bool("enableNetPubsub", false, "Enables thread networking over libp2p pubsub")
mongoUri := fs.String("mongoUri", "", "MongoDB URI (if not provided, an embedded Badger datastore will be used)")
mongoDatabase := fs.String("mongoDatabase", "threaddb", "MongoDB database name")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think is safer to not provide a default value, and error on startup if this isn't set explicitly through flag/env.
I fear that not providing a value might overlap with multiple instances running in the same cluster, which might be dangerous.

That's what I did in Powergate simply to avoid a misconfiguration (or simply doing nothing using defaults) that might cause a really bad situation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, default removed

Signed-off-by: Sander Pick <sanderpick@gmail.com>
Signed-off-by: Sander Pick <sanderpick@gmail.com>
@sanderpick sanderpick merged commit ac7c3c6 into master Dec 6, 2020
@sanderpick sanderpick deleted the sander/go-ds-mongo branch December 6, 2020 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants