From 5d2d3f77e239a0d146d46aa433cfa23f342ec44d Mon Sep 17 00:00:00 2001 From: beb4now <33292945+beb4now@users.noreply.github.com> Date: Thu, 23 May 2024 16:02:23 +0100 Subject: [PATCH] Create deploy-bdjuno-public-testnet.yml First stab stab stab --- .../deploy-bdjuno-public-testnet.yml | 135 ++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 .github/workflows/deploy-bdjuno-public-testnet.yml diff --git a/.github/workflows/deploy-bdjuno-public-testnet.yml b/.github/workflows/deploy-bdjuno-public-testnet.yml new file mode 100644 index 000000000..f6aa7db2a --- /dev/null +++ b/.github/workflows/deploy-bdjuno-public-testnet.yml @@ -0,0 +1,135 @@ +name: Deploy BDJuno on public testnet + +#on: +# push: +# branches: +# - main + +on: + workflow_dispatch: + +jobs: + deploy: + runs-on: cudos-public-testnet-explorer-02 + steps: + - name: Checkout code + uses: actions/checkout@v2 + +# - name: Set up Docker +# uses: docker/setup-buildx-action@v1 + + - name: Create bdjuno directory and download genesis file + run: | + mkdir bdjuno + wget https://storage.googleapis.com/private-testnet-genesis/pubtestnetkmd.json + mv pubtestnetkmd.json 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-testnet-public-4 + address: http://public-testnet-seed-02.hosts.cudos.org:26657 + max_connections: 20 + grpc: + address: http://public-testnet-seed-02.hosts.cudos.org:9090 + insecure: true + parsing: + workers: 4 + 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.POSTGRES_DB }} + host: host.docker.internal + port: 5432 + user: \${{ secrets.POSTGRES_USER }} + password: \${{ secrets.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: 1m + - name: blocks_monitoring_worker + interval: 30s + cudomint: + stats_service_url: https://stats.testnet.cudos.org + crypto-compare: + crypto_compare_prod_api_key: \${{ secrets.CRYPTO_COMPARE_PROD_API_KEY }} + crypto_compare_free_api_key: \${{ secrets.CRYPTO_COMPARE_FREE_API_KEY }} + EOF + chmod 644 bdjuno/config.yaml + + - name: Setup .env for Hasura + run: | + cat << EOF > .env + HASURA_GRAPHQL_DATABASE_URL=postgres://\${{ secrets.POSTGRES_USER }}:\${{ secrets.POSTGRES_PASSWORD }}@host.docker.internal:5432/\${{ secrets.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.HASURA_GRAPHQL_ADMIN_SECRET }} + HASURA_GRAPHQL_ENDPOINT_URL=\${{ secrets.HASURA_GRAPHQL_ENDPOINT_URL }} + HASURA_GRAPHQL_UNAUTHORIZED_ROLE="anonymous" + HASURA_ACTIONS_GRPC="http://public-testnet-seed-02.hosts.cudos.org:9090" + HASURA_ACTIONS_RPC="http://public-testnet-seed-02.hosts.cudos.org:26657" + HASURA_ACTIONS_PORT=4000 + GCLOUD_INSTANCE_CONNECTION_NAME=cudos-testnet:us-central1:public-testnet + CRYPTO_COMPARE_PROD_API_KEY="\${{ secrets.CRYPTO_COMPARE_PROD_API_KEY }}" + CRYPTO_COMPARE_FREE_API_KEY="\${{ secrets.CRYPTO_COMPARE_FREE_API_KEY }}" + EOF + chmod 644 .env + + - name: Deploy with Docker Compose + run: | + sudo docker-compose --file=docker-compose-prod.yml up --build -d + + - 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.HASURA_GRAPHQL_ENDPOINT_URL }} --admin-secret "\${{ secrets.HASURA_GRAPHQL_ADMIN_SECRET }}"