Web3 wants DevOps
Half 9— Constructing a DevOps pipeline for the Ethereum blockchain
Within the earlier put up of this sequence — Web3 Meets DevOps: Pipeline, Deploy dApp — I deployed the appliance to my dev setting. On this put up, I’ll deploy every thing to my QA setting utilizing the Rinkeby check community.
I created a brand new department named “weblog/part9” for this text.
git checkout -b weblog/part9
To deploy to the Rinkeby check community, I would like an Infura node and an account with check Ether. I created a free account and a venture known as My1stEthProject at https://infura.io. As soon as I created the venture, I had entry to the API KEY and Community Endpoints.
I additionally searched the net for “rinkeby faucet” and used one so as to add Ether to my pockets.
To deploy to Rinkeby, the community should be added to the truffle-config.js. The very best useful resource for including the community is the official Truffle Suite docs. After reviewing the documentation, I spotted I wanted an HDWalletProvider
. Utilizing npm, I put in it and saved it as a dependency.
npm set up --save truffle-hdwallet-provider
With the bundle put in, I wanted to replace the truffle-config.js. I added the API KEY from my Infura venture as an setting variable together with the MNEMONIC from my check account.
Utilizing the HDWalletProvider
, I added the Rinkeby community to the networks part.
Infrastructure
Below the iac job of the qa stage, in azure-pipelines.yml
, I added two duties, as proven under:
The primary activity downloads the iac artifact created in the course of the construct stage of the pipeline. This artifact incorporates three Bicep recordsdata and a PowerShell script.
The second activity executes the PowerShell script, which makes use of the three Bicep recordsdata to deploy an Azure Static Internet App. I take advantage of the -rgName $(resourceGroup)-qa
argument, which places all of the sources in a useful resource group for my QA setting. Discover the usage of the service connection I created earlier as the worth of the azureSubscription below inputs.
The contracts are deployed into the Rinkeby check community utilizing the Infura node. Below the deploy_contracts
job of the qa
stage, I added the next:
Discover on line 12 that I cross in rinkeby to the --network
argument and set the suitable setting variables for the API KEY and MNEMONIC.
The frontend is deployed into the Azure Static Internet App deployed within the iac
job of the qa
stage. Below the deploy_frontend
job of the qa
stage, I added the next:
As I did with the Dev setting, I needed to delete the QA setting as soon as I used to be executed with it. Earlier than deleting the QA setting, I needed a possibility to assessment the code. To do that, I used a Handbook Validation job. As soon as I accredited the validation step, the subsequent job deleted the QA useful resource group in Azure, eradicating all my sources. Below the qa_validation
stage, I added the next:
Subsequent I added two secret variables to my pipeline by way of the Azure DevOps UI. These will set the setting variables we use within the truffle-config.js file.
As soon as the pipeline accomplished the QA setting, info was added to the Extensions part of the run.
Utilizing the hyperlink supplied, I used to be in a position to check the appliance.
Now that I’ve deployed to my QA setting, within the subsequent put up, I’ll present find out how to deploy to Mainnet.
Thanks for studying. Till subsequent time!