-
Notifications
You must be signed in to change notification settings - Fork 185
support postgresql other port number #915
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
base: next
Are you sure you want to change the base?
Conversation
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, @lionelbargeot! We've talked about wanting to add this port
option: #494 (comment). It's nice that that's something that will be easy for users to set.
files/service/config.json.template
Outdated
@@ -3,6 +3,7 @@ | |||
"database": { | |||
"host": "${DB_HOST}", | |||
"user": "${DB_USER}", | |||
"port": "${DB_PORT}", |
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.
The quotes around ${DB_PORT}
shouldn't be needed, since ${DB_PORT}
will be a number. Central Backend will pass this port
option as-is to Knex.js, and from the Knex.js docs, it looks like Knex.js is expecting a number, not a string. Then again, if it's working for you with these quotes, it probably doesn't really matter either way.
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.
Just to add to this, I noticed that ${DB_SSL}
works similarly in this file. Since it will be either true
or false
, it doesn't need quotes.
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.
Hi Matthew, thanks for your feedback. Is there anything else I can help with ?
I seem to remember @lognaturel saying that in lieu of a If so, I think the approach in this PR would actually end up breaking things for those users. This PR always specifies the Rather than defaulting to 5432, it'd be preferable to specify the Alternatively, I see in the Central Backend code that specifying |
It looks like there's some precedence for this: we do something similar for the |
Ah I was looking at how Central Backend connects to Slonik, but I'm not so sure that this is true when Backend connects to Knex. I'm looking at |
I searched the codebase for Line 78 in 7114a06
The existence of that line and the hard-coded 5432 in it makes me question whether it really would work to include the port in |
Closes #
What has been done to verify that this works as intended?
We have configured an external database server that uses another port (5434)
We tested ODK Central succesfully.
Why is this the best possible solution? Were any other approaches considered?
We added DB_PORT environment variable support in docker-compose.yaml and in scripts that uses this en var.
How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
users can use a postgresql db server that listen another port than default.
Does this change require updates to documentation? If so, please file an issue here and include the link below.
Not specialy.
Before submitting this PR, please make sure you have:
next
branch OR only changed documentation/infrastructure (master
is stable and used in production)