<?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: AutoIdle</title>
    <description>The latest articles on DEV Community by AutoIdle (@autoidle).</description>
    <link>https://dev.to/autoidle</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%2F138197%2Ff068bc3a-46d9-45d8-8d1b-ae5597a9098b.png</url>
      <title>DEV Community: AutoIdle</title>
      <link>https://dev.to/autoidle</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/autoidle"/>
    <language>en</language>
    <item>
      <title>3 Money Saving Tools You Need for Heroku in 2021</title>
      <dc:creator>AutoIdle</dc:creator>
      <pubDate>Wed, 10 Mar 2021 12:12:17 +0000</pubDate>
      <link>https://dev.to/autoidle/3-money-saving-tools-you-need-for-heroku-in-2021-o6a</link>
      <guid>https://dev.to/autoidle/3-money-saving-tools-you-need-for-heroku-in-2021-o6a</guid>
      <description>&lt;p&gt;If you’re thinking about launching new applications this year, there are many good reasons to choose &lt;a href="https://www.heroku.com/"&gt;Heroku&lt;/a&gt; as your hosting platform. In addition to its ability to make deployment and environment configuration easy, Heroku provides a well-designed platform, tools, &lt;a href="https://devcenter.heroku.com/"&gt;documentation&lt;/a&gt;, and an extensive add-on community.&lt;/p&gt;

&lt;p&gt;Heroku’s superpower is managing your servers for you. It hides the intricacies of server maintenance and provides a friendly interface to manage your application. Deploying is easy once you’re up and running. You can focus on your code without worrying about managing infrastructure.&lt;/p&gt;

&lt;p&gt;As a developer, I personally enjoy the ready-to-use environment Heroku provides. You can create a new server in seconds using the Command Line interface. Heroku is flexible and friendly towards beginners in the way it allows you to integrate with familiar developer workflows.&lt;/p&gt;

&lt;p&gt;The opportunity cost of using Heroku, however, is the amount of money you’ll have to spend as your application grows-you’ll need more dynos (servers) and third-party add-ons to handle demands from users and your growing application.&lt;/p&gt;

&lt;p&gt;Knowing how to optimize your use of dynos, when to autoscale, or put an application to sleep will help you save significant costs on app development. In this article, I’ll share three money-saving tools top Heroku developers use to cut costs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Save money before production
&lt;/h2&gt;

&lt;p&gt;Typically, alpha and beta releases help developers launch their applications, catch errors, and receive useful feedback from early adopters.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://devcenter.heroku.com/articles/github-integration-review-apps"&gt;Review apps on Heroku&lt;/a&gt; work like alpha and beta releases on steroids. They are disposable applications that enable developers to build and test app environments on a temporary URL before merging changes back to production. Review apps also help to improve code review and acceptance test workflows.&lt;/p&gt;

&lt;p&gt;However, before you commit to using review apps, it is important to know that every second your application runs on Heroku increases your server costs. If your applications run 24/7, you’ll rack up high costs over time.&lt;/p&gt;

&lt;p&gt;The good news is that you don’t need your apps running every second of the day. You can save money by putting your applications to sleep when you don’t need them. The best tool to help you achieve this is AutoIdle.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://autoidle.com"&gt;1. AutoIdle&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oW2TOf2z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2804/0%2AnWXAsxaMOVqpK5_G.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oW2TOf2z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2804/0%2AnWXAsxaMOVqpK5_G.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This may come across as a humblebrag, but I wouldn’t suggest &lt;a href="https://autoidle.com"&gt;AutoIdle&lt;/a&gt; if it weren’t one of the most recommended Heroku add-ons for saving server costs on Heroku. As of January 2021, over 200 organizations worldwide have saved over $500,000 using AutoIdle.&lt;/p&gt;

&lt;p&gt;AutoIdle is a Heroku add-on that saves you money by automatically putting your applications to sleep when they’ve been inactive for about 30 minutes. It is designed for staging and review applications, but it also works for non-critical applications running in other servers’ backgrounds.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ldWHFgUs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2860/0%2Ap-eFS48qZyHBy7LC.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ldWHFgUs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2860/0%2Ap-eFS48qZyHBy7LC.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A great feature of AutoIdle is its ability to start your application without displaying an error message on the first request, and it does this with a minimal lag. It integrates easily into your Heroku application in a few clicks and works as a set-and-forget type of application. Once activated, you don’t have to do anything else.&lt;/p&gt;

&lt;h2&gt;
  
  
  Save money at production stage
&lt;/h2&gt;

&lt;p&gt;You start to feel the heat of dyno costs when you get to the production stage. You will need to add more dynos to handle the spike in activities as your application grows. Heroku makes it easy to choose how many dynos you need using their autoscale feature.&lt;/p&gt;

&lt;p&gt;However, autoscaling is available only for performance-tier dynos and dynos running in private spaces. The free and hobby dynos do not have autoscale. Luckily, there are third-party add-ons that can help you autoscale lower-tier applications. My top two picks are Rails Autoscale and Adept Scale.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://railsautoscale.com"&gt;2. Rails Autoscale&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DfUFdLZq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2804/0%2APg3zFEmeey2mmJzV.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DfUFdLZq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2804/0%2APg3zFEmeey2mmJzV.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you’re on a lower tier on Heroku, you’ll need to use an add-on like &lt;a href="https://railsautoscale.com"&gt;Rails Autoscale&lt;/a&gt;. It works based on request queue time, not total response time, making it faster than Heroku’s native autoscaling solution.&lt;/p&gt;

&lt;p&gt;However, as the name suggests, you must be running a Rack-based Ruby app on Heroku to use this add-on. Rails Autoscale also supports scheduling tools like Sidekiq, Resque, Delayed Job, and Que.&lt;/p&gt;

&lt;p&gt;You can split your worker queues across multiple processes and configure each one independently. Rails Autoscale works seamlessly on standard and performance dynos, helping you save more money the more dynos you use.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;a href="http://www.adeptscale.com"&gt;**3. **Adept Scale&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YvQ_Sp9n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2804/0%2AQsorbGuQapY1qB23.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YvQ_Sp9n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2804/0%2AQsorbGuQapY1qB23.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You know those tools that make your work so easy you can spend time working on projects you love while sipping coladas at the beach? &lt;a href="http://www.adeptscale.com"&gt;Adept Scale&lt;/a&gt; is one of those. With its easy-to-use scaling settings, it protects your applications from shutting down when traffic increases suddenly.&lt;/p&gt;

&lt;p&gt;Integrating Adept Scale in your applications reduces the number of running web dynos during low-traffic periods. An important point to note is that Adept Scale requires adequate time after initial setup to gather data insights from your application usage to develop the best settings for your needs.&lt;/p&gt;

&lt;p&gt;Once the application has a good working set of data it goes to work. You can then adjust the configurations to dictate how the scaling responds based on the usage patterns of your app.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;Launching applications and seeing users experience them is the highlight of most developers’ careers. However, the costs involved in building and scaling these applications can take the joy out of watching your baby grow.&lt;/p&gt;

&lt;p&gt;This is why I have suggested these tools to help you scale down your applications when they are not in use. When your applications are scaled down, you will not be billed for them.&lt;/p&gt;

&lt;p&gt;Are you ready to build and launch that application this year? Make sure to use one of these three money-saving tools to save costs on Heroku. You can &lt;a href="https://elements.heroku.com/addons/categories/dynos"&gt;find more here as well&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Want more tips like these?
&lt;/h2&gt;

&lt;p&gt;You should follow me on &lt;a href="https://twitter.com/autoidle"&gt;Twitter&lt;/a&gt;! And if you’re building on Heroku, you should check out &lt;a href="https://autoidle.com"&gt;AutoIdle&lt;/a&gt; — the automated way to save money on your staging and review apps.&lt;/p&gt;

</description>
      <category>heroku</category>
    </item>
    <item>
      <title>Laravel Session configuration on Heroku</title>
      <dc:creator>AutoIdle</dc:creator>
      <pubDate>Thu, 21 Feb 2019 19:06:00 +0000</pubDate>
      <link>https://dev.to/autoidle/laravel-session-configuration-on-heroku-159k</link>
      <guid>https://dev.to/autoidle/laravel-session-configuration-on-heroku-159k</guid>
      <description>&lt;h4&gt;
  
  
  Laravel on Heroku — Tip #6
&lt;/h4&gt;

&lt;p&gt;Laravel by default will save sessions into a directory on disk, which isn’t ideal, because Heroku uses an ephemeral filesystem (explained in &lt;a href="https://dev.to/dynotower/logging-with-laravel-on-heroku-46db-temp-slug-8321570"&gt;Tip #5&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;You have to use another session driver. Laravel ships with several great drivers out of the box:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Cookie&lt;/li&gt;
&lt;li&gt;Database&lt;/li&gt;
&lt;li&gt;Redis&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this example, we use Redis (personally we use always Redis, also for Cache and Queue).&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You have to change the default session driver to Redis in &lt;em&gt;config/session.php&lt;/em&gt;:&lt;/li&gt;
&lt;/ol&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;or by setting the SESSION_DRIVER environment variable:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;heroku config:set SESSION\_DRIVER=redis
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Don’t forget to add the &lt;a href="https://elements.heroku.com/addons/heroku-redis"&gt;Redis Heroku Addon&lt;/a&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;heroku addons:create heroku-redis:hobby-dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Use our &lt;a href="https://dev.to/dynotower/use-heroku-environment-variables-in-your-laravel-app-4f3i"&gt;Tip #1&lt;/a&gt; to use Heroku environment variables in your Laravel app.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That’s it, now your session will not expire again after restart or deploy 🚀&lt;/p&gt;

&lt;h3&gt;
  
  
  Want more tips like these?
&lt;/h3&gt;

&lt;p&gt;You should follow me on &lt;a href="https://twitter.com/AutoIdle"&gt;Twitter&lt;/a&gt;! And if you’re building on Heroku, you should check out &lt;a href="https://autoidle.com"&gt;AutoIdle&lt;/a&gt; — the automated way to save money on your staging and review apps.&lt;/p&gt;

</description>
      <category>heroku</category>
      <category>laravel</category>
    </item>
    <item>
      <title>Logging with Laravel on Heroku</title>
      <dc:creator>AutoIdle</dc:creator>
      <pubDate>Thu, 21 Feb 2019 17:51:00 +0000</pubDate>
      <link>https://dev.to/autoidle/logging-with-laravel-on-heroku-1imf</link>
      <guid>https://dev.to/autoidle/logging-with-laravel-on-heroku-1imf</guid>
      <description>&lt;h4&gt;
  
  
  Laravel on Heroku — Tip #5
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2Av3fvMLA9GJAIDRZm" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2Av3fvMLA9GJAIDRZm"&gt;&lt;/a&gt;Photo by &lt;a href="https://unsplash.com/@markusspiske?utm_source=medium&amp;amp;utm_medium=referral" rel="noopener noreferrer"&gt;Markus Spiske&lt;/a&gt; on &lt;a href="https://unsplash.com?utm_source=medium&amp;amp;utm_medium=referral" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Laravel by default will log errors and messages into a directory on disk, which isn’t ideal, because Heroku uses an &lt;a href="https://devcenter.heroku.com/articles/dynos#ephemeral-filesystem" rel="noopener noreferrer"&gt;ephemeral filesystem&lt;/a&gt;, that means that any changes to the filesystem whilst the dyno is running only last until that dyno is shut down or restarted. Each dyno boots with a clean copy of the filesystem from the most recent deploy. This is similar to how many container-based systems, such as Docker, operate.&lt;/p&gt;

&lt;p&gt;Change the log destination on Heroku:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;heroku config:set LOG\_CHANNEL=errorlog
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you can tail the logs live:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;heroku logs -t
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That’s it. 🚀&lt;/p&gt;

&lt;h3&gt;
  
  
  Want more tips like these?
&lt;/h3&gt;

&lt;p&gt;You should follow me on &lt;a href="https://twitter.com/AutoIdle" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;! And if you’re building on Heroku, you should check out &lt;a href="https://autoidle.com" rel="noopener noreferrer"&gt;AutoIdle&lt;/a&gt; — the automated way to save money on your staging and review apps.&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>heroku</category>
      <category>logging</category>
    </item>
    <item>
      <title>Laravel Deployment Optimization on Heroku</title>
      <dc:creator>AutoIdle</dc:creator>
      <pubDate>Mon, 18 Feb 2019 19:50:24 +0000</pubDate>
      <link>https://dev.to/autoidle/laravel-deployment-optimization-on-heroku-1hkc</link>
      <guid>https://dev.to/autoidle/laravel-deployment-optimization-on-heroku-1hkc</guid>
      <description>&lt;h4&gt;
  
  
  Laravel on Heroku — Tip #4
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3V-K3lEz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AAmZG-ptxLz776cOl" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3V-K3lEz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AAmZG-ptxLz776cOl" alt=""&gt;&lt;/a&gt;Photo by &lt;a href="https://unsplash.com/@toddquackenbush?utm_source=medium&amp;amp;utm_medium=referral"&gt;Todd Quackenbush&lt;/a&gt; on &lt;a href="https://unsplash.com?utm_source=medium&amp;amp;utm_medium=referral"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Laravel has great &lt;a href="https://laravel.com/docs/deployment"&gt;documentation about deployment&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The most important part is optimization, which includes 3 parts:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Autoloader Optimization&lt;/li&gt;
&lt;li&gt;Optimizing Configuration Loading&lt;/li&gt;
&lt;li&gt;Optimizing Route Loading&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;On Heroku, we also need these 3 optimizations.&lt;/p&gt;

&lt;h3&gt;
  
  
  Autoloader Optimization
&lt;/h3&gt;

&lt;p&gt;We have to optimize Composer’s class autoloader with the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;composer install --optimize-autoloader --no-dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Heroku already run composer install with this command (&lt;a href="https://devcenter.heroku.com/articles/php-support#installation-of-dependencies"&gt;Doc&lt;/a&gt;). Thanks Heroku 👍&lt;/p&gt;

&lt;h3&gt;
  
  
  ️Optimizing Configuration Loading and Route Loading
&lt;/h3&gt;

&lt;p&gt;We should run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php artisan config:cache

php artisan route:cache
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;for optimizing configuration loading and route.&lt;/p&gt;

&lt;p&gt;We will call these 2 artisan commands on boot so we create a new scripts entry in composer.json, e.g. warmup:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"scripts": {
 "warmup": [
 "php artisan config:cache",
 "php artisan route:cache"
 ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You may then combine invocation of that script together with your existing command in Procfile, for example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;web: composer warmup &amp;amp;&amp;amp; $(composer config bin-dir)/heroku-php-apache2 web/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it, our Laravel app on Heroku is optimized! 🚀&lt;/p&gt;

&lt;h3&gt;
  
  
  Want more tips like these?
&lt;/h3&gt;

&lt;p&gt;You should follow me on &lt;a href="https://twitter.com/AutoIdle"&gt;Twitter&lt;/a&gt;! And if you’re building on Heroku, you should check out &lt;a href="https://autoidle.com"&gt;AutoIdle&lt;/a&gt; — the automated way to save money on your staging and review apps.&lt;/p&gt;

</description>
      <category>optimization</category>
      <category>heroku</category>
      <category>laravel</category>
    </item>
    <item>
      <title>Run Laravel scheduled jobs on Heroku</title>
      <dc:creator>AutoIdle</dc:creator>
      <pubDate>Mon, 18 Feb 2019 12:01:00 +0000</pubDate>
      <link>https://dev.to/autoidle/run-laravel-scheduled-jobs-on-heroku-2ah6</link>
      <guid>https://dev.to/autoidle/run-laravel-scheduled-jobs-on-heroku-2ah6</guid>
      <description>&lt;h4&gt;
  
  
  Laravel on Heroku — Tip #3
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://cdn-images-1.medium.com/max/1024/0*FkjnO3CTtwSUseXT" class="article-body-image-wrapper"&gt;&lt;img src="https://cdn-images-1.medium.com/max/1024/0*FkjnO3CTtwSUseXT" alt=""&gt;&lt;/a&gt;Photo by &lt;a href="https://unsplash.com/@sonjalangford?utm_source=medium&amp;amp;utm_medium=referral"&gt;Sonja Langford&lt;/a&gt; on &lt;a href="https://unsplash.com?utm_source=medium&amp;amp;utm_medium=referral"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Heroku has the free &lt;a href="https://elements.heroku.com/addons/scheduler"&gt;Heroku Scheduler&lt;/a&gt;, but this has two disadvantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;it runs only every 10 minutes, every hour, or every day&lt;/li&gt;
&lt;li&gt;you have to add your commands in there UI&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Laravel comes with an amazing &lt;a href="https://laravel.com/docs/scheduling"&gt;Task Scheduler&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To run Laravel scheduled jobs on Heroku you have to add a new command and run that as a process.&lt;/p&gt;

&lt;p&gt;Create the Command &lt;em&gt;app/Console/Commands/SchedulerDaemon.php&lt;/em&gt;:&lt;/p&gt;

&lt;p&gt;You can generate this file with:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php artisan make:command SchedulerDaemon
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;




&lt;div class="ltag_gist-liquid-tag"&gt;  &lt;/div&gt;

&lt;p&gt;Add the following line to your &lt;em&gt;Procfile&lt;/em&gt;:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;  &lt;/div&gt;

&lt;p&gt;Don’t forget to enable this process in the Heroku Dashboard:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://cdn-images-1.medium.com/max/1024/1*kHi_1kh82c0cWpUrJZOZMw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://cdn-images-1.medium.com/max/1024/1*kHi_1kh82c0cWpUrJZOZMw.png" alt=""&gt;&lt;/a&gt;Enable this process in the Heroku Dashboard&lt;/p&gt;

&lt;h3&gt;
  
  
  Drop Me a Line
&lt;/h3&gt;

&lt;p&gt;Thanks for reading! Say hi to me on &lt;a href="https://twitter.com/DynoTower"&gt;Twitter&lt;/a&gt; and check out our &lt;a href="https://elements.heroku.com/addons/dynotower-start-stop"&gt;Heroku Addon&lt;/a&gt; to save money by automatically shutting down your non-critical dynos.&lt;/p&gt;

</description>
      <category>heroku</category>
      <category>herokuscheduler</category>
      <category>laravel</category>
    </item>
    <item>
      <title>Use the release phase to automate your release in your Laravel app</title>
      <dc:creator>AutoIdle</dc:creator>
      <pubDate>Sun, 17 Feb 2019 23:11:00 +0000</pubDate>
      <link>https://dev.to/autoidle/use-the-release-phase-to-automate-your-release-in-your-laravel-app-1a0j</link>
      <guid>https://dev.to/autoidle/use-the-release-phase-to-automate-your-release-in-your-laravel-app-1a0j</guid>
      <description>&lt;h4&gt;
  
  
  Laravel on Heroku — Tip #2
&lt;/h4&gt;

&lt;p&gt;On Heroku the &lt;a href="https://devcenter.heroku.com/articles/release-phase"&gt;release phase&lt;/a&gt; allows you to run certain tasks before a new release of your app is deployed.&lt;/p&gt;

&lt;p&gt;Release phase can be useful for tasks such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run the database migrations&lt;/li&gt;
&lt;li&gt;Clear cache&lt;/li&gt;
&lt;li&gt;Sending CSS, JS, and other assets from your app’s slug to a CDN or S3 bucket&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In our Laravel app, we will run the database migrations and flush the application cache.&lt;/p&gt;

&lt;p&gt;Add the following line to your &lt;em&gt;Procfile&lt;/em&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;release: php artisan migrate --force &amp;amp;&amp;amp; php artisan cache:clear
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The main advantage of using the release phase:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If the release command exits with a non-zero exit status, or if it’s shut down by the dyno manager, the release &lt;em&gt;fails&lt;/em&gt;. In this case, the release is &lt;em&gt;not&lt;/em&gt; deployed to the app’s dyno formation. You will receive an email notification in the event of a release phase failure.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Want more tips like these?
&lt;/h3&gt;

&lt;p&gt;You should follow me on &lt;a href="https://twitter.com/AutoIdle"&gt;Twitter&lt;/a&gt;! And if you’re building on Heroku, you should check out &lt;a href="https://autoidle.com"&gt;AutoIdle&lt;/a&gt; — the automated way to save money on your staging and review apps.&lt;/p&gt;

</description>
      <category>heroku</category>
      <category>laravel</category>
    </item>
    <item>
      <title>Use Heroku environment variables in your Laravel app</title>
      <dc:creator>AutoIdle</dc:creator>
      <pubDate>Sun, 17 Feb 2019 21:45:32 +0000</pubDate>
      <link>https://dev.to/autoidle/use-heroku-environment-variables-in-your-laravel-app-4f3i</link>
      <guid>https://dev.to/autoidle/use-heroku-environment-variables-in-your-laravel-app-4f3i</guid>
      <description>&lt;h4&gt;
  
  
  Laravel on Heroku — Tip #1
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YssbDTQo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A3z-4f6PlhJ2nv_gbyUZhzg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YssbDTQo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A3z-4f6PlhJ2nv_gbyUZhzg.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On Heroku, you get environment variables for PostgreSQL, Redis, e.g.&lt;/p&gt;

&lt;p&gt;You shouldn't add manually environment variables on Heroku for Database (like DB_HOST, DB_PORT, e.g.) and Redis (REDIS_HOST, e.g.).&lt;/p&gt;

&lt;p&gt;Because you have to change these if you upgrade/downgrade these Heroku add-ons.&lt;/p&gt;

&lt;p&gt;And more importantly, &lt;strong&gt;Heroku can change these environment variables at any time.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A better solution would be, add the following lines at the beginning of &lt;em&gt;config/database.php&lt;/em&gt;&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h3&gt;
  
  
  Want more tips like these?
&lt;/h3&gt;

&lt;p&gt;You should follow me on &lt;a href="https://twitter.com/AutoIdle"&gt;Twitter&lt;/a&gt;! And if you’re building on Heroku, you should check out &lt;a href="https://autoidle.com"&gt;AutoIdle&lt;/a&gt; — the automated way to save money on your staging and review apps.&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>heroku</category>
    </item>
  </channel>
</rss>
