INTERACTIVE REMOTE DEBUGGING AND
DEVELOPMENT WITH TRAMP MODE
EMACSCONF 2019
Greetings EmacsConf!

My name is Matt Ray, welcome to my session on Interactive Remote Debugging and Development with TRAMP Mode
GREETINGS
MATT RAY
▸ emacs@mattray.dev
▸ mattray IRC|GitHub|Slack|Twitter
▸ SoftwareDefinedTalk.com
▸ MattRay.dev
First, I'd like to thank the organizers of EmacsConf for allowing me to present. 

My name is Matt Ray and I've been using Emacs for about 20 years and figured it would be fun to share some of the ways I use Emacs in my day to day role.

I've been a developer and had various roles over the years.

I'm currently based in Sydney Australia, you can tell by my accent. I moved here about 3 years ago.

I'm 'mattray' on Twitter and Slack and GitHub and I co-host a rambling podcast called Software Defined Talk.

I blog from time to time about random tech stuff at MattRay.dev
EMACS
SHELL MODE
▸ Major mode for shell buffers
▸ M-x shell
▸ Bash
▸ Heavily customised PS1
▸ https://github.com/mattray/home-directory/
▸ .bashrc
▸ .emacs.d/init.el
I've been using M-x shell mode for probably 20 years, it's always been one of the killer features for me within Emacs.

The ability to capture everything I do in an editable shell has proven invaluable time and time again and frequently been a great way to get get people interested in
Emacs.

I'm still using Bash, newer shells like Zsh haven't really caught my eye because I've always gotten what I needed out of Shell mode.

<demo screen>

Within my .bashrc I set a couple of configuration settings, including setting more and less to cat so there's no weird pagination issues within shell mode.

My editor and git_editor shell variables are set for any commands that need to spawn an editor, and I use the emacs server to manage all of my emacs sessions within a
single window.

Shell history settings are there to optimise what's tracked, and I frequently grep my .bash_history file for anything not in the current shell session.
DEMO
M-X SHELL DEMO
▸ Start emacs
▸ M-x shell
▸ C-x 1
▸ M-+ 3x
▸ Cd emacsconf
▸ C-x C-f hello.sh
▸ Bash hello.sh
EMACS
TRAMP MODE
▸ Transparent Remote Access, Multiple Protocols
▸ Remote file editing over multiple protocols
▸ C-x C-f /[method/user@remotehost]/filename
▸ /ssh:cubert:/etc/hosts
▸ Sudo support
▸ /ssh:cubert|sudo@cubert:/etc/hosts
▸ /ssh:cubert|sudo:omnibus@cubert:~/
DEMO
EMACS
▸ C-x C-f /ssh:hyperchicken:/etc/hosts
▸ /ssh:hyperchicken|sudo:hyperchicken:/etc/
▸ Show off Dir-ed +1
▸ Edit /etc/motd
▸ Open iterm, ssh to the box to show off the MOTD
▸ Open up the hello.sh, write it remotely
BeagleBone black ARM box

I can open files on the remote system

I can sudo in and edit them as root

I can use DirEd to wander through the filesystem, poking around

I can also open a file locally, then write it to the remote system

I'll do that with my 'hello.sh'
EMACS
TRAMP MODE REMOTE SHELL
▸ C-u M-x shell
▸ Usually name the buffer after the host
▸ Default shell
▸ export PAGER=cat
Now editing files on a remote system is great and all, but I just showed off how I use Shell Mode.

I can use TRAMP to open a remote shell and run from there, just like on my local workstation.

I like to open a remote shell and name the buffer after the host, to make it easier to identify in my Buffer list
DEMO
EMACS
▸ C-u M-x shell
▸ Hostname
▸ /bin/bash
▸ Ls
▸ Ps
▸ whoami
▸ /tmp/hello.sh
Default shell

export PAGER=cat

I'm now running my shell over SSH on a remote server, editing files and copying content between buffers, pretty cool.
INFRASTRUCTURE
TEST KITCHEN
▸ Testing harness to execute infrastructure code in
isolation
▸ VM plugins for Vagrant, Docker, public and private
clouds
▸ Infrastructure as code with Chef, Puppet, Ansible
▸ Test frameworks like InSpec, ServerSpec, Bats
▸ https://kitchen.ci
Apache v2 licensed Free Software
INFRASTRUCTURE
VAGRANT
▸ Developer testing tool for desktop virtual machines
▸ Virtualbox, Docker and other providers
▸ Simple configuration with SSH access
▸ Standardized 'bento' images from Chef for basic
machines
▸ https://vagrantup.com
▸ C-x C-f /ssh:vagrant@127.0.0.1#2222:/
DEMO
EMACS
▸ Kitchen status
▸ Kitchen create
▸ Open kitchen.yml
▸ C-x C-f /ssh:vagrant@127.0.0.1#2222:/
▸ C-u M-x shell
▸ Whom
INFRASTRUCTURE
INSPEC
▸ Compliance as Code
▸ Ruby DSL
▸ 100s of Resources for auditing machines,
databases, APIs, cloud platforms, etc.
▸ Local or remote scanning
▸ https://inspec.io
Translate compliance into Code

Clearly express statements of policy

Move risk to build/test from runtime

Find issues early

Write code quickly

Run code anywhere

Inspect machines, data and APIs

100+ built-in resources
DEMO
EMACS
▸ Look at hello/controls/example.rb
▸ Kitchen verify
▸ Chmod +x hello.sh
▸ Kitchen verify
▸ Let's check on the command output, paste it in to our matcher
▸ It fails, why?
▸ Fix, kitchen verify
▸ Kitchen destroy
▸ Kitchen verify, now it's gone and broken
INFRASTRUCTURE
CHEF
▸ Infrastructure as Code
▸ Ruby DSL
▸ Resources for configuring servers in standardised
libraries for easy reuse
▸ Client/server scales to 100s of thousands of machines
▸ https://chef.io
Configuration Management, 

▪ Managesdeployment and on-going automation

▪ Definereusableresources

and infrastructure state as code

▪ Scale elegantly from one to tens of thousands of managed nodes across multiple complex environments

▪ Community, Certified Partner, and Chef supported content available for all common automation tasks
DEMO
EMACS
▸ Let's ensure that our file is always there
▸ Add the file resource
▸ Kitchen converge
▸ Kitchen verify
▸ Permissions again
▸ Mode '0755'
▸ Kitchen converge
▸ Kitchen verify
▸ Kitchen test
DEBUGGING
PRY
▸ Interactive Ruby debugger
▸ Built into Chef and InSpec
▸ Drop breakpoints into code
▸ ~/.emacs.d/ruby.el
DEMO
EMACS
▸ Drop debug into control
▸ Kitchen verify
▸ Exit-program, edit to bash resource
▸ Kitchen verify
▸ But it's hard-coded, so let's make it more dynamic
▸ Ls
▸ Content
▸ sys_info
▸ sys_info.methods
▸ sys_info.fqdn
▸ sys_info.short
▸ expected = "Hello EmacsConf 2019 from root on #{sys_info.short}"
▸ Whereami
▸ C 1
▸ Ls
▸ described_class
▸ described_class.methods
▸ described_class.result
▸ described_class.result.stdout
▸ Exit
▸ "".match?(expected)
▸ Exit-program
▸ Update example.rb
▸ Kitchen verify
▸ Kitchen test
Combining TRAMP with Shell Mode and local desktop testing with Kitchen make for a very fast feedback loop.

I can test through the shell and through Ruby without leaving Emacs, going back and forth between my Chef infrastructure code and my InSpec compliance code.

You might not be using these tools, but this pattern of rapid development feedback should be available to you no matter what you're working with.

If you're a system administrator, you don't need to have screen or tmux anymore.

If you're a developer you can deploy your applications into VM and test their behaviour in a clean room environment, using the same configurations as production
environments.

This was just a quick dive into Shell Mode, TRAMP, Chef, InSpec and Pry but hopefully you can take some of these ideas into your own Emacs setup and day to day
workflow.
THANKS!https://github.com/mattray/emacsconf2019
emacs@mattray.dev
This was just a quick dive into Shell Mode, TRAMP, Chef, InSpec and Pry but hopefully you can take some of these ideas into your own Emacs setup and day to day
workflow.

I've put this demo up on GitHub, there's a link to my emacs and bash configuration there as well.

Thanks again for allowing me to present, I'm available in IRC for any questions you may have or you can email me at emacs@mattray.dev

More Related Content

KEY
Linecook - A Chef Alternative
PDF
Continuous infrastructure testing
PDF
Vagrant for real (codemotion rome 2016)
PDF
Vagrant for real codemotion (moar tips! ;-))
PPTX
A Docker-based Development Environment Even I Can Understand
PDF
Preparation study of_docker - (MOSG)
PDF
Instruction: dev environment
PPTX
DevOps Hackathon - Session 1: Vagrant
Linecook - A Chef Alternative
Continuous infrastructure testing
Vagrant for real (codemotion rome 2016)
Vagrant for real codemotion (moar tips! ;-))
A Docker-based Development Environment Even I Can Understand
Preparation study of_docker - (MOSG)
Instruction: dev environment
DevOps Hackathon - Session 1: Vagrant

What's hot (19)

PDF
From Dev to DevOps - Codemotion ES 2012
PDF
Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...
DOCX
Dockerfish-Tutorial
PDF
Multi-provider Vagrant and Chef: AWS, VMware, and more
PDF
Continuous Delivery: The Next Frontier
PPTX
6 Years of Docker: The Good, the Bad and Python Packaging at PyCon.DE&PyData ...
KEY
From Dev to DevOps - FOSDEM 2012
PDF
Meetup C++ Floripa - Conan.io
PDF
DevOps(3) : Ansible - (MOSG)
KEY
PDF
Testing Your Automation Code (Docker Version)
PPTX
DevOps hackathon Session 2: Basics of Chef
PDF
DevOps(4) : Ansible(2) - (MOSG)
PDF
Beaker: Automated, Cloud-Based Acceptance Testing - PuppetConf 2014
KEY
Usando o Cloud
KEY
Puppet for Java developers - JavaZone NO 2012
PDF
體驗 Hhvm
PDF
Conan a C/C++ Package Manager
PDF
Trust, but verify | Testing with Docker Containers
From Dev to DevOps - Codemotion ES 2012
Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...
Dockerfish-Tutorial
Multi-provider Vagrant and Chef: AWS, VMware, and more
Continuous Delivery: The Next Frontier
6 Years of Docker: The Good, the Bad and Python Packaging at PyCon.DE&PyData ...
From Dev to DevOps - FOSDEM 2012
Meetup C++ Floripa - Conan.io
DevOps(3) : Ansible - (MOSG)
Testing Your Automation Code (Docker Version)
DevOps hackathon Session 2: Basics of Chef
DevOps(4) : Ansible(2) - (MOSG)
Beaker: Automated, Cloud-Based Acceptance Testing - PuppetConf 2014
Usando o Cloud
Puppet for Java developers - JavaZone NO 2012
體驗 Hhvm
Conan a C/C++ Package Manager
Trust, but verify | Testing with Docker Containers
Ad

Similar to EmacsConf 2019: Interactive Remote Debugging and Development with TRAMP Mode (20)

PDF
Aucklug slides - desktop tips and tricks
PPTX
A Fabric/Puppet Build/Deploy System
PDF
Testing Your Automation Code (Vagrant Version)
PDF
Testing your-automation-code (vagrant version) v0.2
PDF
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
PDF
Chef basics - write infrastructure as code
PDF
Stop Being Lazy and Test Your Software
PDF
The Modern Developer Toolbox
PPTX
What is Test Kitchen
PPTX
Azure Bootcamp 2016 - Docker Orchestration on Azure with Rancher
KEY
Capistrano, Puppet, and Chef
PDF
Red Teaming macOS Environments with Hermes the Swift Messenger
PDF
Be a happier developer with Docker: Tricks of the trade
PPTX
drupal ci cd concept cornel univercity.pptx
PDF
Be a Happier Developer with Docker: Tricks of the Trade
PDF
Comment améliorer le quotidien des Développeurs PHP ?
PDF
Lean Drupal Repositories with Composer and Drush
PPTX
Docker Starter Pack
PDF
eZ Platform Cloud and eZ Launchpad: Don’t Host, Don’t Deploy, Don’t Install—J...
PDF
eZ Platform Cloud and eZ Launchpad: Don’t Host, Don’t Deploy, Don’t Install—J...
Aucklug slides - desktop tips and tricks
A Fabric/Puppet Build/Deploy System
Testing Your Automation Code (Vagrant Version)
Testing your-automation-code (vagrant version) v0.2
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Chef basics - write infrastructure as code
Stop Being Lazy and Test Your Software
The Modern Developer Toolbox
What is Test Kitchen
Azure Bootcamp 2016 - Docker Orchestration on Azure with Rancher
Capistrano, Puppet, and Chef
Red Teaming macOS Environments with Hermes the Swift Messenger
Be a happier developer with Docker: Tricks of the trade
drupal ci cd concept cornel univercity.pptx
Be a Happier Developer with Docker: Tricks of the Trade
Comment améliorer le quotidien des Développeurs PHP ?
Lean Drupal Repositories with Composer and Drush
Docker Starter Pack
eZ Platform Cloud and eZ Launchpad: Don’t Host, Don’t Deploy, Don’t Install—J...
eZ Platform Cloud and eZ Launchpad: Don’t Host, Don’t Deploy, Don’t Install—J...
Ad

More from Matt Ray (20)

PDF
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
PDF
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
PDF
SCaLE 20X: Kubernetes Cloud Cost Monitoring with OpenCost & Optimization Stra...
PDF
HashiTalks 2020 - Chef Tools & Terraform: Better Together
PDF
Wellington DevOps: Bringing Your Applications into the Future with Habitat
PDF
DevOps Days Singapore 2018 Ignite - Bringing Your Applications into the Futur...
PDF
Cloud Expo Asia 20181010 - Bringing Your Applications into the Future with Ha...
PDF
Compliance as Code Everywhere
PDF
DevOpsDays Jakarta: State of DevOps 2018
PDF
DevOps Talks Melbourne 2018: Whales, Cats and Kubernetes
PDF
Infrastructure and Compliance Delight with Chef Automate
PDF
Cooking Up Windows with Chef Automate
PDF
DevOpsDays Singapore - Continuous Auditing with Compliance as Code
PDF
DevOpsDays Singapore Habitat Ignite
PDF
Chef Automate - Azure Sydney User Group
PDF
Automating Compliance with InSpec - AWS North Sydney
PDF
Automating Applications with Habitat - Sydney Cloud Native Meetup
PDF
Automating AWS Compliance with InSpec
PDF
Chef Automate - Infracoders Canberra August 8, 2017
PDF
OpsWorks for Chef Automate - Auckland AWS
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
SCaLE 20X: Kubernetes Cloud Cost Monitoring with OpenCost & Optimization Stra...
HashiTalks 2020 - Chef Tools & Terraform: Better Together
Wellington DevOps: Bringing Your Applications into the Future with Habitat
DevOps Days Singapore 2018 Ignite - Bringing Your Applications into the Futur...
Cloud Expo Asia 20181010 - Bringing Your Applications into the Future with Ha...
Compliance as Code Everywhere
DevOpsDays Jakarta: State of DevOps 2018
DevOps Talks Melbourne 2018: Whales, Cats and Kubernetes
Infrastructure and Compliance Delight with Chef Automate
Cooking Up Windows with Chef Automate
DevOpsDays Singapore - Continuous Auditing with Compliance as Code
DevOpsDays Singapore Habitat Ignite
Chef Automate - Azure Sydney User Group
Automating Compliance with InSpec - AWS North Sydney
Automating Applications with Habitat - Sydney Cloud Native Meetup
Automating AWS Compliance with InSpec
Chef Automate - Infracoders Canberra August 8, 2017
OpsWorks for Chef Automate - Auckland AWS

Recently uploaded (20)

PDF
Improvisation in detection of pomegranate leaf disease using transfer learni...
PDF
Transform-Quality-Engineering-with-AI-A-60-Day-Blueprint-for-Digital-Success.pdf
PDF
The influence of sentiment analysis in enhancing early warning system model f...
PDF
NewMind AI Weekly Chronicles – August ’25 Week IV
PDF
Enhancing plagiarism detection using data pre-processing and machine learning...
PDF
The-Future-of-Automotive-Quality-is-Here-AI-Driven-Engineering.pdf
PDF
Early detection and classification of bone marrow changes in lumbar vertebrae...
PDF
Taming the Chaos: How to Turn Unstructured Data into Decisions
PDF
Flame analysis and combustion estimation using large language and vision assi...
PPT
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
PDF
Consumable AI The What, Why & How for Small Teams.pdf
PPT
Geologic Time for studying geology for geologist
DOCX
Basics of Cloud Computing - Cloud Ecosystem
PPTX
TEXTILE technology diploma scope and career opportunities
PDF
“A New Era of 3D Sensing: Transforming Industries and Creating Opportunities,...
PDF
sbt 2.0: go big (Scala Days 2025 edition)
PPTX
GROUP4NURSINGINFORMATICSREPORT-2 PRESENTATION
PDF
Comparative analysis of machine learning models for fake news detection in so...
PPTX
Custom Battery Pack Design Considerations for Performance and Safety
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
Improvisation in detection of pomegranate leaf disease using transfer learni...
Transform-Quality-Engineering-with-AI-A-60-Day-Blueprint-for-Digital-Success.pdf
The influence of sentiment analysis in enhancing early warning system model f...
NewMind AI Weekly Chronicles – August ’25 Week IV
Enhancing plagiarism detection using data pre-processing and machine learning...
The-Future-of-Automotive-Quality-is-Here-AI-Driven-Engineering.pdf
Early detection and classification of bone marrow changes in lumbar vertebrae...
Taming the Chaos: How to Turn Unstructured Data into Decisions
Flame analysis and combustion estimation using large language and vision assi...
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
Consumable AI The What, Why & How for Small Teams.pdf
Geologic Time for studying geology for geologist
Basics of Cloud Computing - Cloud Ecosystem
TEXTILE technology diploma scope and career opportunities
“A New Era of 3D Sensing: Transforming Industries and Creating Opportunities,...
sbt 2.0: go big (Scala Days 2025 edition)
GROUP4NURSINGINFORMATICSREPORT-2 PRESENTATION
Comparative analysis of machine learning models for fake news detection in so...
Custom Battery Pack Design Considerations for Performance and Safety
NewMind AI Weekly Chronicles – August ’25 Week III

EmacsConf 2019: Interactive Remote Debugging and Development with TRAMP Mode

  • 1. INTERACTIVE REMOTE DEBUGGING AND DEVELOPMENT WITH TRAMP MODE EMACSCONF 2019 Greetings EmacsConf! My name is Matt Ray, welcome to my session on Interactive Remote Debugging and Development with TRAMP Mode
  • 2. GREETINGS MATT RAY ▸ [email protected] mattray IRC|GitHub|Slack|Twitter ▸ SoftwareDefinedTalk.com ▸ MattRay.dev First, I'd like to thank the organizers of EmacsConf for allowing me to present. My name is Matt Ray and I've been using Emacs for about 20 years and figured it would be fun to share some of the ways I use Emacs in my day to day role. I've been a developer and had various roles over the years. I'm currently based in Sydney Australia, you can tell by my accent. I moved here about 3 years ago. I'm 'mattray' on Twitter and Slack and GitHub and I co-host a rambling podcast called Software Defined Talk. I blog from time to time about random tech stuff at MattRay.dev
  • 3. EMACS SHELL MODE ▸ Major mode for shell buffers ▸ M-x shell ▸ Bash ▸ Heavily customised PS1 ▸ https://github.com/mattray/home-directory/ ▸ .bashrc ▸ .emacs.d/init.el I've been using M-x shell mode for probably 20 years, it's always been one of the killer features for me within Emacs. The ability to capture everything I do in an editable shell has proven invaluable time and time again and frequently been a great way to get get people interested in Emacs. I'm still using Bash, newer shells like Zsh haven't really caught my eye because I've always gotten what I needed out of Shell mode. <demo screen> Within my .bashrc I set a couple of configuration settings, including setting more and less to cat so there's no weird pagination issues within shell mode. My editor and git_editor shell variables are set for any commands that need to spawn an editor, and I use the emacs server to manage all of my emacs sessions within a single window. Shell history settings are there to optimise what's tracked, and I frequently grep my .bash_history file for anything not in the current shell session.
  • 4. DEMO M-X SHELL DEMO ▸ Start emacs ▸ M-x shell ▸ C-x 1 ▸ M-+ 3x ▸ Cd emacsconf ▸ C-x C-f hello.sh ▸ Bash hello.sh
  • 5. EMACS TRAMP MODE ▸ Transparent Remote Access, Multiple Protocols ▸ Remote file editing over multiple protocols ▸ C-x C-f /[method/user@remotehost]/filename ▸ /ssh:cubert:/etc/hosts ▸ Sudo support ▸ /ssh:cubert|sudo@cubert:/etc/hosts ▸ /ssh:cubert|sudo:omnibus@cubert:~/
  • 6. DEMO EMACS ▸ C-x C-f /ssh:hyperchicken:/etc/hosts ▸ /ssh:hyperchicken|sudo:hyperchicken:/etc/ ▸ Show off Dir-ed +1 ▸ Edit /etc/motd ▸ Open iterm, ssh to the box to show off the MOTD ▸ Open up the hello.sh, write it remotely BeagleBone black ARM box I can open files on the remote system I can sudo in and edit them as root I can use DirEd to wander through the filesystem, poking around I can also open a file locally, then write it to the remote system I'll do that with my 'hello.sh'
  • 7. EMACS TRAMP MODE REMOTE SHELL ▸ C-u M-x shell ▸ Usually name the buffer after the host ▸ Default shell ▸ export PAGER=cat Now editing files on a remote system is great and all, but I just showed off how I use Shell Mode. I can use TRAMP to open a remote shell and run from there, just like on my local workstation. I like to open a remote shell and name the buffer after the host, to make it easier to identify in my Buffer list
  • 8. DEMO EMACS ▸ C-u M-x shell ▸ Hostname ▸ /bin/bash ▸ Ls ▸ Ps ▸ whoami ▸ /tmp/hello.sh Default shell export PAGER=cat I'm now running my shell over SSH on a remote server, editing files and copying content between buffers, pretty cool.
  • 9. INFRASTRUCTURE TEST KITCHEN ▸ Testing harness to execute infrastructure code in isolation ▸ VM plugins for Vagrant, Docker, public and private clouds ▸ Infrastructure as code with Chef, Puppet, Ansible ▸ Test frameworks like InSpec, ServerSpec, Bats ▸ https://kitchen.ci Apache v2 licensed Free Software
  • 10. INFRASTRUCTURE VAGRANT ▸ Developer testing tool for desktop virtual machines ▸ Virtualbox, Docker and other providers ▸ Simple configuration with SSH access ▸ Standardized 'bento' images from Chef for basic machines ▸ https://vagrantup.com ▸ C-x C-f /ssh:[email protected]#2222:/
  • 11. DEMO EMACS ▸ Kitchen status ▸ Kitchen create ▸ Open kitchen.yml ▸ C-x C-f /ssh:[email protected]#2222:/ ▸ C-u M-x shell ▸ Whom
  • 12. INFRASTRUCTURE INSPEC ▸ Compliance as Code ▸ Ruby DSL ▸ 100s of Resources for auditing machines, databases, APIs, cloud platforms, etc. ▸ Local or remote scanning ▸ https://inspec.io Translate compliance into Code Clearly express statements of policy Move risk to build/test from runtime Find issues early Write code quickly Run code anywhere Inspect machines, data and APIs 100+ built-in resources
  • 13. DEMO EMACS ▸ Look at hello/controls/example.rb ▸ Kitchen verify ▸ Chmod +x hello.sh ▸ Kitchen verify ▸ Let's check on the command output, paste it in to our matcher ▸ It fails, why? ▸ Fix, kitchen verify ▸ Kitchen destroy ▸ Kitchen verify, now it's gone and broken
  • 14. INFRASTRUCTURE CHEF ▸ Infrastructure as Code ▸ Ruby DSL ▸ Resources for configuring servers in standardised libraries for easy reuse ▸ Client/server scales to 100s of thousands of machines ▸ https://chef.io Configuration Management, ▪ Managesdeployment and on-going automation ▪ Definereusableresources and infrastructure state as code ▪ Scale elegantly from one to tens of thousands of managed nodes across multiple complex environments ▪ Community, Certified Partner, and Chef supported content available for all common automation tasks
  • 15. DEMO EMACS ▸ Let's ensure that our file is always there ▸ Add the file resource ▸ Kitchen converge ▸ Kitchen verify ▸ Permissions again ▸ Mode '0755' ▸ Kitchen converge ▸ Kitchen verify ▸ Kitchen test
  • 16. DEBUGGING PRY ▸ Interactive Ruby debugger ▸ Built into Chef and InSpec ▸ Drop breakpoints into code ▸ ~/.emacs.d/ruby.el
  • 17. DEMO EMACS ▸ Drop debug into control ▸ Kitchen verify ▸ Exit-program, edit to bash resource ▸ Kitchen verify ▸ But it's hard-coded, so let's make it more dynamic ▸ Ls ▸ Content ▸ sys_info ▸ sys_info.methods ▸ sys_info.fqdn ▸ sys_info.short ▸ expected = "Hello EmacsConf 2019 from root on #{sys_info.short}" ▸ Whereami ▸ C 1 ▸ Ls ▸ described_class ▸ described_class.methods ▸ described_class.result ▸ described_class.result.stdout ▸ Exit ▸ "".match?(expected) ▸ Exit-program ▸ Update example.rb ▸ Kitchen verify ▸ Kitchen test Combining TRAMP with Shell Mode and local desktop testing with Kitchen make for a very fast feedback loop. I can test through the shell and through Ruby without leaving Emacs, going back and forth between my Chef infrastructure code and my InSpec compliance code. You might not be using these tools, but this pattern of rapid development feedback should be available to you no matter what you're working with. If you're a system administrator, you don't need to have screen or tmux anymore. If you're a developer you can deploy your applications into VM and test their behaviour in a clean room environment, using the same configurations as production environments. This was just a quick dive into Shell Mode, TRAMP, Chef, InSpec and Pry but hopefully you can take some of these ideas into your own Emacs setup and day to day workflow.
  • 18. THANKS!https://github.com/mattray/emacsconf2019 [email protected] This was just a quick dive into Shell Mode, TRAMP, Chef, InSpec and Pry but hopefully you can take some of these ideas into your own Emacs setup and day to day workflow. I've put this demo up on GitHub, there's a link to my emacs and bash configuration there as well. Thanks again for allowing me to present, I'm available in IRC for any questions you may have or you can email me at [email protected]