SlideShare a Scribd company logo
1 of 19
Elixir/Phoenix Umbrella App
Package |> Release |> Deploy
with Distillery Docker Docker-Compose
Yeong Sheng, Tan
tanyeongsheng@gmail.com
@yeongsheng
Who Is This Dude?
● Ruckus Wireless (now part of Brocade)
● WiFi Access Points (AP) and AP Controller/Manager
● Acquired by Brocade - Campus Switch product offering
● WiFi location based device detection and Analytics
● Campus Switch Management/Monitoring and Metrics publishing platform
● WE ARE HIRING!!!
Intent:
Sharing the lessons I learnt packaging and
deploying an Elixir/Phoenix Application using
distillery packaged into docker container and
run and orchestrated with docker-compose
Desired Outcome:
1. Configure and build an Elixir/Phoenix
release package
2. Basic understanding of a docker container
3. Build a target env container that packages
your app
4. Run your app in the target env container
orchestrated using docker-compose
Tools of the Trade
macOS with Homebrew
Erlang 19.3 + Elixir 1.4.2 + Phoenix 1.3
docker for macOS
docker-compose
Phoenix Umbrella app
bitwalker/distillery hex package
What is distillery?
Both Exrm and Distillery from Paul
Schoenfelder: @gotbones
Modern rewrite of Exrm - which relies on
Relx (meant for Erlang apps)
Support for umbrella projects and multi-
app/per-app release build
Support for release env and profiles
Event hooks, custom commands, EEx
overlay templates
What is docker?
DevOps 2016
Promise of Build, Ship, Run any App
Anywhere!
Not VMs!!! Feather-lite VMs - smaller &
faster
Contract between Dev and Ops/Infra
Infra as code - blurred lines with config
management/provisioning eco-
system like salt-stack, puppet,
terraform, etc
chroot on steroids - runc, lxc, cgroups
likes of FreeBSD/Solaris jails,
AIX mini-partitions
What is docker-
compose?
Microservice single-purpose container
Container orchestration within a single host -
similar to K8 pods
Build-Scale-Heal
docker-compose build
docker-compose scale SERVICE=3
docker-compose up -d
docker-compose ps
docker-compose stop && docker-compose rm -
v
docker-compose.yml
services, networks, dependencies
Multi-host orchestration -> K8 or Mesos
Setup
Install phoenix-1.3
1. Setup phoenix umbrella app
2. Fetch and compile hex deps
3. Init distillery rel config
4. Test run app locally
a. http://localhost:4000
Release Config
1. Init release config
2. Define rel/config.exs
a. environment :prod
b. include_erts: true
c. release :umbrella_app_name
d. vm.args
3. Execute ‘release’
4. Built artifacts location _build/:env
Build App Docker Image
1. Demo App context
a. SNMP, GPB and MQTT
2. Base image elixir:1.4.2
3. ENV
a. LANG=en_US.UTF-8, LC_ALL=${LANG}
b. MIX_ENV=prod
c. REPLACE_OS_VARS=true
4. Execute `docker build -f Dockerfile -t name/tag .`
Run built App Docker Image
1. Execute `docker run -d --name app_cont_name -p 1883:1883 -it name/tag
/opt/app/bin/rna_umbrella foreground`
2. Check running container status
a. `docker logs app_cont_name`
3. What went wrong?
4. docker-compose
Container orchestration
1. docker-compose.yml
2. Docker network
3. Container startup dependency chain
4. Execute `docker-compose up -d`
5. Check running containers statuses
a. `docker logs app_cont_name`
b. `docker logs postgres_1`
c. `docker logs mosquitto_broker1_1`
mix_docker Build-Release flow
1. Define new mix hex dep ‘mix_docker’
2. Execute `mix docker.init`
3. Customise mix_docker config: `mix docker.customise`
4. Define Dockerfile.build and Dockerfile.release
5. Execute `mix docker.build`
6. Execute `docker-compose up -d`
7. Execute `mix docker.release`
8. Run the container
Iterate with smaller images + mix_docker flow
1. What can be done better in previous approaches?
2. Alpine Linux - apk vs apt-get/yum
3. Define docker build step to compile and `mix release`
4. Copy release package tarball with ERTS to S3, binary repo, etc
5. Define docker release step
6. Download/Copy release package tarball and explode in release container
7. Use docker-compose to stitch and orchestrate containers to run app suite
Conclusion:
1. Distillery release profiles
2. Size of container matters
3. Decouple build and release container images
4. Single purpose docker runtime container
5. docker-compose for container orchestration
Feedback
Q&A
What next:
1. mix_docker release profiles for docker-release per app in umbrella
app - rolled my own with bash script
2. Overlay network and DNS Service discovery to enable cross
containers and physical machine BEAM processes connectivity
3. Hot upgrade-releases with distillery (still relevant in docker
deployments???)
4. Multi-host deployments and service orchestration with K8
Thank you for your time and kind patience
Acknowledgements:
● Zsolt Molnar
● Yos Riady
● Benjamin Tan W.H
● Paul Schoenfelder
● Tymon Tobolsk
● Paul Lamb
● Pete Corey
● Dmitry Rubinstein
● Michael Klein

More Related Content

What's hot

Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and A...
Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and A...Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and A...
Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and A...Alexey Petrov
 
Dockerize your Symfony application - Symfony Live NYC 2014
Dockerize your Symfony application - Symfony Live NYC 2014Dockerize your Symfony application - Symfony Live NYC 2014
Dockerize your Symfony application - Symfony Live NYC 2014André Rømcke
 
What’s New in Docker - Victor Vieux, Docker
What’s New in Docker - Victor Vieux, DockerWhat’s New in Docker - Victor Vieux, Docker
What’s New in Docker - Victor Vieux, DockerDocker, Inc.
 
Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.)
Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.)Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.)
Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.)Nils De Moor
 
Docker Command Line, Using and Choosing containers
Docker Command Line, Using and Choosing containers Docker Command Line, Using and Choosing containers
Docker Command Line, Using and Choosing containers Will Hall
 
Developer South Coast 2018: Modernizing .NET Apps with Docker
Developer South Coast 2018: Modernizing .NET Apps with DockerDeveloper South Coast 2018: Modernizing .NET Apps with Docker
Developer South Coast 2018: Modernizing .NET Apps with DockerElton Stoneman
 
CI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
CI and CD at Scale: Scaling Jenkins with Docker and Apache MesosCI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
CI and CD at Scale: Scaling Jenkins with Docker and Apache MesosCarlos Sanchez
 
Docker on Google App Engine
Docker on Google App EngineDocker on Google App Engine
Docker on Google App EngineDocker, Inc.
 
Docker Commands With Examples | Docker Tutorial | DevOps Tutorial | Docker Tr...
Docker Commands With Examples | Docker Tutorial | DevOps Tutorial | Docker Tr...Docker Commands With Examples | Docker Tutorial | DevOps Tutorial | Docker Tr...
Docker Commands With Examples | Docker Tutorial | DevOps Tutorial | Docker Tr...Edureka!
 
Building Reusable Development Environments with Docker
Building Reusable Development Environments with DockerBuilding Reusable Development Environments with Docker
Building Reusable Development Environments with DockerRevelation Technologies
 
Continous delivery at docker age
Continous delivery at docker ageContinous delivery at docker age
Continous delivery at docker ageAdrien Blind
 
Docker : Container Virtualization
Docker : Container VirtualizationDocker : Container Virtualization
Docker : Container VirtualizationRanjan Baisak
 
Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...
Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...
Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...Carlos Sanchez
 
The Golden Ticket: Docker and High Security Microservices by Aaron Grattafiori
The Golden Ticket: Docker and High Security Microservices by Aaron GrattafioriThe Golden Ticket: Docker and High Security Microservices by Aaron Grattafiori
The Golden Ticket: Docker and High Security Microservices by Aaron GrattafioriDocker, Inc.
 
Delivering eBay's CI Solution with Apache Mesos & Docker - DockerCon 2014
Delivering eBay's CI Solution with Apache Mesos & Docker - DockerCon 2014Delivering eBay's CI Solution with Apache Mesos & Docker - DockerCon 2014
Delivering eBay's CI Solution with Apache Mesos & Docker - DockerCon 2014ahunnargikar
 
Testing Distributed Micro Services. Agile Testing Days 2017
Testing Distributed Micro Services. Agile Testing Days 2017Testing Distributed Micro Services. Agile Testing Days 2017
Testing Distributed Micro Services. Agile Testing Days 2017Carlos Sanchez
 
Getting Started with Azure Kubernetes Service
Getting Started with Azure Kubernetes ServiceGetting Started with Azure Kubernetes Service
Getting Started with Azure Kubernetes ServiceSean Whitesell
 
How to Improve Your Image Builds Using Advance Docker Build
How to Improve Your Image Builds Using Advance Docker BuildHow to Improve Your Image Builds Using Advance Docker Build
How to Improve Your Image Builds Using Advance Docker BuildDocker, Inc.
 

What's hot (20)

Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and A...
Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and A...Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and A...
Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and A...
 
Dockerize your Symfony application - Symfony Live NYC 2014
Dockerize your Symfony application - Symfony Live NYC 2014Dockerize your Symfony application - Symfony Live NYC 2014
Dockerize your Symfony application - Symfony Live NYC 2014
 
What’s New in Docker - Victor Vieux, Docker
What’s New in Docker - Victor Vieux, DockerWhat’s New in Docker - Victor Vieux, Docker
What’s New in Docker - Victor Vieux, Docker
 
Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.)
Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.)Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.)
Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.)
 
Docker Command Line, Using and Choosing containers
Docker Command Line, Using and Choosing containers Docker Command Line, Using and Choosing containers
Docker Command Line, Using and Choosing containers
 
Developer South Coast 2018: Modernizing .NET Apps with Docker
Developer South Coast 2018: Modernizing .NET Apps with DockerDeveloper South Coast 2018: Modernizing .NET Apps with Docker
Developer South Coast 2018: Modernizing .NET Apps with Docker
 
CI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
CI and CD at Scale: Scaling Jenkins with Docker and Apache MesosCI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
CI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
 
Docker on Google App Engine
Docker on Google App EngineDocker on Google App Engine
Docker on Google App Engine
 
Docker Commands With Examples | Docker Tutorial | DevOps Tutorial | Docker Tr...
Docker Commands With Examples | Docker Tutorial | DevOps Tutorial | Docker Tr...Docker Commands With Examples | Docker Tutorial | DevOps Tutorial | Docker Tr...
Docker Commands With Examples | Docker Tutorial | DevOps Tutorial | Docker Tr...
 
Building Reusable Development Environments with Docker
Building Reusable Development Environments with DockerBuilding Reusable Development Environments with Docker
Building Reusable Development Environments with Docker
 
Continous delivery at docker age
Continous delivery at docker ageContinous delivery at docker age
Continous delivery at docker age
 
Docker : Container Virtualization
Docker : Container VirtualizationDocker : Container Virtualization
Docker : Container Virtualization
 
Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...
Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...
Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...
 
The Golden Ticket: Docker and High Security Microservices by Aaron Grattafiori
The Golden Ticket: Docker and High Security Microservices by Aaron GrattafioriThe Golden Ticket: Docker and High Security Microservices by Aaron Grattafiori
The Golden Ticket: Docker and High Security Microservices by Aaron Grattafiori
 
Delivering eBay's CI Solution with Apache Mesos & Docker - DockerCon 2014
Delivering eBay's CI Solution with Apache Mesos & Docker - DockerCon 2014Delivering eBay's CI Solution with Apache Mesos & Docker - DockerCon 2014
Delivering eBay's CI Solution with Apache Mesos & Docker - DockerCon 2014
 
Docker orchestration
Docker orchestrationDocker orchestration
Docker orchestration
 
Docker for a .NET web developer
Docker for a .NET web developerDocker for a .NET web developer
Docker for a .NET web developer
 
Testing Distributed Micro Services. Agile Testing Days 2017
Testing Distributed Micro Services. Agile Testing Days 2017Testing Distributed Micro Services. Agile Testing Days 2017
Testing Distributed Micro Services. Agile Testing Days 2017
 
Getting Started with Azure Kubernetes Service
Getting Started with Azure Kubernetes ServiceGetting Started with Azure Kubernetes Service
Getting Started with Azure Kubernetes Service
 
How to Improve Your Image Builds Using Advance Docker Build
How to Improve Your Image Builds Using Advance Docker BuildHow to Improve Your Image Builds Using Advance Docker Build
How to Improve Your Image Builds Using Advance Docker Build
 

Similar to Phoenix 1.3 Umbrella App deployment via Distillery-Docker-Docker_Compose

時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇Philip Zheng
 
Docker Basic to Advance
Docker Basic to AdvanceDocker Basic to Advance
Docker Basic to AdvanceParas Jain
 
Docker workshop 0507 Taichung
Docker workshop 0507 Taichung Docker workshop 0507 Taichung
Docker workshop 0507 Taichung Paul Chao
 
手把手帶你學 Docker 入門篇
手把手帶你學 Docker 入門篇手把手帶你學 Docker 入門篇
手把手帶你學 Docker 入門篇Philip Zheng
 
Docker and containers - Presentation Slides by Priyadarshini Anand
Docker and containers - Presentation Slides by Priyadarshini AnandDocker and containers - Presentation Slides by Priyadarshini Anand
Docker and containers - Presentation Slides by Priyadarshini AnandPRIYADARSHINI ANAND
 
BBL Premiers pas avec Docker
BBL Premiers pas avec DockerBBL Premiers pas avec Docker
BBL Premiers pas avec Dockerkanedafromparis
 
Docker: A New Way to Turbocharging Your Apps Development
Docker: A New Way to Turbocharging Your Apps DevelopmentDocker: A New Way to Turbocharging Your Apps Development
Docker: A New Way to Turbocharging Your Apps Developmentmsyukor
 
[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안양재동 코드랩
 
14309525_docker_docker_docker_docker_introduction.ppt
14309525_docker_docker_docker_docker_introduction.ppt14309525_docker_docker_docker_docker_introduction.ppt
14309525_docker_docker_docker_docker_introduction.pptaravym456
 
PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...
PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...
PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...Puppet
 
手把手帶你學Docker 03042017
手把手帶你學Docker 03042017手把手帶你學Docker 03042017
手把手帶你學Docker 03042017Paul Chao
 
Setup docker on existing application
Setup docker on existing applicationSetup docker on existing application
Setup docker on existing applicationLuc Juggery
 
Faster and Easier Software Development using Docker Platform
Faster and Easier Software Development using Docker PlatformFaster and Easier Software Development using Docker Platform
Faster and Easier Software Development using Docker Platformmsyukor
 
Docker for developers
Docker for developersDocker for developers
Docker for developersandrzejsydor
 
Develop with docker 2014 aug
Develop with docker 2014 augDevelop with docker 2014 aug
Develop with docker 2014 augVincent De Smet
 
containers and virtualization tools ( Docker )
containers and virtualization tools ( Docker )containers and virtualization tools ( Docker )
containers and virtualization tools ( Docker )Imo Inyang
 
Accelerate your development with Docker
Accelerate your development with DockerAccelerate your development with Docker
Accelerate your development with DockerAndrey Hristov
 
Accelerate your software development with Docker
Accelerate your software development with DockerAccelerate your software development with Docker
Accelerate your software development with DockerAndrey Hristov
 

Similar to Phoenix 1.3 Umbrella App deployment via Distillery-Docker-Docker_Compose (20)

時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇
 
Docker Basic to Advance
Docker Basic to AdvanceDocker Basic to Advance
Docker Basic to Advance
 
Docker workshop 0507 Taichung
Docker workshop 0507 Taichung Docker workshop 0507 Taichung
Docker workshop 0507 Taichung
 
手把手帶你學 Docker 入門篇
手把手帶你學 Docker 入門篇手把手帶你學 Docker 入門篇
手把手帶你學 Docker 入門篇
 
Docker and containers - Presentation Slides by Priyadarshini Anand
Docker and containers - Presentation Slides by Priyadarshini AnandDocker and containers - Presentation Slides by Priyadarshini Anand
Docker and containers - Presentation Slides by Priyadarshini Anand
 
BBL Premiers pas avec Docker
BBL Premiers pas avec DockerBBL Premiers pas avec Docker
BBL Premiers pas avec Docker
 
Docker: A New Way to Turbocharging Your Apps Development
Docker: A New Way to Turbocharging Your Apps DevelopmentDocker: A New Way to Turbocharging Your Apps Development
Docker: A New Way to Turbocharging Your Apps Development
 
[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안
 
14309525_docker_docker_docker_docker_introduction.ppt
14309525_docker_docker_docker_docker_introduction.ppt14309525_docker_docker_docker_docker_introduction.ppt
14309525_docker_docker_docker_docker_introduction.ppt
 
PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...
PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...
PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...
 
手把手帶你學Docker 03042017
手把手帶你學Docker 03042017手把手帶你學Docker 03042017
手把手帶你學Docker 03042017
 
Setup docker on existing application
Setup docker on existing applicationSetup docker on existing application
Setup docker on existing application
 
Faster and Easier Software Development using Docker Platform
Faster and Easier Software Development using Docker PlatformFaster and Easier Software Development using Docker Platform
Faster and Easier Software Development using Docker Platform
 
Docker for developers
Docker for developersDocker for developers
Docker for developers
 
Develop with docker 2014 aug
Develop with docker 2014 augDevelop with docker 2014 aug
Develop with docker 2014 aug
 
Docker
DockerDocker
Docker
 
Docker intro
Docker introDocker intro
Docker intro
 
containers and virtualization tools ( Docker )
containers and virtualization tools ( Docker )containers and virtualization tools ( Docker )
containers and virtualization tools ( Docker )
 
Accelerate your development with Docker
Accelerate your development with DockerAccelerate your development with Docker
Accelerate your development with Docker
 
Accelerate your software development with Docker
Accelerate your software development with DockerAccelerate your software development with Docker
Accelerate your software development with Docker
 

Recently uploaded

Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfLivetecs LLC
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
Best Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfBest Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfIdiosysTechnologies1
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....kzayra69
 

Recently uploaded (20)

Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdf
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Best Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfBest Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdf
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
 

Phoenix 1.3 Umbrella App deployment via Distillery-Docker-Docker_Compose

  • 1. Elixir/Phoenix Umbrella App Package |> Release |> Deploy with Distillery Docker Docker-Compose Yeong Sheng, Tan tanyeongsheng@gmail.com @yeongsheng
  • 2. Who Is This Dude? ● Ruckus Wireless (now part of Brocade) ● WiFi Access Points (AP) and AP Controller/Manager ● Acquired by Brocade - Campus Switch product offering ● WiFi location based device detection and Analytics ● Campus Switch Management/Monitoring and Metrics publishing platform ● WE ARE HIRING!!!
  • 3. Intent: Sharing the lessons I learnt packaging and deploying an Elixir/Phoenix Application using distillery packaged into docker container and run and orchestrated with docker-compose
  • 4. Desired Outcome: 1. Configure and build an Elixir/Phoenix release package 2. Basic understanding of a docker container 3. Build a target env container that packages your app 4. Run your app in the target env container orchestrated using docker-compose
  • 5. Tools of the Trade macOS with Homebrew Erlang 19.3 + Elixir 1.4.2 + Phoenix 1.3 docker for macOS docker-compose Phoenix Umbrella app bitwalker/distillery hex package
  • 6. What is distillery? Both Exrm and Distillery from Paul Schoenfelder: @gotbones Modern rewrite of Exrm - which relies on Relx (meant for Erlang apps) Support for umbrella projects and multi- app/per-app release build Support for release env and profiles Event hooks, custom commands, EEx overlay templates
  • 7. What is docker? DevOps 2016 Promise of Build, Ship, Run any App Anywhere! Not VMs!!! Feather-lite VMs - smaller & faster Contract between Dev and Ops/Infra Infra as code - blurred lines with config management/provisioning eco- system like salt-stack, puppet, terraform, etc chroot on steroids - runc, lxc, cgroups likes of FreeBSD/Solaris jails, AIX mini-partitions
  • 8. What is docker- compose? Microservice single-purpose container Container orchestration within a single host - similar to K8 pods Build-Scale-Heal docker-compose build docker-compose scale SERVICE=3 docker-compose up -d docker-compose ps docker-compose stop && docker-compose rm - v docker-compose.yml services, networks, dependencies Multi-host orchestration -> K8 or Mesos
  • 9. Setup Install phoenix-1.3 1. Setup phoenix umbrella app 2. Fetch and compile hex deps 3. Init distillery rel config 4. Test run app locally a. http://localhost:4000
  • 10. Release Config 1. Init release config 2. Define rel/config.exs a. environment :prod b. include_erts: true c. release :umbrella_app_name d. vm.args 3. Execute ‘release’ 4. Built artifacts location _build/:env
  • 11. Build App Docker Image 1. Demo App context a. SNMP, GPB and MQTT 2. Base image elixir:1.4.2 3. ENV a. LANG=en_US.UTF-8, LC_ALL=${LANG} b. MIX_ENV=prod c. REPLACE_OS_VARS=true 4. Execute `docker build -f Dockerfile -t name/tag .`
  • 12. Run built App Docker Image 1. Execute `docker run -d --name app_cont_name -p 1883:1883 -it name/tag /opt/app/bin/rna_umbrella foreground` 2. Check running container status a. `docker logs app_cont_name` 3. What went wrong? 4. docker-compose
  • 13. Container orchestration 1. docker-compose.yml 2. Docker network 3. Container startup dependency chain 4. Execute `docker-compose up -d` 5. Check running containers statuses a. `docker logs app_cont_name` b. `docker logs postgres_1` c. `docker logs mosquitto_broker1_1`
  • 14. mix_docker Build-Release flow 1. Define new mix hex dep ‘mix_docker’ 2. Execute `mix docker.init` 3. Customise mix_docker config: `mix docker.customise` 4. Define Dockerfile.build and Dockerfile.release 5. Execute `mix docker.build` 6. Execute `docker-compose up -d` 7. Execute `mix docker.release` 8. Run the container
  • 15. Iterate with smaller images + mix_docker flow 1. What can be done better in previous approaches? 2. Alpine Linux - apk vs apt-get/yum 3. Define docker build step to compile and `mix release` 4. Copy release package tarball with ERTS to S3, binary repo, etc 5. Define docker release step 6. Download/Copy release package tarball and explode in release container 7. Use docker-compose to stitch and orchestrate containers to run app suite
  • 16. Conclusion: 1. Distillery release profiles 2. Size of container matters 3. Decouple build and release container images 4. Single purpose docker runtime container 5. docker-compose for container orchestration
  • 18. What next: 1. mix_docker release profiles for docker-release per app in umbrella app - rolled my own with bash script 2. Overlay network and DNS Service discovery to enable cross containers and physical machine BEAM processes connectivity 3. Hot upgrade-releases with distillery (still relevant in docker deployments???) 4. Multi-host deployments and service orchestration with K8
  • 19. Thank you for your time and kind patience Acknowledgements: ● Zsolt Molnar ● Yos Riady ● Benjamin Tan W.H ● Paul Schoenfelder ● Tymon Tobolsk ● Paul Lamb ● Pete Corey ● Dmitry Rubinstein ● Michael Klein

Editor's Notes

  1. References: https://docs.docker.com/docker-for-mac/install/ https://paullamb.exposed/blog/2017/1/11/bottling-elixir-with-docker-part-1 http://teamon.eu/2017/deploying-phoenix-to-production-using-docker/ http://teamon.eu/2017/setting-up-elixir-cluster-using-docker-and-rancher/ https://virviil.github.io/2016/11/30/Elixir-Your-package-should-survive-in-production.html https://github.com/bitwalker/distillery/blob/master/docs/Walkthrough.md https://github.com/Recruitee/mix_docker https://github.com/merqlove/elixir-docker-compose
  2. References: http://bitwalker.org/posts/2016-07-21-distillery-vs-exrm-vs-relx/ http://www.east5th.co/blog/2016/12/26/deploying-elixir-applications-with-distillery/ https://hexdocs.pm/distillery/umbrella-projects.html https://github.com/bitwalker/distillery/blob/master/docs/Common%20Issues.md
  3. References: https://www.docker.com/ http://www.tomsitpro.com/articles/docker-container-faq,1-3340.html http://docker-saigon.github.io/post/Docker-Internals/ Analogy of shipping containers Share Kernel host Use kernel ability to group processes for resource control Ensure isolation through namespace Docker engine provides the ecosystem to interact and control (build, tag, stop, destroy, revive) Docker registry (similar to github)
  4. References: https://docs.docker.com/compose/overview/ https://blog.codeship.com/orchestrate-containers-for-development-with-docker-compose/ https://docs.docker.com/engine/swarm/networking/#create-an-overlay-network-in-a-swarm
  5. Release profiles, prod: include_erts, cookie, vm_args overwrite with a template file distillery templating for vm.args e.g. <%= release_name %> Built artifacts in _build dir Cross compile release in target deployment OS-architecture to prevent runtime failures due to NIFs (natively implemented functions - BEAM and deps e.g. comeonin) https://virviil.github.io/ http://blog.firstiwaslike.com/elixir-deployments-with-distillery-running-ecto-migrations/ https://hexdocs.pm/distillery/boot-hooks.html#content https://github.com/Nebo15/confex, https://github.com/bitwalker/conform
  6. warning: the VM is running with native name encoding of latin1 which may cause Elixir to malfunction as it expects utf8. Please ensure your locale is set to UTF-8 (which can be verified by running "locale" in your shell) Bundle NPM assets (brunch build --production) Assets pipeline - minify/uglify (mix phx.digest)
  7. App requires mqtt broker, networking, postgreSQL? docker build -f docker/Dockerfile.build -t elixirsg_deb/rna_umbrella:build . docker run -d --name demo_rna_2 -e HOST="rna-demo.com" -e PORT=9000 -p 8000:9000 -it elixirsg_deb/rna_umbrella:build /bin/bash -lc "/opt/app/bin/rna_umbrella foreground" docker build -f docker/Dockerfile.build.aio -t elixirsg_deb/rna_umbrella_aio:build . docker run -d --name demo_rna_2 -e HOST="rna-demo.com" -e PORT=9000 -p 8000:9000 -p 1883:1883 -it elixirsg_deb/rna_umbrella_aio:build /bin/bash -lc "service mosquitto restart && /opt/app/bin/rna_umbrella foreground" docker build -f Dockerfile.build.rna_umbrella -t elixirsg_alp/rna_umbrella:build . docker create --name rna_umb_tmp elixirsg_alp/rna_umbrella:build docker cp rna_umb_tmp:/opt/app/_build/prod/rel/rna_umbrella/releases/0.3.0/rna_umbrella.tar.gz . docker rm -f rna_umb_tmp docker build -f Dockerfile.release.rna_umbrella -t elixirsg_alp/rna_umbrella:release .
  8. Expected built/compiled app bundle tarball location per distillery release profile definition in docker build images UNexpected and hard-coded WORKDIR, and inability to use distillery release profile to pick up app bundle tarball for injection to docker release image build
  9. https://pkgs.alpinelinux.org/packages