Nathan Smith
Strong Practices for Rails Applications Continuous Delivery

Strong Practices for Rails Applications Continuous Delivery

by Nathan Smith and Robb Kidd

The video titled "Strong Practices for Rails Applications Continuous Delivery" by Nathan Smith and Robb Kidd explores essential practices for implementing continuous delivery within Ruby on Rails applications using Chef Delivery. Presented at RailsConf 2016, the talk emphasizes the importance of high-velocity organizations that deliver rapid and reliable updates to their customers. The speakers underscore the necessity of automation and the adoption of DevOps principles to enhance quality while minimizing the time between code commitment and production deployment.

Key points discussed in the presentation include:

  • DevOps Philosophy: Defined as a cultural movement that fosters collaboration across teams and emphasizes building and operating high-velocity organizations.
  • Engineering Quality vs. Speed: The balance between achieving high quality and compliance while maintaining a quick innovation rate. The goal is to minimize manual processes that hinder progress.
  • Automation of Processes: Emphasizing the importance of automating workflows to boost efficiency and reduce manual intervention, thereby enhancing the team's capacity to deploy more frequently.
  • Continuous Delivery Practices: Implementing smaller batches of changes as a means to safely deploy applications, assuring customers receive frequent updates without waiting for substantial releases.
  • Use of Tools: The selection of tools like Git for version control, along with Chef Delivery, facilitates a streamlined deployment pipeline, ensuring code quality and rapid iterations through continuous integration practices.
  • Testing and Quality Assurance: The significance of rigorous testing (including unit tests and security checks) to uphold high standards throughout the development process. Tools like RSpec and Brakeman are noted for their roles in testing and auditing.
  • Demonstration of Chef Delivery: Presenting a workflow that illustrates the stages of transforming code changes into production, with a focus on verification, build, security checks, and publishing release artifacts.
  • Human Intervention: The necessity of manual gates within the process, ensuring human inputs help maintain quality and oversight during deliveries.
  • Cultural Impact: The presentation emphasizes that a positive workforce culture leads to better products and outcomes.

In conclusion, the speakers advocate for a culture of continuous improvement that embraces failure as a learning opportunity, encourages diversity, and values collaborative efforts among teams. By adopting strong continuous delivery practices, organizations can enhance product quality, maintain compliance, and deliver value to customers efficiently.

00:00:10.099 Hello everybody, welcome to our talk. I'm Nathan Smith from Chef Software, and this is Robb Kidd, also from Chef.
00:00:17.220 Our talk is about strong practices for continuous delivery using Ruby on Rails and Chef Delivery. I primarily focus on front-end development at Chef, where I work on our web applications. How about you, Rob?
00:00:32.899 I am on the community engineering team and maintain a Rails app that is the equivalent of RubyGems for the Chef community, specifically the Supermarket web app for cookbooks. I'm a sysadmin by trade and a software developer by happenstance.
00:01:04.350 We're going to start by discussing DevOps and the rationale behind some of our practices, as well as how we approach the challenges we face.
00:01:17.810 If you look at this graph, it represents engineering quality. You want to be in the top corner where you have a high level of quality and compliance, based on the standards you’re aiming for. You also want to move fast with a high rate of innovation to try new things and create value.
00:01:39.360 However, there is a trade-off at play. You can move quickly without regard for quality and end up producing poor work, which we want to avoid. On the other hand, strict adherence to compliance can slow you down, especially in organizations with numerous compliance requirements. Our goal is to find a way to navigate this curve, moving closer to the top corner while maintaining our innovation rate and quality.
00:02:21.640 Some of the existing challenges in software engineering include manual processes that can prolong tasks such as server setups and software acquisitions.
00:02:28.720 To overcome these challenges, we aim to automate processes to enhance efficiency. Automating particular tasks allows us to build and implement tools that minimize manual work. Many of us are likely leveraging cloud technology, making it far easier to spin up an EC2 instance compared to ordering and setting up new physical hardware.
00:03:08.319 Additionally, transitioning from legacy systems to more dynamic infrastructure can improve flexibility in managing our resources.
00:03:19.600 It's crucial to foster a culture that encourages trust and collaboration between teams to enhance quality and innovation speed. Sometimes, deploying changes after significant modifications can be painful, especially if numerous updates have occurred simultaneously.
00:03:40.450 If we decrease the batch size of the changes we send out and continuously deliver applications, it becomes safer to implement minor changes, and customers receive updates sooner, eliminating the need to wait for major releases. We also contend with compliance pressures, where integrating compliance workflows into our initial process can enhance efficiency.
00:04:57.660 Moving forward with these strategies, we can improve quality, compliance, and speed, allowing us to create better products more efficiently. This is facilitated by employing dynamic infrastructures, infrastructure as code, and adopting DevOps principles.
00:05:51.190 Let’s discuss what DevOps means. At Chef, we define it as a cultural and professional movement focused on building and operating high-velocity organizations, drawing from the experiences of practitioners.
00:06:06.370 Organizations that operate quickly often have great people who design great products, which ultimately leads to successful companies. Conversely, if the workforce is disengaged, they produce subpar products that contribute to unsuccessful outcomes.
00:07:01.199 Diversity is vital within this context; everyone should be included in system design processes. Incorporating various perspectives can lead to innovative solutions and the prevention of issues.
00:07:39.630 Another element you’ll encounter when learning about DevOps is the language and philosophy that originated with the Toyota Production System. Concepts such as eliminating non-value-added actions, known in Japanese as "muda," and adopting systems like Kanban emphasize pulling work through a system rather than pushing it.
00:08:21.160 The principle of continuous improvement, or "kaizen," underscores the importance of engineering teams consistently reviewing processes with an eye toward enhancements. Additionally, introducing significant changes—"kaizoku"—should be executed in small batches, iterating and experimenting to ensure improvement.
00:09:27.020 A crucial part of adopting a quick-paced work ethic is embracing failure as a learning opportunity. Conduct post-mortems after faults occur to identify learnings without assigning blame. The focus should be on enabling the organization to grow from experiences.
00:10:51.410 Manual processes hinder progress, so automating workflows becomes essential. The more tasks that can be automated, the less impediment there is to achieving goals. Embracing a DevOps culture leads to deployments that occur more frequently, resulting in faster shipments and pleased customers.
00:11:45.990 With a more rapid deployment pace comes a shorter mean time to resolution for problems, since the process allows for swift updates to production in response to customer feedback.
00:12:04.829 Incorporating continuous delivery practices prepares your organization to offer prompt changes to users.
00:12:19.350 The choice of tools utilized in your procedures has a significant impact on the organizational culture. A prevalent practice is to use version control systems like Git, ensuring that everything is stored in version control, enabling rebuilding and recovering systems easily.
00:13:02.879 This approach creates a single path of change, from idea to production, allowing for quick iterations and validation through acceptance environments. Continuous integration is key, involving consistent merging of changes to the master branch to prevent long-lived divergences.
00:14:01.160 The practice of pair programming, or 'two sets of eyes on every piece of code,' ensures quality and encourages collective accountability. Testing is critical within the Ruby community, especially unit tests, integration, and functional tests to ensure the software’s reliability.
00:15:51.040 During our demonstration, we will present a simple Rails application moving through the delivery pipeline.
00:16:04.000 The verification stage is vital, running every time a pull request is opened and ensuring that the code adheres to established guidelines and passes unit tests.
00:16:59.980 When using tools like RuboCop, ensure the team agrees on coding style and rules for consistency. Unit tests are pivotal, and tools such as RSpec facilitate writing comprehensive tests to assure code correctness.
00:19:06.420 Additionally, security testing is vital; tools like Brakeman help audit the application for vulnerabilities in dependencies.
00:20:15.100 Quality checks and assessments assist in maintaining standards across the development process. We will focus on the Chef Delivery tool and walk through its functionalities.
00:21:00.510 The pipeline includes several stages for transforming a code change into production, starting with the verification stage, resembling CI tools like Travis CI.
00:21:22.110 The verify stage reviews code, conducts lint tests, and unit tests to ensure compliance before escalating to human review.
00:22:10.770 After successful verification, we move into the build phase where local integration with the master branch is confirmed, preventing outdated code from being merged.
00:23:00.960 Subsequently, phase transitions to security checks and quality assurance using tools such as Breakman for security auditing.
00:23:49.710 The publish phase involves crafting a release artifact, which could be in various formats depending on the production environment. Testing should primarily occur in staging before live deployment to mitigate risks.
00:25:15.940 We will demonstrate how Chef Delivery assists in deploying applications to platforms like Heroku in an efficient manner.
00:25:38.890 The flexibility of Chef Delivery allows users to transition between environments, maintaining consistent processes whether deploying to Heroku or EC2.
00:26:51.340 In our proposed workflow, the primary goal is to create a release artifact that can be tested and approved in acceptance environments.
00:27:50.080 After successful testing, a human must approve the changes before delivery is made to production. The union environment serves as the integration point for all components to test their interactions.
00:28:54.440 Once all functional tests pass in the union, we enter the rehearsal phase to ensure the application behaves correctly. It's a safeguard to identify interactions that may lead to failures.
00:30:22.120 By utilizing Chef Delivery's UI, teams can manage and visualize their delivery processes effectively. By incorporating manual gates, we ensure human involvement to uphold quality standards. The session concludes with a Q&A to clarify concepts and practices discussed.