From 955996badfe79811ab555e233c7e42884e1a0483 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Placzy=C5=84ski?= Date: Thu, 3 Oct 2024 13:10:02 +0200 Subject: [PATCH 1/2] Bump Cardano Node version to 9.2.1 on sanchonet Updated the Cardano Node version from 9.1.1 to 9.2.1 in both the `Makefile` and `docker-compose.node+dbsync.yml` files to ensure compatibility with the latest release. This change is in line with the user story requirement to use version 9.2.1 on sanchonet in the proposal pillar, addressing potential improvements or fixes that come with the new version. --- scripts/govtool/Makefile | 2 +- scripts/govtool/docker-compose.node+dbsync.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/govtool/Makefile b/scripts/govtool/Makefile index 6d7c8e53f..c3808633a 100644 --- a/scripts/govtool/Makefile +++ b/scripts/govtool/Makefile @@ -11,7 +11,7 @@ include config.mk .DEFAULT_GOAL := info # image tags -cardano_node_image_tag := 9.1.1 +cardano_node_image_tag := 9.2.1 cardano_db_sync_image_tag := 13.5.0.2 .PHONY: all diff --git a/scripts/govtool/docker-compose.node+dbsync.yml b/scripts/govtool/docker-compose.node+dbsync.yml index 24662f89a..b41711e3f 100644 --- a/scripts/govtool/docker-compose.node+dbsync.yml +++ b/scripts/govtool/docker-compose.node+dbsync.yml @@ -51,7 +51,7 @@ services: retries: 5 cardano-node: - image: ghcr.io/intersectmbo/cardano-node:9.1.1 + image: ghcr.io/intersectmbo/cardano-node:9.2.1 environment: - NETWORK=sanchonet volumes: From d85d21d5b4264cce93e5771060bf1241419aab7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Placzy=C5=84ski?= Date: Mon, 7 Oct 2024 06:23:27 +0200 Subject: [PATCH 2/2] Switch base image from Debian Buster to Ubuntu 24.04 to resolve PostgreSQL repository issue The deployment of the GovTool backend was failing due to a missing PostgreSQL repository for Debian Buster. Upon investigation, it was determined that the specific repository required is no longer available, causing a 404 error. To resolve this, the base image has been updated from Debian Buster to Ubuntu 24.04. This change ensures compatibility with the PostgreSQL repository, allowing for seamless installation of PostgreSQL 14 and associated development libraries. The Dockerfile has been modified to include essential dependencies and tools, facilitating a consistent and reliable deployment process for the backend application. --- govtool/backend/Dockerfile.base | 52 ++++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/govtool/backend/Dockerfile.base b/govtool/backend/Dockerfile.base index 6dd3c75a3..fcdf388ab 100644 --- a/govtool/backend/Dockerfile.base +++ b/govtool/backend/Dockerfile.base @@ -3,16 +3,60 @@ # process by ensuring it only needs to compile against these dependencies. This # is a common practice in Haskell projects, as it can significantly reduce the # time it takes to build the project. +# +# The reason why we do not use the official haskell image is that the official +# image does not include the necessary dependencies for the project, which are +# unobtainable from the official image. -FROM haskell:9.2.7-buster +FROM ubuntu:24.04 + +# Set the working directory WORKDIR /src +# Set noninteractive mode +ENV DEBIAN_FRONTEND=noninteractive + +# Update package list and install dependencies RUN apt-get update && \ - apt-get install -y wget lsb-release && \ - sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' && \ + apt-get install -y \ + software-properties-common \ + wget \ + gnupg \ + curl \ + build-essential \ + libncurses-dev \ + libgmp-dev \ + liblzma-dev \ + pkg-config \ + zlib1g-dev \ + xz-utils + +# Install PostgreSQL 14 +RUN sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' && \ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \ apt-get update && \ apt-get install -y postgresql-14 libpq-dev +# Download and install GHC 9.2.7 +RUN wget https://downloads.haskell.org/~ghc/9.2.7/ghc-9.2.7-x86_64-deb10-linux.tar.xz && \ + tar -xf ghc-9.2.7-x86_64-deb10-linux.tar.xz && \ + cd ghc-9.2.7 && \ + ./configure && \ + make install && \ + cd .. && \ + rm -rf ghc-9.2.7 ghc-9.2.7-x86_64-deb10-linux.tar.xz + +# Install Cabal +RUN wget https://downloads.haskell.org/~cabal/cabal-install-3.6.2.0/cabal-install-3.6.2.0-x86_64-linux-deb10.tar.xz && \ + tar -xf cabal-install-3.6.2.0-x86_64-linux-deb10.tar.xz && \ + mv cabal /usr/local/bin/ && \ + rm cabal-install-3.6.2.0-x86_64-linux-deb10.tar.xz + +# Copy the project files into the container COPY . . -RUN cabal update && cabal configure && cabal install --only-dependencies && rm -rf /src/* + +# Install the project dependencies +RUN cabal update && \ + cabal configure && \ + cabal install --only-dependencies && \ + rm -rf /src/*