Deploy BDJuno on private testnet #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy BDJuno on private testnet | |
#on: | |
# push: | |
# branches: | |
# - main | |
on: | |
workflow_dispatch: | |
jobs: | |
deploy: | |
runs-on: private-testnet-explorer-v2 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
# - name: Set up Docker | |
# uses: docker/setup-buildx-action@v1 | |
- name: Stop and remove any existing containers | |
run: | | |
sudo docker stop cudos-bdjuno-hasura-1 || true | |
sudo docker rm cudos-bdjuno-hasura-1 || true | |
sudo docker stop cudos-bdjuno-bdjuno-1 || true | |
sudo docker rm cudos-bdjuno-bdjuno-1 || true | |
sudo docker stop cudos-bdjuno-hasura-actions-1 || true | |
sudo docker rm cudos-bdjuno-hasura-actions-1 || true | |
sudo docker stop cloudsql-proxy || true | |
sudo docker rm cloudsql-proxy || true | |
- name: Stop and remove any existing containers with alt names | |
run: | | |
sudo docker stop deploy_bdjuno_hasura_1 || true | |
sudo docker rm deploy_bdjuno_hasura_1 || true | |
sudo docker stop deploy_bdjuno_bdjuno_1 || true | |
sudo docker rm deploy_bdjuno_bdjuno_1 || true | |
sudo docker stop deploy_bdjuno_hasura-actions_1 || true | |
sudo docker rm deploy_bdjuno_hasura-actions_1 || true | |
sudo docker stop cloudsql-proxy || true | |
sudo docker rm cloudsql-proxy || true | |
- name: Create bdjuno directory and download genesis file | |
run: | | |
mkdir bdjuno | |
wget https://storage.googleapis.com/private-testnet-genesis/private_testnet_20240705.export | |
mv private_testnet_20240705.export bdjuno/genesis.json | |
chmod 644 bdjuno/genesis.json | |
- name: Setup bdjuno config file | |
run: | | |
cat << EOF > bdjuno/config.yaml | |
chain: | |
bech32_prefix: cudos | |
modules: | |
- modules | |
- messages | |
- auth | |
- bank | |
- consensus | |
- gov | |
- slashing | |
- staking | |
- distribution | |
- history | |
- pricefeed | |
- cosmwasm | |
- gravity | |
- cudomint | |
- nft | |
- group | |
- cw20token | |
- marketplace | |
node: | |
type: remote | |
config: | |
rpc: | |
client_name: cudos-private-testnet-1 | |
address: http://private-testnet-sentry-01.hosts.cudos.org:26657 | |
max_connections: 10 | |
grpc: | |
address: http://private-testnet-sentry-01.hosts.cudos.org:9090 | |
insecure: true | |
parsing: | |
workers: 5 | |
listen_new_blocks: true | |
parse_old_blocks: false | |
parse_genesis: true | |
start_height: 1 | |
fast_sync: false | |
genesis_file_path: /usr/local/bdjuno/bdjuno/genesis.json | |
database: | |
name: ${{ secrets.PRIVATE_TN_POSTGRES_DB }} | |
host: host.docker.internal | |
port: 5432 | |
user: ${{ secrets.PRIVATE_TN_POSTGRES_USER }} | |
password: ${{ secrets.PRIVATE_TN_POSTGRES_PASSWORD }} | |
schema: public | |
max_open_connections: 10 | |
max_idle_connections: 10 | |
logging: | |
level: debug | |
format: text | |
telemetry: | |
port: 5000 | |
pricefeed: | |
tokens: | |
- name: Cudos | |
units: | |
- denom: cudos | |
exponent: 0 | |
price_id: cudos | |
distribution: | |
rewards_frequency: 1000 | |
workers: | |
- name: fix_blocks_worker | |
interval: 10m | |
- name: migrate_nfts_worker | |
interval: 120m | |
- name: blocks_monitoring_worker | |
interval: 20s | |
cudomint: | |
stats_service_url: http://cudos-utils.hosts.private-testnet.cudos.org:3001 | |
crypto-compare: | |
crypto_compare_prod_api_key: ${{ secrets.PRIVATE_TN_CRYPTO_COMPARE_PROD_API_KEY }} | |
crypto_compare_free_api_key: ${{ secrets.PRIVATE_TN_CRYPTO_COMPARE_FREE_API_KEY }} | |
EOF | |
chmod 644 bdjuno/config.yaml | |
cat bdjuno/config.yaml | |
- name: Setup .env for Hasura | |
run: | | |
cat << EOF > .env | |
HASURA_GRAPHQL_DATABASE_URL=postgres://${{ secrets.PRIVATE_TN_POSTGRES_USER }}:${{ secrets.PRIVATE_TN_POSTGRES_PASSWORD }}@host.docker.internal:5432/${{ secrets.PRIVATE_TN_POSTGRES_DB }} | |
HASURA_GRAPHQL_ENABLE_CONSOLE="true" | |
HASURA_GRAPHQL_DEV_MODE="false" | |
HASURA_GRAPHQL_ENABLED_LOG_TYPES=startup, http-log, webhook-log, websocket-log, query-log | |
HASURA_GRAPHQL_ADMIN_SECRET=${{ secrets.PRIVATE_TN_HASURA_GRAPHQL_ADMIN_SECRET }} | |
HASURA_GRAPHQL_ENDPOINT_URL=${{ secrets.PRIVATE_TN_HASURA_GRAPHQL_ENDPOINT_URL }} | |
HASURA_GRAPHQL_UNAUTHORIZED_ROLE="anonymous" | |
HASURA_ACTIONS_GRPC="http://private-testnet-sentry-01.hosts.cudos.org:9090" | |
HASURA_ACTIONS_RPC="http://private-testnet-sentry-01.hosts.cudos.org:26657" | |
HASURA_ACTIONS_PORT=4000 | |
GCLOUD_INSTANCE_CONNECTION_NAME=cudos-testnet:us-central1:private-testnet-sql | |
CRYPTO_COMPARE_PROD_API_KEY="${{ secrets.PRIVATE_TN_CRYPTO_COMPARE_PROD_API_KEY }}" | |
CRYPTO_COMPARE_FREE_API_KEY="${{ secrets.PRIVATE_TN_CRYPTO_COMPARE_FREE_API_KEY }}" | |
EOF | |
chmod 644 .env | |
cat .env | |
- name: Setup Hasura config file | |
run: | | |
cat << EOF > hasura/config.yaml | |
version: 3 | |
endpoint: http://explorer-v2.hosts.private-testnet.hosts.cudos.org:8080 | |
api_paths: | |
v1_query: v1/query | |
v2_query: v2/query | |
v1_metadata: v1/metadata | |
graphql: v1/graphql | |
config: v1alpha1/config | |
pg_dump: v1alpha1/pg_dump | |
version: v1/version | |
metadata_directory: metadata | |
migrations_directory: migrations | |
seeds_directory: seeds | |
actions: | |
kind: synchronous | |
handler_webhook_baseurl: http://explorer-v2.hosts.private-testnet.hosts.cudos.org:4000 | |
codegen: | |
framework: "" | |
output_dir: "" | |
EOF | |
chmod 644 hasura/config.yaml | |
cat hasura/config.yaml | |
- name: Deploy with Docker Compose | |
run: | | |
sudo docker compose --file=docker-compose-prod.yml up --build -d | |
sleep 15 | |
- name: Apply Hasura metadata | |
run: | | |
cd hasura | |
curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | bash | |
hasura metadata apply --endpoint ${{ secrets.PRIVATE_TN_HASURA_GRAPHQL_ENDPOINT_URL }} --admin-secret ${{ secrets.PRIVATE_TN_HASURA_GRAPHQL_ADMIN_SECRET }} |