1 option
Mastering Go for DevOps : Master Building, Automating, and Scaling Cloud Infrastructure with Go.
- Format:
- Book
- Author/Creator:
- Polat, Engin.
- Language:
- English
- Subjects (All):
- Computer software--Development.
- Computer software.
- Go (Computer program language).
- Physical Description:
- 1 online resource (371 pages)
- Edition:
- 1st ed.
- Place of Publication:
- Birmingham : Packt Publishing, Limited, 2025.
- Summary:
- Build cloud native apps, Terraform providers, and scalable DevOps tools using Go in production grade systems Key Features Build scalable DevOps tools, APIs, and CLIs using Go Develop custom Terraform providers and test them with the SDK Integrate Prometheus metrics, AWS, and Azure cloud SDKs Purchase of the print or Kindle book includes a free.
- Contents:
- Cover
- Copyright Page
- Contributors
- Table Of Contents
- Preface
- Free Benefits with Your Book
- Part 1: Go Foundations - CLI, Monitoring, and APIs
- Chapter 1: Developing Command-Line Interfaces with Go
- Why Go is the perfect match for CLI development in DevOps
- Building reliable, user-friendly, and efficient CLI tools in Go
- Command parsing and argument handling
- Setting up cobra
- Creating the root command
- Adding subcommands
- Best practices
- Output formatting and user feedback
- Networking best practices
- Error handling and retries
- Securing connections
- Handling timeouts
- Rate limiting
- Best practices for building robust CLIs
- Designing intuitive command structures
- Effective error handling and feedback
- Testing for reliability
- Configuration management and flexibility
- Documentation and help messages
- Get This Book's PDF Version and Exclusive Extras
- Summary
- Chapter 2: Packaging and Distributing Go CLIs
- Building executable binaries for different platforms
- Understanding Go's compilation model
- Cross-compilation basics
- Handling platform-specific differences
- Building tags for platform-specific code
- External dependencies and tooling
- Optimizing binaries for distribution
- Automating the build process
- Testing built binaries
- Dockerizing CLI applications
- Introduction to Docker and its benefits
- Creating a Dockerfile for a Go CLI application
- Building the Docker image
- Running the Dockerized CLI application
- Optimizing the Docker image
- Using Docker Compose for local development
- Managing environment variables and configuration
- Best practices for Dockerizing CLI applications
- Chapter 3: Integrating Go Applications with Prometheus
- Introduction to monitoring and observability with Prometheus and Grafana.
- The role of monitoring and observability
- Prometheus: a robust monitoring solution
- Grafana: visualization and dashboarding
- The synergy between Prometheus and Grafana
- Setting up Prometheus and Grafana for Go applications
- Installing Prometheus
- Configuring Prometheus
- Instrumenting Go applications
- Installing Grafana
- Setting up Grafana dashboards
- Exposing metrics: instrumenting Go code
- Installing the Prometheus client library for Go
- Defining metrics
- Counters
- Gauges
- Histograms
- Summaries
- Organizing metrics in your application
- Encapsulating metrics
- Using middleware
- Introduction to alerting and incident response
- Setting up alertmanager
- Configuring alert rules in Prometheus
- Integrating Alertmanager with Prometheus
- Utilizing Go libraries for Prometheus and Grafana integration
- Prometheus client Go library
- Installing the library
- Exposing Metrics
- Grafana libraries for visualization
- Grafana API
- Using Grafana Terraform provider
- Additional libraries and tools
- Best practices for using Go libraries
- Chapter 4: Writing Go Exporters for Prometheus
- Understanding exporters and their role in Prometheus
- What is an exporter?
- Types of exporters
- Official exporters
- Custom exporters
- How exporters work
- Why use exporters?
- Challenges of using exporters
- Design principles for custom metrics exporters
- Keep it simple and focused
- Use Prometheus metric types correctly
- Minimize performance impact
- Ensure data accuracy and consistency
- Make the exporter configurable
- Implement proper error handling
- Secure the exporter
- Document and maintain the exporter
- Implementing metric types: Counters, gauges, and histograms
- Implementing counters
- Implementing gauges.
- Implementing histograms
- Ensuring data accuracy and performance
- Avoiding missing or incomplete data
- Reducing memory and CPU usage
- Handling high traffic load
- Testing and deploying exporters
- Unit testing exporters
- Integration testing with Prometheus
- Containerizing the exporter
- Automating deployment with Kubernetes
- Chapter 5: Building and Consuming RESTful APIs with Go
- Setting up a basic API server with Go
- Setting up a project
- Creating the API server
- Creating the URL shortening logic
- Adding routes
- Testing the API
- Handling requests and responses
- Understanding HTTP methods and JSON handling
- Validating incoming data
- Improving error responses
- Handling GET requests and redirects
- Enhancing response structure
- Adding routes to main.go
- Managing routing and middleware
- How middleware works
- Logging middleware
- Adding authentication middleware
- Rate-limiting middleware
- Combining middleware
- Testing middleware in Go
- Consuming external APIs and integrating data
- Creating the middleware for URL validation
- Best practice: Don't hardcode secrets!
- Creating the URL shortener with metrics integration
- Integrating Prometheus metrics
- Chapter 6: Working with gRPC and Microservices Architecture
- Defining service contracts with Protocol Buffers
- Accessing generated types and methods
- Creating a gRPC server
- Creating a gRPC client
- Best practices for defining Protobuf files
- Implementing streaming with gRPC
- Overview of gRPC streaming
- Defining gRPC streaming methods
- Implementing server-side streaming
- Implementing the client for server streaming
- Implementing client-side streaming
- Implementing the client for client streaming
- Implementing bidirectional streaming.
- Implementing the client for bidirectional streaming
- Running the gRPC server and client
- Running the gRPC server
- Running the gRPC client
- What to expect for each streaming type
- Best practices for gRPC in microservices
- Efficient connection management and load balancing
- Connection pooling
- Implementing load balancing
- Proper error handling and retries
- Basic error handling in the client
- Implementing retries with backoff
- Enabling security with TLS
- Enabling TLS on the server
- Configuring TLS on the client
- Using deadlines and timeouts
- Versioning gRPC services
- Monitoring and logging gRPC requests
- Part 2: Build Custom Terraform Providers with Go
- Chapter 7: Using Go to Build Custom Terraform Providers
- Introduction to Terraform providers and the provider model
- What is a Terraform provider?
- The Terraform provider model
- Setting up the project structure
- Why this design
- Defining the provider
- Defining resources
- Implementing CRUD operations
- Configuring the provider
- Writing tests for the provider
- Implementing CRUD operations for resources
- Defining the resource schema
- Implementing the create operation
- Implementing the Read operation
- Implementing the Update operation
- Implementing the Delete operation
- Testing CRUD operations
- Managing resource state and handling the lifecycle
- Understanding Terraform resource state
- Create operation with state management
- Read operation to maintain state
- Update operation with state tracking
- Delete operation and state cleanup
- Handling lifecycle hooks
- Implementing resource import
- Chapter 8: Writing Unit Tests and Integration Tests for Terraform Providers
- Writing unit tests for resource CRUD operations
- Setting up the environment
- Writing unit tests for CRUD operations.
- Testing the Create operation
- Testing the Read operation
- Testing the Update operation
- Testing the Delete operation
- Running the unit tests
- Mocking API calls for effective testing
- Why mock API calls?
- Setting up a mock HTTP server
- Mocking HTTP requests with http.Client
- Using httptest to mock API responses
- Mocking API calls with interfaces
- Using gomock for advanced mocking
- Using mocks in tests
- Chapter 9: Documenting and Publishing Terraform Providers
- Generating provider documentation
- Setting up the environment for tfplugindocs
- Customizing the documentation
- Generating documentation for a resource
- Best practices for writing provider documentation
- Organizing documentation effectively
- Writing a helpful example usage
- Explaining arguments clearly
- Documenting computed attributes
- Providing multiple examples
- Be explicit about defaults and optional behavior
- Clarifying import behavior
- Keeping changelogs relevant to docs
- Using consistent terminology
- Providing complete context in data sources
- Using comments in code samples when helpful
- Avoiding redundancy across resources
- Validating with real users
- Implementing provider versioning and changelogs
- Understanding semantic versioning
- Using Git tags to version the provider
- Writing a changelog
- Automating changelog creation
- Versioning and Terraform Registry
- Keeping the changelog up to date
- Publishing to the public Terraform Registry
- Understanding the registry requirements
- Registering the provider
- Validating the provider manifest
- Registry UI and metadata
- Managing multiple versions
- Publishing to a private Terraform registry for internal consumption
- Chapter 10: Automating Testing in Pipelines.
- Setting up GitHub Actions for Terraform testing.
- Notes:
- Description based on publisher supplied metadata and other sources.
- ISBN:
- 1-83702-732-3
- 9781837027323
- OCLC:
- 1552154240
- Publisher Number:
- CIPO000306528
The Penn Libraries is committed to describing library materials using current, accurate, and responsible language. If you discover outdated or inaccurate language, please fill out this feedback form to report it and suggest alternative language.