SlideShare a Scribd company logo
1 of 15
Download to read offline
Hot deployments with
Distillery
Jeffrey Chan
Who I am
DevOps/SRE for a long time, now turning to
developing
Learning and writing Elixir - it’s been great!
Released and deployed Elixir application as side
project
Why make Elixir releases?
Self-contained release artefacts (everything included)
Good for delivery pipeline to production
Good tracking of production version
Hot Deploy
Distillery
http://learnyousomeerlang.com/release-is-the-word
Distillery
https://github.com/bitwalker/distillery
Pure Elixir tool to make Elixir releases easy to do
Generate the release config with “mix release:init”
Modify if necessary (most likely only minor changes)
Compile: “MIX_ENV=prod mix compile"
Release: “MIX_ENV=prod mix release --env prod”
Tarball is generated with Erlang Run Time System (ERTS), application and run
scripts
Profit!
Gotchas
MUST build on the same OS as the target host (use
Docker)
Mix tasks do not work in release artefact e.g. “ecto
migrate”
Using environment variables as configuration can be
tricky - “REPLACE_OS_VARS=true” helps a bit
Build process
Docker image contains Erlang/Elixir and other build tools
Ecto Migrations
“mix ecto:migrate” will not work
Workaround:
Define a migrator task which calls `Ecto.Migrator.run`
Execute it after deploy with “bin/test_app command release_tasks migrate”, or
Call it as part of a release hook
Hot Deploys
http://erlang.org/doc/design_principles/release_handling.html
http://erlang.org/doc/man/appup.html
2 basic components:
Appups - Steps to upgrade each application
Relups - Steps to upgrade the entire release
“9th Circle of ERL” - Learn you some Erlang
Distillery to the rescue
http://learnyousomeerlang.com/relups
Semi-Live Demo
Drawbacks/Gotchas
Must keep a copy of the previous build version to build next version (Distillery drawback)
Phoenix is not fully compatible with hot deploys e.g https://github.com/phoenixframework/
phoenix/issues/2432
The release directory MUST be writable by the `daemon` user (or whatever user is running
the application). Even if you execute the command as root, it will change to the user and
throw nonsense errors. https://github.com/bitwalker/distillery/issues/173
Must use the same environment variables when calling “upgrade”, or upgraded version
may die
If one application breaks, it can take down the whole thing
Must remember to update the app version and release version
Can only upgrade/downgrade sequentially
Summary
Releases are good
Distillery makes releases much much easier
Hot deploys are pretty neat!
But…only if you really need it
It is much easier to just do rolling deployments the ye
olde fashioned way
References
Distillery documentation - https://hexdocs.pm/distillery
Great walkthrough of Phoenix and Distillery - https://hexdocs.pm/distillery/phoenix-
walkthrough.html
Another good guide for Distillery - https://hackernoon.com/mastering-elixir-releases-with-
distillery-a-pretty-complete-guide-497546f298bc
Great resource on Erlang release process - http://learnyousomeerlang.com/release-is-the-
word
Great resource on Hot deploys - http://learnyousomeerlang.com/relups
Erlang Release Handler documentation - http://erlang.org/doc/design_principles/
release_handling.html
Erlang Appup documentation - http://erlang.org/doc/man/appup.html
Questions?
Full working demo project at: https://github.com/
jgmchan/elixir-hot-deploy-demo
Twitter: @jgmchan
Email: jgmchan@gmail.com

More Related Content

What's hot

Eclipse Che : ParisJUG
Eclipse Che : ParisJUGEclipse Che : ParisJUG
Eclipse Che : ParisJUGFlorent BENOIT
 
An Introduction to Eclipse Che - Next-Gen Eclipse Java IDE
An Introduction to Eclipse Che - Next-Gen Eclipse Java IDEAn Introduction to Eclipse Che - Next-Gen Eclipse Java IDE
An Introduction to Eclipse Che - Next-Gen Eclipse Java IDEKubeAcademy
 
Ci For The Web 2.0 Guy Or Gal
Ci For The Web 2.0 Guy Or GalCi For The Web 2.0 Guy Or Gal
Ci For The Web 2.0 Guy Or GalChad Woolley
 
Jenkins on Docker
Jenkins on DockerJenkins on Docker
Jenkins on DockerCraig Trim
 
Code in the cloud with Eclipse Che and Docker - EclipseCon France 2016
Code in the cloud with Eclipse Che and Docker - EclipseCon France 2016Code in the cloud with Eclipse Che and Docker - EclipseCon France 2016
Code in the cloud with Eclipse Che and Docker - EclipseCon France 2016Florent BENOIT
 
GitHub Slack Bot
GitHub Slack BotGitHub Slack Bot
GitHub Slack BotPriti Desai
 
DockerCon 2014: Thoughts on interoperable containers
DockerCon 2014: Thoughts on interoperable containersDockerCon 2014: Thoughts on interoperable containers
DockerCon 2014: Thoughts on interoperable containersFabio Kung
 
Docker Best Practices in development and Production
Docker Best Practices in development and Production Docker Best Practices in development and Production
Docker Best Practices in development and Production Kevin Simper
 
DevOps and Windows
DevOps and WindowsDevOps and Windows
DevOps and WindowsTodd Pigram
 
Sleep Peacefully as Maven Tycho Builds your Product
Sleep Peacefully as Maven Tycho Builds your ProductSleep Peacefully as Maven Tycho Builds your Product
Sleep Peacefully as Maven Tycho Builds your ProductSubramanyam C
 
Hand Crafted Artisanal Chef Resources
Hand Crafted Artisanal Chef ResourcesHand Crafted Artisanal Chef Resources
Hand Crafted Artisanal Chef ResourcesSean OMeara
 
perlbrew yapcasia 2010
perlbrew yapcasia 2010perlbrew yapcasia 2010
perlbrew yapcasia 2010Kang-min Liu
 
ChefConf 2016 - Writing Compossible Community Cookbooks using Chef Custom Res...
ChefConf 2016 - Writing Compossible Community Cookbooks using Chef Custom Res...ChefConf 2016 - Writing Compossible Community Cookbooks using Chef Custom Res...
ChefConf 2016 - Writing Compossible Community Cookbooks using Chef Custom Res...Tim Smith
 
Volunteering atyouseeforit services
Volunteering atyouseeforit servicesVolunteering atyouseeforit services
Volunteering atyouseeforit servicesYouSee
 
[Part 1] automation of home appliances using raspberry pi – software installa...
[Part 1] automation of home appliances using raspberry pi – software installa...[Part 1] automation of home appliances using raspberry pi – software installa...
[Part 1] automation of home appliances using raspberry pi – software installa...Azilen Technologies Pvt. Ltd.
 
Eclipse Che and Artik IDE
Eclipse Che and Artik IDEEclipse Che and Artik IDE
Eclipse Che and Artik IDEFlorent BENOIT
 
Running scala in eclipse using play
Running scala in eclipse using playRunning scala in eclipse using play
Running scala in eclipse using playVijayananda Mohire
 
Vagrant for local and team WordPress Development
Vagrant for local and team WordPress DevelopmentVagrant for local and team WordPress Development
Vagrant for local and team WordPress DevelopmentAnthony Alvarez
 
Introduction to Eclipse Che - Devoxx FR - 2017
Introduction to Eclipse Che - Devoxx FR - 2017Introduction to Eclipse Che - Devoxx FR - 2017
Introduction to Eclipse Che - Devoxx FR - 2017stevanLM
 

What's hot (20)

Eclipse Che : ParisJUG
Eclipse Che : ParisJUGEclipse Che : ParisJUG
Eclipse Che : ParisJUG
 
An Introduction to Eclipse Che - Next-Gen Eclipse Java IDE
An Introduction to Eclipse Che - Next-Gen Eclipse Java IDEAn Introduction to Eclipse Che - Next-Gen Eclipse Java IDE
An Introduction to Eclipse Che - Next-Gen Eclipse Java IDE
 
Ci For The Web 2.0 Guy Or Gal
Ci For The Web 2.0 Guy Or GalCi For The Web 2.0 Guy Or Gal
Ci For The Web 2.0 Guy Or Gal
 
Jenkins on Docker
Jenkins on DockerJenkins on Docker
Jenkins on Docker
 
Code in the cloud with Eclipse Che and Docker - EclipseCon France 2016
Code in the cloud with Eclipse Che and Docker - EclipseCon France 2016Code in the cloud with Eclipse Che and Docker - EclipseCon France 2016
Code in the cloud with Eclipse Che and Docker - EclipseCon France 2016
 
GitHub Slack Bot
GitHub Slack BotGitHub Slack Bot
GitHub Slack Bot
 
DockerCon 2014: Thoughts on interoperable containers
DockerCon 2014: Thoughts on interoperable containersDockerCon 2014: Thoughts on interoperable containers
DockerCon 2014: Thoughts on interoperable containers
 
Docker Best Practices in development and Production
Docker Best Practices in development and Production Docker Best Practices in development and Production
Docker Best Practices in development and Production
 
DevOps and Windows
DevOps and WindowsDevOps and Windows
DevOps and Windows
 
Sleep Peacefully as Maven Tycho Builds your Product
Sleep Peacefully as Maven Tycho Builds your ProductSleep Peacefully as Maven Tycho Builds your Product
Sleep Peacefully as Maven Tycho Builds your Product
 
Hand Crafted Artisanal Chef Resources
Hand Crafted Artisanal Chef ResourcesHand Crafted Artisanal Chef Resources
Hand Crafted Artisanal Chef Resources
 
perlbrew yapcasia 2010
perlbrew yapcasia 2010perlbrew yapcasia 2010
perlbrew yapcasia 2010
 
ChefConf 2016 - Writing Compossible Community Cookbooks using Chef Custom Res...
ChefConf 2016 - Writing Compossible Community Cookbooks using Chef Custom Res...ChefConf 2016 - Writing Compossible Community Cookbooks using Chef Custom Res...
ChefConf 2016 - Writing Compossible Community Cookbooks using Chef Custom Res...
 
Volunteering atyouseeforit services
Volunteering atyouseeforit servicesVolunteering atyouseeforit services
Volunteering atyouseeforit services
 
[Part 1] automation of home appliances using raspberry pi – software installa...
[Part 1] automation of home appliances using raspberry pi – software installa...[Part 1] automation of home appliances using raspberry pi – software installa...
[Part 1] automation of home appliances using raspberry pi – software installa...
 
Eclipse Che and Artik IDE
Eclipse Che and Artik IDEEclipse Che and Artik IDE
Eclipse Che and Artik IDE
 
Running scala in eclipse using play
Running scala in eclipse using playRunning scala in eclipse using play
Running scala in eclipse using play
 
Versions
VersionsVersions
Versions
 
Vagrant for local and team WordPress Development
Vagrant for local and team WordPress DevelopmentVagrant for local and team WordPress Development
Vagrant for local and team WordPress Development
 
Introduction to Eclipse Che - Devoxx FR - 2017
Introduction to Eclipse Che - Devoxx FR - 2017Introduction to Eclipse Che - Devoxx FR - 2017
Introduction to Eclipse Che - Devoxx FR - 2017
 

Similar to Hot deployments with distillery

Using Erlang in an Embedded and Cross-Compiled World
Using Erlang in an Embedded and Cross-Compiled WorldUsing Erlang in an Embedded and Cross-Compiled World
Using Erlang in an Embedded and Cross-Compiled WorldFrank Hunleth
 
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
 
Instruction: dev environment
Instruction: dev environmentInstruction: dev environment
Instruction: dev environmentSoshi Nemoto
 
Eclipse Overview
Eclipse Overview Eclipse Overview
Eclipse Overview Lars Vogel
 
State ofappdevelopment
State ofappdevelopmentState ofappdevelopment
State ofappdevelopmentgillygize
 
Bauen und Verteilen von Multi-Arch Docker Images für Linux und Windows
Bauen und Verteilen von Multi-Arch Docker Images für Linux und WindowsBauen und Verteilen von Multi-Arch Docker Images für Linux und Windows
Bauen und Verteilen von Multi-Arch Docker Images für Linux und WindowsStefan Scherer
 
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Fabrice Bernhard
 
The Build System of Commercial RCP Application A Case Study
The Build System of Commercial RCP Application A Case StudyThe Build System of Commercial RCP Application A Case Study
The Build System of Commercial RCP Application A Case Studygustavoeliano
 
The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer ToolboxPablo Godel
 
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...Codemotion
 
Nantes Jug 2016 Eclipse Che: The Next-Gen Eclipse IDE
Nantes Jug 2016 Eclipse Che: The Next-Gen Eclipse IDENantes Jug 2016 Eclipse Che: The Next-Gen Eclipse IDE
Nantes Jug 2016 Eclipse Che: The Next-Gen Eclipse IDEFlorent BENOIT
 
IBM ConnectED 2015 - BP106 From XPages Hero To OSGi Guru: Taking The Scary Ou...
IBM ConnectED 2015 - BP106 From XPages Hero To OSGi Guru: Taking The Scary Ou...IBM ConnectED 2015 - BP106 From XPages Hero To OSGi Guru: Taking The Scary Ou...
IBM ConnectED 2015 - BP106 From XPages Hero To OSGi Guru: Taking The Scary Ou...Paul Withers
 
How to become an Eclipse committer in 20 minutes and fork the IDE
How to become an Eclipse committer in 20 minutes and fork the IDEHow to become an Eclipse committer in 20 minutes and fork the IDE
How to become an Eclipse committer in 20 minutes and fork the IDELars Vogel
 
Code in the cloud with eclipse che and docker / snowcamp.io 2017
Code in the cloud with eclipse che and docker /  snowcamp.io 2017Code in the cloud with eclipse che and docker /  snowcamp.io 2017
Code in the cloud with eclipse che and docker / snowcamp.io 2017Florent BENOIT
 
Gabriele Columbro - Maurizio Pillitu - Get your Alfresco project from Zero to...
Gabriele Columbro - Maurizio Pillitu - Get your Alfresco project from Zero to...Gabriele Columbro - Maurizio Pillitu - Get your Alfresco project from Zero to...
Gabriele Columbro - Maurizio Pillitu - Get your Alfresco project from Zero to...Symphony Software Foundation
 
Plug yourself in and your app will never be the same (2 hr editon)
Plug yourself in and your app will never be the same (2 hr editon)Plug yourself in and your app will never be the same (2 hr editon)
Plug yourself in and your app will never be the same (2 hr editon)Mikkel Flindt Heisterberg
 
Plug yourself in and your app will never be the same (2 hour edition)
Plug yourself in and your app will never be the same (2 hour edition)Plug yourself in and your app will never be the same (2 hour edition)
Plug yourself in and your app will never be the same (2 hour edition)Mikkel Flindt Heisterberg
 
codemotion-docker-2014
codemotion-docker-2014codemotion-docker-2014
codemotion-docker-2014Carlo Bonamico
 
Plug yourself in and your app will never be the same (1 hr edition)
Plug yourself in and your app will never be the same (1 hr edition)Plug yourself in and your app will never be the same (1 hr edition)
Plug yourself in and your app will never be the same (1 hr edition)Mikkel Flindt Heisterberg
 
Docker for Devs - John Zaccone, IBM
Docker for Devs - John Zaccone, IBMDocker for Devs - John Zaccone, IBM
Docker for Devs - John Zaccone, IBMDocker, Inc.
 

Similar to Hot deployments with distillery (20)

Using Erlang in an Embedded and Cross-Compiled World
Using Erlang in an Embedded and Cross-Compiled WorldUsing Erlang in an Embedded and Cross-Compiled World
Using Erlang in an Embedded and Cross-Compiled World
 
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
 
Instruction: dev environment
Instruction: dev environmentInstruction: dev environment
Instruction: dev environment
 
Eclipse Overview
Eclipse Overview Eclipse Overview
Eclipse Overview
 
State ofappdevelopment
State ofappdevelopmentState ofappdevelopment
State ofappdevelopment
 
Bauen und Verteilen von Multi-Arch Docker Images für Linux und Windows
Bauen und Verteilen von Multi-Arch Docker Images für Linux und WindowsBauen und Verteilen von Multi-Arch Docker Images für Linux und Windows
Bauen und Verteilen von Multi-Arch Docker Images für Linux und Windows
 
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
 
The Build System of Commercial RCP Application A Case Study
The Build System of Commercial RCP Application A Case StudyThe Build System of Commercial RCP Application A Case Study
The Build System of Commercial RCP Application A Case Study
 
The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer Toolbox
 
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...
 
Nantes Jug 2016 Eclipse Che: The Next-Gen Eclipse IDE
Nantes Jug 2016 Eclipse Che: The Next-Gen Eclipse IDENantes Jug 2016 Eclipse Che: The Next-Gen Eclipse IDE
Nantes Jug 2016 Eclipse Che: The Next-Gen Eclipse IDE
 
IBM ConnectED 2015 - BP106 From XPages Hero To OSGi Guru: Taking The Scary Ou...
IBM ConnectED 2015 - BP106 From XPages Hero To OSGi Guru: Taking The Scary Ou...IBM ConnectED 2015 - BP106 From XPages Hero To OSGi Guru: Taking The Scary Ou...
IBM ConnectED 2015 - BP106 From XPages Hero To OSGi Guru: Taking The Scary Ou...
 
How to become an Eclipse committer in 20 minutes and fork the IDE
How to become an Eclipse committer in 20 minutes and fork the IDEHow to become an Eclipse committer in 20 minutes and fork the IDE
How to become an Eclipse committer in 20 minutes and fork the IDE
 
Code in the cloud with eclipse che and docker / snowcamp.io 2017
Code in the cloud with eclipse che and docker /  snowcamp.io 2017Code in the cloud with eclipse che and docker /  snowcamp.io 2017
Code in the cloud with eclipse che and docker / snowcamp.io 2017
 
Gabriele Columbro - Maurizio Pillitu - Get your Alfresco project from Zero to...
Gabriele Columbro - Maurizio Pillitu - Get your Alfresco project from Zero to...Gabriele Columbro - Maurizio Pillitu - Get your Alfresco project from Zero to...
Gabriele Columbro - Maurizio Pillitu - Get your Alfresco project from Zero to...
 
Plug yourself in and your app will never be the same (2 hr editon)
Plug yourself in and your app will never be the same (2 hr editon)Plug yourself in and your app will never be the same (2 hr editon)
Plug yourself in and your app will never be the same (2 hr editon)
 
Plug yourself in and your app will never be the same (2 hour edition)
Plug yourself in and your app will never be the same (2 hour edition)Plug yourself in and your app will never be the same (2 hour edition)
Plug yourself in and your app will never be the same (2 hour edition)
 
codemotion-docker-2014
codemotion-docker-2014codemotion-docker-2014
codemotion-docker-2014
 
Plug yourself in and your app will never be the same (1 hr edition)
Plug yourself in and your app will never be the same (1 hr edition)Plug yourself in and your app will never be the same (1 hr edition)
Plug yourself in and your app will never be the same (1 hr edition)
 
Docker for Devs - John Zaccone, IBM
Docker for Devs - John Zaccone, IBMDocker for Devs - John Zaccone, IBM
Docker for Devs - John Zaccone, IBM
 

Recently uploaded

Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
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
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
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
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
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.
 
software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxnada99848
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 

Recently uploaded (20)

Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
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
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
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
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
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
 
software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptx
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 

Hot deployments with distillery

  • 2. Who I am DevOps/SRE for a long time, now turning to developing Learning and writing Elixir - it’s been great! Released and deployed Elixir application as side project
  • 3. Why make Elixir releases? Self-contained release artefacts (everything included) Good for delivery pipeline to production Good tracking of production version Hot Deploy
  • 5. Distillery https://github.com/bitwalker/distillery Pure Elixir tool to make Elixir releases easy to do Generate the release config with “mix release:init” Modify if necessary (most likely only minor changes) Compile: “MIX_ENV=prod mix compile" Release: “MIX_ENV=prod mix release --env prod” Tarball is generated with Erlang Run Time System (ERTS), application and run scripts Profit!
  • 6. Gotchas MUST build on the same OS as the target host (use Docker) Mix tasks do not work in release artefact e.g. “ecto migrate” Using environment variables as configuration can be tricky - “REPLACE_OS_VARS=true” helps a bit
  • 7. Build process Docker image contains Erlang/Elixir and other build tools
  • 8. Ecto Migrations “mix ecto:migrate” will not work Workaround: Define a migrator task which calls `Ecto.Migrator.run` Execute it after deploy with “bin/test_app command release_tasks migrate”, or Call it as part of a release hook
  • 9. Hot Deploys http://erlang.org/doc/design_principles/release_handling.html http://erlang.org/doc/man/appup.html 2 basic components: Appups - Steps to upgrade each application Relups - Steps to upgrade the entire release “9th Circle of ERL” - Learn you some Erlang
  • 10. Distillery to the rescue http://learnyousomeerlang.com/relups
  • 12. Drawbacks/Gotchas Must keep a copy of the previous build version to build next version (Distillery drawback) Phoenix is not fully compatible with hot deploys e.g https://github.com/phoenixframework/ phoenix/issues/2432 The release directory MUST be writable by the `daemon` user (or whatever user is running the application). Even if you execute the command as root, it will change to the user and throw nonsense errors. https://github.com/bitwalker/distillery/issues/173 Must use the same environment variables when calling “upgrade”, or upgraded version may die If one application breaks, it can take down the whole thing Must remember to update the app version and release version Can only upgrade/downgrade sequentially
  • 13. Summary Releases are good Distillery makes releases much much easier Hot deploys are pretty neat! But…only if you really need it It is much easier to just do rolling deployments the ye olde fashioned way
  • 14. References Distillery documentation - https://hexdocs.pm/distillery Great walkthrough of Phoenix and Distillery - https://hexdocs.pm/distillery/phoenix- walkthrough.html Another good guide for Distillery - https://hackernoon.com/mastering-elixir-releases-with- distillery-a-pretty-complete-guide-497546f298bc Great resource on Erlang release process - http://learnyousomeerlang.com/release-is-the- word Great resource on Hot deploys - http://learnyousomeerlang.com/relups Erlang Release Handler documentation - http://erlang.org/doc/design_principles/ release_handling.html Erlang Appup documentation - http://erlang.org/doc/man/appup.html
  • 15. Questions? Full working demo project at: https://github.com/ jgmchan/elixir-hot-deploy-demo Twitter: @jgmchan Email: jgmchan@gmail.com