Skip to content
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

Rewrite database tooling and support for postgres passwords #6803

Merged
merged 31 commits into from
Feb 6, 2023

Conversation

normanrz
Copy link
Member

@normanrz normanrz commented Feb 1, 2023

This PR rewrites the previous database tools from tools/postgres into a single JS file with multiple commands. The dbtool (I'll happily take other name suggestions) has some handling of parsing the Scala-supplied postgres connection config into regular postgres URLs (eg. postgres://user:password@host:port/database) for use with psql.

The Scala code now calls this tool by invoking node as a command instead of JVM-executed JS. Therefore, I added node to the Docker image. I could remove a few Scala and node dependencies.

diff-schema was a JS script already, but I also rewrote to have everything in one place. I tested that it produces exactly the same dump output.

To test everything, I configured the CI to use non-standard user/password combination and set up a different postgres user on the dev instance.

URL of deployed dev instance (used for testing):

Steps to test:

  • Create a new postgres superuser: CREATE ROLE webknossos WITH LOGIN SUPERUSER PASSWORD '...';
  • Add user and password to slick.conf (or as env var)
  • Try to run webKnossos
  • Try the commands of the tools/postgres/dbtool.js; although, most are checked during runtime or CI

Issues:


(Please delete unneeded items, merge only when none are left open)

@normanrz normanrz requested review from fm3 and philippotto February 1, 2023 20:33
@normanrz normanrz self-assigned this Feb 1, 2023
@normanrz
Copy link
Member Author

normanrz commented Feb 2, 2023

ftr https://stackoverflow.com/posts/70103077/revisions to change the owner of postgres objects.

docker-compose.yml Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
Copy link
Member

@fm3 fm3 left a comment

Choose a reason for hiding this comment

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

Cool stuff!

app/Startup.scala Outdated Show resolved Hide resolved
app/Startup.scala Outdated Show resolved Hide resolved
app/Startup.scala Outdated Show resolved Hide resolved
app/utils/WkConf.scala Outdated Show resolved Hide resolved
conf/slick.conf Outdated Show resolved Hide resolved
conf/slick.conf Outdated Show resolved Hide resolved
tools/postgres/dbtool.js Outdated Show resolved Hide resolved
tools/postgres/dbtool.js Outdated Show resolved Hide resolved
tools/postgres/dbtool.js Outdated Show resolved Hide resolved
tools/postgres/dbtool.js Show resolved Hide resolved
normanrz and others added 3 commits February 2, 2023 11:23
Copy link
Member

@philippotto philippotto left a comment

Choose a reason for hiding this comment

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

Looks great 👍 Only left a couple of nitpicks and suggestions.

tools/postgres/dbtool.js Outdated Show resolved Hide resolved
tools/postgres/dbtool.js Outdated Show resolved Hide resolved
tools/postgres/dbtool.js Outdated Show resolved Hide resolved
tools/postgres/dbtool.js Outdated Show resolved Hide resolved
tools/postgres/dbtool.js Show resolved Hide resolved
tools/postgres/dbtool.js Outdated Show resolved Hide resolved
@normanrz normanrz requested a review from fm3 February 2, 2023 19:37
Copy link
Member

@fm3 fm3 left a comment

Choose a reason for hiding this comment

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

@normanrz normanrz merged commit 79d21cb into master Feb 6, 2023
@normanrz normanrz deleted the postgres-password branch February 6, 2023 15:03
hotzenklotz added a commit that referenced this pull request Feb 6, 2023
…a_owner

* 'master' of github.com:scalableminds/webknossos:
  Rewrite database tooling and support for postgres passwords (#6803)
hotzenklotz added a commit that referenced this pull request Feb 7, 2023
…_editable_text_style

* 'master' of github.com:scalableminds/webknossos:
  Rewrite database tooling and support for postgres passwords (#6803)
  Fix saving allowed teams in dataset settings (#6817)
  Prevent Deactivaing Orga Owner (#6816)
  Fix some login problems (#6810)
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.

Use postgres with password
3 participants