This repository contains the source code for Engineering Elixir Applications by Ellie and Pep. The book is published by Pragmatic Bookshelf.
The source code is separated into the 12 different chapters of the book. The code in each chapter is further divided into the different sections/themes. The chapters have been structured as follows:
This code sets up the foundation for the journey, providing scripts to get started with the tools and concepts covered throughout the book.
- Introduction to the Journey: Scripts for initial setup. (pp. 1-12)
Automate GitHub repository setup using Terraform.
- Initial Setup (pp. 13-25)
- Local Values (pp. 26-28)
- Initial Milestones Setup (pp. 29-30)
- Milestones with Variables (pp. 31-37)
- Labels (pp. 38-42)
- Resource Dependencies (p. 43)
- Issues (pp. 44-48)
- Extra Mile
- Final Version
This chapter guides you through creating a Dockerized Phoenix LiveView application.
- FROM (pp. 49-63)
- ARGS (pp. 64-66)
- Compile Dependencies (pp. 67-69)
- Release Configuration (p. 70)
- Mix Release (pp. 71-73)
- Multi-Stage Builds (pp. 74-78)
Learn to create robust CI/CD pipelines using GitHub Actions.
- Failing Mix Compile (pp. 79-81)
- Successful Mix Compile (pp. 82-87)
- Caching Dependencies (pp. 88-91)
- Conditional Steps (pp. 92-93)
- Failing Mix Test (pp. 94-95)
- Successful Mix Test
- Failing Mix Format (p. 96)
- Successful Mix Format (p. 97)
- Failing Dialyzer (pp. 98-99)
- Successful Dialyzer (pp. 100-101)
- Unused Dependencies (pp. 102-105)
- Build Docker (pp. 106-109)
- Cache Docker Build (pp. 110-112)
- Multi-Arch Builds (pp. 113-115)
- Triggers (pp. 116-118)
- Extra Mile
Set up a development environment with Docker Compose.
- Installing Phoenix with Ecto (pp. 119-134)
- Simple Postgres Setup (pp. 135-136)
- Postgres Ports Published (Hardcoded) (pp. 137-138)
- Postgres Ports Published
- Postgres Pinned Version (pp. 139-141)
- Postgres with Explicit Volume definition (pp. 142-144)
- Adding Phoenix to Compose (pp. 145-147)
- Updating Your CI Pipeline (pp. 148-156)
- Extra Mile
This chapter shows how to set up a robust production environment using Packer to build machine images.
- EC2 Import - Part 1 (pp. 157-172)
- EC2 Import - Part 2 (p. 173)
- EC2 Import - Part 3 (pp. 174-175)
- EC2 Import - Part 4 (p. 176)
- SG Import - Part 1 (pp. 177-180)
- SG Import - Part 2 (p. 181)
- VPC and Subnet Config (pp. 182-183)
- Key Pair Import (pp. 184-189)
- Bootstrap EC2 (pp. 190-191)
- Packer Introduction (pp. 192-196)
- Packer Refactor (pp. 197-200)
- Final Version (pp. 201-208)
- Extra Mile
Learn to securely manage repository secrets and automate deployments.
- Postgres Secret (pp. 209-213)
- Web Secrets - Part 1 (pp. 214-218)
- Web Secrets - Part 2 (pp. 219-221)
- SOPS (pp. 222-229)
- Secrets Decrypt Script (pp. 230-231)
- Convenience Script (pp. 232-236)
- GitHub Secrets (pp. 237-241)
- Deployment Action (pp. 242-246)
- Contributing Workflow (pp. 247-250)
- Extra Mile
Build a highly available Docker Swarm using AWS.
- Multiple EC2 Instances (pp. 251-254)
- Multi-Node Swarm (pp. 255-266)
- Initialize Script (pp. 267-272)
- Join Script - Part 1 (pp. 273-275)
- Join Script - Part 2 (p. 276)
- Join Script - Part 3
- Initial Deployment Automation (pp. 277-284)
Explore the power of distributed systems.
- Connect Multiple Releases (pp. 285-309)
This chapter shows how to create robust, scalable deployments with AWS.
- Autoscaling Groups (pp. 310-317)
- One Script to Rule Them All - Part 1 (pp. 318-321)
- One Script to Rule Them All - Part 2 (pp. 322-324)
- Implement Autoscaling (pp. 325-333)
- Trigger Autoscaling (pp. 334-337)
- Load Balancers (pp. 338-342)
- Automatic Rollbacks (pp. 343-346)
- Housekeeping Tasks (pp. 347-351)
Learn to monitor your Elixir applications effectively.
- Add Logs (pp. 352-360)
- Metrics and Promex (pp. 371-377)
- Metrics and Grafana Dashboards (pp. 378-385)
- Extra Mile
Go beyond defaults to customize metrics and alerts.
- Custom PromEx Plugin (pp. 386-398)
- Custom Dashboard (pp. 399-404)
- Custom Alerts (pp. 405-410)
- Final Version (pp. 411-413)
- Extra Mile
Made with ❤️ by Ellie & Pep.