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

Adding postgres support to ombi #5050

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

dben
Copy link

@dben dben commented Dec 12, 2023

I saw the feature suggestion at https://features.ombi.io/suggestions/127609/add-postgresql-as-a-database-provider and thought It would be nice and quick to implement, as the *arrs all have postgres support but not mySql support built in.

This should be pretty straightforward - I added NpgSql and generated the migrations for it, then updated DatabaseExtensions.cs.

I've also built a docker image that includes this, based on the LinuxServer Ombi container at ghcr.io/dben/ombi:latest.

In my personal testing deploying the image in my nomad cluster, this appears to work identically to the mysql provider, at least for my setup (plex/radarr/sonarr/email notifications). Since it's just EF I woudn't expect too much divergence.

@dben dben force-pushed the add-postgres-provider branch 3 times, most recently from e9bdad6 to de9cdd4 Compare December 13, 2023 00:17
…ut to use minutes so they only break for a cuple minutes instead.
@dben
Copy link
Author

dben commented Dec 13, 2023

After further testing, I made a few updates:

  1. Fixed an issue where Npgsql was more strict than the app in timezone comparison, causing some failed inserts
  2. Since Ombi has a few places where it uses raw SQL queries, I switched the postgres tables to be case-insensitive by converting identifiers to lowercase in the postgres migrations. This lets us avoid needing quotes for everything too.
  3. I noticed a few unit tests were failng from midnght UTC to about 2-4 am UTC - I switched the addHours calls to addMinutes so there's only a down time of a few minutes instead.

@teambvd
Copy link

teambvd commented Feb 29, 2024

Just chiming in to note, I've been testing this for ~5 weeks now, all without issue - going through the request history, it looks like users requested 11 series and 14 movies in that time (normal usage).

In an attempt to 'stress' the app, I'd added 4 multi-season TV series (~430 episodes combined) along with 8 movies, all in rapid succession; all went without a hitch, and was still more performant than adding a single series with the sqlite DB, at least to my eyes! 😮

Great work @dben !

@dben
Copy link
Author

dben commented Mar 21, 2024

Thanks for the testing - I've been running this PR as well on my personal instance since December, and haven't had any issues, although I've only had about a half dozen new movies and seven shortish tv shows added during that time.

@0xFEEDC0DE64
Copy link

could you provide a working example for database.json, it will also be easier to update the docs later based on this

@dben
Copy link
Author

dben commented Apr 10, 2024

could you provide a working example for database.json, it will also be easier to update the docs later based on this

sure, here's what I use (with the passwords redacted) - you can use separate databases too, but they all work lumped together:

{
    "OmbiDatabase": {
        "Type": "Postgres",
        "ConnectionString": "Host=127.0.0.1;Port=5432;Database=ombi;Username=postgres;Password=password"
    },
    "SettingsDatabase": {
        "Type": "Postgres",
        "ConnectionString": "Host=127.0.0.1;Port=5432;Database=ombi;Username=postgres;Password=password"
    },
    "ExternalDatabase": {
        "Type": "Postgres",
        "ConnectionString": "Host=127.0.0.1;Port=5432;Database=ombi;Username=postgres;Password=password"
}

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.

None yet

3 participants