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

[CI] Optimize rosetta docker #14272

Merged
merged 32 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
eab5933
New rosetta docker
dkijania Oct 6, 2023
498533f
comp fix
dkijania Oct 6, 2023
9459d39
fix from
dkijania Oct 9, 2023
435d430
fix rosetta docker
dkijania Oct 9, 2023
71cf695
better deb
dkijania Oct 9, 2023
12b4aaf
Merge branch 'berkeley' into clean_rosetta_toolchain_dockers
dkijania Oct 9, 2023
20cd9f7
clean deb job and dependency
dkijania Oct 10, 2023
d90fcf1
Merge remote-tracking branch 'origin/clean_rosetta_toolchain_dockers'…
dkijania Oct 10, 2023
f089566
Merge branch 'berkeley' into clean_rosetta_toolchain_dockers
dkijania Oct 10, 2023
1ba559b
fix cp
dkijania Oct 10, 2023
ecf8121
create dirs
dkijania Oct 10, 2023
d9ec4f0
set variable
dkijania Oct 10, 2023
dc42234
fix network
dkijania Oct 10, 2023
3547647
join rosetta with mina
dkijania Oct 11, 2023
47738a0
do not download mina-rosetta
dkijania Oct 12, 2023
1907c7e
remove copy
dkijania Oct 16, 2023
ec49b33
convert mina-dev mina
dkijania Oct 16, 2023
c731989
fix ocaml signer
dkijania Oct 16, 2023
95b5a7c
fix path from /rosetta to /etc/mina/rosetta/
dkijania Oct 16, 2023
a1ebbf9
Merge branch 'berkeley' into clean_rosetta_toolchain_dockers
dkijania Oct 16, 2023
707a6c5
fix archive path
dkijania Oct 16, 2023
0cf77a3
Merge remote-tracking branch 'origin/clean_rosetta_toolchain_dockers'…
dkijania Oct 16, 2023
f99531d
Merge branch 'berkeley' into clean_rosetta_toolchain_dockers
dkijania Oct 16, 2023
c894d72
fix mina-rosetta name
dkijania Oct 17, 2023
ceabc21
mina archive fix
dkijania Oct 17, 2023
a968932
build rosetta instead of downloading
dkijania Oct 18, 2023
d14db90
install gcc and go
dkijania Oct 18, 2023
30cd04a
Merge branch 'berkeley' into clean_rosetta_toolchain_dockers
dkijania Oct 18, 2023
1cd66ba
Merge branch 'berkeley' into clean_rosetta_toolchain_dockers
dkijania Oct 18, 2023
457ad03
remove comments
dkijania Oct 18, 2023
1747ef2
Merge branch 'berkeley' into clean_rosetta_toolchain_dockers
dkijania Oct 19, 2023
f58e8c4
Merge branch 'berkeley' into clean_rosetta_toolchain_dockers
dkijania Oct 19, 2023
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
3 changes: 2 additions & 1 deletion buildkite/scripts/build-artifact.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ echo "--- Build libp2p_helper TODO: use the previously uploaded build artifact"
make -C src/app/libp2p_helper

MAINNET_TARGETS=""
[[ ${MINA_BUILD_MAINNET} ]] && MAINNET_TARGETS="src/app/cli/src/mina_mainnet_signatures.exe src/app/rosetta/rosetta_mainnet_signatures.exe "
[[ ${MINA_BUILD_MAINNET} ]] && MAINNET_TARGETS="src/app/cli/src/mina_mainnet_signatures.exe src/app/rosetta/rosetta_mainnet_signatures.exe src/app/rosetta/ocaml-signer/signer_mainnet_signatures.exe"

echo "--- Build all major tagets required for packaging"
echo "Building from Commit SHA: ${MINA_COMMIT_SHA1}"
Expand All @@ -33,6 +33,7 @@ dune build "--profile=${DUNE_PROFILE}" \
src/app/swap_bad_balances/swap_bad_balances.exe \
src/app/zkapp_test_transaction/zkapp_test_transaction.exe \
src/app/rosetta/rosetta_testnet_signatures.exe \
src/app/rosetta/ocaml-signer/signer_testnet_signatures.exe \
src/app/test_executive/test_executive.exe # 2>&1 | tee /tmp/buildocaml.log

echo "--- Bundle all packages for Debian ${MINA_DEB_CODENAME}"
Expand Down
46 changes: 23 additions & 23 deletions buildkite/scripts/rosetta-integration-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# that source. It is important to make sure that the zkapp-cli version installed
# is compatible with o1js version used.

# These tests use the mina-dev binary, as rosetta-cli assumes we use a testnet.
# These tests use the mina binary, as rosetta-cli assumes we use a testnet.
# See https://github.com/coinbase/rosetta-sdk-go/blob/master/keys/signer_pallas.go#L222

set -eo pipefail
Expand All @@ -29,7 +29,7 @@ export PG_CONN=postgres://${POSTGRES_USERNAME}:${POSTGRES_USERNAME}@127.0.0.1:54

# Mina Archive variables
export MINA_ARCHIVE_PORT=${MINA_ARCHIVE_PORT:=3086}
export MINA_ARCHIVE_SQL_SCHEMA_PATH=${MINA_ARCHIVE_SQL_SCHEMA_PATH:=/archive/create_schema.sql}
export MINA_ARCHIVE_SQL_SCHEMA_PATH=${MINA_ARCHIVE_SQL_SCHEMA_PATH:=/etc/mina/rosetta/archive/create_schema.sql}

# Mina Rosetta variables
export MINA_ROSETTA_ONLINE_PORT=${MINA_ROSETTA_ONLINE_PORT:=3087}
Expand Down Expand Up @@ -88,7 +88,7 @@ popd
# Files from ROSETTA_CLI_CONFIG_FILES will be read from
# ROSETTA_CONFIGURATION_INPUT_DIR and some placeholders will be
# substituted.
ROSETTA_CONFIGURATION_INPUT_DIR=${ROSETTA_CONFIGURATION_INPUT_DIR:=/rosetta/rosetta-cli-config}
ROSETTA_CONFIGURATION_INPUT_DIR=${ROSETTA_CONFIGURATION_INPUT_DIR:=/etc/mina/rosetta/rosetta-cli-config}
ROSETTA_CLI_CONFIG_FILES=${ROSETTA_CLI_CONFIG_FILES:="config.json mina.ros"}
ROSETTA_CLI_MAIN_CONFIG_FILE=${ROSETTA_CLI_MAIN_CONFIG_FILE:="config.json"}

Expand All @@ -101,13 +101,13 @@ mv /tmp/MinaProtocol-rosetta-integration-test-zkapps-* $ZKAPP_PATH

# Libp2p Keypair
echo "=========================== GENERATING KEYPAIR IN ${MINA_LIBP2P_KEYPAIR_PATH} ==========================="
mina-dev libp2p generate-keypair -privkey-path $MINA_LIBP2P_KEYPAIR_PATH
mina libp2p generate-keypair -privkey-path $MINA_LIBP2P_KEYPAIR_PATH

# Configuration
echo "=========================== GENERATING GENESIS LEDGER FOR ${MINA_NETWORK} ==========================="
mkdir -p $MINA_KEYS_PATH
mina-dev advanced generate-keypair --privkey-path $MINA_KEYS_PATH/block-producer.key
mina-dev advanced generate-keypair --privkey-path $MINA_KEYS_PATH/snark-producer.key
mina advanced generate-keypair --privkey-path $MINA_KEYS_PATH/block-producer.key
mina advanced generate-keypair --privkey-path $MINA_KEYS_PATH/snark-producer.key
chmod -R 0700 $MINA_KEYS_PATH
BLOCK_PRODUCER_PK=$(cat $MINA_KEYS_PATH/block-producer.key.pub)
SNARK_PRODUCER_PK=$(cat $MINA_KEYS_PATH/snark-producer.key.pub)
Expand All @@ -132,9 +132,9 @@ for zkapp_path in ${ZKAPP_PATH}/*/; do
zkapp_path=${zkapp_path%/}
zkapp=$(basename $zkapp_path)
# Generate zkApp account keypair
mina-dev advanced generate-keypair --privkey-path ${MINA_KEYS_PATH}/zkapp-${zkapp}-account.key
mina advanced generate-keypair --privkey-path ${MINA_KEYS_PATH}/zkapp-${zkapp}-account.key
# Generate zkApp fee payer keypair
mina-dev advanced generate-keypair --privkey-path ${MINA_KEYS_PATH}/zkapp-${zkapp}-fee-payer.key
mina advanced generate-keypair --privkey-path ${MINA_KEYS_PATH}/zkapp-${zkapp}-fee-payer.key
zkapp_fee_payer_pk=$(cat $MINA_KEYS_PATH/zkapp-${zkapp}-fee-payer.key.pub)
line="[{ \"pk\": \"${zkapp_fee_payer_pk}\", \"balance\": \"10000\", \"delegate\": null, \"sk\": null }]"
jq ".ledger.accounts |= . + ${line}" $MINA_CONFIG_FILE >${MINA_CONFIG_FILE}.tmp
Expand All @@ -158,19 +158,19 @@ done

# Import Genesis Accounts
echo "==================== IMPORTING GENESIS ACCOUNTS ======================"
mina-dev accounts import --privkey-path $MINA_KEYS_PATH/block-producer.key --config-directory $MINA_CONFIG_DIR
mina-dev accounts import --privkey-path $MINA_KEYS_PATH/snark-producer.key --config-directory $MINA_CONFIG_DIR
mina accounts import --privkey-path $MINA_KEYS_PATH/block-producer.key --config-directory $MINA_CONFIG_DIR
mina accounts import --privkey-path $MINA_KEYS_PATH/snark-producer.key --config-directory $MINA_CONFIG_DIR
for zkapp_path in ${ZKAPP_PATH}/*/; do
zkapp_path=${zkapp_path%/}
zkapp=$(basename $zkapp_path)
mina-dev accounts import --privkey-path $MINA_KEYS_PATH/zkapp-${zkapp}-fee-payer.key --config-directory $MINA_CONFIG_DIR
mina accounts import --privkey-path $MINA_KEYS_PATH/zkapp-${zkapp}-fee-payer.key --config-directory $MINA_CONFIG_DIR
done

# Postgres
echo "========================= INITIALIZING POSTGRESQL ==========================="
pg_ctlcluster ${POSTGRES_VERSION} main start
pg_dropcluster --stop ${POSTGRES_VERSION} main
pg_createcluster --start -d ${POSTGRES_DATA_DIR} --createclusterconf /rosetta/postgresql.conf ${POSTGRES_VERSION} main
pg_createcluster --start -d ${POSTGRES_DATA_DIR} --createclusterconf /etc/mina/rosetta/postgresql.conf ${POSTGRES_VERSION} main
sudo -u postgres psql --command "CREATE USER ${POSTGRES_USERNAME} WITH SUPERUSER PASSWORD '${POSTGRES_USERNAME}';"
sudo -u postgres createdb -O ${POSTGRES_USERNAME} ${POSTGRES_DBNAME}
psql -f "${MINA_ARCHIVE_SQL_SCHEMA_PATH}" "${PG_CONN}"
Expand All @@ -179,7 +179,7 @@ psql -f "${MINA_ARCHIVE_SQL_SCHEMA_PATH}" "${PG_CONN}"
echo "=========================== STARTING ROSETTA API ONLINE AND OFFLINE INSTANCES ==========================="
ports=($MINA_ROSETTA_ONLINE_PORT $MINA_ROSETTA_OFFLINE_PORT)
for port in ${ports[*]}; do
mina-rosetta-dev \
mina-rosetta \
--archive-uri "${PG_CONN}" \
--graphql-uri http://127.0.0.1:${MINA_GRAPHQL_PORT}/graphql \
--log-level ${LOG_LEVEL} \
Expand All @@ -198,7 +198,7 @@ sleep 5

# Daemon
echo "========================= STARTING DAEMON connected to ${MINA_NETWORK} ==========================="
mina-dev daemon \
mina daemon \
--archive-address 127.0.0.1:${MINA_ARCHIVE_PORT} \
--background \
--block-producer-pubkey "$BLOCK_PRODUCER_PK" \
Expand All @@ -218,29 +218,29 @@ retries_left=20
until [ $daemon_status == "Synced" ]; do
[[ $retries_left -eq 0 ]] && echo "Unable to Sync the Daemon" && exit 1 || ((retries_left--))
sleep 15
daemon_status=$(mina-dev client status --json | jq -r .sync_status 2>/dev/null || echo "Pending")
daemon_status=$(mina client status --json | jq -r .sync_status 2>/dev/null || echo "Pending")
echo "Daemon Status: ${daemon_status}"
done

# Unlock Genesis Accounts
echo "==================== UNLOCKING GENESIS ACCOUNTS ======================"
mina-dev accounts unlock --public-key $BLOCK_PRODUCER_PK
mina-dev accounts unlock --public-key $SNARK_PRODUCER_PK
mina accounts unlock --public-key $BLOCK_PRODUCER_PK
mina accounts unlock --public-key $SNARK_PRODUCER_PK

# Start sending payments
send_payments() {
mina-dev client send-payment -rest-server http://127.0.0.1:${MINA_GRAPHQL_PORT}/graphql -amount 1 -nonce 0 -receiver $BLOCK_PRODUCER_PK -sender $BLOCK_PRODUCER_PK
mina client send-payment -rest-server http://127.0.0.1:${MINA_GRAPHQL_PORT}/graphql -amount 1 -nonce 0 -receiver $BLOCK_PRODUCER_PK -sender $BLOCK_PRODUCER_PK
while true; do
sleep $TRANSACTION_FREQUENCY
mina-dev client send-payment -rest-server http://127.0.0.1:${MINA_GRAPHQL_PORT}/graphql -amount 1 -receiver $BLOCK_PRODUCER_PK -sender $BLOCK_PRODUCER_PK
mina client send-payment -rest-server http://127.0.0.1:${MINA_GRAPHQL_PORT}/graphql -amount 1 -receiver $BLOCK_PRODUCER_PK -sender $BLOCK_PRODUCER_PK
done
}
send_payments &

# Fee payer cache creation
echo "==================== PREPARE FEE PAYER CACHE ======================"
zkapp_fee_payer_pk=$(cat ${MINA_KEYS_PATH}/zkapp-${zkapp}-fee-payer.key.pub)
zkapp_fee_payer_privkey=$(mina-dev advanced dump-keypair --privkey-path "${MINA_KEYS_PATH}/zkapp-${zkapp}-fee-payer.key" | sed -ne "s/Private key: //p")
zkapp_fee_payer_privkey=$(mina advanced dump-keypair --privkey-path "${MINA_KEYS_PATH}/zkapp-${zkapp}-fee-payer.key" | sed -ne "s/Private key: //p")

mkdir -p /root/.cache/zkapp-cli/keys
echo -e "{\n \"privateKey\": \"${zkapp_fee_payer_privkey}\",\n \"publicKey\": \"${zkapp_fee_payer_pk}\"\n}" >/root/.cache/zkapp-cli/keys/sandbox.json
Expand All @@ -264,7 +264,7 @@ for zkapp_path in ${ZKAPP_PATH}/*/; do
echo "Deploying ${zkapp}..."

zkapp_account_pk=$(cat ${MINA_KEYS_PATH}/zkapp-${zkapp}-account.key.pub)
zkapp_account_privkey=$(mina-dev advanced dump-keypair --privkey-path "${MINA_KEYS_PATH}/zkapp-${zkapp}-account.key" | sed -ne "s/Private key: //p")
zkapp_account_privkey=$(mina advanced dump-keypair --privkey-path "${MINA_KEYS_PATH}/zkapp-${zkapp}-account.key" | sed -ne "s/Private key: //p")

mkdir -p ${zkapp_path}/keys
echo -e "{\n \"privateKey\": \"${zkapp_account_privkey}\",\n \"publicKey\": \"${zkapp_account_pk}\"\n}" >"${zkapp_path}/keys/sandbox.json"
Expand Down Expand Up @@ -294,7 +294,7 @@ done

# TODO: wait until all zkApps deploy txns are included in a block

next_block_time=$(mina-dev client status --json | jq '.next_block_production.timing[1].time' | tr -d '"')
next_block_time=$(mina client status --json | jq '.next_block_production.timing[1].time' | tr -d '"')
curr_time=$(date +%s%N | cut -b1-13)
sleep_time=$((($next_block_time - $curr_time) / 1000))
echo "Sleeping for ${sleep_time}s until next block is created..."
Expand All @@ -314,7 +314,7 @@ for zkapp_path in ${ZKAPP_PATH}/*/; do
echo "Done."
done

next_block_time=$(mina-dev client status --json | jq '.next_block_production.timing[1].time' | tr -d '"')
next_block_time=$(mina client status --json | jq '.next_block_production.timing[1].time' | tr -d '"')
curr_time=$(date +%s%N | cut -b1-13)
sleep_time=$((($next_block_time - $curr_time) / 1000))
echo "Sleeping for ${sleep_time}s until next block is created..."
Expand Down
3 changes: 2 additions & 1 deletion buildkite/src/Command/MinaArtifact.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ let pipeline : DebianVersions.DebVersion -> PipelineMode.Type -> Pipeline.Config

-- rosetta image
let rosettaSpec = DockerImage.ReleaseSpec::{
deps=DebianVersions.dependsOn debVersion,
service="mina-rosetta",
extra_args="--build-arg MINA_BRANCH=\\\${BUILDKITE_BRANCH} --cache-from ${DebianVersions.toolchainImage debVersion}",
network="berkeley",
deb_codename="${DebianVersions.lowerName debVersion}",
step_key="rosetta-${DebianVersions.lowerName debVersion}-docker-image"
}
Expand Down
91 changes: 49 additions & 42 deletions dockerfiles/stages/4-production → dockerfiles/Dockerfile-mina-rosetta
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@
ARG image=ubuntu:focal
FROM ${image} AS production
ARG deb_codename=focal
ARG deb_version
ARG deb_release=unstable
ARG network=mainnet


ARG psql_version=13
# Golang version number used to detemine tarball name
ARG GO_VERSION=1.19.11

ARG MINA_DAEMON_PORT=10101
ARG MINA_CONFIG_DIR=/data/.mina-config
Expand All @@ -18,6 +24,23 @@ ARG ROSETTA_CLI_VERSION=v0.10.1

ENV DEBIAN_FRONTEND noninteractive

# We do not install the below platform-specific dependencies,
# and instead assume that apt will install the proper deps based on the package definition.
# The packages are noted here just for clarity/documentation.
# Stretch-only Deps:
# libffi6
# libprocps6
# libjemalloc1
# Buster-only Deps:
# libffi7
# libprocps7
# libjemalloc2
# Bullseye/Focal-only Deps:
# libffi7
# libprocps8
# libjemalloc2


# --- Dependencies across many platforms
RUN apt-get update --quiet --yes \
&& apt-get upgrade --quiet --yes \
Expand All @@ -26,6 +49,7 @@ RUN apt-get update --quiet --yes \
apt-transport-https \
curl \
ca-certificates \
build-essential \
dnsutils \
dumb-init \
gettext \
Expand All @@ -46,41 +70,16 @@ RUN curl -s https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
postgresql-"$psql_version" \
postgresql-client-"$psql_version"

# --- Debian 11 "Bullseye" Dependencies
RUN test "$deb_codename" = "bullseye" \
&& apt-get update -y \
&& apt-get install -y \
libjemalloc2 \
libprocps8 \
libffi7 \
|| exit 0

# --- Debian 10 "Buster" Dependencies
RUN test "$deb_codename" = "buster" \
&& apt-get update --quiet --yes \
&& apt-get install --quiet --yes --no-install-recommends \
libjemalloc2 \
libprocps7 \
libffi6 \
|| exit 0

# --- Ubuntu 20.04 "Focal Fossa" Dependencies
RUN test "$deb_codename" = "focal" \
&& apt-get update --quiet --yes \
&& apt-get install --quiet --yes --no-install-recommends \
libjemalloc2 \
libprocps8 \
libffi7 \
|| exit 0

# --- Install rosetta-cli


# --- Golang install of a given GO_VERSION (add -v for spam output of each file from the go dist)
RUN curl -s "https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz" | tar -xz -C /usr/lib/

# The following commands install rosetta-cli with an updated rosetta-sdk-go dependency, which supports delegation transactions.
# Upstream PR to rosetta-sdk-go: https://github.com/coinbase/rosetta-sdk-go/pull/457
# They can be replaced once there is a new release of rosetta-cli containing the above change by:
# RUN curl -sSfL https://raw.githubusercontent.com/coinbase/rosetta-cli/${ROSETTA_CLI_VERSION}/scripts/install.sh | sh -s
COPY --from=builder /usr/lib/go /usr/lib/go
RUN apt-get install -y gcc
#RUN curl -sSfL https://raw.githubusercontent.com/coinbase/rosetta-cli/${ROSETTA_CLI_VERSION}/scripts/install.sh | sh -s
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this line commented out? If it's unnecessary, let's delete it.

Copy link
Member Author

Choose a reason for hiding this comment

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

There is an explanation above to uncomment this line once coinbase fix delegation transaction support

RUN export GOBIN="$(pwd)/bin" \
&& curl -L "https://github.com/coinbase/rosetta-cli/archive/refs/tags/v0.10.1.tar.gz" -o "/tmp/v0.10.1.tar.gz" \
&& tar xzf "/tmp/v0.10.1.tar.gz" -C "/tmp" \
Expand All @@ -89,8 +88,17 @@ RUN export GOBIN="$(pwd)/bin" \
&& /usr/lib/go/bin/go mod tidy \
&& /usr/lib/go/bin/go install

# Rosetta-demo artifacts / build dir removal:
Copy link
Member

Choose a reason for hiding this comment

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

Is this documentation for running the test locally? It would be better to move this to somewhere more discoverable (or just delete it).

# Make rosetta-crucial components and the generate_keypair tool
# && dune build --profile=${DUNE_PROFILE} \
# && _build/default/src/app/runtime_genesis_ledger/runtime_genesis_ledger.exe \
# --config-file src/app/rosetta/demo-config.json \
# --genesis-dir ${HOME}/demo-genesis \
# && mv _build/default/src/app $HOME/app \
# && rm -rf _build

# --- Generate en_US.UTF-8 locale to allow use of O(1) Labs DB dumps
RUN locale-gen en_US.UTF-8
#RUN locale-gen en_US.UTF-8

# --- Set up sample/demo wallets and configuration
RUN mkdir -p --mode=700 ${MINA_CONFIG_DIR}/wallets/store/ \
Expand All @@ -99,15 +107,14 @@ RUN mkdir -p --mode=700 ${MINA_CONFIG_DIR}/wallets/store/ \
> ${MINA_CONFIG_DIR}/wallets/store/${PK} \
&& chmod go-rwx ${MINA_CONFIG_DIR}/wallets/store/${PK}

# --- Copy artifacts from the 3-builder stage
COPY --from=builder /home/opam/app/* /usr/local/bin/
COPY --from=builder /home/opam/mina/src/app/rosetta/*.sh /rosetta/
COPY --from=builder /home/opam/mina/src/app/rosetta/*.conf /rosetta/
COPY --from=builder /home/opam/mina/src/app/rosetta/README.md /rosetta/
COPY --from=builder /home/opam/mina/src/app/rosetta/rosetta-cli-config/*.json /rosetta/rosetta-cli-config/
COPY --from=builder /home/opam/mina/src/app/rosetta/rosetta-cli-config/*.ros /rosetta/rosetta-cli-config/
COPY --from=builder /home/opam/mina/src/app/archive/*.sql /archive/
COPY --from=builder /home/opam/mina/genesis_ledgers /genesis_ledgers/

# Mina daemon package
# jemalloc is also installed automatically here to match the package dependencies for this $deb_codename
RUN echo "Building image with version $deb_version from repo $deb_release $deb_codename for network $network" \
&& echo "deb [trusted=yes] http://packages.o1test.net $deb_codename $deb_release" > /etc/apt/sources.list.d/o1.list \
&& apt-get update --quiet --yes \
&& apt-get install --quiet --yes --allow-downgrades "mina-$network=$deb_version" "mina-archive=$deb_version" \
&& rm -rf /var/lib/apt/lists/*

# --- Set up postgres
USER postgres
Expand All @@ -118,10 +125,10 @@ RUN POSTGRES_VERSION=$(psql -V | cut -d " " -f 3 | sed 's/.[[:digit:]]*$//g') \
# Run as root so it can create /data/postgresql
USER root
RUN POSTGRES_VERSION=$(psql -V | cut -d " " -f 3 | sed 's/.[[:digit:]]*$//g') \
&& pg_createcluster --start -d /data/postgresql --createclusterconf /rosetta/postgresql.conf ${POSTGRES_VERSION} main
&& pg_createcluster --start -d /data/postgresql --createclusterconf /etc/mina/rosetta/postgresql.conf ${POSTGRES_VERSION} main

# --- Container workdir, ports, entrypoint, etc.
WORKDIR /rosetta
WORKDIR /etc/mina/rosetta

EXPOSE 3087
EXPOSE $MINA_DAEMON_PORT
Expand Down
Loading