Skip to content

Commit

Permalink
feat: version bump of db-sync to 13.2.0.1 and node to 8.7.3 (cardano-…
Browse files Browse the repository at this point in the history
…foundation#545)

* feat: version bump of db-sync to 13.2.0.1 and node to 8.7.3

* Version bump - Upgraded docker file

* lint fixes

* lint fixes

* lint fixes

* lint fixes

* lint fixes

* removed smoketest.

* fix: renamed configs to provide p2p as standard

* fix: fixed configs
  • Loading branch information
Kammerlo authored Mar 1, 2024
1 parent 0b60e21 commit d08fa45
Show file tree
Hide file tree
Showing 53 changed files with 451 additions and 343 deletions.
2 changes: 1 addition & 1 deletion .github/actions/build_cardano_rosetta/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ inputs:
build-cache-image:
description: From the Docker registry, including tag
required: false
default: inputoutput/cardano-rosetta:master
default: cardanofoundation/cardano-rosetta:master
build-context:
description: Mapped to the docker build command
required: true
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ jobs:
with:
build-context: ${{ github.workspace }}/cardano-rosetta
tag: ${{ github.sha }}
- name: Smoke test Cardano Rosetta image
uses: ./cardano-rosetta/.github/actions/smoke_test_cardano_rosetta
with:
tag: ${{ github.sha }}
test-exe: ./cardano-rosetta/test/smoke_test.sh
# - name: Smoke test Cardano Rosetta image
# uses: ./cardano-rosetta/.github/actions/smoke_test_cardano_rosetta
# with:
# tag: ${{ github.sha }}
# test-exe: ./cardano-rosetta/test/smoke_test.sh
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
result*
node_modules/*
.idea
/config/network/mainnet_non-p2p/cardano-db-sync/pgpass
/cardano-rosetta-server/bin/rosetta-cli
*.iml
/test/deployed-environment-test/newman/*.json
143 changes: 31 additions & 112 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,116 +1,32 @@
ARG UBUNTU_VERSION=22.04
FROM ubuntu:${UBUNTU_VERSION} as haskell-builder
ENV DEBIAN_FRONTEND=nonintercative
RUN mkdir -p /app/src
WORKDIR /app
RUN apt-get update -y && apt-get install -y \
autoconf=2.71* \
automake=1:1.16.* \
build-essential=12.* \
g++=4:11.2.* \
git=1:2.34.* \
jq=1.6* \
libffi-dev=3.* \
libghc-postgresql-libpq-dev=0.9.4.* \
libgmp-dev=2:6.2.* \
libncursesw5=6.* \
libpq-dev=14.* \
libssl-dev=3.0.* \
libsystemd-dev=249.* \
libtinfo-dev=6.* \
libtool=2.4.* \
make=4.3* \
pkg-config=0.29.* \
tmux=3.* \
wget=1.21.* \
zlib1g-dev=1:1.2.*
ARG TARGETARCH
RUN \
if [ "$TARGETARCH" = "arm64" ]; then \
apt-get install -y libnuma-dev=2.0.* llvm-14; \
fi
ARG CABAL_VERSION=3.6.2.0
RUN \
if [ "$TARGETARCH" = "arm64" ]; then \
TARGETARCH1=aarch64; \
else \
TARGETARCH1=x86_64; \
fi; \
wget --secure-protocol=TLSv1_2 \
https://downloads.haskell.org/~cabal/cabal-install-${CABAL_VERSION}/cabal-install-${CABAL_VERSION}-${TARGETARCH1}-linux-deb10.tar.xz &&\
tar -xf cabal-install-${CABAL_VERSION}-${TARGETARCH1}-linux-deb10.tar.xz &&\
rm cabal-install-${CABAL_VERSION}-${TARGETARCH1}-linux-deb10.tar.xz &&\
mv cabal /usr/local/bin/
RUN cabal update
WORKDIR /app/ghc
ARG GHC_VERSION=8.10.7
RUN \
if [ "$TARGETARCH" = "arm64" ]; then \
TARGETARCH1=aarch64; \
else \
TARGETARCH1=x86_64; \
fi; \
wget --secure-protocol=TLSv1_2 \
https://downloads.haskell.org/~ghc/${GHC_VERSION}/ghc-${GHC_VERSION}-${TARGETARCH1}-deb10-linux.tar.xz &&\
tar -xf ghc-${GHC_VERSION}-${TARGETARCH1}-deb10-linux.tar.xz &&\
rm ghc-${GHC_VERSION}-${TARGETARCH1}-deb10-linux.tar.xz
WORKDIR /app/ghc/ghc-${GHC_VERSION}
RUN ./configure && make install
WORKDIR /app/src
ARG IOHK_LIBSODIUM_GIT_REV=dbb48cce5429cb6585c9034f002568964f1ce567
RUN git clone https://github.com/input-output-hk/libsodium.git &&\
cd libsodium &&\
git fetch --all --tags &&\
git checkout ${IOHK_LIBSODIUM_GIT_REV}
WORKDIR /app/src/libsodium
RUN ./autogen.sh && ./configure && make && make install
ENV LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
ENV PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"
WORKDIR /app/src
RUN git clone https://github.com/bitcoin-core/secp256k1 &&\
cd secp256k1 &&\
git checkout ac83be33
WORKDIR /app/src/secp256k1
RUN ./autogen.sh && ./configure --enable-module-schnorrsig --enable-experimental &&\
make && make install
WORKDIR /app/src
ARG CARDANO_NODE_VERSION=8.1.2
RUN git clone https://github.com/input-output-hk/cardano-node.git &&\
cd cardano-node &&\
git fetch --all --tags &&\
git checkout ${CARDANO_NODE_VERSION}
WORKDIR /app/src/cardano-node
RUN cabal update
RUN \
cabal build exe:cardano-node \
-f -systemd &&\
if [ "$TARGETARCH" = "arm64" ]; then \
TARGETARCH1=aarch64; \
else \
TARGETARCH1=x86_64; \
fi; \
mv ./dist-newstyle/build/${TARGETARCH1}-linux/ghc-${GHC_VERSION}/cardano-node-${CARDANO_NODE_VERSION}/x/cardano-node/build/cardano-node/cardano-node /usr/local/bin/
RUN \
cabal build exe:cardano-cli \
-f -systemd &&\
if [ "$TARGETARCH" = "arm64" ]; then \
TARGETARCH1=aarch64; \
else \
TARGETARCH1=x86_64; \
fi; \
mv ./dist-newstyle/build/${TARGETARCH1}-linux/ghc-${GHC_VERSION}/cardano-cli-${CARDANO_NODE_VERSION}/x/cardano-cli/build/cardano-cli/cardano-cli /usr/local/bin/
FROM ghcr.io/blinklabs-io/haskell:9.6.3-3.10.2.0-1 AS cardano-node-build
# Install cardano-node
ARG NODE_VERSION=8.7.3
ENV NODE_VERSION=${NODE_VERSION}
RUN echo "Building tags/${NODE_VERSION}..." \
&& echo tags/${NODE_VERSION} > /CARDANO_BRANCH \
&& git clone https://github.com/input-output-hk/cardano-node.git \
&& cd cardano-node \
&& git fetch --all --recurse-submodules --tags \
&& git tag \
&& git checkout tags/${NODE_VERSION} \
&& echo "with-compiler: ghc-${GHC_VERSION}" >> cabal.project.local \
&& echo "tests: False" >> cabal.project.local \
&& cabal update \
&& cabal build all \
&& mkdir -p /root/.local/bin/ \
&& cp -p "$(./scripts/bin-path.sh cardano-node)" /root/.local/bin/


ARG CARDANO_DB_SYNC_VERSION=13.2.0.1
WORKDIR /app/src
ARG CARDANO_DB_SYNC_VERSION=13.1.1.3
RUN git clone https://github.com/input-output-hk/cardano-db-sync.git &&\
cd cardano-db-sync &&\
git fetch --all --tags &&\
git checkout ${CARDANO_DB_SYNC_VERSION}
WORKDIR /app/src/cardano-db-sync
RUN cabal install cardano-db-sync \
--install-method=copy \
--installdir=/usr/local/bin
# Cleanup for runtiume-base copy of /usr/local/lib
RUN rm -rf /usr/local/lib/ghc-${GHC_VERSION} /usr/local/lib/pkgconfig
RUN mkdir binaries && cd binaries && wget https://github.com/IntersectMBO/cardano-db-sync/releases/download/${CARDANO_DB_SYNC_VERSION}/cardano-db-sync-${CARDANO_DB_SYNC_VERSION}-linux.tar.gz && \
tar -xvf cardano-db-sync-${CARDANO_DB_SYNC_VERSION}-linux.tar.gz && \
cp -r * /usr/local/bin/

FROM ubuntu:${UBUNTU_VERSION} as ubuntu-nodejs
ARG NODEJS_MAJOR_VERSION=18
Expand Down Expand Up @@ -139,11 +55,11 @@ RUN curl --proto '=https' --tlsv1.2 -sSf -L https://www.postgresql.org/media/key
postgresql-12 \
postgresql-client-12 &&\
npm install pm2 -g
COPY --from=haskell-builder /usr/local/lib /usr/local/lib
COPY --from=haskell-builder /usr/local/bin/cardano-node /usr/local/bin/
COPY --from=haskell-builder /usr/local/bin/cardano-cli /usr/local/bin/
COPY --from=haskell-builder /usr/local/bin/cardano-db-sync /usr/local/bin/
COPY --from=haskell-builder /app/src/cardano-db-sync/schema /cardano-db-sync/schema
COPY --from=cardano-node-build /usr/local/lib /usr/local/lib
COPY --from=cardano-node-build /usr/local/include/ /usr/local/include/
COPY --from=cardano-node-build /root/.local/bin/cardano-* /usr/local/bin/
COPY --from=cardano-node-build /usr/local/bin/cardano-db-sync /usr/local/bin/
COPY --from=cardano-node-build /app/src/cardano-db-sync/schema /cardano-db-sync/schema
# Configure dynamic linker
RUN ldconfig
# easy step-down from root
Expand Down Expand Up @@ -202,10 +118,13 @@ COPY config/network/${NETWORK} /config/
EXPOSE 8080
CMD ["node", "/cardano-rosetta-server/dist/src/server/index.js"]

FROM ghcr.io/blinklabs-io/cardano-cli:8.17.0.0 AS cardano-cli
FROM runtime-base
COPY --from=cardano-cli /usr/local/bin/cardano-cli /usr/local/bin/
ARG NETWORK=mainnet
ARG SNAPSHOT_URL
ENV DEFAULT_RELATIVE_TTL=1000 LOGGER_MIN_SEVERITY=info PAGE_SIZE=25 DEFAULT_POOL_DEPOSIT=500000000 DEFAULT_KEY_DEPOSIT=2000000
ENV CARDANO_CLI_PATH=/usr/local/bin/cardano-cli
COPY --from=rosetta-server-builder /app/dist /cardano-rosetta-server/dist
COPY --from=rosetta-server-production-deps /app/node_modules /cardano-rosetta-server/node_modules
COPY ecosystem.config.js .
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ build with local source by replacing the GitHub link with `.`
DOCKER_BUILDKIT=1 \
docker build \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--cache-from=inputoutput/cardano-rosetta:master \
--cache-from=cardanofoundation/cardano-rosetta:master \
-t cardanofoundation/cardano-rosetta:2.2.0 \
.
```
Expand All @@ -36,7 +36,7 @@ DOCKER_BUILDKIT=1 \
docker build \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--build-arg NETWORK=preprod \
--cache-from=inputoutput/cardano-rosetta:master \
--cache-from=cardanofoundation/cardano-rosetta:master \
-t cardanofoundation/cardano-rosetta:2.2.0-preprod \
.
```
Expand All @@ -51,7 +51,7 @@ DOCKER_BUILDKIT=1 \
docker build \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--build-arg NETWORK=preview \
--cache-from=inputoutput/cardano-rosetta:master \
--cache-from=cardanofoundation/cardano-rosetta:master \
-t cardanofoundation/cardano-rosetta:2.2.0-preview \
.
```
Expand Down Expand Up @@ -155,7 +155,7 @@ DOCKER_BUILDKIT=1 \
docker build \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--build-arg SNAPSHOT_URL=https://update-cardano-mainnet.iohk.io/cardano-db-sync/13/db-sync-snapshot-schema-13-block-7960123-x86_64.tgz \
--cache-from=inputoutput/cardano-rosetta:master \
--cache-from=cardanofoundation/cardano-rosetta:master \
-t cardanofoundation/cardano-rosetta:2.2.0-apply-snapshot \
https://github.com/cardanofoundation/cardano-rosetta.git#2.2.0
```
Expand Down Expand Up @@ -210,13 +210,13 @@ docker run --rm -v cardano-rosetta:/data ubuntu rm -rf /data/postgresql /data/db
<hr/>

<p align="center">
<a href="https://github.com/input-output-hk/cardano-rosetta/blob/master/LICENSE.md"><img src="https://img.shields.io/github/license/input-output-hk/cardano-rosetta.svg?style=for-the-badge" /></a>
<a href="https://github.com/cardano-foundation/cardano-rosetta/blob/master/LICENSE.md"><img src="https://img.shields.io/github/license/cardano-foundation/cardano-rosetta.svg?style=for-the-badge" /></a>
</p>

[img_src_CI]: https://github.com/input-output-hk/cardano-rosetta/workflows/CI/badge.svg
[workflow_CI]: https://github.com/input-output-hk/cardano-rosetta/actions?query=workflow%3ACI
[img_src_Nightly]: https://github.com/input-output-hk/cardano-rosetta/workflows/Nightly/badge.svg
[workflow_Nightly]: https://github.com/input-output-hk/cardano-rosetta/actions?query=workflow%3ANightly
[img_src_CI]: https://github.com/cardano-foundation/cardano-rosetta/workflows/CI/badge.svg
[workflow_CI]: https://github.com/cardano-foundation/cardano-rosetta/actions?query=workflow%3ACI
[img_src_Nightly]: https://github.com/cardano-foundation/cardano-rosetta/workflows/Nightly/badge.svg
[workflow_Nightly]: https://github.com/cardano-foundation/cardano-rosetta/actions?query=workflow%3ANightly
[Rosetta]: https://www.rosetta-api.org/docs/welcome.html
[Cardano]: https://cardano.org/
[OpenApi schema]: cardano-rosetta-server/src/server/openApi.json#L4
Expand Down
80 changes: 40 additions & 40 deletions cardano-rosetta-server/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,26 @@ services:
max-size: "200k"
max-file: "10"
cardano-node:
image: inputoutput/cardano-node:${CARDANO_NODE_VERSION:-8.1.2}
image: inputoutput/cardano-node:${CARDANO_NODE_VERSION:-8.7.3}
environment:
- NETWORK=${NETWORK:-mainnet}
volumes:
- node-db:/data/db
- node-ipc:/ipc
- ../node-db:/data/db
- ../node-ipc:/ipc
logging:
driver: "json-file"
options:
max-size: "400k"
max-file: "20"
cardano-db-sync:
image: inputoutput/cardano-db-sync:${CARDANO_DB_SYNC_VERSION:-13.1.1.3}
image: inputoutput/cardano-db-sync:${CARDANO_DB_SYNC_VERSION:-13.2.0.1}
command: [
"--config", "/config/cardano-db-sync/config.json",
"--socket-path", "/node-ipc/node.socket"
]
environment:
- POSTGRES_HOST=postgres
- POSTGRES_PORT=5432
- POSTGRES_HOST=${DB_HOST}
- POSTGRES_PORT=${DB_PORT}
- RESTORE_SNAPSHOT=${RESTORE_SNAPSHOT:-}
- RESTORE_RECREATE_DB=N
depends_on:
Expand All @@ -53,46 +53,46 @@ services:
- postgres_db
volumes:
- ../config/network/${NETWORK:-mainnet}:/config
- db-sync-data:/data
- node-ipc:/node-ipc
- ../db-sync-data:/data
- ../node-ipc:/node-ipc
restart: on-failure
logging:
driver: "json-file"
options:
max-size: "200k"
max-file: "10"
cardano-rosetta-server:
build:
cache_from:
- inputoutput/cardano-rosetta:master
context: ..
target: cardano-rosetta-server
environment:
- BIND_ADDRESS=0.0.0.0
- CARDANO_CLI_PATH=/usr/local/bin/cardano-cli
- CARDANO_NODE_PATH=/usr/local/bin/cardano-node
- CARDANO_NODE_SOCKET_PATH=/node-ipc/node.socket
- DB_CONNECTION_STRING=postgresql://postgres:notForProduction!@postgres:5432/cexplorer
- DEFAULT_RELATIVE_TTL=1000
- GENESIS_SHELLEY_PATH=/config/genesis/shelley.json
- LOGGER_LEVEL=debug
- PAGE_SIZE=30
- PORT=8080
- TOPOLOGY_FILE_PATH=/config/cardano-node/topology.json
- DEFAULT_POOL_DEPOSIT=500000000
- DEFAULT_KEY_DEPOSIT=2000000
expose:
- 8080
ports:
- ${PORT:-8080}:8080
logging:
driver: "json-file"
options:
max-size: "200k"
max-file: "10"
volumes:
- ../config/network/${NETWORK:-mainnet}:/config
- node-ipc:/node-ipc
# cardano-rosetta-server:
# build:
# cache_from:
# - cardanofoundation/cardano-rosetta:master
# context: ..
# target: cardano-rosetta-server
# environment:
# - BIND_ADDRESS=${BIND_ADDRESS:0.0.0.0}
# - CARDANO_CLI_PATH=${CARDANO_CLI_PATH:/usr/local/bin/cardano-cli}
# - CARDANO_NODE_PATH=${CARDANO_NODE_PATH:/usr/local/bin/cardano-node}
# - CARDANO_NODE_SOCKET_PATH=${CARDANO_NODE_SOCKET_PATH:/node-ipc/node.socket}
# - DB_CONNECTION_STRING=${DB_CONNECTION_STRING:postgresql://postgres:notForProduction!@postgres:5432/cexplorer}
# - DEFAULT_RELATIVE_TTL=${DEFAULT_RELATIVE_TTL:1000}
# - GENESIS_SHELLEY_PATH=${GENESIS_SHELLEY_PATH:/config/genesis/shelley.json}
# - LOGGER_LEVEL=${LOGGER_LEVEL:debug}
# - PAGE_SIZE=${PAGE_SIZE:30}
# - PORT=8080
# - TOPOLOGY_FILE_PATH=${TOPOLOGY_FILE_PATH:/config/cardano-node/topology.json}
# - DEFAULT_POOL_DEPOSIT=${DEFAULT_POOL_DEPOSIT:500000000}
# - DEFAULT_KEY_DEPOSIT=${DEFAULT_KEY_DEPOSIT:2000000}
# expose:
# - 8080
# ports:
# - ${PORT:-8080}:8080
# logging:
# driver: "json-file"
# options:
# max-size: "200k"
# max-file: "10"
# volumes:
# - ../config/network/${NETWORK:-mainnet}:/config
# - ../node-ipc:/node-ipc
secrets:
postgres_db:
file: ./config/secrets/postgres_db
Expand Down
8 changes: 4 additions & 4 deletions cardano-rosetta-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/input-output-hk/cardano-rosetta.git"
"url": "git+https://github.com/cardano-foundation/cardano-rosetta.git"
},
"keywords": [
"cardano",
"rosetta",
"blockchain",
"proof-of-stake"
],
"author": "IOHK",
"author": "Cardano Foundation",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/input-output-hk/cardano-rosetta/issues"
"url": "https://github.com/cardano-foundation/cardano-rosetta/issues"
},
"homepage": "https://github.com/input-output-hk/cardano-rosetta#readme",
"homepage": "https://github.com/cardano-foundation/cardano-rosetta#readme",
"devDependencies": {
"@types/cbor": "5.0.1",
"@types/dockerode": "2.5.34",
Expand Down
Loading

0 comments on commit d08fa45

Please sign in to comment.