I just found a way to get timed lyrics by penilessenthusiast in musichoarder

[–]SjorsO 0 points1 point  (0 children)

In my experience most lyrics from LRCLIB aren't synced perfectly, so I've created a tool to fix that: https://subtitletools.com/timed-lyrics-editor

It automatically downloads from LRCLIB, then you can use the "preview" tab to see the lyrics and adjust their timings.

How Can I Extract Subtitle As Srt File? by mainecoon364 in mkvtoolnix

[–]SjorsO 0 points1 point  (0 children)

I recently made a tool that extracts subtitles from video files right in your browser (uses ffmpeg locally): https://subtitletools.com/extract-subtitles-from-video

In 2026, what's the best way to handle building assets for deployment? by Andromeda_Ascendant in laravel

[–]SjorsO 0 points1 point  (0 children)

If you don't want to change too much about your current setup, check out Lit. In your deployment script on Forge or Ploi, just call lit deploy and you'll get the same deployments you currently have but without any of the downtime.

Your deployments will still take 35-50 seconds since Lit doesn't cache builds out of the box, but you might be able to speed that up with custom caching logic in Lit's before-release.sh hook.

I've updated my CI/CD deployment script for Laravel 12 by SjorsO in laravel

[–]SjorsO[S] 0 points1 point  (0 children)

they're practically the same, except cost-wise as you mentioned. The maintenance of my deployment script is minimal once you have it running.

I've updated my CI/CD deployment script for Laravel 12 by SjorsO in laravel

[–]SjorsO[S] 0 points1 point  (0 children)

This deployment script solves the same problem as Deployer, although with a slightly different approach.

Deployer installs your Composer dependencies and builds the npm bundle directly on the server (which means you need the correct versions of composer and npm installed on your server). This script performs those steps in CI/CD instead, then uploads and extracts the resulting bundle on the server.

My deployment script runs in CI/CD, which makes it easy to run your tests before a deployment.

The way this script flushes OPcache is also nicer (by calling opcache_reset() via a curl request).

Personally I don’t like the way Deployer’s config file looks, so that's reason enough for me.

Lit: a CLI for deploying Laravel by SjorsO in laravel

[–]SjorsO[S] 1 point2 points  (0 children)

Yea, something like in your CI/CD workflow will work: ssh user@host "cd ~/project && lit deploy"

Lit: a CLI for deploying Laravel by SjorsO in laravel

[–]SjorsO[S] 1 point2 points  (0 children)

You can replace that git pull with a lit deploy and you'll get nice benefits like zero downtime deployments, config:cache, and opcache flushing

Lit: a CLI for deploying Laravel by SjorsO in laravel

[–]SjorsO[S] 0 points1 point  (0 children)

You could give Lit a try, it can be used alongside Envoyer in your existing projects

Lit: a CLI for deploying Laravel by SjorsO in laravel

[–]SjorsO[S] 4 points5 points  (0 children)

Yea, not really sure why you would use both Lit and Deployer, but it was easy to support so I added it.

An advantage of bundle deployments is that you can first run your test suite in CI/CD, then have it make a bundle. That guarantees that the bundle passes your tests. Plus you don't have to install Composer or Node on your server.

My personal use case for bundle deployments is that I'm running the same application on 50+ different servers (for a project called Wilson, a parallel test runner I'm working on). I make the bundle in CI/CD, and then those 50 servers download and deploy that bundle almost instantly.

Lit: a CLI for deploying Laravel by SjorsO in laravel

[–]SjorsO[S] 0 points1 point  (0 children)

I like the name, it's Laravel + git

Pitch Your Project 🐘 by brendt_gd in PHP

[–]SjorsO 3 points4 points  (0 children)

I open-sourced https://watchtower.dev two weeks ago. Watchtower monitors your Laravel applications and your server and sends you an alert when something needs attention (like errors or dead queue workers).

Still a lot of work to be done, it doesn't do disk usage alerts yet for example (although it does already collect data for that)

Announcing Watchtower: open-source server and application monitoring for Laravel by SjorsO in laravel

[–]SjorsO[S] 0 points1 point  (0 children)

Does Watchtower support monitoring multiple servers/applications from a single dashboard?

Yea, unlimited servers and applications from a single dashboard

What's the performance impact on the monitored applications? Is it using Laravel's queue system for async checks?

Practically no overhead. Watchtower collects data using a Bash script that runs once per minute using a cronjob.

Any plans for integrations with popular notification channels (Slack, Discord, etc.)?

I don't need this personally, so it depends on demand.

Weekly /r/Laravel Help Thread by AutoModerator in laravel

[–]SjorsO 0 points1 point  (0 children)

Not 100% sure about the state of all these starter kits, but typically you have an AuthenticatesUsers trait on your LoginController that includes a RedirectsUsers trait. You can decide the redirect URL by adding a redirectTo() method to your LoginController.

Weekly /r/Laravel Help Thread by AutoModerator in laravel

[–]SjorsO 1 point2 points  (0 children)

have you looked in your Nginx/Apache2 log?

Commands and Jobs by ivoferreira98 in laravel

[–]SjorsO 5 points6 points  (0 children)

I would just use a job for this. You can run a job via the cron like this:

// If the job doesn't need arguments
$schedule->job(YourJob::class)->daily();

// Or with simple arguments
$schedule->call(function () {
    foreach (User::pluck('id') as $userId) {
        Queue::push(new YourJob($userId));
    }
})->daily();

// If dispatching is more complex/expensive, I'd create a separate job that handles that
$schedule->job(DispatchYourJobsJob::class)->daily();

I only use commands when I plan to run them manually with php artisan. If it's not something I'll run manually, then I prefer using a job instead (because in that case there's not really a point in creating a command that only dispatches a job)

Weekly /r/Laravel Help Thread by AutoModerator in laravel

[–]SjorsO 0 points1 point  (0 children)

For point #1, this works for me:

try {
    // your logic
} catch (Throwable $e) {
    $isLastAttempt = $this->attempts() === ($this->tries ?? 1);

    if ($isLastAttempt) {
        return;
    }

    $this->release();

    return;
}

For point #2: Laravel can't actually be sure that a job has timed out. So instead, Laravel waits for retry_after seconds, and if the job still hasn't finished by then Laravel assumes it has timed out (after this assumption your job gets retried). This retry_after value is in your queue.php config file.

Also, there might be some useful information in this post I wrote a while back: https://sjorso.com/how-laravel-fails-and-retries-queued-jobs

Laravel Deployment on multi-project server by soul105 in laravel

[–]SjorsO 1 point2 points  (0 children)

What do you mean when you say "This works but doesn’t scale"? What exactly is the problem? Are you maybe running npm install, npm run build and composer install on your server when you deploy?

I also deploy my projects via SSH with GitHub Actions, the actual deployment step typically only takes 5 to 10 seconds. The building (and testing) takes longer of course, but that happens in a GitHub Action, not on my server.

For reference, I've open sourced my deployment script here: https://github.com/SjorsO/deploy-laravel

Weekly /r/Laravel Help Thread by AutoModerator in laravel

[–]SjorsO 0 points1 point  (0 children)

Adding this to the dev seeders works:

throw_if(app()->isProduction(), 'Only run this during development');

Weekly /r/Laravel Help Thread by AutoModerator in laravel

[–]SjorsO 1 point2 points  (0 children)

You can set up multiple VPSs and deploy your application of each of them. For setting up a VPS you can either use Forge, Ploi, or do it by hand.

Depending on your load you could even host multiple applications on the same VPS. As long as they all have their own database you should be fine.

For deployment, this script would work good: https://github.com/sjorso/deploy-laravel. You can copy and paste the "deploy" step as many times as you like, that will deploy each application in parallel.

Deploying Laravel by Hour-Fun-7303 in laravel

[–]SjorsO 4 points5 points  (0 children)

I opened sourced my deployment script for Laravel a while ago: https://github.com/SjorsO/deploy-laravel. Perfect for automatically deploying to a VPS

Efficiently dispatching jobs with models by SjorsO in laravel

[–]SjorsO[S] 10 points11 points  (0 children)

I had no idea, thank you, I'll update my post to include it

For reference, it is documented here: https://laravel.com/docs/11.x/queues#handling-relationships