Chris Fidao
Chris Fidao
  • 21
  • 144 815
Leveling up Laravel deployments: Unlocking optionality
This is how I like to do deployments for Laravel applications.
This involves using a CI pipeline, instead of (blindly) deploying based on git webhooks.
There's a lot of reasons why deployments can get bogged down and, frankly, suck. Let's see how to get unstuck by adding some process to our deployments.
The two main things that buy you optionality are:
1. An approval process
2. A deployable build artifact
These gives you lots of options! You can prevent bad code from going to production with an enforced approval process. When a build artifact, you can run your code from different points in time (without having to worry about nodejs dependency issues), test out other platforms, build containers, and run all sorts of experiments with little hassle.
Check out the same repository: github.com/fideloper/deploy-me
⌚️ Timestamps
00:00 Deployments: Complicated!
00:35 Why optionality?
01:30 You need a CI pipeline
01:54 GitHub Action setup (approval)
04:18 Build a deployable artifact
06:35 Need your feedback
Переглядів: 1 873

Відео

Surviving Homebrew: 9 tricks to master (and debug) Brew
Переглядів 8577 місяців тому
We become Brew power users, learning 9 tricks to better make use of Brew, and debug issues that come along with using it. We laugh, we cry, we poke fun. Everyone has a good time. ⌚️ Timestamps 00:00 Intro 00:30 Where is everything? 01:15 Brew Services 01:51 Brewfile 02:28 Brew hell: Installing/Updateing 03:44 Brew Doctor 04:17 Permissions 05:08 Brew Mas 05:47 Brew (un)link 06:35 Brew Edit 7:07 ...
The secret behind FrankenPHP: Will it revolutionize PHP?
Переглядів 40 тис.7 місяців тому
How to use FrankenPHP to ship your PHP/Laravel application, in a way that's potentially revolutionary and definitely pretty magical. FrankenPHP is a PHP application server, written in Golang. It's a module for the Caddy web server. Behind the scenes, Franken acts as a PHP SAPI (the thing that site between your web server and your PHP application). It manages handling PHP processes that result f...
Public routes blow up Laravel (in a weird way!)
Переглядів 16 тис.7 місяців тому
Public routes can grind your Laravel app to a halt. See why and how to fix it! A public "asset" route is one created dynamically in your Laravel code base, but serves “static asset” such as an SVG or JS embed meant to be used by your users/customers. However this means any traffic your customers get, you get (since they’re serving up YOUR asset on their site)! There’s two ways this breaks Larav...
Run Laravel in a subdirectory with Nginx (full, working config)
Переглядів 2,4 тис.7 місяців тому
We get Laravel working in a subdirectory, using Nginx configuration. This is great for multiple Laravel installations, or when you just have a second Laravel running inside of any subdirectory. The Laravel code base is not literally in a subdirectory of a parent code base, instead we just use Nginx routing to make the URL routes behave as if it is. ▶ The original content for this article is her...
Nginx Wildcard Subdomains for Multi-Tenancy (ssl + better config)
Переглядів 2,4 тис.7 місяців тому
We use letsencrypt (certbot) with the CloudFlare DNS plugin to generate a fee, auto-renewing TLS certificate to use with Nginx. Then we configure Nginx to use that TLS certificate and create a configuration to support multi-tenancy in our applications. We use a special configuration to capture the value of the subdomain so we can pass it off to our PHP application (or do anything we want, like ...
SSL Certificates in 30 Seconds
Переглядів 1,9 тис.8 місяців тому
See how to install, setup, and configure LetsEncrypt (certbot) with Nginx to get an SSL certificate in something like 30 seconds. This will help you get and configure an TSL certificate that auto-renews itself via LetsEncrypt - you never have to think about it again! When you install certbot, it will add a systemd timer. This timer periodically checks if the certificate needs renewing, and if s...
Production Ready Nginx, fixing Nginx's Default Configuration
Переглядів 19 тис.8 місяців тому
We take Nginx's default configuration and ensure we properly setup caching and security settings so we can serve our applications under the most idea circumstances. This makes use of H5BP's Nginx Configuration to quickly and easily get Nginx setup for production. H5BP: github.com/h5bp/server-configs-nginx ⌚️ TIMESTAMPS 00:00 Intro 00:26 Nginx’s Problematic Defaults 02:30 Fixing Nginx w/ H5BP 03...
Understanding and Debugging Nginx Configuration
Переглядів 9258 місяців тому
We take a tour of Nginx configuration to help you figure out and debug issues. We see where configuration is, talk about configuration conventions, seeing how to view loaded Nginx, test Nginx configuration, and finally understand a basic server configuration (to host your sites)!. Keep an eye out for future, more in-depth videos, especially regarding Nginx for Multi-tenant application setups (e...
Shipping Docker Course (re)Introduction
Переглядів 3738 місяців тому
I'm updating the Shipping Docker course ahead of Black Friday in 2023. courses.serversforhackers.com/shipping-docker This is my most sucessful course! It's also the oldest! It's still super relevant tho - luckily Docker hasn't changed under my feet. I've made a bunch of updates for 2023 and I talk a bit about why I didn't feel the need (at all!) to completely redo the course! If you want to hea...
Local dev setup for multi-tenant applications
Переглядів 2,1 тис.8 місяців тому
I'm doing some videos on setting servers up for multi-tenant applications. This means letting each customer/user have their own subdomain within your application. To start, we setup our local dev environment to use dnsmasq nginx to: 1. Map the domain used to a directory (where our code lives) 2. Setup specific apps to run with ANY subdomain so we can test a multi-tenant setup locally ⌚️ Timesta...
The surprising ways Nginx try_files actually works
Переглядів 1,5 тис.9 місяців тому
We see how Nginx's try_files directive actually works. It seems super simple at first, but there are configuration settings that affect how it works! We'll see what other configuration we should care about, and how other Nginx location blocks can be used in conjunction with try_files. ⌚️ Timestamps 00:00 Intro 00:08 URI and the Document Root 01:01 What try_files does 02:27 Other location blocks...
PHP is Weird, Stateless, and Beautiful
Переглядів 22 тис.9 місяців тому
HTTP is stateless. Most languages and frameworks are not! PHP, however, is a weirdo. It was created for HTTP! Unlike other languages, PHP rebuilds it's entire world on each request. This is a beautiful thing. ⌚️ Timestamps 00:00 PHP is Stateless 00:09 HTTP is stateless, too 01:22 Comparing Languages 04:28 The People's History of PHP 05:22 Ancient PHP looked like this 06:41 What's your point? 07...
Nginx Unit changes how we host PHP (& Laravel)
Переглядів 20 тис.10 місяців тому
Nginx Unit changes how we host PHP (& Laravel)
How Nginx and PHP-FPM turn a web request into code
Переглядів 3,7 тис.10 місяців тому
How Nginx and PHP-FPM turn a web request into code
Configuring and Troubleshooting PHP-FPM
Переглядів 4,2 тис.10 місяців тому
Configuring and Troubleshooting PHP-FPM
What to do when you hit 502 or 504 gateway errors on your Laravel app
Переглядів 2,6 тис.11 місяців тому
What to do when you hit 502 or 504 gateway errors on your Laravel app
I recreated GitHub Actions on Fly
Переглядів 27311 місяців тому
I recreated GitHub Actions on Fly
Setting your $PATH variable for Laravel development
Переглядів 34211 місяців тому
Setting your $PATH variable for Laravel development

КОМЕНТАРІ

  • @Vortigon
    @Vortigon 15 днів тому

    Good video but you completely forgot to include anything about debugging which was supposed to be the point of the video

  • @qureshiowais6951
    @qureshiowais6951 2 місяці тому

    you can use cloudflare for SSL also ?

    • @fideloper
      @fideloper Місяць тому

      certainly, and that pairs well with their origin certs so the connection is encrypted end to end!

  • @ryanvelbon
    @ryanvelbon 2 місяці тому

    Great explanation. No fluff. No boilerplate cluttering the examples.

  • @ryanvelbon
    @ryanvelbon 2 місяці тому

    Great content. Keep 'em coming please!

  • @cooltech5441
    @cooltech5441 2 місяці тому

    I already have nginx server on my ubuntu 22.04 running for several project, I want to try nginx unit for my newest project, if I install this nginx unit, would it break my nginx and all related website?

    • @fideloper
      @fideloper 2 місяці тому

      i don’t think so - but i’d experiment in a docker container first.

  • @uttula
    @uttula 2 місяці тому

    I remember yhe good old times when it was considered bloated if the executable exceeded a few megabytes in size :) oh how the turntables have been turning ;D

    • @fideloper
      @fideloper 2 місяці тому

      definitely not my favorite part of it. Interestingly golang can pretty easily get large too!

  • @badmadmat20
    @badmadmat20 2 місяці тому

    There is no revolution or magic here to be found! It is not worth to study how this works internally, reading documentation for hours etc. Use docker and apache,nginx. Keep it as simple as possible.

  • @AbhinavKulshreshtha
    @AbhinavKulshreshtha 2 місяці тому

    Franken php to bundle backend, and deno (hopefully bun too) to bundle and deploy frontend. Maybe someone can come up with installer script for windows, shipping products is going to be smooth as f in future.

  • @paulobitfranca
    @paulobitfranca 3 місяці тому

    Hi. I'm trying to run the frankphp in a different port. Is it possible to specify a port different from default (80) on run it? Thanks

    • @fideloper
      @fideloper 3 місяці тому

      unsure! did you figure that out? (in their docs?)

    • @paulobitfranca
      @paulobitfranca 3 місяці тому

      @@fideloper I didn't find anything. I forgot to mention... I'm talking about the standalone binary, not about the docker version

  • @RuhshadDaruwalla
    @RuhshadDaruwalla 4 місяці тому

    Awesome, neat and easily put across! Can you make a video auto ssl for external domains, something what Shopify does?

    • @fideloper
      @fideloper 3 місяці тому

      i’d use cloudflare 😂 - check out “cloudflare for saas”

  • @christogonusobasi7882
    @christogonusobasi7882 4 місяці тому

    Thanks for the great tutorial. I just setup Laravel with Tenancy package, but I get a different behavior on Herd; the tenant app loads the landlord home page. Maybe this is as a result of the folder structure on Laravel 11. Edit: This doesnt happen in laravel10. My guess is because the folder structure is exactly as on the documentation of the tenancy Package and I followed all steps as supposed :) Thanks once more for the great video.

  • @vishalchavda2931
    @vishalchavda2931 4 місяці тому

    Why that door moved from right side to left side 😆😆

  • @underflowexception
    @underflowexception 5 місяців тому

    How would the Laravel task scheduler be setup ? Will it leverage the existing binary or will you need to install PHP on the host machine and setup a cronjob?

    • @fideloper
      @fideloper 3 місяці тому

      you can use the existing binary to run any command

  • @PtolemySoter
    @PtolemySoter 5 місяців тому

    docker run --rm -v $PWD:/app -p 443:443 dunglas/frankenphp php artisan sapi ERROR Command "sapi" is not defined. How come you did not get this error ?

  • @saddlebear
    @saddlebear 5 місяців тому

    Excellent!!!

  • @ericknyoto3806
    @ericknyoto3806 5 місяців тому

    Required reviewers are only available for public repositories.

    • @fideloper
      @fideloper 5 місяців тому

      kinda lame, but I guess in theory if you use GH for business…pay for it!

  • @Mohamed.Shosha.
    @Mohamed.Shosha. 5 місяців тому

    Is it best than swoole ?

    • @FilipePetter
      @FilipePetter 2 місяці тому

      nothing is best or worst... its a very shallow way of thinking... you should ask, best for X or Y

  • @jonnymbarnes
    @jonnymbarnes 5 місяців тому

    the wink about 6mins in got a chuckle out of me

  • @razvangrigore322
    @razvangrigore322 5 місяців тому

    Crazy. I was just about to use Nginx Unit with PHP inside one container and now I see this.

    • @fideloper
      @fideloper 5 місяців тому

      it’s worth experimenting to see which you like better! Since Franken uses caddy, i think you get more configuration (it’s a full web server, i think Unit has less features)

  • @alexios4392
    @alexios4392 5 місяців тому

    Nice explanation

  • @CaimAstraea
    @CaimAstraea 6 місяців тому

    What about logging and other stuff when you build the binary ?

    • @fideloper
      @fideloper 6 місяців тому

      they get spit out through the processes stdout, which you can direct to a file or ship to whatever logging mechanism you want (this is standard for non-php things, php was always the weirdo for really only having a file-based option)

  • @KuroUsagi1010
    @KuroUsagi1010 6 місяців тому

    This is awesome!

  • @mongi244
    @mongi244 6 місяців тому

    Took me a day till i found this

    • @fideloper
      @fideloper 6 місяців тому

      glad it was helpful!!

  • @user-tc4rz9mk9d
    @user-tc4rz9mk9d 6 місяців тому

    Just awesome explaining.... You're rocks

    • @fideloper
      @fideloper 6 місяців тому

      Thank you so much 😀

  • @Bob-tx7hv
    @Bob-tx7hv 6 місяців тому

    finally even PHP can suffer from a complex zero downtime deployment - thanks to single binaries.

    • @fideloper
      @fideloper 6 місяців тому

      ohhh interesting, what’s the complexity? what’s different from other deployment methods?

  • @seeds_of_growth-yi5gx
    @seeds_of_growth-yi5gx 6 місяців тому

    I think putting it architecturally side by side with nginx + fpm could provide clarity, thanks for sharing, cheers!

  • @seeds_of_growth-yi5gx
    @seeds_of_growth-yi5gx 6 місяців тому

    how does it compare with preloading, JIT...etc ?

  • @seeds_of_growth-yi5gx
    @seeds_of_growth-yi5gx 6 місяців тому

    how do u deal with pecl extensions? that are not listed in the bash file ?

    • @tomasprochazka6198
      @tomasprochazka6198 4 місяці тому

      You can set up the mentioned envs. With it, you can specify a minimal list of your extensions. Notice, that they use static-php-cli to build the static PHP. FrankenPHP, as its name suggests, is just tailored of various components.

  • @smtkumar007
    @smtkumar007 6 місяців тому

    i wanted to ship a mysql server as well , does it bundle that as well?

    • @fideloper
      @fideloper 6 місяців тому

      this isn’t a whole server, nope! Think is this as just rubbing your app code, no database or anything else

  • @dadlord689
    @dadlord689 6 місяців тому

    When I am looking at any web stuff I can't believe that it is a binary code. It is super slow and absolutely religious by it's nature. While it is for the most part just an implementation of a prefab concept with a declarative language + some language that is targeting simple projects (getting problematic later). And overall everything web purposed is very similar to a game engine scope. I would expect true revolution for web with something like web-engine with specific IDE and editor. Game engine is an example of how you have an environment that is ready for all sorts of typical stuff and solutions for them in one place. And you don't have to remake everything if you just want to replace a physical engine or rendering pipeline. In few words: to have an actual architecture and not just bunch of unrelated stuff glued together hoping for the best. But I am quite delusional about web as I don't like browser and websites in the first place.

  • @gssj-o8p
    @gssj-o8p 6 місяців тому

    Hello my name is Guilherme I'm from Brazil, I'm interested in your course, do your videos have subtitles? With subtitles in English I can understand almost anything, without subtitles is a bit harder...

    • @fideloper
      @fideloper 6 місяців тому

      they don’t, but I should see if I can update them 🤔

  • @vesper8
    @vesper8 6 місяців тому

    I've recently implemented my CI pipeline within AWS itself.. I noticed you didn't even mention AWS as an option yet you mentioned 6 or 7 others.. you're making me doubt my choices now.. is AWS for CI not a good idea?

  • @mez_mez
    @mez_mez 6 місяців тому

    I'm currently having this problem and this video solves it. Thank you for the great video and great explanation!

  •  6 місяців тому

    C.I. it`s a art! 🤓

  • @mrforsythdevon
    @mrforsythdevon 6 місяців тому

    I like your style, however your artifact has compiled built code (with npm packages), that was created via a node version. You stated that you can go back and not have to worry about NPM. This is not totally true as you will still need to deploy that artifact into an environment which is able to run in (a different NPM or node version may still make it fail). Clearly there are ways around this - like using a docker build file, making sure that is tracked as well. But then this also means you know the code will run on that tagged image version (correct NPM and node versions) your artifact though speeds up the reverting to an old build and WORST.. a package going offline so you can't install it again. Again only a small point, I don't use artifacts enough at the moment and will be moving to this. Approval stage is also great, to often code goes out that shouldn't. However I do also employ protected branches, so merge requests must be completed with a reviewer. The advantage you have, is that your test / build stage has generated an artifact, that is then a lot faster to deploy. Keep up the great content.

    • @fideloper
      @fideloper 6 місяців тому

      thanks! In this case (not all cases for sure) you already have built the static assets so you probably don’t need node again in production to rebuild all those assets. Of course if you also run some node process alongside your laravel app, then you’ll need node in production as well.

  • @LV-md6lb
    @LV-md6lb 6 місяців тому

    Your last chapter reminded me of people, and perhaps me the most, spending hours upon winning two milliseconds in context of nginx vs caddy, when a relationship query is taking 500ms 🤣🤣

    • @tomasprochazka6198
      @tomasprochazka6198 4 місяці тому

      Don't forget the folks who always struggle with the auto-cert with Nginx.

  • @sdevore
    @sdevore 6 місяців тому

    Is the deploy only after review only available in Enterprise GitHub or is the setting something I am missing in our organization account?

    • @fideloper
      @fideloper 6 місяців тому

      I believe it’s available on public repos or private paid org repos (the environment feature, that is). See the note here: docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment

    • @sdevore
      @sdevore 6 місяців тому

      @@fideloper it looks like on my plans " If you are on a GitHub Free, GitHub Pro, or GitHub Team plan, required reviewers are only available for public repositories. " still working on some ways to add this for our small shop. Loving this new series of videos by the way.

  • @usmanarshad1275
    @usmanarshad1275 6 місяців тому

    what is this value "$GITHUB_SHA"?

    • @fideloper
      @fideloper 6 місяців тому

      that’s the git commit sha (a git thing, not specific to github)

  • @gevurahs
    @gevurahs 6 місяців тому

    But I mean. Docker already is something you use to be able to deploy things in an easier way. If I have a dockerized application I can deploy it to any cloud environment like aws, azure etc with docker integration. I don't see the point

  • @mickythompson
    @mickythompson 6 місяців тому

    Chris: "Does anyone use Travis CI anymore?" Me: 🤣 Good stuff!

    • @fideloper
      @fideloper 6 місяців тому

      and no one’s feelings got hurt! probably!

  • @GregKedzierski
    @GregKedzierski 6 місяців тому

    I'll argue that having 2 separate branches for 2 environments (e.g. develop -> staging, main -> prod) is infinitely better than the workflow you presented, even if you're the only developer.

    • @fideloper
      @fideloper 6 місяців тому

      That's definitely how I've done it the most myself as well! I'm very curious about what setups others have.

    • @dippyes
      @dippyes 6 місяців тому

      Care to explain the benefits of having multiple branches per environment? I am mostly using GIT FLOW as an approach and it can be bothersome for small projects. Though using feature branches is an approach I enjoy.

    • @dippyes
      @dippyes 6 місяців тому

      My 2 cents is that it was practical knowledge. I usually have a staging & main/master branches where those are both protected and requiere a review process before merging the PRs which triggers the CI/CD pipeline for release to prod upon merging. This enforces a workflow of PRs but does not protect from rogue commits to main/master unless you have that setup in github or git hooks (still can be bypassed) But I don’t feel like I need to start worrying about direct commits to the main branch or out of the blue force pushes to master branch,regardless this was a bit out of topic. This approach seems to introduce an additional layer of validation process which in a certain scenarios may come in handy.

  • @cmuller1593
    @cmuller1593 6 місяців тому

    👌 *Promo sm*

  • @pingugrumpy
    @pingugrumpy 6 місяців тому

    i not understand that the part when you can give others to run immediately. 1. does it can run on others developer local machine on windows when it is develop in ubuntu OS without having composer npm node all those sort thing? 2. how to run it on other machines?

    • @fideloper
      @fideloper 6 місяців тому

      it has everything built in , so no need to run “composer install” nor “npm o stall && npm run build”, basically you can just give someone a working code base (they’d need php and stuff to run it).

  • @mubvarakcoded
    @mubvarakcoded 6 місяців тому

    This is coming at the right time 👌. Great job

  • @xiCO2k
    @xiCO2k 6 місяців тому

    Great stuff, keep it going! 💪

    • @fideloper
      @fideloper 6 місяців тому

      thanks!! really appreciate it

  • @fideloper
    @fideloper 6 місяців тому

    Check out the repository for the code! github.com/fideloper/deploy-me

  • @mihaes7172
    @mihaes7172 6 місяців тому

    How the process / the php app is kept alive or restart if chashes? Thanks

    • @fideloper
      @fideloper 6 місяців тому

      depends how you deploy it but in general it’s setup to handle that

  • @DanielGamboaStewart
    @DanielGamboaStewart 6 місяців тому

    This looks insane… if you have any sort of app that is moderately complex we should test the $&@T out of it and see if it’s faster, concurrent requests and page loads on dinámica content etc etc… would love to see a deep dive on server deployment

  • @g4mrplays
    @g4mrplays 6 місяців тому

    how easy is this to use with ssl? manual and automatic systems like letsencrypt?

    • @fideloper
      @fideloper 6 місяців тому

      caddy (via certbot) attempts to setup ssl for you! you can tell it not to if you’d like, but in theory you can configure caddy however you like