From 68748c2e2374013a259938e3432bc51320f65e7a Mon Sep 17 00:00:00 2001 From: samoht9277 Date: Thu, 19 Dec 2024 19:00:54 -0300 Subject: [PATCH 1/4] Added Makefile for explorer. --- explorer/Makefile | 52 ++++++++++++++++++++++++++++++++++++++++++++++ explorer/README.md | 50 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 explorer/Makefile create mode 100644 explorer/README.md diff --git a/explorer/Makefile b/explorer/Makefile new file mode 100644 index 0000000000..bd6d734ae7 --- /dev/null +++ b/explorer/Makefile @@ -0,0 +1,52 @@ +.PHONY: build_explorer install_explorer set_cap create_env + +ifneq (,$(wildcard ./.env)) + include .env + export +endif + +create_env: + truncate -s0 /tmp/aligned_layer/explorer/.env + echo "RPC_URL=${RPC_URL}" >> /tmp/aligned_layer/explorer/.env + echo "ENVIRONMENT=${ENVIRONMENT}" >> /tmp/aligned_layer/explorer/.env + echo "ALIGNED_CONFIG_FILE=${ALIGNED_CONFIG_FILE}" >> /tmp/aligned_layer/explorer/.env + echo "PHX_HOST=${PHX_HOST}" >> /tmp/aligned_layer/explorer/.env + echo "ELIXIR_HOSTNAME=${ELIXIR_HOSTNAME}" >> /tmp/aligned_layer/explorer/.env + echo "PHX_SERVER=true" >> /tmp/aligned_layer/explorer/.env + echo "DB_NAME=${DB_NAME}" >> /tmp/aligned_layer/explorer/.env + echo "DB_USER=${DB_USER}" >> /tmp/aligned_layer/explorer/.env + echo "DB_PASS=${DB_PASS}" >> /tmp/aligned_layer/explorer/.env + echo "DB_HOST=${DB_HOST}" >> /tmp/aligned_layer/explorer/.env + echo "TRACKER_API_URL=${TRACKER_API_URL}" >> /tmp/aligned_layer/explorer/.env + echo "SECRET_KEY_BASE=${SECRET_KEY_BASE}" >> /tmp/aligned_layer/explorer/.env + echo "KEYFILE_PATH=/home/app/.ssl/key.pem" >> /tmp/aligned_layer/explorer/.env + echo "CERTFILE_PATH=/home/app/.ssl/cert.pem" >> /tmp/aligned_layer/explorer/.env + +# on /tmp/aligned_layer/explorer/ as app +build_explorer: export MIX_ENV=prod +build_explorer: + mix local.hex --force + mix local.rebar --force + mix deps.get --only $(MIX_ENV) + echo $(ENVIRONMENT) + mix compile + pnpm --prefix=assets/ install + mix phx.digest + mix assets.deploy + mix release --overwrite + +# on /tmp/aligned_layer/explorer/ as app +install_explorer: + mkdir -p /home/app/repos/explorer/ + mv /tmp/aligned_layer/ /home/app/repos/explorer/ + +# on /home/app/repos/explorer/aligned_layer/explorer/ as admin +set_cap: + sudo setcap CAP_NET_BIND_SERVICE=+eip /home/app/repos/explorer/aligned_layer/explorer/_build/prod/rel/explorer/erts-14.2.1/bin/beam.smp + +# on /home/app/repos/explorer/aligned_layer/explorer/ as app +run_service: + mkdir -p /home/app/config/ + cp /home/app/repos/explorer/aligned_layer/explorer/.env /home/app/config/.env.explorer + systemctl --user daemon-reload + systemctl --user enable --now explorer diff --git a/explorer/README.md b/explorer/README.md new file mode 100644 index 0000000000..d348519010 --- /dev/null +++ b/explorer/README.md @@ -0,0 +1,50 @@ +# Explorer + +## Steps to build + +1. Clone [Aligned Layer](https://github.com/yetanotherco/aligned_layer/) inside the `/tmp` directory. + ``` + cd /tmp/ + git clone https://github.com/yetanotherco/aligned_layer + ``` + +3. Head to the `explorer/` folder and run the following command: + ``` + RPC_URL= + ENVIRONMENT= + ALIGNED_CONFIG_FILE= + PHX_HOST= + ELIXIR_HOSTNAME= + PHX_SERVER=true + DB_NAME= + DB_USER= + DB_PASS= + DB_HOST= + TRACKER_API_URL= + SECRET_KEY_BASE= + KEYFILE_PATH=/home/app/.ssl/key.pem + CERTFILE_PATH=/home/app/.ssl/cert.pem + make create_env + ``` + > The values to be filled can be found inside the documentation. + +3. Build the elixir application. + ``` + make build_explorer + ``` + +4. Move the built binary outside `/tmp/` and move it to the actual location. + ``` + make install_explorer + ``` + +5. Set the `CAP_NET_BIND_SERVICE=+eip` to the elixir application to allow elixir to bind port `443` + ``` + make set_cap + ``` + > This step must be ran as user `admin`. + +7. Enable the systemd service. + ``` + make run_service + ``` From e1b152c9408b06e0702efab8c66993eecdbfd917 Mon Sep 17 00:00:00 2001 From: samoht9277 Date: Tue, 7 Jan 2025 11:38:24 -0300 Subject: [PATCH 2/4] Added missing documentation for explorer. --- infra/ansible/README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/infra/ansible/README.md b/infra/ansible/README.md index 806b3fe900..14f206024a 100644 --- a/infra/ansible/README.md +++ b/infra/ansible/README.md @@ -60,6 +60,27 @@ Deploy the Batcher: make ansible_batcher_deploy INVENTORY= KEYSTORE= ``` +## Explorer +| Variable | Description | Stage | Mainnet +|----------------------------------|-----------------------------------------------------|------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------| +| MIX_ENV | Elixir environment for compiling the binaries | prod | prod | +| RPC_URL | RPC's URL for the explorer to pull data from | https://aligned-rpc-node-2.tail665ae.ts.net | https://aligned-rpc-node-2.tail665ae.ts.net | +| ENVIRONMENT | Build environment for aligned internal use | holesky | mainnet | +| ALIGNED_CONFIG_FILE | JSON config file for aligned | /home/app/repos/explorer/aligned_layer/contracts/script/output/holesky/alignedlayer_deployment_output.stage.json | /home/app/repos/explorer/aligned_layer/contracts/script/output/mainnet/alignedlayer_deployment_output.json | +| PHX_HOST | Domain name pointing to the server | stage.explorer.alignedlayer.com | explorer.alignedlayer.com | +| ELIXIR_HOSTNAME | Server name | `` | `` | +| PHX_SERVER | Phoenix boolean to spin up a webserver | true | true | +| DB_NAME | Postgresql Database Name | `` | `` | +| DB_USER | Postgresql Database User | `` | `` | +| DB_PASS | Postgresql Database Password | `` | `` | +| DB_HOST | Postgresql network location | localhost | localhost | +| TRACKER_API_URL | Tracker API Domain name (FQDN) | https://stage.telemetry.alignedlayer.com | https://mainnet.telemetry.alignedlayer.com | +| SECRET_KEY_BASE | Elixir's Secret Key Base | `` | `` | +| KEYFILE_PATH | SSL's Keyfile location | /home/app/.ssl/key.pem | /home/app/.ssl/key.pem | +| CERTFILE_PATH | SSL's Certificate location | /home/app/.ssl/cert.pem | /home/app/.ssl/cert.pem | +| BATCH_TTL_MINUTES | Batch Time to Live (In minutes) | 5 | 60 | +| SCHEDULED_BATCH_INTERVAL_MINUTES | Scheduled Interval for batch | 1 | N/A | + ## Operator > [!IMPORTANT] @@ -266,3 +287,4 @@ Public Key: E([...,...]) Refer to this link for more details about keystore creation https://docs.eigenlayer.xyz/eigenlayer/operator-guides/operator-installation#create-keys + From 82580746c728946549c3c0066b727a3dffaf0641 Mon Sep 17 00:00:00 2001 From: samoht9277 Date: Tue, 7 Jan 2025 15:24:12 -0300 Subject: [PATCH 3/4] Replaced value in README. --- infra/ansible/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infra/ansible/README.md b/infra/ansible/README.md index 14f206024a..4c835d8279 100644 --- a/infra/ansible/README.md +++ b/infra/ansible/README.md @@ -64,7 +64,7 @@ make ansible_batcher_deploy INVENTORY= KEYSTORE=` | `` | | ENVIRONMENT | Build environment for aligned internal use | holesky | mainnet | | ALIGNED_CONFIG_FILE | JSON config file for aligned | /home/app/repos/explorer/aligned_layer/contracts/script/output/holesky/alignedlayer_deployment_output.stage.json | /home/app/repos/explorer/aligned_layer/contracts/script/output/mainnet/alignedlayer_deployment_output.json | | PHX_HOST | Domain name pointing to the server | stage.explorer.alignedlayer.com | explorer.alignedlayer.com | From cdd07b054ca63e15c5f40a7134cd6b2de2b117d9 Mon Sep 17 00:00:00 2001 From: samoht9277 Date: Tue, 7 Jan 2025 16:06:38 -0300 Subject: [PATCH 4/4] Added testnet column in README. --- infra/ansible/README.md | 43 ++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/infra/ansible/README.md b/infra/ansible/README.md index 4c835d8279..4fc3c29fbf 100644 --- a/infra/ansible/README.md +++ b/infra/ansible/README.md @@ -60,27 +60,30 @@ Deploy the Batcher: make ansible_batcher_deploy INVENTORY= KEYSTORE= ``` -## Explorer -| Variable | Description | Stage | Mainnet -|----------------------------------|-----------------------------------------------------|------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------| -| MIX_ENV | Elixir environment for compiling the binaries | prod | prod | -| RPC_URL | RPC's URL for the explorer to pull data from | `` | `` | -| ENVIRONMENT | Build environment for aligned internal use | holesky | mainnet | -| ALIGNED_CONFIG_FILE | JSON config file for aligned | /home/app/repos/explorer/aligned_layer/contracts/script/output/holesky/alignedlayer_deployment_output.stage.json | /home/app/repos/explorer/aligned_layer/contracts/script/output/mainnet/alignedlayer_deployment_output.json | -| PHX_HOST | Domain name pointing to the server | stage.explorer.alignedlayer.com | explorer.alignedlayer.com | -| ELIXIR_HOSTNAME | Server name | `` | `` | -| PHX_SERVER | Phoenix boolean to spin up a webserver | true | true | -| DB_NAME | Postgresql Database Name | `` | `` | -| DB_USER | Postgresql Database User | `` | `` | -| DB_PASS | Postgresql Database Password | `` | `` | -| DB_HOST | Postgresql network location | localhost | localhost | -| TRACKER_API_URL | Tracker API Domain name (FQDN) | https://stage.telemetry.alignedlayer.com | https://mainnet.telemetry.alignedlayer.com | -| SECRET_KEY_BASE | Elixir's Secret Key Base | `` | `` | -| KEYFILE_PATH | SSL's Keyfile location | /home/app/.ssl/key.pem | /home/app/.ssl/key.pem | -| CERTFILE_PATH | SSL's Certificate location | /home/app/.ssl/cert.pem | /home/app/.ssl/cert.pem | -| BATCH_TTL_MINUTES | Batch Time to Live (In minutes) | 5 | 60 | -| SCHEDULED_BATCH_INTERVAL_MINUTES | Scheduled Interval for batch | 1 | N/A | + +Here is the updated table with the new **testnet** column added and filled with the same values as the **stage** column: + +## Explorer +| Variable | Description | Stage | Testnet | Mainnet +|----------------------------------|-----------------------------------------------------|------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------| +| MIX_ENV | Elixir environment for compiling the binaries | prod | prod | prod | +| RPC_URL | RPC's URL for the explorer to pull data from | `` | `` | `` | +| ENVIRONMENT | Build environment for aligned internal use | holesky | holesky | mainnet | +| ALIGNED_CONFIG_FILE | JSON config file for aligned | /home/app/repos/explorer/aligned_layer/contracts/script/output/holesky/alignedlayer_deployment_output.stage.json | /home/app/repos/explorer/aligned_layer/contracts/script/output/holesky/alignedlayer_deployment_output.json | /home/app/repos/explorer/aligned_layer/contracts/script/output/mainnet/alignedlayer_deployment_output.json | +| PHX_HOST | Domain name pointing to the server | stage.explorer.alignedlayer.com | holesky.explorer.alignedlayer.com | explorer.alignedlayer.com | +| ELIXIR_HOSTNAME | Server name | `` | `` | `` | +| PHX_SERVER | Phoenix boolean to spin up a webserver | true | true | true | +| DB_NAME | Postgresql Database Name | `` | `` | `` | +| DB_USER | Postgresql Database User | `` | `` | `` | +| DB_PASS | Postgresql Database Password | `` | `` | `` | +| DB_HOST | Postgresql network location | localhost | localhost | localhost | +| TRACKER_API_URL | Tracker API Domain name (FQDN) | https://stage.telemetry.alignedlayer.com | https://tracker.telemetry.alignedlayer.com | https://mainnet.telemetry.alignedlayer.com | +| SECRET_KEY_BASE | Elixir's Secret Key Base | `` | `` | `` | +| KEYFILE_PATH | SSL's Keyfile location | /home/app/.ssl/key.pem | /home/app/.ssl/key.pem | /home/app/.ssl/key.pem | +| CERTFILE_PATH | SSL's Certificate location | /home/app/.ssl/cert.pem | /home/app/.ssl/cert.pem | /home/app/.ssl/cert.pem | +| BATCH_TTL_MINUTES | Batch Time to Live (In minutes) | 5 | 5 | 60 | +| SCHEDULED_BATCH_INTERVAL_MINUTES | Scheduled Interval for batch | 1 | 1 | N/A | ## Operator > [!IMPORTANT]