<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Eric Saupe</title>
    <description>The latest articles on DEV Community by Eric Saupe (@ericsaupe).</description>
    <link>https://dev.to/ericsaupe</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F254816%2Fe63c5d38-f681-47bc-b02e-38ae87a3b90f.jpeg</url>
      <title>DEV Community: Eric Saupe</title>
      <link>https://dev.to/ericsaupe</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ericsaupe"/>
    <language>en</language>
    <item>
      <title>Remote Debugging with Foreman and Byebug</title>
      <dc:creator>Eric Saupe</dc:creator>
      <pubDate>Mon, 20 Dec 2021 21:19:13 +0000</pubDate>
      <link>https://dev.to/ericsaupe/remote-debugging-with-foreman-and-byebug-2efg</link>
      <guid>https://dev.to/ericsaupe/remote-debugging-with-foreman-and-byebug-2efg</guid>
      <description>&lt;p&gt;With &lt;a href="https://rubyonrails.org/2021/12/15/Rails-7-fulfilling-a-vision"&gt;Rails 7 recently dropping&lt;/a&gt; there are a few improvements outside of the great new features that might take new projects by surprise. The first that I encountered after starting up a new Rails project was the &lt;code&gt;bin/dev&lt;/code&gt; script that now uses &lt;a href="https://github.com/ddollar/foreman"&gt;&lt;code&gt;foreman&lt;/code&gt;&lt;/a&gt; by default.&lt;/p&gt;

&lt;p&gt;The benefit of &lt;code&gt;foreman&lt;/code&gt; is you can create a &lt;code&gt;Procfile&lt;/code&gt; that defines all the processes your application will need to run. Processes like a web app process and maybe a background worker process and &lt;code&gt;foreman&lt;/code&gt; will run them both from a single command, &lt;code&gt;foreman start&lt;/code&gt;. Then you can reuse this &lt;code&gt;Procfile&lt;/code&gt; in production namely with Heroku that will create processes for all that are listed within that file. The downside is that all those processes are wrapped up in a single tab in your command line and doesn't lend itself well to debugging. This is because it is taking the output from all the processes defined and is simply echoing their output to you. When you debug you need access to the underlying process in order to interact with the debugger. You can get around this by running the web process in a separate tab but that takes away the benefit of &lt;code&gt;foreman&lt;/code&gt;. Luckily, &lt;a href="https://github.com/deivid-rodriguez/byebug"&gt;&lt;code&gt;byebug&lt;/code&gt;&lt;/a&gt; has a solution with &lt;a href="https://github.com/deivid-rodriguez/byebug/blob/master/GUIDE.md#debugging-remote-programs"&gt;remote debugging&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;Remote debugging with &lt;code&gt;byebug&lt;/code&gt; is really simple to set up. Simply create a &lt;code&gt;config/initializers/byebug.rb&lt;/code&gt; and start the server.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# config/initializers/byebug.rb
# frozen_string_literal: true

if Rails.env.development?
  require 'byebug/core'
  begin
    Byebug.start_server 'localhost', ENV.fetch('BYEBUG_SERVER_PORT', 8989).to_i
  rescue Errno::EADDRINUSE
    Rails.logger.debug 'Byebug server already running'
  end
end

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A few things to highlight:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;if Rails.env.development?&lt;/code&gt; is to ensure we start the server only in the development environment and not in the test environment. This makes it easier to debug in test because you're running those commands in a single command line process instead of through &lt;code&gt;foreman&lt;/code&gt; but in development you're probably running it with &lt;code&gt;foreman&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;begin rescue&lt;/code&gt; block is to allow multiple runs the &lt;code&gt;rails&lt;/code&gt; command. I ran into an issue where I had the development server running but wanted to generate a migration using &lt;code&gt;rails g migration&lt;/code&gt;. That command runs the initializers and was throwing an error since the &lt;code&gt;byebug&lt;/code&gt; server was already up and running on the other process. In that case we just ignore it and output the error to the logs.&lt;/li&gt;
&lt;li&gt;The default port for the &lt;code&gt;byebug&lt;/code&gt; server can be whatever you want and can be set via the &lt;code&gt;BYEBUG_SERVER_PORT&lt;/code&gt; environment variable. I've set the default port to be &lt;code&gt;8989&lt;/code&gt; but it can be whatever you want that is not in use.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once all that is in place you can open another command line prompt and run &lt;code&gt;byebug -R localhost:8989&lt;/code&gt;. Then once your web process hits the &lt;code&gt;byebug&lt;/code&gt; command and stops for debugging the new process will have access to it and you can debug to your heart's content.&lt;/p&gt;

&lt;p&gt;The default debugger in Rails 7 is now the default Ruby debugger aptly named &lt;code&gt;debugger&lt;/code&gt;. There are some docs that say &lt;code&gt;debugger&lt;/code&gt; supports remote debugging but I wasn't able to ever get it to work within &lt;code&gt;foreman&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I hope this makes using &lt;code&gt;foreman&lt;/code&gt; and debugging in Rails a more comfortable and happy experience!&lt;/p&gt;

</description>
      <category>byebug</category>
      <category>debugging</category>
      <category>rails</category>
      <category>ruby</category>
    </item>
    <item>
      <title>🎉 StickerChart.Party is now Free!</title>
      <dc:creator>Eric Saupe</dc:creator>
      <pubDate>Tue, 12 Nov 2019 15:41:35 +0000</pubDate>
      <link>https://dev.to/ericsaupe/stickerchart-party-is-now-free-2k2</link>
      <guid>https://dev.to/ericsaupe/stickerchart-party-is-now-free-2k2</guid>
      <description>&lt;p&gt;&lt;a href="//stickerchart.party"&gt;StickerChart.Party&lt;/a&gt;, the popular Slack appreciation plugin, has now dropped it's monthly service charge and is free forever!&lt;/p&gt;

&lt;p&gt;Giving praise in a digital world can feel a little underwhelming. Some of us might pine for the days when we were in school and were rewarded with a little gold star 🌟 for our special efforts that would go on a board for all to see. Well, those days are back with &lt;a href="//stickerchart.party"&gt;StickerChart.Party&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;Once you've added the plugin to one, or all, of your Slack accounts you can give a sticker to anyone by entering a quick chat command.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xXDY7Bf4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/r0c3nnsnrd061julbml4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xXDY7Bf4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/r0c3nnsnrd061julbml4.png" alt="Slash command example"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Instantly, everyone will know that a sticker was given.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--r421LT26--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/kbnww9n6j0kpsldck3hd.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--r421LT26--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/kbnww9n6j0kpsldck3hd.jpg" alt="Slack success response"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And your sticker will be on the board along with all the other stickers given out to other teammates.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2b-A5J4y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/e4dhpzm76cghj9bs28pq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2b-A5J4y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/e4dhpzm76cghj9bs28pq.png" alt="Sticker Chart"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Do you have a ton of custom emojis you've set up in your Slack group? No problem, &lt;a href="//stickerchart.party"&gt;StickerChart.Party&lt;/a&gt; supports all emojis that your team is currently using including animated ones!&lt;/p&gt;

&lt;p&gt;We've loved having &lt;a href="//stickerchart.party"&gt;StickerChart.Party&lt;/a&gt; installed on our Slack and have been having so much fun giving stickers for every little thing that comes to mind.&lt;/p&gt;

&lt;p&gt;&lt;a href="//stickerchart.party"&gt;Give it a try today&lt;/a&gt;, it's fun and it's free!&lt;/p&gt;

&lt;p&gt;Feel free to message me if you have any ideas for features and improvements. I hope you enjoy using it!&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>productivity</category>
      <category>news</category>
    </item>
  </channel>
</rss>
