-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
matrix-synapse: default to postgresql on 18.03
- Loading branch information
Showing
2 changed files
with
17 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a4b7de7
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.
@corngood Can you comment on why the default was changed from sqlite3 to postgresql? This just broke my matrix-synapse setup (which was not specifying the database_type variable) during a nixos-rebuild switch command. (Until I added database_type="sqlite3" of course.)
Could the package possibly detect whether sqlite3 was already in use on the system as another conditional before switching automatically to psycopg2?
a4b7de7
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.
@jeschmidt I changed it after migrating myself because I was told multiple times not to use the sqlite database for a real server. I'm trying to find some actual docs on that, but I'm not seeing anything obvious aside from this, with no references:
matrix-org/synapse#2889
Did you already have your stateVersion set to 18.03? That's probably not a good idea for anything you want to keep working, because it's a moving target until release.
If you had it set < 18.03, then there's a serious problem.
a4b7de7
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.
Hmm, interesting. As for stateVersion, what likely happened is that it was set to less than 18.03 then when I ran nix-channel --update and nixos-rebuild switch, it got bumped to >= 18.03. I'm using nixos-unstable for a channel, which could be the source of the issue. I don't specifically set stateVersion myself. (Nor actually do I know how to query it.)
Perhaps I will plan to migrate to postgresql at some point. Just wasn't expecting it to happen today! :)
I do recall a different nix package that went through a similar transition where a configuration variable default changed (in a "breaking" sort of way). That package had some check for whether the previous default was being used, and to keep the old default if so. Only fresh installations would get the new default. Seemed like a nice design pattern, but unfortunately I can't recall which nix package that was. If I find it, I will link it here.
a4b7de7
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.
nixos-generate-config
should spit out a config file with the stateVersion set. If you don't have that I suppose it will just be set to the latest.My advice is to keep it set to the latest released version (17.09 now) and once a new version is released, read the stateVersion section in the release notes before updating it. In this case the should be a note explaining the matrix change and a link to the migration docs. You can also just leave it at 17.09 as long as things are working fine.
a4b7de7
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.
It doesn't have any knowledge about the running system config. That would be fragile anyway.
stateVersion
is basically the way you do this.I don't think this would work here, because we want the same exact configuration to use postgres now instead of sqlite, so there's nothing you could use to differentiate them in general (aside from database_type).
a4b7de7
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 advice. I have now added system.stateVersion = "17.09"; to my configuration.nix and it is working. It is likely that nixos-generate-config does specify this now, but I installed this version of nixos quite some time ago and I've just been dragging it (kicking and screaming, sometimes) through the major updates.