DevOps in Python: Infrastructure as Python
Book information
Description
Take advantage of Python to automate complex systems with readable code. This new edition will help you move from operations/system administration into easy-to-learn coding. You'll start by writing command-line scripts and automating simple DevOps-style tasks followed by creating reliable and fast unit tests designed to avoid incidents caused by buggy automation. You’ll then move on to more advanced cases, like using Jupyter as an auditable remote-control panel and writing Ansible and Salt extensions. The updated information in this book covers best practices for deploying and updating Python applications. This includes Docker, modern Python packaging, and internal Python package repositories. You'll also see how to use the AWS API, and the Kubernetes API, and how to automate Docker container image building and running. Finally, you'll work with Terraform from Python to allow more flexible templating and customization of environments. What You'll LearnUnderstand operating system automation with PythonPackage Python applicationsUse Python as a DevOps consoleReview Cloud automation with PythonWho This Book Is For DevOps engineer. Site Reliability Engineer, or similar (including Platform, Production, and Systems), and whose organization uses Python. Table of Contents About the Author About the Technical Reviewer Acknowledgments Introduction Chapter 1: Installing Python 1.1 OS Packages 1.2 Using pyenv 1.3 Building Python from Source 1.4 PyPy 1.5 Anaconda 1.6 Summary Chapter 2: Packaging 2.1 Virtual Environments 2.2 pip 2.3 Setup and Wheels 2.4 Binary Wheels 2.5 manylinux Wheels 2.5.1 Self-Contained Wheels 2.5.2 Portable Wheels 2.5.3 manylinux Containers 2.5.4 Installing manylinux Wheels 2.6 tox 2.6.1 One Environment 2.6.2 Multiple Environments 2.6.3 Multiple Differently Configured Environments 2.7 Pip Tools 2.8 Poetry 2.8.1 Installing 2.8.2 Creating 2.8.3 Dependencies 2.8.4 Developing 2.8.5 Building 2.9 Pipenv 2.10 DevPI 2.11 pex and shiv 2.11.1 pex 2.11.2 shiv 2.12 Summary Chapter 3: Interactive Usage 3.1 Native Console 3.2 The Code Module 3.3 ptpython 3.4 IPython 3.5 JupyterLab 3.6 Summary Chapter 4: OS Automation 4.1 Files 4.2 Processes 4.3 Networking 4.4 Summary Chapter 5: Testing 5.1 Unit Testing 5.2 Mocks, Stubs, and Fakes 5.3 Testing Files 5.3.1 Testing with Subdirectories 5.3.2 Accelerating Tests with eatmydata 5.3.3 Accelerating Tests with tmpfs 5.4 Testing Processes 5.5 Testing Networking 5.6 Testing HTTP Clients Chapter 6: Text Manipulation 6.1 Bytes, Strings, and Unicode 6.2 Strings 6.3 Regular Expressions 6.4 JSON 6.5 CSV 6.6 Summary Chapter 7: HTTPX 7.1 Clients 7.2 REST 7.3 Security 7.4 Authentication 7.5 Async client 7.6 Summary Chapter 8: Cryptography 8.1 Fernet 8.2 PyNaCl 8.3 Passlib 8.4 TLS Certificates 8.5 Summary Chapter 9: Paramiko 9.1 SSH Security 9.2 Client Keys 9.3 Host Identity 9.4 Connecting 9.5 Running Commands 9.6 Remote Files 9.6.1 Metadata Management 9.6.2 Upload 9.6.3 Download 9.7 Summary Chapter 10: SaltStack 10.1 Salt Basics 10.2 Salt Concepts 10.3 Salt Formats 10.4 Salt Extensions 10.4.1 States 10.4.2 Execution 10.4.3 Utility 10.4.4 Extra Third-Party Dependencies 10.5 Summary Chapter 11: Ansible 11.1 Ansible Basics 11.2 Ansible Concepts 11.3 Ansible Extensions 11.4 Summary Chapter 12: Containers 12.1 Choosing a Base Image 12.1.1 GNU C Library Support 12.1.2 Long-Term Support 12.1.3 Avoiding Unexpected Changes 12.2 Installing the Python Interpreter 12.2.1 conda 12.2.2 Third-Party Repositories 12.2.3 Building Python in the Container 12.2.4 Python Base Image 12.3 Installing Python Applications 12.4 Optimizing Container Build Cache 12.5 Rebuilding Containers 12.6 Container Security 12.7 Summary Chapter 13: Amazon Web Services 13.1 Security 13.1.1 Configuring Access Keys 13.1.2 Creating Short-Term Tokens 13.2 Elastic Computing Cloud (EC2) 13.2.1 Regions 13.2.2 Amazon Machine Images 13.2.3 SSH Keys 13.2.4 Bringing up Machines 13.2.5 Securely Logging In 13.2.6 Building Images 13.3 Simple Storage Service (S3) 13.3.1 Managing Buckets 13.4 Summary Chapter 14: Kubernetes 14.1 Pods 14.1.1 Liveness and Readiness 14.1.2 Configuration Environment Variables Configuration Files Secrets 14.1.3 Python Sidecars 14.2 REST API 14.3 Operators 14.3.1 Permissions 14.3.2 Custom Types 14.3.3 Retrieval 14.3.4 Goal State 14.3.5 Comparison 14.3.6 Reconciliation 14.3.7 Combining the Pieces 14.4 Summary Chapter 15: Terraform 15.1 JSON Syntax 15.2 Generating Terraform Configurations 15.3 Summary Index
Similar books
DevOps in Python: Infrastructure as Python
2022 · PDF
DevOps in Python: Infrastructure as Python
2022 · PDF
Expert Twisted: Event-Driven and Asynchronous Programming with Python
2019 · EPUB
Expert Twisted: Event-Driven and Asynchronous Programming with Python
2019 · PDF
EXCEL 2023 CRASH COURSE: Master Excel 2023 With This Complete Crash Course In 7 Days
2022 · EPUB
The arraignment and tryall with a declaration of the Ranters also, several sentences proceedings at the sessions in the Old-Baily, and Councel of War: their protestations and the hanging of one up by the thumbs; with divers penalties to be inflicted upon others. The dancing and revelling of Dr. Buckeridge and his wife, and other gent. dancing all in white, in Berkshire, and their Christmas carol. A dispute between a Ranter in Bridewel, and one that came to see him; with his creed and pater noster: and the names of the false gods they worship. As also, a list of many of the Ranters, from whence they are derived: and of many hundreds of them in England
2019 · EPUB
The discoverer; vvherein is set forth (to undeceive the nation) the reall plots and stratagems of Lievt. Col. John Lilburn, Mr. William Walwyn, Mr. Thomas Prince, Mr. Richard Overton, and that partie ... Namely, under the pretence and colour of libertie ... a most dangerous and destructive designe is carried on to deprive the nation of their religion, rights, liberties, proprieties, lawes, government, &c. and to bring a totall and universall ruine upon the land. And so much is here clearely proved. The first part
2019 · EPUB
An act to impower Sir John Molesworth: Baronet, and Joseph Moyle, Esquire, Two of the surviving Trustees, in an Indenture, dated the Twenty-Fifth Day of December One thousand Seven hundred and Forty-Three, to raise the several Sums in the said Indenture mentioned, or such of them as are still unsatisfied, and pay the same, as well as the rest of the personal Estate of Hugh Gregor, deceased, to such Person as Jane Gregor, an Infant, shall marry during her Infancy, with the Consent of the surviving Trustees, and of her Guardians
EPUB