-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add postgres datastore type #5403
base: master
Are you sure you want to change the base?
Conversation
df6caaa
to
ce3bfc2
Compare
Thank you for the PR! Just a bit of a heads-up, we're a bit oversubscribed on quite a few fronts at the moment and the changes to sql-datastore are non-trivial so it may be a while before we get a chance to do a thorough review. Quick things:
|
I'm planning to do just that as soon as the PRs this depends on are merged! As soon as those are done, I'll update this pull; for the time being, it's here for posterity's sake. |
repo/fsrepo/datastores.go
Outdated
} | ||
|
||
type postgresDatastoreConfig struct { | ||
path string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
path
isn't needed here either.
repo/fsrepo/datastores.go
Outdated
} | ||
|
||
func (postgresDatastoreConfig) Create(path string) (repo.Datastore, error) { | ||
pg := postgresdb.Options{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should get Host/User/Password/Database from config.
When initializing node with this backend user could pass those using env vars. in config profile we'd just call os.Getenv
.
We then could provide a simple script like the one below to avoid storing passwords in shell history
#!/bin/sh
[check args]
export IPFS_PG_HOST=$1
export IPFS_PG_USER=$2
export IPFS_PG_DATABASE=$3
printf "${IPFS_PG_USER}@${IPFS_PG_HOST} password:"
stty -echo
read IPFS_PG_PASSWORD
stty echo
export IPFS_PG_PASSWORD
ipfs init --profile=postgres
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback! Making these changes now. I think we could also use the PGPASSFILE env variable to avoid directly storing the password as an env variable.
repo/fsrepo/datastores.go
Outdated
func (c *postgresDatastoreConfig) DiskSpec() DiskSpec { | ||
return map[string]interface{}{ | ||
"type": "postgresds", | ||
"path": c.path, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
path
is not needed here, but I'm not sure what to put here that makes sense. My guess would be user+database, as host/password may change frequently in some setups.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for taking so long and you having to fight with gx, but this is getting there.
Some things in other places:
- Some of my pervious review comments still need addressing Implement go-ipfs datastore interface for postgres (#2) go-ds-sql#2
- Git history in Add postgres profile go-ipfs-config#5 got a bit messy
There are also some merge conflicts here, if you don't want to fight with them, once other review comments are addressed I can fix them for you (it will likely involve gx too)
But other than that it's looking good.
9b54bce
to
0fd2dd3
Compare
I believe I've addressed all of the above issues. The required sql-datastore PR has been merged but the go-ipfs-config PR still needs to be merged, iptb-plugins will then need to be gx-ified with the new go-ipfs-config hash, and then finally go-ipfs can be gx-ified with the new go-ipfs-config and iptb-plugins hashes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(1 nit + needs rebase), rest looks good
plugin/loader/preload_list
Outdated
@@ -8,3 +8,4 @@ ipldgit github.com/ipfs/go-ipfs/plugin/plugins/git 0 | |||
badgerds github.com/ipfs/go-ipfs/plugin/plugins/badgerds 0 | |||
flatfs github.com/ipfs/go-ipfs/plugin/plugins/flatfs 0 | |||
levelds github.com/ipfs/go-ipfs/plugin/plugins/levelds 0 | |||
postgresds github.com/ipfs/go-ipfs/plugin/plugins/postgresds 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While it may be useful for quite a few people, I wouldn't preload this plugin by default (leaving commented out is fine)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for all the help, magik6k!
Jenkins seems to be unable to fetch dependencies from you - https://ci.ipfs.team/blue/organizations/jenkins/IPFS%2Fgo-ipfs/detail/PR-5403/44/pipeline. (gitcop warning needs fixing tee) |
After making some very minor last minute changes to sql-datastore.. I forgot to re-gx-ify the package and so it was merged with the wrong hash :( My apologies, sql-datastore will need a gx release patch performed. |
ba74810
to
1534b75
Compare
sql-datastore has been updated with the correct hash and I am also confused because the travis-ci builds are passing on OSX and only run into this issue with sql-datastore with the Linux builds. Before this can be merged go-ipfs-config PR needs to be merged and its hash updated here and in iptb-plugins, and then the iptb-plugins hash needs to be updated here as well. |
Lol. It looks like gx is case sensitive when it comes to language names. |
Try again with: QmZmPKg1RKY2Cy5czKEBJTfDYzenbGww2pFNQKxLSKrPRB (you're not the first to find this, apparently: whyrusleeping/gx#187) |
29e3193
to
b09225e
Compare
Yay that seems to have fixed the problem, thanks! It looks like the QmZmPKg1RKY2Cy5czKEBJTfDYzenbGww2pFNQKxLSKrPRB hash didn't capture the changes from ipfs/go-ds-sql#6 so we might want to gx release patch one more time although it appears the error we are getting now is just due to waiting on the updated go-ipfs-config dependencies. |
License: MIT Signed-off-by: User Name <email@address>
…ies; undo gx releases; address feedback; gx hashes will need to be updated once go-ipfs-config PR is merged and gx released"
That was just a bug that has been fixed in master. I've rebased for you. |
This is work that aims to integrate changed submitted here and here. No changes have been made to the gx package hashes as the work it depends upon has not yet been accepted.