Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Remove Testnet #424

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 0 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
export DB_TYPE= # set to postgresql if you want to use postgresql, empty otherwise (sqlite).
export DISABLE_MAINNET_SYNC=true # Set to true if you want to disable mainnet sync
export DISABLE_TESTNET_SYNC=true # Set to true if you want to disable testnet sync
export DISABLE_SEPOLIA_SYNC=true # Set to true if you want to disable sepolia sync
export RPC_API_HOST=<YOUR_RPC_API_HOST> # Set to your mainnet rpc api host, is will be used in the explorer as "Mainnet"
export TESTNET_RPC_API_HOST=<YOUR_TESTNET_RPC_API_HOST> # Set to your testnet rpc api host, is will be used in the explorer as "Testnet"
export SEPOLIA_RPC_API_HOST=<YOUR_SEPOLIA_RPC_API_HOST> # Set to your sepolia rpc api host, is will be used in the explorer as "Sepolia"
export DB_NAME=<DB_NAME> # set DB creds
export DB_USER=<DB_USER>
export DB_PASS=<DB_PASS>
export DB_HOST=<DB_HOST>

3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ permissions:

jobs:
build:
env:
env:
RPC_API_HOST: ${{ secrets.RPC_API_HOST }}
TESTNET_RPC_API_HOST: ${{ secrets.TESTNET_RPC_API_HOST }}
SEPOLIA_RPC_API_HOST: ${{ secrets.SEPOLIA_RPC_API_HOST }}
name: Build and test
runs-on: ubuntu-latest
Expand Down
100 changes: 48 additions & 52 deletions .github/workflows/deploy-production.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,66 +9,62 @@ on:
- v**

jobs:

build-deploy:
name: Build and deploy to production
runs-on: ubuntu-latest
environment:
name: production
url: https://starkcompass.com/
steps:
- name: Checkout
uses: actions/[email protected]

- name: Checkout
uses: actions/[email protected]

- name: Tailscale
uses: tailscale/github-action@v2
with:
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
tags: tag:ci
- name: Tailscale
uses: tailscale/github-action@v2
with:
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
tags: tag:ci

- name: Create ssh private key file from env var
env:
SSH_KEY: ${{ secrets.SSH_KEY }}
TS_HOST: ${{ vars.TS_HOST }}
run: |
mkdir ~/.ssh/
sed -E 's/(-+(BEGIN|END) OPENSSH PRIVATE KEY-+) *| +/\1\n/g' <<< "$SSH_KEY" > ~/.ssh/id_ed25519
chmod 400 ~/.ssh/id_ed25519
retries=5; until ssh-keyscan $TS_HOST >> ~/.ssh/known_hosts || [ $retries -eq 0 ]; do ((retries--)); sleep 5; done
- name: Create ssh private key file from env var
env:
SSH_KEY: ${{ secrets.SSH_KEY }}
TS_HOST: ${{ vars.TS_HOST }}
run: |
mkdir ~/.ssh/
sed -E 's/(-+(BEGIN|END) OPENSSH PRIVATE KEY-+) *| +/\1\n/g' <<< "$SSH_KEY" > ~/.ssh/id_ed25519
chmod 400 ~/.ssh/id_ed25519
retries=5; until ssh-keyscan $TS_HOST >> ~/.ssh/known_hosts || [ $retries -eq 0 ]; do ((retries--)); sleep 5; done

- name: Install ansible
run: |
pip install ansible
- name: Install ansible
run: |
pip install ansible

- name: "Deploy with ansible"
env:
MIX_ENV: ${{ vars.MIX_ENV }}
DB_TYPE: ${{ vars.DB_TYPE }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }}
PHX_HOST: ${{ vars.PHX_HOST }}
PHX_SERVER: ${{ vars.PHX_SERVER }}
RPC_API_HOST: ${{ secrets.RPC_API_HOST }}
TESTNET_RPC_API_HOST: ${{ secrets.TESTNET_RPC_API_HOST }}
SEPOLIA_RPC_API_HOST: ${{ secrets.SEPOLIA_RPC_API_HOST }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ vars.AWS_REGION }}
PROVER_STORAGE: ${{ vars.PROVER_STORAGE }}
ANSIBLE_SSH_PKEY_DIR: "~/.ssh/id_ed25519"
TS_HOST: ${{ vars.TS_HOST }}
TS_USER: ${{ vars.TS_USER }}
GIT_BRANCH: ${{ github.head_ref || github.ref_name }}
ANSIBLE_STDOUT_CALLBACK: "yaml"
NEWRELIC_KEY: ${{ secrets.NEWRELIC_KEY }}
NEWRELIC_APP_NAME: ${{ vars.NEWRELIC_APP_NAME }}
SENTRY_ENV: "production"
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
ENABLE_MAINNET_SYNC: "true"
ENABLE_TESTNET_SYNC: "true"
ENABLE_SEPOLIA_SYNC: "true"
ENABLE_GATEWAY_DATA: "true"
run: |
ansible-playbook -i ansible/inventory.yaml ansible/playbooks/deployment.yaml
- name: "Deploy with ansible"
env:
MIX_ENV: ${{ vars.MIX_ENV }}
DB_TYPE: ${{ vars.DB_TYPE }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }}
PHX_HOST: ${{ vars.PHX_HOST }}
PHX_SERVER: ${{ vars.PHX_SERVER }}
RPC_API_HOST: ${{ secrets.RPC_API_HOST }}
SEPOLIA_RPC_API_HOST: ${{ secrets.SEPOLIA_RPC_API_HOST }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ vars.AWS_REGION }}
PROVER_STORAGE: ${{ vars.PROVER_STORAGE }}
ANSIBLE_SSH_PKEY_DIR: "~/.ssh/id_ed25519"
TS_HOST: ${{ vars.TS_HOST }}
TS_USER: ${{ vars.TS_USER }}
GIT_BRANCH: ${{ github.head_ref || github.ref_name }}
ANSIBLE_STDOUT_CALLBACK: "yaml"
NEWRELIC_KEY: ${{ secrets.NEWRELIC_KEY }}
NEWRELIC_APP_NAME: ${{ vars.NEWRELIC_APP_NAME }}
SENTRY_ENV: "production"
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
ENABLE_MAINNET_SYNC: "true"
ENABLE_SEPOLIA_SYNC: "true"
ENABLE_GATEWAY_DATA: "true"
run: |
ansible-playbook -i ansible/inventory.yaml ansible/playbooks/deployment.yaml
99 changes: 48 additions & 51 deletions .github/workflows/deploy-testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ on:
workflow_dispatch:

jobs:

build-deploy:
name: Build and deploy to testing
runs-on: ubuntu-latest
Expand All @@ -19,57 +18,55 @@ jobs:
url: https://testing.starkcompass.com/

steps:
- name: Checkout
uses: actions/[email protected]
- name: Checkout
uses: actions/[email protected]

- name: Tailscale
uses: tailscale/github-action@v2
with:
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
tags: tag:ci
- name: Tailscale
uses: tailscale/github-action@v2
with:
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
tags: tag:ci

- name: Create ssh private key file from env var
env:
SSH_KEY: ${{ secrets.SSH_KEY }}
TS_HOST: ${{ vars.TS_HOST }}
run: |
mkdir ~/.ssh/
sed -E 's/(-+(BEGIN|END) OPENSSH PRIVATE KEY-+) *| +/\1\n/g' <<< "$SSH_KEY" > ~/.ssh/id_ed25519
chmod 400 ~/.ssh/id_ed25519
retries=5; until ssh-keyscan $TS_HOST >> ~/.ssh/known_hosts || [ $retries -eq 0 ]; do ((retries--)); sleep 5; done
- name: Create ssh private key file from env var
env:
SSH_KEY: ${{ secrets.SSH_KEY }}
TS_HOST: ${{ vars.TS_HOST }}
run: |
mkdir ~/.ssh/
sed -E 's/(-+(BEGIN|END) OPENSSH PRIVATE KEY-+) *| +/\1\n/g' <<< "$SSH_KEY" > ~/.ssh/id_ed25519
chmod 400 ~/.ssh/id_ed25519
retries=5; until ssh-keyscan $TS_HOST >> ~/.ssh/known_hosts || [ $retries -eq 0 ]; do ((retries--)); sleep 5; done

- name: Install ansible
run: |
pip install ansible
- name: Install ansible
run: |
pip install ansible

- name: "Deploy with ansible"
env:
MIX_ENV: ${{ vars.MIX_ENV }}
DB_TYPE: ${{ vars.DB_TYPE }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }}
PHX_HOST: ${{ vars.PHX_HOST }}
PHX_SERVER: ${{ vars.PHX_SERVER }}
RPC_API_HOST: ${{ secrets.RPC_API_HOST }}
TESTNET_RPC_API_HOST: ${{ secrets.TESTNET_RPC_API_HOST }}
SEPOLIA_RPC_API_HOST: ${{ secrets.SEPOLIA_RPC_API_HOST }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ vars.AWS_REGION }}
PROVER_STORAGE: ${{ vars.PROVER_STORAGE }}
ANSIBLE_SSH_PKEY_DIR: "~/.ssh/id_ed25519"
TS_HOST: ${{ vars.TS_HOST }}
TS_USER: ${{ vars.TS_USER }}
GIT_BRANCH: ${{ github.head_ref || github.ref_name }}
ANSIBLE_STDOUT_CALLBACK: "yaml"
ENABLE_MAINNET_SYNC: "true"
ENABLE_TESTNET_SYNC: "true"
ENABLE_SEPOLIA_SYNC: "true"
ENABLE_GATEWAY_DATA: "true"
NEWRELIC_KEY: ${{ secrets.NEWRELIC_KEY }}
NEWRELIC_APP_NAME: ${{ vars.NEWRELIC_APP_NAME }}
SENTRY_ENV: "testing"
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
run: |
ansible-playbook -i ansible/inventory.yaml ansible/playbooks/deployment.yaml
- name: "Deploy with ansible"
env:
MIX_ENV: ${{ vars.MIX_ENV }}
DB_TYPE: ${{ vars.DB_TYPE }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }}
PHX_HOST: ${{ vars.PHX_HOST }}
PHX_SERVER: ${{ vars.PHX_SERVER }}
RPC_API_HOST: ${{ secrets.RPC_API_HOST }}
SEPOLIA_RPC_API_HOST: ${{ secrets.SEPOLIA_RPC_API_HOST }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ vars.AWS_REGION }}
PROVER_STORAGE: ${{ vars.PROVER_STORAGE }}
ANSIBLE_SSH_PKEY_DIR: "~/.ssh/id_ed25519"
TS_HOST: ${{ vars.TS_HOST }}
TS_USER: ${{ vars.TS_USER }}
GIT_BRANCH: ${{ github.head_ref || github.ref_name }}
ANSIBLE_STDOUT_CALLBACK: "yaml"
ENABLE_MAINNET_SYNC: "true"
ENABLE_SEPOLIA_SYNC: "true"
ENABLE_GATEWAY_DATA: "true"
NEWRELIC_KEY: ${{ secrets.NEWRELIC_KEY }}
NEWRELIC_APP_NAME: ${{ vars.NEWRELIC_APP_NAME }}
SENTRY_ENV: "testing"
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
run: |
ansible-playbook -i ansible/inventory.yaml ansible/playbooks/deployment.yaml
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@

## Local development

If you run `make` it will print out the available targets:
If you run `make` it will print out the available targets:
```
% make
% make
Usage:
run : Starts the Elixir backend server.
setup : Sets up everything necessary to build and run the explorer.
Expand All @@ -37,7 +37,7 @@ Usage:
```

### Setup
Once you have the requirements installed and set up, you can proceed to building and running the project.
Once you have the requirements installed and set up, you can proceed to building and running the project.

```bash
make setup
Expand All @@ -58,7 +58,6 @@ Set the following environment variables:

```bash
export RPC_API_HOST=your_rpc_hostname
export TESTNET_RPC_API_HOST=testnet_rpc_hostname
export SEPOLIA_RPC_API_HOST=sepolia_rpc_hostname
```

Expand Down Expand Up @@ -102,7 +101,6 @@ The synchronization process is activated by default, you can turn it off by conf

```bash
export DISABLE_MAINNET_SYNC=true
export DISABLE_TESTNET_SYNC=true
export DISABLE_SEPOLIA_SYNC=true
```

Expand All @@ -114,7 +112,7 @@ There are 3 things to keep in mind here:
1. Amount of requests:
If you have any constraint on how many requests you can make: keep an eye on that,
because the State Synchronization System can do a lot of requests per second.
2. Disk Usage: We're still measuring it, but we expect it to be considerable
2. Disk Usage: We're still measuring it, but we expect it to be considerable
after running it for a couple of days.
3. If you are going to sync a large amount of blocks, we *strongly* suggest to use PostgreSQL instead of SQLite. You can check how to swap the DB in [this section](#using-stark-compass-with-postgresql).

Expand Down Expand Up @@ -156,7 +154,7 @@ docker-compose up postgres

## Contributing

We appreciate your interest in contributing to the Stark Compass Explorer! Your contributions can help make this project even better.
We appreciate your interest in contributing to the Stark Compass Explorer! Your contributions can help make this project even better.

PRs are more than welcome if you want to collaborate to the project. If you don't know how to implement a feature, you are still welcome to create an issue!

Expand Down
Loading
Loading