<?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: umarhadi</title>
    <description>The latest articles on DEV Community by umarhadi (@umarhadi).</description>
    <link>https://dev.to/umarhadi</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%2F635417%2Fd4c01124-87e7-4aa5-9e26-83e7f8accbb7.jpg</url>
      <title>DEV Community: umarhadi</title>
      <link>https://dev.to/umarhadi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/umarhadi"/>
    <language>en</language>
    <item>
      <title>Mastering Docker: Key Commands for Developers</title>
      <dc:creator>umarhadi</dc:creator>
      <pubDate>Tue, 03 Oct 2023 17:16:28 +0000</pubDate>
      <link>https://dev.to/umarhadi/mastering-docker-key-commands-for-developerss-1anc</link>
      <guid>https://dev.to/umarhadi/mastering-docker-key-commands-for-developerss-1anc</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Welcome to the world of Docker, where software packaging and deployment become as easy as waving a magic wand! In this whimsical journey, we'll explore the enchanting realm of Docker's fundamentals, deciphering its secrets and uncovering why it's a must-know for developers. Prepare to embark on a spellbinding adventure through the land of containers, where we'll provide you with a guide to essential Docker commands that every developer should conjure up!&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is Docker? A Wizard's Explanation
&lt;/h2&gt;

&lt;p&gt;Imagine Docker as a powerful wizard's spellbook for developing, shipping, and running applications. It's the kind of magic that changed the game in software packaging and deployment by introducing the concept of containers. These containers are like magical boxes, each containing everything needed to run a piece of software – the code, the runtime, the libraries, and even the mystical system tools!&lt;/p&gt;

&lt;p&gt;Docker, the wizard's apprentice, provides a standardized way to create, distribute, and deploy these containers. With its help, developers can work their magic in various environments, ensuring that their applications run consistently across different systems. In essence, Docker is the sorcerer's wand for modern application development, making it a breeze to package, distribute, and run software in containers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Do We Need Docker? A Comedic Interlude
&lt;/h2&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1chz0ji28790p4ejievs.png" 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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1chz0ji28790p4ejievs.png" alt="it works on my machine"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, let's take a moment to chuckle as we unveil the comical reasons why we desperately need Docker!&lt;/p&gt;

&lt;h3&gt;
  
  
  Consistency - Banishing the "It Works on My Machine" Monster
&lt;/h3&gt;

&lt;p&gt;With Docker, the days of "it works on my machine" are long gone! It brings consistency to the chaotic world of software development, ensuring that your application runs smoothly from a developer's humble laptop to the grandiose production servers. Say goodbye to compatibility conundrums and hello to harmonious deployments!&lt;/p&gt;

&lt;h3&gt;
  
  
  Isolation - Containers: The Great Separators
&lt;/h3&gt;

&lt;p&gt;Containers are the knights in shining armor, guarding your applications and their dependencies with utmost diligence. They keep everything separate and soundproof, so no container can throw a noisy party that disrupts its neighbors. Security is paramount in this kingdom of containers!&lt;/p&gt;

&lt;h3&gt;
  
  
  Portability - The Grand Tour of Docker Containers
&lt;/h3&gt;

&lt;p&gt;Picture your Docker container as a well-traveled explorer. Once you package your application and its companions into a container, it becomes a globetrotter! It will gallantly run the same way in any land that supports Docker. Traveling between environments has never been so effortless!&lt;/p&gt;

&lt;h3&gt;
  
  
  Scalability - Docker's Elastic Charm
&lt;/h3&gt;

&lt;p&gt;Docker's magic extends to scaling applications up or down with grace and ease, especially when joined by its trusty sidekick, Kubernetes. Watch as your applications gracefully transform in size, like a wizard's trick!&lt;/p&gt;

&lt;h3&gt;
  
  
  Version Control - Keeping Tabs on Docker Spells
&lt;/h3&gt;

&lt;p&gt;Docker allows you to capture the essence of your containers and their mystical dependencies. You can track changes over time, much like a wizard documenting their spells in a grimoire.&lt;/p&gt;

&lt;h3&gt;
  
  
  Continuous Integration/Continuous Deployment (CI/CD) - The Magical Assembly Line
&lt;/h3&gt;

&lt;p&gt;Docker's seamless integration with CI/CD pipelines is akin to an enchanted assembly line. It automates the testing, building, and deployment of applications, just as if they were brewed in a cauldron of automation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Microservices - Docker's Potion for the Future
&lt;/h3&gt;

&lt;p&gt;For those who dream of microservices, Docker is the ultimate potion. It's tailor-made for breaking down applications into smaller, independently deployable services – a bit like splitting a magic wand into countless wands! Containers make managing and scaling these microservices as easy as a wave of a wand.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Docker Components: Unlocking the Treasure Chest
&lt;/h2&gt;

&lt;p&gt;In our magical journey through Docker, let's explore the treasure chest of key Docker components that power the enchantment.&lt;/p&gt;

&lt;h3&gt;
  
  
  Images: Capturing the Essence of Docker Spells
&lt;/h3&gt;

&lt;p&gt;In the mystical realm of Docker, an "Image" is a precious gem – a lightweight, standalone, and executable package that contains the very essence of a piece of software. Within this gem lies the code, the runtime, the libraries, and the mystical system tools. Think of it as a magical snapshot of an entire universe!&lt;/p&gt;

&lt;p&gt;These Docker images are the building blocks of containers – living, breathing instances of these images that can be summoned to run on any Docker-compatible platform. They are like clones created from the original spell, ready to do your bidding.&lt;/p&gt;

&lt;p&gt;A Docker image is, in essence, a snapshot of a file system that encapsulates an application and all its dependencies. This encapsulation is what makes it a breeze to distribute and deploy applications consistently across different realms – from the humble developer's laptop to the grand citadels of production servers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Registries: The Treasure Vaults of Docker
&lt;/h3&gt;

&lt;p&gt;In the land of Docker, a "registry" is where treasure is stored – a centralized repository dedicated to safeguarding and distributing Docker images. These registries are the guardians of Docker's most valuable assets, ensuring that the images are safe, accessible, and can be easily shared among developers and across diverse environments.&lt;/p&gt;

&lt;p&gt;The Docker registry plays a pivotal role in the epic tale of managing and sharing Docker images. It provides a haven to store, version, and distribute these magical containers, fostering collaboration among software adventurers and enabling the consistent deployment of applications.&lt;/p&gt;

&lt;p&gt;One illustrious example of such a registry is the legendary Docker Hub, where Docker images from across the realm gather for all to see and share.&lt;/p&gt;

&lt;h3&gt;
  
  
  Setting Up Docker: Preparing for the Quest
&lt;/h3&gt;

&lt;p&gt;Before you embark on your epic quest of Docker commands, you must first prepare your vessel. Follow the ancient installation instructions tailored to your platform:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.docker.com/desktop/install/windows-install/" rel="noopener noreferrer"&gt;Docker Desktop for Windows&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.docker.com/desktop/install/mac-install/" rel="noopener noreferrer"&gt;Docker Desktop for Mac&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.docker.com/desktop/install/linux-install/" rel="noopener noreferrer"&gt;Docker Desktop for Linux&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once you've equipped your vessel with Docker's magical powers, you can determine its potency by invoking the following incantation in your terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Basic Docker Commands: Unleash the Magic
&lt;/h2&gt;

&lt;p&gt;Now, let's unlock some of Docker's basic spells!&lt;/p&gt;

&lt;h3&gt;
  
  
  Pulling Docker Images: Summoning the Magic
&lt;/h3&gt;

&lt;p&gt;To conjure an image from the mystical Docker Hub, you'll need the docker pull command. For instance, should you desire the essence of Ubuntu, simply speak the command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker pull ubuntu
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By default, the latest version of an image will be summoned to your realm. However, should you wish to specify a particular version, like the revered 20.04 version of Ubuntu, utter the incantation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker pull ubuntu:20.04
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But remember, choose your images wisely to match the nature of your quest!&lt;/p&gt;

&lt;h3&gt;
  
  
  Running a Container: Breathing Life into the Magic
&lt;/h3&gt;

&lt;p&gt;To bring your Docker magic to life, employ the docker run command. This is the incantation that births containers, allowing applications to thrive within them.&lt;/p&gt;

&lt;p&gt;For instance, to summon an Ubuntu container in detached mode, cast the spell:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-d&lt;/span&gt; ubuntu
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Manage Images Commands: Orchestrating Image Magic
&lt;/h3&gt;

&lt;p&gt;In our magical expedition through the Docker kingdom, it's crucial to understand how to manage the mystical images that power your spells. Here are some common image management commands that will help you orchestrate this magic:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;Explanation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;docker image ls&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Lists all images&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;docker image rm python&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Removes a specific image (e.g., python)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;docker history image&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Displays the image's history&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;docker inspect image&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Reveals low-level information about an image&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Container Interaction Commands: Dance of the Docker Containers
&lt;/h3&gt;

&lt;p&gt;In the world of Docker, containers are like dancers, and you're their choreographer. Here are some common commands to interact with your Docker containers:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;Explanation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;docker start container&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Begins a new performance (container)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;docker stop container&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Ends a performance (container)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;docker pause container&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Puts a performance on pause (container)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;docker restart container&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Restarts a performance (container)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;docker wait container&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Temporarily blocks a performance (container)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;docker create image&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Crafts a new performer (container)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Container Inspection Commands: Peeking Behind the Curtain
&lt;/h3&gt;

&lt;p&gt;Sometimes, the show must go on, but you need to peek behind the curtain. Here are commands to inspect your containers:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;Explanation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;docker ps&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Lists all running containers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;docker ps -a&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Lists all containers, even the ones that stopped&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;docker diff container&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Inspects changes in the container filesystem&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;docker inspect container&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Dives deep into low-level container information&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;docker log container&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Gathers the logs of a container&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;docker stats container&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Shows statistics of a container's resource usage&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Clean Up Commands: Keeping the Stage Tidy
&lt;/h3&gt;

&lt;p&gt;After a mesmerizing performance, it's essential to tidy up the stage. Here are commands to keep your Docker world neat and tidy:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;Explanation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;docker image prune&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Clears unused Docker images&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;docker image prune -a&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Clears all images not used by containers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;docker system prune&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Sweeps the stage clean, removing all stopped containers, unused networks, dangling images, and build cache&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;docker image rm image&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Removes a specific image&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;docker rm container&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Removes a running container&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;docker rm $(docker ps -a -q)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Bids farewell to all stopped containers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;docker kill $(docker ps -q)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Silences all running containers&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Conclusion: Your Docker Odyssey
&lt;/h3&gt;

&lt;p&gt;With these commands at your disposal, you've unlocked the secrets of Docker's magical world. Understanding Docker and mastering these fundamentals is essential for any modern developer. As containerization becomes the standard practice, Docker's power will simplify your development journey.&lt;/p&gt;

&lt;p&gt;Congratulations! 👏🏻 You've not only completed this magical journey but have also become a master of the essential Docker 🐳 spells. May your future Docker adventures be filled with enchantment and seamless development workflows!&lt;/p&gt;

&lt;p&gt;🪄✨🐳&lt;/p&gt;

</description>
      <category>docker</category>
      <category>devops</category>
    </item>
    <item>
      <title>Deploying Previews with GitHub Actions on Fly.io</title>
      <dc:creator>umarhadi</dc:creator>
      <pubDate>Wed, 20 Sep 2023 06:55:26 +0000</pubDate>
      <link>https://dev.to/umarhadi/deploying-previews-with-github-actions-on-flyio-8n7</link>
      <guid>https://dev.to/umarhadi/deploying-previews-with-github-actions-on-flyio-8n7</guid>
      <description>&lt;p&gt;Alright, fellow code adventurers, fasten your seatbelts because we're about to embark on a wild coding journey to the clouds! 🚀 Imagine this: You've got a project, and you want to show it off to the world, but you also want to make sure it's as polished as a freshly waxed surfboard. Well, fear not, because we're going to learn how to create deploy previews that are so snazzy, even your grandma will be impressed!&lt;/p&gt;

&lt;p&gt;In this cosmic tale of code and cloud, we'll be using the dynamic duo of &lt;a href="https://fly.io"&gt;Fly.io&lt;/a&gt; and &lt;a href="https://github.com/actions"&gt;GitHub Actions&lt;/a&gt;. Think of Fly.io as your trusty steed, ready to carry your code to the far reaches of the internet, while GitHub Actions is the sidekick with the magical powers to make it all happen automatically. Together, they'll take your project to new heights (pun totally intended).&lt;/p&gt;

&lt;p&gt;So, grab your coding cape and get ready to take flight as we dive into the world of deploying previews with a sprinkle of humor and a dash of technical wizardry. Let's make your code soar like a majestic albatross (or at least like a really efficient drone). Buckle up, because it's going to be one heck of a ride!" 🌟 &lt;/p&gt;

&lt;h2&gt;
  
  
  Let's Fly, Laravel!
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Prepare a Laravel app
&lt;/h3&gt;

&lt;p&gt;Alrighty, let's get this Laravel party started! You can either bring your trusty Laravel app to the shindig, or if you're feeling adventurous, whip up a fresh one! 🍰&lt;/p&gt;

&lt;p&gt;But why choose Laravel for this coding adventure, you ask? Well, imagine Laravel as the magical wand in your coder's toolkit. It's like having a wizard's spellbook, filled with elegant incantations that turn code chaos into pure digital poetry. With its intuitive syntax and a treasure trove of packages, Laravel is your trusty sidekick in this quest for code greatness.&lt;/p&gt;

&lt;p&gt;To start from scratch, here's what you'll need: &lt;code&gt;PHP 8+&lt;/code&gt; and Composer. Make sure you've got PHP installed, and you can check that with a quick &lt;code&gt;php --version&lt;/code&gt; command.&lt;/p&gt;

&lt;p&gt;Now, let's create a new Laravel application that's as fresh as a minty toothpaste commercial:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;composer create-project laravel/laravel fly-laravel
&lt;span class="nb"&gt;cd &lt;/span&gt;fly-laravel
php artisan serve
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Voilà! You should be able to visit &lt;a href="http://localhost:8000"&gt;http://localhost:8000&lt;/a&gt; and behold your shiny new home page. It's like baking a digital cake, isn't it?&lt;/p&gt;

&lt;h3&gt;
  
  
  Deploy to Fly.io
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Install Fly
&lt;/h4&gt;

&lt;p&gt;Before we take off, you'll need to install your co-pilot, &lt;code&gt;flyctl&lt;/code&gt; – the superhero of your Fly.io adventures. If you haven't already, sign up for Fly.io to get your golden ticket.&lt;/p&gt;

&lt;h4&gt;
  
  
  Launch
&lt;/h4&gt;

&lt;p&gt;Now, let's unleash the magic with the &lt;code&gt;fly launch&lt;/code&gt; command. It's like giving your app a jetpack!&lt;/p&gt;

&lt;p&gt;This command will sprinkle some Fly.io goodness into your code base, but don't fret, it'll ask for permission before making any changes.&lt;/p&gt;

&lt;p&gt;If you haven't done it already, go ahead and summon Fly with this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;fly launch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When it asks if you want to deploy right away, be a rebel and say "No." We've got more tricks up our sleeves!&lt;/p&gt;

&lt;p&gt;If you've got some secret sauce (environment variables) to add, you can spice up the fly.toml file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight toml"&gt;&lt;code&gt;&lt;span class="nn"&gt;[env]&lt;/span&gt;
&lt;span class="c"&gt;# Set any env vars you want here&lt;/span&gt;
&lt;span class="c"&gt;# Caution: Don't add secrets here&lt;/span&gt;
&lt;span class="py"&gt;APP_URL&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"https://fly-hello-laravel.fly.dev"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace that link with the URL your app will be served on, like "&lt;a href="https://your-app-name.fly.dev"&gt;https://your-app-name.fly.dev&lt;/a&gt;." And for the super-secret stuff, use the &lt;code&gt;fly secrets&lt;/code&gt; set command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;fly secrets &lt;span class="nb"&gt;set &lt;/span&gt;&lt;span class="nv"&gt;SOME_SECRET_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;lt;the-value-from-your-env-file&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Deploy
&lt;/h4&gt;

&lt;p&gt;Drumroll, please! It's showtime! 🥁 Run the &lt;code&gt;fly deploy&lt;/code&gt; command to build and launch your application into the digital skies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;fly deploy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, sit back, relax, and visit &lt;a href="https://your-app-name.fly.dev"&gt;https://your-app-name.fly.dev&lt;/a&gt; to witness your Laravel demo home page in all its glory. Your app just spread its wings and flew into the cloud! 🚀&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Before we dive into the GitHub action-packed adventure, don't forget to create a cozy little home for your project on GitHub. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  GitHub Actions - The Magic Wand for Automatic Deployments
&lt;/h2&gt;

&lt;p&gt;Now, let's summon our code-controlling sorcerer, GitHub Actions, to automate our deployment to Fly.io whenever there's a commit on the main branch, or any other branch of your choosing. It's like having a trusty spellbook for your code! ✨&lt;/p&gt;

&lt;p&gt;Here's how you cast this spell&lt;/p&gt;

&lt;p&gt;First, create a mystical directory named &lt;code&gt;.github&lt;/code&gt;. Inside this mystical realm, forge a folder called &lt;code&gt;workflows&lt;/code&gt;. And within that folder, conjure a new scroll named &lt;code&gt;deploy-prod.yml&lt;/code&gt;. Or feel free to name it whatever your creative wizardry desires. 🧙&lt;/p&gt;

&lt;p&gt;Inside this magical scroll, inscribe the incantations like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Production Deployment&lt;/span&gt;
&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;push&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;branches&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;main&lt;/span&gt;

&lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;FLY_API_TOKEN&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.FLY_API_TOKEN }}&lt;/span&gt;

&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;deploy&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Deploy to fly.io&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Checkout code&lt;/span&gt;
        &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v3&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Setup flyctl&lt;/span&gt;
        &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;superfly/flyctl-actions/setup-flyctl@master&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Deploy&lt;/span&gt;
        &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;flyctl deploy --remote-only --wait-timeout &lt;/span&gt;&lt;span class="m"&gt;3600&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ah, but before we proceed with our mystical ritual, we must create a &lt;a href="https://fly.io/user/personal_access_tokens"&gt;Fly API token&lt;/a&gt; in the sacred Fly.io realm. Once obtained, guard it like a dragon guards its treasure. Then, secretly whisper its name, &lt;code&gt;FLY_API_TOKEN&lt;/code&gt;, into the GitHub vault known as 'secrets.'&lt;/p&gt;

&lt;p&gt;With your GitHub Actions spell in place, you're now the master of automatic deployments. But what's the fun in having a magical wand if you don't wave it around a bit more? Let's dive deeper:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The name of your spell, &lt;code&gt;Production Deployment&lt;/code&gt; is like the title of a chapter in your code journey. Feel free to give it a whimsical name that tickles your coder's fancy.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;on&lt;/code&gt; section is where you declare the mystical conditions for your spell. Currently, it's set to trigger on every push to the &lt;code&gt;main&lt;/code&gt; branch. But if you're feeling mischievous, you can change main to any other branch name of your choice. It's like picking the color of your wizard's robe for the day.&lt;/li&gt;
&lt;li&gt;Ah, the &lt;code&gt;env&lt;/code&gt; section! Here, you're using the power of secrets. Remember that sacred &lt;code&gt;FLY_API_TOKEN&lt;/code&gt; we whispered into GitHub's ear? This is where it comes to life, allowing your spell to access the Fly.io realm securely.&lt;/li&gt;
&lt;li&gt;The heart of your GitHub Actions spell is the &lt;code&gt;jobs&lt;/code&gt; section. Think of it as the recipe for your magical potion;
&lt;code&gt;name&lt;/code&gt;, give your job a grand name like &lt;code&gt;Deploy to the Clouds.&lt;/code&gt; This is what appears in the spellbook. 
&lt;code&gt;runs-on&lt;/code&gt;, here, you specify the mystical environment where your spell will be cast. We're using &lt;code&gt;ubuntu-latest&lt;/code&gt; but you can choose other environments as well.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;steps&lt;/code&gt; section is where the real magic happens. Each step is like a wand movement in your spellcasting; &lt;code&gt;Checkout code&lt;/code&gt;, this step fetches your enchanted code from the GitHub repository. &lt;code&gt;Setup flyctl&lt;/code&gt;, it prepares the &lt;code&gt;flyctl&lt;/code&gt; tool, your trusty broomstick for flying to Fly.io. &lt;code&gt;Deploy&lt;/code&gt;, this is where the actual deployment incantation takes place. &lt;code&gt;flyctl&lt;/code&gt; deploy is the spell that sends your code to the clouds. The &lt;code&gt;--remote-only&lt;/code&gt; flag ensures it deploys remotely, and &lt;code&gt;--wait-timeout 3600&lt;/code&gt; ensures it waits for up to 3600 seconds (1 hour) for completion.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;With this done, embrace your code changes, commit them, and with a flourish, push them to your repository.&lt;/p&gt;

&lt;p&gt;Behold, the magic! GitHub Actions shall now heed your command, automatically deploying your code to Fly.io whenever there's a push to the main branch, or the branch of your choosing. 🪄✨&lt;/p&gt;

&lt;p&gt;Congratulations, you've now harnessed the powers of automation! Your code is as nimble as a ninja, deploying with every push. 🚀&lt;/p&gt;

&lt;p&gt;&lt;em&gt;May your deploys always be smooth and your errors easily banished!&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Embracing Deploy Previews - A Peek Before the Merge
&lt;/h2&gt;

&lt;p&gt;So, you've mastered the art of automating deployments to your production branch (main), but what if you want a sneak peek before you let those changes roam free in the main branch wilderness? That's where deploy previews come to the rescue! It's like having a magical crystal ball to see the future of your Laravel changes before they join the grand main parade.&lt;/p&gt;

&lt;p&gt;Let's dive right in!&lt;/p&gt;

&lt;h3&gt;
  
  
  Setting the Stage
&lt;/h3&gt;

&lt;p&gt;Imagine this: You've got a pull request (PR) with some dazzling Laravel updates, and you're itching to see how they'll dance in your application before you hit that merge button. Well, that's where deploy previews steal the spotlight!&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating the Deploy Preview Spell
&lt;/h3&gt;

&lt;p&gt;Now, let's craft the incantation that will bring your deploy previews to life. Navigate to the mystical &lt;code&gt;.github/workflows&lt;/code&gt; directory and conjure a new scroll named &lt;code&gt;deploy-preview.yml&lt;/code&gt;. Within this scroll, we shall inscribe the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Preview Deployment&lt;/span&gt;
&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;pull_request&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;types&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;opened&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;reopened&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;synchronize&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;closed&lt;/span&gt;

&lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;FLY_API_TOKEN&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.FLY_API_TOKEN }}&lt;/span&gt;
  &lt;span class="na"&gt;FLY_REGION&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;lax&lt;/span&gt;
  &lt;span class="na"&gt;FLY_ORG&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;personal&lt;/span&gt;

&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;user_preview&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class="na"&gt;concurrency&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;group&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;pr-${{ github.event.number }}-your-app-name&lt;/span&gt;
    &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Preview Deployment&lt;/span&gt;
      &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ steps.deploy.outputs.url }}&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Checkout code&lt;/span&gt;
        &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v3&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Deploy to Fly&lt;/span&gt;
        &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;deploy&lt;/span&gt;
        &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;tkangketik/fly-preview@main&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;pr-${{ github.event.number }}-your-app-name&lt;/span&gt;
          &lt;span class="na"&gt;vm_memory&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;512&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Deciphering the Deploy Preview Spell
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;The &lt;code&gt;name&lt;/code&gt; of our spell is "Preview Deployment." It's the title of this chapter in our magical code book.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;on&lt;/code&gt; section defines when this spell should be invoked. In our mystical GitHub land, it's triggered when a pull request is either &lt;code&gt;opened&lt;/code&gt;, &lt;code&gt;reopened&lt;/code&gt;, &lt;code&gt;synchronized&lt;/code&gt; (updated), or &lt;code&gt;closed&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;env&lt;/code&gt; section brings in the magic tokens from your GitHub secrets vault. These are essential ingredients for spellcasting on Fly.io, including your Fly API token, region, and organization.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;user_preview&lt;/code&gt;, this is the star of the show, your deploy preview job. It runs on the Ubuntu stage.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;concurrency&lt;/code&gt; section ensures that each PR gets its own stage to shine. Think of it as giving each preview its private viewing room.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;environment&lt;/code&gt; subsection names your deployment environment, like a label on a jar of enchanted pickles. The &lt;code&gt;url&lt;/code&gt; here is where the magic link to your preview will appear.&lt;/li&gt;
&lt;li&gt;"Checkout code", this step fetches your Laravel magic from the GitHub realm.&lt;/li&gt;
&lt;li&gt;"Deploy to Fly", the heart of the spell, where &lt;a href="https://github.com/tkangketik/fly-preview"&gt;tkangketik/fly-preview&lt;/a&gt; conjures your deploy preview. You can customize it with memory, VM settings, and secrets as you see fit.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now, with this enchanting GitHub Actions spell, every time you open, reopen, update, or close a pull request, a deploy preview will be conjured. It's like having a crystal ball to peer into the future of your Laravel changes!&lt;/p&gt;

&lt;p&gt;For more magical details and customization options, you can refer to the &lt;a href="https://github.com/tkangketik/fly-preview"&gt;spellbook&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;May your deploy previews be as clear as a wizard's prophecy and as smooth as a dragon's breath! 🧙‍♂️🔮🚀&lt;/p&gt;

&lt;h2&gt;
  
  
  Closing Thoughts: The Magic of Deploy Previews
&lt;/h2&gt;

&lt;p&gt;And there you have it, fellow coding enchanters! You've now unlocked the mystical power of deploy previews, allowing you to gaze into the future of your Laravel changes before they join the grand parade of the main branch. It's like having a front-row seat to a magical show, where code transformations unfold before your eyes!&lt;/p&gt;

&lt;p&gt;With the GitHub Actions spell and the Fly.io realm at your command, you're not just a code sorcerer; you're a code visionary. So, go forth, create, enchant, and may your deploys always be as smooth as a wizard's spell.&lt;/p&gt;

&lt;h3&gt;
  
  
  References:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://fly.io/docs/"&gt;Fly.io Docs&lt;/a&gt;: Explore the Fly.io documentation to discover even more magical capabilities for your deployments.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.github.com/en/actions"&gt;GitHub Actions Docs&lt;/a&gt;: Dive into the GitHub Actions documentation to master the art of automation.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/tkangketik/fly-preview"&gt;Fly-Preview Repository&lt;/a&gt;: Visit the Fly-Preview repository to uncover the secrets behind this deploy preview spell, crafted by the coding wizards.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Remember, code is not just a tool; it's a canvas for your digital magic. Happy coding and may your code always soar to new heights! 🚀🔮✨&lt;/p&gt;

</description>
      <category>githubactions</category>
      <category>cloud</category>
      <category>laravel</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
