Skip to content

Upgrade to PostgreSQL 17 #1936

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

Merged
merged 2 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker-compose.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: cardano-db-sync

services:
postgres:
image: postgres:14.10-alpine
image: postgres:17.2-alpine
environment:
- POSTGRES_LOGGING=true
- POSTGRES_DB=cexplorer
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: "3.9"

services:
postgres:
image: postgres:14.10-alpine
image: postgres:17.2-alpine
environment:
- POSTGRES_LOGGING=true
- POSTGRES_DB_FILE=/run/secrets/postgres_db
Expand Down
2 changes: 1 addition & 1 deletion docker-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3.5"

services:
postgres:
image: postgres:14.10-alpine
image: postgres:17.2-alpine
environment:
- POSTGRES_LOGGING=true
- POSTGRES_DB_FILE=/run/secrets/postgres_db
Expand Down
17 changes: 17 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 16 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
url = "github:IntersectMBO/cardano-haskell-packages?ref=repo";
flake = false;
};
# Note[PostgreSQL 17]: This is a workaround to get postgresql_17 from nixpkgs. It's
Copy link
Contributor

Choose a reason for hiding this comment

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

we could maybe create an issue and link it here so we can track it being done

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, we had the original discussion here: #1875

Copy link
Contributor

Choose a reason for hiding this comment

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

sweet if that will jog memories then ✅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sweet if that will jog memories then ✅

Do you think we should create another issue, just repurpose #1875 above?

Copy link
Contributor

Choose a reason for hiding this comment

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

totally up to you, new issue always helps with "throughput"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, I just renamed it. I think a whole new ticket would make it a blatant duplicate

# available in nixpkgs unstable, but has not been updated in haskell.nix yet. Remove
# this after the next time haskell.nix updates nixpkgs.
nixpkgsUpstream.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};

outputs = { self, ... }@inputs:
Expand All @@ -36,6 +40,12 @@
in
inputs.utils.lib.eachSystem supportedSystems (system:
let
# TODO: Remove me (See Note[PostgreSQL 17]).
nixpkgsUpstream = import inputs.nixpkgsUpstream {
inherit system;
inherit (inputs.haskellNix) config;
};

nixpkgs = import inputs.nixpkgs {
inherit system;
inherit (inputs.haskellNix) config;
Expand Down Expand Up @@ -92,6 +102,11 @@
doCheck = false;
});
})

# TODO: Remove me (See Note[PostgreSQL 17])
(final: prev: {
postgresql_17 = nixpkgsUpstream.postgresql_17;
})
];
};

Expand Down Expand Up @@ -250,7 +265,7 @@
# Database tests
let
postgresTest = {
build-tools = [ pkgs.pkgsBuildHost.postgresql_14 ];
build-tools = [ pkgs.pkgsBuildHost.postgresql_17 ];
inherit preCheck;
inherit postCheck;
};
Expand Down
4 changes: 2 additions & 2 deletions nix/docker.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
, bashInteractive, cacert, cardano-cli, cardano-db-sync, cardano-db-tool
, cardano-smash-server, coreutils, curl, findutils, getconf, glibcLocales
, gnused, gnutar, gzip, jq, iana-etc, iproute, iputils, lib, libidn, libpqxx
, postgresql_14, socat, utillinux
, postgresql_17, socat, utillinux
}:

let
Expand Down Expand Up @@ -46,7 +46,7 @@ let
iputils # Useful utilities for Linux networking
libidn # Library for internationalized domain names
libpqxx # A C++ library to access PostgreSQL databases
postgresql_14 # A powerful, open source object-relational database system
postgresql_17 # A powerful, open source object-relational database system
socat # Utility for bidirectional data transfer
utillinux # System utilities for Linux
cardano-cli # tool for interacting with cardano-node
Expand Down
2 changes: 1 addition & 1 deletion nix/nixos/tests/services-basic-test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ with pkgs;
systemd.services.cardano-db-sync.serviceConfig.SupplementaryGroups = "cardano-node";
services.postgresql = {
enable = true;
package = postgresql_14;
package = postgresql_17;
enableTCPIP = false;
ensureDatabases = [ "${config.services.cardano-db-sync.postgres.database}" ];
initialScript = builtins.toFile "enable-pgcrypto.sql" ''
Expand Down
Loading