diff --git a/flake.lock b/flake.lock index d31de64605..d4febf83ff 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1700639964, - "narHash": "sha256-iQ48z5eqSHP8d7B8BBJtnXkVPIKPvdWc0GhIgy4j8cc=", + "lastModified": 1702290471, + "narHash": "sha256-uivAP05RENSzQDbDjAU3Fbq+AiDDpcNaHAzvOZM1fik=", "owner": "input-output-hk", "repo": "cardano-haskell-packages", - "rev": "eaf713ef8029332b9e4e23685fa157f26086da8b", + "rev": "1ff7483a6d2670c8627de92779a2b92a989293cd", "type": "github" }, "original": { @@ -1269,11 +1269,11 @@ "cardano-configurations": { "flake": false, "locked": { - "lastModified": 1700184336, - "narHash": "sha256-YhGAINYsk5qmHNOzoaB3vfItytsuADAA6XrFsfOOHQ8=", + "lastModified": 1702085095, + "narHash": "sha256-IJChESftdO2tj2pRB+82xMaLP/RqyKHzttE7QMLqvBQ=", "owner": "input-output-hk", "repo": "cardano-configurations", - "rev": "bd40a1ee99782196a70e8fa084a572c276d1d297", + "rev": "21249e0d5c68b4e8f3661b250aa8272a8785d678", "type": "github" }, "original": { @@ -3432,11 +3432,11 @@ "ghc99": { "flake": false, "locked": { - "lastModified": 1697054644, - "narHash": "sha256-kKarOuXUaAH3QWv7ASx+gGFMHaHKe0pK5Zu37ky2AL4=", + "lastModified": 1701580282, + "narHash": "sha256-drA01r3JrXnkKyzI+owMZGxX0JameMzjK0W5jJE/+V4=", "ref": "refs/heads/master", - "rev": "f383a242c76f90bcca8a4d7ee001dcb49c172a9a", - "revCount": 62040, + "rev": "f5eb0f2982e9cf27515e892c4bdf634bcfb28459", + "revCount": 62197, "submodules": true, "type": "git", "url": "https://gitlab.haskell.org/ghc/ghc" @@ -3485,11 +3485,11 @@ "hackage-nix": { "flake": false, "locked": { - "lastModified": 1700612632, - "narHash": "sha256-UzG6TDIano8KutKie9wI5yvvN3CfUfWOSBgDtuDa0L0=", + "lastModified": 1702340598, + "narHash": "sha256-CC0HI+6iKPtH+8r/ZfcpW5v/OYvL7zMwpr0xfkXV1zU=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "2674c27b8de693e83776083ed5fdf95e54be6463", + "rev": "24617c569995e38bf3b83b48eec6628a50fdb4fb", "type": "github" }, "original": { @@ -3716,16 +3716,17 @@ "nixpkgs-2205": "nixpkgs-2205_3", "nixpkgs-2211": "nixpkgs-2211_2", "nixpkgs-2305": "nixpkgs-2305", + "nixpkgs-2311": "nixpkgs-2311", "nixpkgs-unstable": "nixpkgs-unstable_8", "old-ghc-nix": "old-ghc-nix_6", "stackage": "stackage_6" }, "locked": { - "lastModified": 1700638396, - "narHash": "sha256-vQy1p94QFz8Lo+x2zZLb2gmNGtm2CUWk9j/IkuETs1s=", + "lastModified": 1702342211, + "narHash": "sha256-cVitlW0guoMsB7oZZt1bJU2XpFN4uQciO/z/ZQBaV7g=", "owner": "input-output-hk", "repo": "haskell.nix", - "rev": "fc060cf2934f7f206a4340ef86f5764b2f95737d", + "rev": "2a1000b835ea4f8186b79e5926c99a80f9e354fc", "type": "github" }, "original": { @@ -4649,11 +4650,11 @@ "sodium": "sodium_2" }, "locked": { - "lastModified": 1698999258, - "narHash": "sha256-42D1BMbdyZD+lT+pWUzb5zDQyasNbMJtH/7stuPuPfE=", + "lastModified": 1702362799, + "narHash": "sha256-cU8cZXNuo5GRwrSvWqdaqoW5tJ2HWwDEOvWwIVPDPmo=", "owner": "input-output-hk", "repo": "iohk-nix", - "rev": "73dc2bb45af6f20cfe1d962f1334eed5e84ae764", + "rev": "b426fb9e0b109a9d1dd2e1476f9e0bd8bb715142", "type": "github" }, "original": { @@ -6346,11 +6347,11 @@ }, "nixpkgs-2305": { "locked": { - "lastModified": 1695416179, - "narHash": "sha256-610o1+pwbSu+QuF3GE0NU5xQdTHM3t9wyYhB9l94Cd8=", + "lastModified": 1701362232, + "narHash": "sha256-GVdzxL0lhEadqs3hfRLuj+L1OJFGiL/L7gCcelgBlsw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "715d72e967ec1dd5ecc71290ee072bcaf5181ed6", + "rev": "d2332963662edffacfddfad59ff4f709dde80ffe", "type": "github" }, "original": { @@ -6360,6 +6361,22 @@ "type": "github" } }, + "nixpkgs-2311": { + "locked": { + "lastModified": 1701386440, + "narHash": "sha256-xI0uQ9E7JbmEy/v8kR9ZQan6389rHug+zOtZeZFiDJk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "293822e55ec1872f715a66d0eda9e592dc14419f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-23.11-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs-docker": { "locked": { "lastModified": 1652739558, @@ -6702,11 +6719,11 @@ }, "nixpkgs-unstable_8": { "locked": { - "lastModified": 1695318763, - "narHash": "sha256-FHVPDRP2AfvsxAdc+AsgFJevMz5VBmnZglFUMlxBkcY=", + "lastModified": 1701336116, + "narHash": "sha256-kEmpezCR/FpITc6yMbAh4WrOCiT2zg5pSjnKrq51h5Y=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e12483116b3b51a185a33a272bf351e357ba9a99", + "rev": "f5c27c6136db4d76c30e533c20517df6864c46ee", "type": "github" }, "original": { @@ -8271,8 +8288,8 @@ }, "original": { "owner": "mlabs-haskell", + "ref": "gergely/version-bump", "repo": "plutip", - "rev": "1bf0b547cd3689c727586abb8385c008fb2a3d1c", "type": "github" } }, @@ -8865,11 +8882,11 @@ "stackage_6": { "flake": false, "locked": { - "lastModified": 1700438989, - "narHash": "sha256-x+7Qtboko7ds8CU8pq2sIZiD45DauYoX9LxBfwQr/hs=", + "lastModified": 1702339768, + "narHash": "sha256-bqhJHSY5QXnPnfZjRHU0RJjotx9iwUMpDaJVDRuPxic=", "owner": "input-output-hk", "repo": "stackage.nix", - "rev": "9c2015334cc77837b8454b3b10ef4f711a256f6f", + "rev": "1a29112fc771bfa37b5f4f6555fe85177b5dd7fe", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 48aa83bf7a..3719c9475a 100644 --- a/flake.nix +++ b/flake.nix @@ -76,7 +76,8 @@ # Plutip server related inputs plutip = { - url = "github:mlabs-haskell/plutip/1bf0b547cd3689c727586abb8385c008fb2a3d1c"; + url = "github:mlabs-haskell/plutip?ref=gergely/version-bump"; + # TODO(bladyjoker): Why are we overriding inputs here? inputs = { nixpkgs.follows = "nixpkgs"; iohk-nix.follows = "iohk-nix"; @@ -324,8 +325,8 @@ # it (i.e. `nix develop`) default = (psProjectFor (nixpkgsFor system)).devShell; - # This can be used with `nix develop .#hsDevShell - hsDevShell = self.hsFlake.${system}.devShell; + # This can be used with `nix develop .#devPlutipServer` to work with `./plutip-server` + devPlutipServer = ((plutipServerFor system).flake { }).devShell; }); packages = perSystem (system: diff --git a/nix/runtime.nix b/nix/runtime.nix index 9f0ca6d904..1198cf8274 100644 --- a/nix/runtime.nix +++ b/nix/runtime.nix @@ -15,9 +15,6 @@ rec { # to change the values after calling `buildCtlRuntime` node = { port = 3001; - # the version of the node to use, corresponds to the image version tag, - # i.e. `"inputoutput/cardano-node:${tag}"` - tag = "1.35.4"; }; ogmios = { port = 1337; }; postgres = { @@ -98,10 +95,15 @@ rec { nodeSocketPath = "/ipc/node.socket"; bindPort = port: "${toString port}:${toString port}"; defaultServices = with config; { - # TODO make this use `cardano-node` from flake inputs cardano-node = { + image.contents = [ + # Note: Required, fixes issue with "Failed to start all.. subscriptions". + # Creates the /etc/services file. + pkgs.iana-etc + pkgs.coreutils + ]; service = { - image = "inputoutput/cardano-node:${node.tag}"; + useHostStore = true; ports = [ (bindPort node.port) ]; volumes = [ "${config.cardano-configurations}/network/${config.network.name}/cardano-node:/config" @@ -110,22 +112,21 @@ rec { "${nodeIpcVol}:/ipc" ]; command = [ - "run" - "--config" - "/config/config.json" - "--database-path" - "/data/db" - "--socket-path" - "${nodeSocketPath}" - "--topology" - "/config/topology.json" + "${pkgs.bash}/bin/sh" + "-c" + '' + ${inputs.cardano-node.packages."${pkgs.system}".cardano-node}/bin/cardano-node run \ + --config /config/config.json \ + --database-path /data/db \ + --socket-path "${nodeSocketPath}" \ + --topology /config/topology.json + '' ]; }; }; - # TODO make this use `kupo` from flake inputs kupo = { service = { - image = "cardanosolutions/kupo:${kupo.tag}"; + useHostStore = true; ports = [ (bindPort kupo.port) ]; volumes = [ "${config.cardano-configurations}/network/${config.network.name}:/config" @@ -133,26 +134,20 @@ rec { "${kupoDbVol}:/kupo-db" ]; command = [ - "--node-config" - "/config/cardano-node/config.json" - "--node-socket" - "${nodeSocketPath}" - "--since" - "${kupo.since}" - "--match" - "${"${kupo.match}"}" - "--host" - "0.0.0.0" - "--workdir" - "kupo-db" - ] ++ ( - pkgs.lib.lists.optional kupo.pruneUtxo "--prune-utxo" - ) ++ ( - pkgs.lib.lists.optional kupo.deferDbIndexes "--defer-db-indexes" - ); + "${pkgs.bash}/bin/sh" + "-c" + '' + ${inputs.kupo-nixos.packages.${pkgs.system}.kupo}/bin/kupo \ + --node-config /config/cardano-node/config.json \ + --node-socket "${nodeSocketPath}" \ + --since "${kupo.since}" \ + --match "${kupo.match}" \ + --host "0.0.0.0" \ + --workdir kupo-db ${pkgs.lib.strings.optionalString kupo.pruneUtxo "--prune-utxo"} ${pkgs.lib.strings.optionalString kupo.deferDbIndexes "--defer-db-indexes"} + '' + ]; }; }; - # TODO make this use `ogmios` from flake inputs ogmios = { service = { useHostStore = true; diff --git a/plutip-server/cabal.project b/plutip-server/cabal.project index 8f005a3662..c1a038651d 100644 --- a/plutip-server/cabal.project +++ b/plutip-server/cabal.project @@ -12,10 +12,6 @@ repository cardano-haskell-packages -- Align index-states with cardano-wallet index-state: 2023-06-06T00:00:00Z -index-state: - , hackage.haskell.org 2023-06-06T00:00:00Z - , cardano-haskell-packages 2023-06-05T06:39:32Z - packages: ./. tests: true @@ -111,9 +107,8 @@ source-repository-package --sha256: 04q58c82wy6x9nkwqbvcxbv6s61fx08h5kf62sb511aqp08id4bb subdir: generated - source-repository-package type: git location: https://github.com/mlabs-haskell/plutip.git - tag: d060231ebf20383cbdc854a4664fd66a5815aedc - --sha256: 0yydxf1f0mdx2ypnas987bnr7fmz0l1255rid5l9f4ajagd4bfry + tag: 1bf0b547cd3689c727586abb8385c008fb2a3d1c + --sha256: sha256-7ZhZUDhlFvV2us4G27iAk6lHezKS/4WA07NQn88VtQU= diff --git a/plutip-server/plutip-server.cabal b/plutip-server/plutip-server.cabal index da121dc1b2..495825b762 100644 --- a/plutip-server/plutip-server.cabal +++ b/plutip-server/plutip-server.cabal @@ -87,6 +87,7 @@ executable plutip-server , wai-cors , wai-logger , warp + , wai-extra other-modules: Api diff --git a/plutip-server/src/Api.hs b/plutip-server/src/Api.hs index b3c6fcc938..f3de22776b 100644 --- a/plutip-server/src/Api.hs +++ b/plutip-server/src/Api.hs @@ -7,6 +7,7 @@ import Api.Handlers ( import Control.Monad.IO.Class (liftIO) import Control.Monad.Reader (runReaderT) import Data.Kind (Type) +import Network.Wai.Middleware.RequestLogger as Logger import Network.Wai.Middleware.Cors qualified as Cors import Servant ( Application, @@ -42,7 +43,7 @@ type Api = :> Post '[JSON] StopClusterResponse app :: Env -> Application -app = Cors.cors (const $ Just policy) . serve api . appServer +app = Logger.logStdout . Cors.cors (const $ Just policy) . serve api . appServer where policy :: Cors.CorsResourcePolicy policy =