-
Notifications
You must be signed in to change notification settings - Fork 391
Added Makefile for explorer. #1665
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
base: testnet
Are you sure you want to change the base?
Changes from 4 commits
68748c2
1758313
8c63f06
a5258e1
e1b152c
8258074
cdd07b0
cb06ed2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
| 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 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
|
Comment on lines
+11
to
+27
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| ``` | ||
| > 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 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had to run this with |
||
| ``` | ||
|
|
||
| 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 | ||
| ``` | ||
|
Comment on lines
+47
to
+50
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a comment saying this should be run as |
||
There was a problem hiding this comment.
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_dbto do the migrations if needed?