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

Added Makefile for explorer. #1665

Open
wants to merge 8 commits into
base: testnet
Choose a base branch
from
Open

Added Makefile for explorer. #1665

wants to merge 8 commits into from

Conversation

samoht9277
Copy link
Collaborator

Makefile for explorer

Description

Adds a makefile for building and deploying the explorer

Type of change

  • New feature

Checklist

  • “Hotfix” to testnet, everything else to staging
  • Linked to Github Issue
  • This change depends on code or research by an external entity
    • Acknowledgements were updated to give credit
  • Unit tests added
  • This change requires new documentation.
    • Documentation has been added/updated.
  • This change is an Optimization
    • Benchmarks added/run
  • Has a known issue
  • If your PR changes the Operator compatibility (Ex: Upgrade prover versions)
    • This PR adds compatibility for operator for both versions and do not change batcher/docs/examples
    • This PR updates batcher and docs/examples to the newer version. This requires the operator are already updated to be compatible

@samoht9277 samoht9277 self-assigned this Dec 19, 2024
@samoht9277 samoht9277 changed the base branch from testnet to staging December 19, 2024 22:02
@samoht9277 samoht9277 changed the base branch from staging to testnet December 19, 2024 22:03
@samoht9277 samoht9277 requested a review from klaus993 January 3, 2025 14:03
Copy link
Contributor

@uri-99 uri-99 left a comment

Choose a reason for hiding this comment

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

looks good but im not devops

Copy link
Collaborator

@MarcosNicolau MarcosNicolau left a comment

Choose a reason for hiding this comment

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

The targets worked well for me. I wonder if we can make an script that does everything automatically (maybe via ansible). Also, I’m curious on why we are building the explorer on /tmp and then moving it. Can't we just build the explorer directly in /home/app? We could avoid cloning the repository, installing dependencies, etc., every time we redeploy. That repetitive step was a bit frustrating.

mix assets.deploy
mix release --overwrite

# on /tmp/aligned_layer/explorer/ as app
Copy link
Collaborator

Choose a reason for hiding this comment

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

Personally, I would remove these comments or make them a little more specific.

Comment on lines +11 to +27
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
Copy link
Collaborator

@MarcosNicolau MarcosNicolau Jan 13, 2025

Choose a reason for hiding this comment

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

Why don't we instead pass a .env file path instead of providing all the vars in the console? I find it a little uncomfortable. Or instead, the create_env just creates the template, and then you go to the created file and fill in the variables.

Comment on lines +47 to +50
7. Enable the systemd service.
```
make run_service
```
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add a comment saying this should be run as app user.

| MIX_ENV | Elixir environment for compiling the binaries | prod | prod | prod |
| RPC_URL | RPC's URL for the explorer to pull data from | `<RPC_URL>` | `<RPC_URL>` | `<RPC_URL>` |
| 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 |
Copy link
Collaborator

Choose a reason for hiding this comment

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

If you don't have a explorer built into /home/app (on first build) you can't build the explorer as if can't find the .jsons with the addresses.


# on /tmp/aligned_layer/explorer/ as app
build_explorer: export MIX_ENV=prod
build_explorer:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't this missing: explorer_ecto_setup_db to do the migrations if needed?


4. Move the built binary outside `/tmp/` and move it to the actual location.
```
make install_explorer
Copy link
Collaborator

Choose a reason for hiding this comment

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

I had to run this with sudo (I was logged as admin).

@MarcosNicolau MarcosNicolau mentioned this pull request Jan 14, 2025
17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants