Added separate database credentials for each stack #1152
Labels
No labels
_CRITICAL_
API
app
backEnd
Blocked, waiting for further changes
bug
cleanup
close
design
duplicate
enhancement
feature request
frontEnd
help wanted
invalid
low priority
needs input
needs review
project documentation
question
research
reviewed
script
security
SQL
style
testing
topLevel
wontfix
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Andras/BoundlessFlowCampus2K!1152
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issue-988-db-passwords-week7"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What has been done
Added separate database usernames and passwords for each stack service
Updated compose files for:
Updated healthchecks to use stack-specific database users
Added stack-specific environment variables
Notes
This PR re-applies the changes on top of
team_1_week_7after PR #985 was merged.Conflicts from the previous closed PR were resolved against the latest week_7 branch.
Review on #1152
Whats done
Tested building a fresh install of the project to see if it works
Tested on ubuntu
Inspected following files
+ On line 71 in DockerCompose/stacks/parking/compose.yaml there is some code left from a merge. This should be removed
What needs to be done
Add new env variables to installation script
Update the database connection strings in the affected services to use new env variables
Fix code on line 71 in DockerCompose/stacks/parking/compose.yaml that is left from merge.
Another thing is that the file database does not get new credentials, however this is fine with me, as long as DATABASE_USER and DATABASE_PASSWORD are not removed from the installation scripts
Conclusion
This is still not ready to merge. It builds, but cannot connect to the databases. When checking the logs, the it is still DATABASE_USER trying to connect, presumably with the incorrect password. I do not know if this is because it still uses the old images, or if I missed updating some env-variable
When trying to connect to the databases, the "old" variables are still used (strings DATABASE_USER and DATABASE_PASSWORD in env file). I have no idea why.
I think the problem is in middleware. The connection string used to connect to all databases there is
dbUser and Password are still the old DATABASE_USER and DATABASE_PASSWORD.
This needs to be updated so that the correct username and password are used when trying to connect to a specific database
@b23albst wrote in #1152 (comment):
Was just about to comment this. This issue basically covers 4 areas: compose files, installation scripts, middleware and all the service DataQueries.
As you just said, middleware connects to all databases with the same user and password. This needs to be changed so that middleware tries to access ENERGY_DATABASE_USER if the service provided is energy, for example. Middleware right now does receive the service name so this should be possible.
Several issues was found:
The issues above has already been solved since to be able to review this, I needed to fix them. The commit below involves these fixes.
Theses fixes don't fix the solar service. It has wrongly typed database queries.
what has been reviewed
Important notes
remove .env file
run installation script
run rebuild
OBG: you need to remove your old .env as it uses only one user and one password for all services