A Guide To Successful DevOps in Web3
DevOps has revolutionized Web2 development. Now, these new tools are bringing DevOps to Web3—for testing, building, CI/CD, monitoring, planning, and feedback.
Join the DZone community and get the full member experience.
Join For FreeAs Web3 engineering grows in complexity, there is an increasing need for DevOps practices and philosophies that have proven proficiency with Web2 apps at scale, sometimes to billions of users.
In this article, we’ll explore how DevOps—an engineering philosophy that facilitates fast and efficient collaboration, maintenance, and release of software—works in Web3. We’ll walk through tools that you can use as-is from traditional software engineering, and we’ll look at offerings that are specifically intended for end-to-end blockchain application development.
What Is DevOps?
DevOps is a software-development philosophy that emphasizes collaboration, communication, and integration between various engineering stakeholders.
Used well, DevOps can drastically increase the speed and quality of software development as well as the reliability and resilience of the systems being developed. DevOps creates a unified pipeline that facilitates efficient coding and testing, continuous delivery, robust releases, monitoring, and planning.
Given the many complex operations DevOps brings together, it tends to require separate tools for each component. As a result, there is an extremely mature ecosystem of DevOps tools available for Web3 engineers.
There are, however, nuances associated with Web3 that don't translate from Web2. One such case is the use of a public, decentralized ledger as a backend as opposed to private, centralized databases. Fortunately, Web3-specific DevOps tooling is growing rapidly, thanks to companies like ConsenSys which provides the essential tools for every stage of development to streamline Web3 engineering.
DevOps Tooling for Web3
As stated earlier, Web3 DevOps is a mixture of traditional Web2 engineering tools and offerings that cater to Web3’s unique needs. In this section, we’ll survey the tools available for each component of the DevOps pipeline. Let’s walk through some of the DevOps stages and see how they look in Web3:
- Build
- Test
- CI/CD
- Monitor
- Planning and Feedback
Build
Perhaps the most obvious and visible component, the build or development team is responsible for creating new features, improving existing features, fixing bugs, and documenting code.
Blockchain engineering usually entails the creation of special programs called smart contracts that run on top of a blockchain. As a result, a unique set of tools is required for building such apps. There are many development environments available, such as Remix IDE, that facilitate this. However, the most popular and robust option available is the Truffle Suite.
The Truffle Suite allows developers to work seamlessly with Web3 components such as wallets, chains, and node providers. Some of the things you can do with Truffle include:
- Code smart contracts using Solidity
- Write scripts that deploy smart contracts to a chain of your choice
- Allow for seamless integration of node providers like Infura
- Integrate other useful third-party libraries like Ethlint
Other options include Brownie and Hardhat for EVM smart contracts, Anchor for Solana, and the Playground GUI for Flow.
Testing
Testing is a critical component of Web3 DevOps, as it helps ensure the quality and reliability of the software. This is even more critical with Web3, where you often deal with contracts that are immutable and extraordinarily expensive to deploy and maintain.
There are several types of testing that may be used in a DevOps environment including unit, integration, functional, and performance testing. In the case of Web3 (and more specifically blockchain), unit testing and integration testing are perhaps the most important. The former involves testing individual units or components of the software to ensure that they are working correctly. The latter is more focused on how different components of the software work together.
Developers/Ops engineers are often advised to set up a local instance of a blockchain for testing before deploying it to a public network. One of the most popular tools that allows us to do this is Ganache. Since Ganache is maintained by the same development team, it seamlessly integrates into the Truffle suite.
Tests are usually written the same way as in web2, using libraries like Mocha and Chai. Truffle also has built-in support for tests.
A traditional Truffle test and a test using Mocha
By their very nature, smart contracts tend to be immutable and unforgiving of critical security flaws. As a result, the degree of Web3 security testing is much higher than what is expected out of a traditional Web2 project. If the contract is expected to handle a large amount of money and/or assets, it is strongly suggested that external security audits be conducted in addition to the testing mentioned above.
Continuous Integration and Continuous Delivery
Continuous Integration and Continuous Delivery, often abbreviated as CI/CD, involves automating the build, test, and deployment process for software updates and new features.
Once the development team publishes new code to the repository, the CI component integrates the code into the codebase to ensure there are no breaking changes. Once the changes are deemed satisfactory, a new build is triggered (by the CD tool) and deployed to the various environments (typically staging and production).
Although certain tests and testing environments may be different when working with Web3 dapps, Truffle works exceptionally well with traditional CI/CD tools such as Gradle, Jenkins, and CircleCI.
Some of the things these tools offer out of the box include:
- Auto-deployment on successfully passing tests and creating a new build
- Live build requests
- Integration with a number of tools including GitHub and Assembla
- Audit logs
As mentioned above, the installation and setup of your chosen tool is almost identical to any other software engineering project, with enterprise support available when needed.
Monitoring
Monitoring, like its sister components, also ensures the performance and reliability of systems. It does this by tracking the health and performance of systems, and by identifying and resolving issues in a timely manner.
Key aspects of monitoring in DevOps include collecting and storing log data from systems, configuring systems to send alerts when certain conditions or thresholds are met, and dashboards that display real-time performance and health of systems.
When dealing with dApps, we are interested in monitoring both the overall health of the blockchain as well as activity and incidents that are specific to our smart contracts. Leading node providers like Infura present both these macro and micro assessments via readily accessible APIs and dashboards.
In the case of general blockchain, Infura provides APIs you can use to access any information relevant to that particular blockchain. Some of the Web3 information you might want to monitor includes:
- Current gas price
- Block number
- Balance of a particular address
- Compiled smart contract code at a particular address
- Gas fee history
If you’re using Infura’s nodes, they will also give you detailed information on the health of your smart contract/dApp, how much traffic Infura is witnessing, how many users are interacting with it, etc.
Planning and Feedback
Planning and feedback ensure that the entire development process is aligned with business goals and priorities, and that timely progress is being made. This includes Agile planning using methodologies like Scrum and Kanban, mechanisms that facilitate continuous feedback, and metrics that track progress and identify areas for improvement.
Most of the tools used for planning and feedback in traditional software engineering, such as Jira, Trello, Slack, and Datadog, can be used in Web3 development as well. For blockchain-specific metrics, you can continue to use the monitoring tools highlighted in the previous section (for example, Infura).
Conclusion
As Web3 and blockchain engineering grow in complexity, they require large teams to collaboratively deliver results quickly and efficiently. Therefore, the DevOps philosophy has become as integral to Web3 engineering teams as it has been for traditional software.
Web3 engineers will find that existing DevOps tools work very well for their use cases, and the ecosystem of tools coming up to serve the nuances of Web3 is also growing all the time.
Published at DZone with permission of Alvin Lee. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments