Skip to content

Commit

Permalink
Explicitly use IPv4 comms since 'localhost' can be resolved differently.
Browse files Browse the repository at this point in the history
  • Loading branch information
shimkiv committed May 24, 2024
1 parent 66e3231 commit d9b9ede
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
18 changes: 9 additions & 9 deletions DockerHub.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Each Docker image is packaged with the genesis ledger configuration with more th
## Specifications

- This Docker image exposes port `8080` that is served by the NGINX reverse proxy with proper cross-origin resource sharing (CORS) management and passes requests to an available Mina Daemon GraphQL endpoint.
- To ensure that the **o1js** zkApps applications work without additional environment configuration, you must use an endpoint like `http://localhost:8080/graphql` to communicate with the Mina GraphQL endpoint.
- To ensure that the **o1js** zkApps applications work without additional environment configuration, you must use an endpoint like `http://127.0.0.1:8080/graphql` to communicate with the Mina GraphQL endpoint.

By default, containers run the [Mina Archive Node](https://docs.minaprotocol.com/node-operators/archive-node) along with the PostgreSQL RDBMS that stores the blockchain data.

Expand All @@ -38,7 +38,7 @@ Connection to the container's PostgreSQL can be used for other needs, including
- The default PostgreSQL connection string is:
```shell
postgresql://postgres:postgres@localhost:5432/archive
postgresql://postgres:postgres@127.0.0.1:5432/archive
```
If no Mina Archive Node will run inside the container, then [Archive-Node-API](https://github.com/o1-labs/Archive-Node-API) won't be available.
Expand Down Expand Up @@ -297,11 +297,11 @@ The Mina accounts manager that runs inside the container provides the following
.:: Mina Accounts-Manager ::.
-----------------------------
Application initialized and is running at: http://localhost:8181
Application initialized and is running at: http://127.0.0.1:8181
Available endpoints:
HTTP GET:
http://localhost:8181/acquire-account
http://127.0.0.1:8181/acquire-account
Supported Query params:
isRegularAccount=<boolean>, default: true
Useful if you need to get non-zkApp account.
Expand All @@ -312,29 +312,29 @@ Available endpoints:
{ pk:"", sk:"" }
HTTP PUT:
http://localhost:8181/release-account
http://127.0.0.1:8181/release-account
Accepts JSON account key-pair as request payload:
{ pk:"", sk:"" }
Returns JSON status message
HTTP GET:
http://localhost:8181/list-acquired-accounts
http://127.0.0.1:8181/list-acquired-accounts
Returns JSON list of acquired accounts key-pairs:
[ { pk:"", sk:"" }, ... ]
HTTP PUT:
http://localhost:8383/lock-account
http://127.0.0.1:8383/lock-account
Accepts JSON account key-pair as request payload:
{ pk:"", sk:"" }
Returns JSON status message
HTTP PUT:
http://localhost:8181/unlock-account
http://127.0.0.1:8181/unlock-account
Accepts JSON account key-pair as request payload:
{ pk:"", sk:"" }
Returns JSON status message
Operating with:
Mina Genesis ledger: /root/.mina-network/mina-local-network-2-1-1/daemon.json
Mina GraphQL endpoint: http://localhost:8080/graphql
Mina GraphQL endpoint: http://127.0.0.1:8080/graphql
```
4 changes: 2 additions & 2 deletions configuration/archive-node-api.env
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
PORT=8282
CORS_ORIGIN="*"

PG_CONN="postgresql://postgres:postgres@localhost:5432/archive"
PG_CONN="postgresql://postgres:postgres@127.0.0.1:5432/archive"

ENABLE_GRAPHIQL="true"
ENABLE_INTROSPECTION="true"

ENABLE_LOGGING="true"
_ENABLE_JAEGER="false"
JAEGER_SERVICE_NAME="archive-api"
JAEGER_ENDPOINT='http://localhost:14268/api/traces'
JAEGER_ENDPOINT='http://127.0.0.1:14268/api/traces'
8 changes: 4 additions & 4 deletions scripts/spinup-testnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ mkdir -p ${HOME}/logs || true

wait-for-service() {
echo ""
while ! nc -z localhost ${1}; do
while ! nc -z 127.0.0.1 ${1}; do
echo "Waiting for the service (:${1}) to be ready..."
sleep 5
done
Expand All @@ -36,7 +36,7 @@ prepare-rdbms() {

echo "Updating the Archive Node RDBMS schema..."
echo ""
psql postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:${RDBMS_PORT}/${POSTGRES_DB} <create_schema.sql
psql postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@127.0.0.1:${RDBMS_PORT}/${POSTGRES_DB} <create_schema.sql
echo ""
}

Expand All @@ -59,7 +59,7 @@ nginx-reload() {
echo ""

cp -r ${HOME}/nginx.conf /etc/nginx/nginx.conf
perl -i -p -e "s~###PROXY_PASS###~proxy_pass http://localhost:${GRAPHQL_PORT}/graphql;~g" /etc/nginx/nginx.conf
perl -i -p -e "s~###PROXY_PASS###~proxy_pass http://127.0.0.1:${GRAPHQL_PORT}/graphql;~g" /etc/nginx/nginx.conf
nginx -c /etc/nginx/nginx.conf
nginx -s reload
}
Expand Down Expand Up @@ -107,7 +107,7 @@ if [[ $NETWORK_TYPE == "single-node" ]]; then
${HOME}/archive.exe run \
--config-file ${GENESIS_LEDGER_CONFIG_FILE} \
--log-level ${LOG_LEVEL} \
--postgres-uri postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:${RDBMS_PORT}/${POSTGRES_DB} \
--postgres-uri postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@127.0.0.1:${RDBMS_PORT}/${POSTGRES_DB} \
--server-port ${ARCHIVE_NODE_PORT} >${ARCHIVE_LOG_FILE_PATH} 2>&1 &
wait-for-service ${ARCHIVE_NODE_PORT}
fi
Expand Down
4 changes: 2 additions & 2 deletions scripts/wait-for-network.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ START=$(date +%s)
CURRENT_DIR="$(pwd)"

MINA_DAEMON_GRAPHQL_PORT=${1}
MINA_DAEMON_GRAPHQL_URL="http://localhost:${MINA_DAEMON_GRAPHQL_PORT}/graphql"
MINA_DAEMON_GRAPHQL_URL="http://127.0.0.1:${MINA_DAEMON_GRAPHQL_PORT}/graphql"
QUERY='{"query": "{ syncStatus }"}'
MAX_ATTEMPTS=60
SLEEP_DURATION=10
attempt=1
synced=false

while ! nc -z localhost ${MINA_DAEMON_GRAPHQL_PORT}; do
while ! nc -z 127.0.0.1 ${MINA_DAEMON_GRAPHQL_PORT}; do
sleep 1
done

Expand Down

0 comments on commit d9b9ede

Please sign in to comment.