Reading List
The most recent articles from a list of feeds I subscribe to.
Keeping Forge deploy script in version control
I love Laravel Forge's quick deploy scripts. Forge allows you to set up a deploy script in their web interface and run it when you push to a git branch. However, I generally prefer to keep orchestration in the git repository. It's nice to have history, and I don't want to visit Forge whenever I want to make a change to the deploy script.
An elegant solution: move the script to a file. I created a deploy.sh and call it from Forge.

My deploy script isn't too bulky for now. It runs composer install and npm ci for dependencies, builds assets, clears the cache, caches config files, and does a safe restart of the php fpm process.
composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader npm cinpm run build php artisan cache:clearphp artisan config:cache ( flock -w 10 9 || exit 1 echo 'Restarting FPM...'; sudo -S service php8.2-fpm reload ) 9>/tmp/fpmlock
Which I call from Forge:
cd /home/forge/full-stack-artisan.devgit pull origin $FORGE_SITE_BRANCH ./deploy.sh
Don't forget to make deploy.sh executable before use.
chmod +x deploy.sh
Whenever I need to tweak the deploy script, I can update it from my text editor and git push.
Forge deploy scripts in version control
I love Laravel Forge's quick deploy scripts. Forge allows you to set up a deploy script in their web interface and run it when you push to a git branch. However, I generally prefer to keep orchestration in the git repository. It's nice to have history, and I don't want to visit Forge whenever I want to make a change to the deploy script.
An elegant solution: move the script to a file. I created a deploy.sh and call it from Forge.

My deploy script isn't too bulky for now. It runs composer install and npm ci for dependencies, builds assets, clears the cache, caches config files, and does a safe restart of the php fpm process.
composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader npm cinpm run build php artisan cache:clearphp artisan config:cache ( flock -w 10 9 || exit 1 echo 'Restarting FPM...'; sudo -S service php8.2-fpm reload ) 9>/tmp/fpmlock
Which I call from Forge:
cd /home/forge/full-stack-artisan.devgit pull origin $FORGE_SITE_BRANCH ./deploy.sh
Don't forget to make deploy.sh executable before use.
chmod +x deploy.sh
Whenever I need to tweak the deploy script, I can update it from my text editor and git push.
Go by example
A few years ago I taught myself some Go. Not because I needed it but because I like poking around other ecosystems. I came across Go By Example, and it's still is one of my favorite formats to explore a new language or framework.
The examples are succinct and introduce you to a concept without overwhelming you. This format will not turn into an expert, but is just enough to get you curious and kickstart your own explorations.
End the day with a failing test
A green test suite is a blank canvas, and a blank canvas is a paralyzing place to start.
A failing test is a pointer to the next step. When I end the day with a failing test, I know exactly where to begin when I get back. The perfect kickstart to get into flow.
Why Turborepo is migrating from Go to Rust
The past few years I've seen more projects use Go or Rust for heavy lifting alongside a higher-level language like PHP or JavaScript.
I've learned a little Go myself but don't know enough about Rust to understand when you'd choose one over the other. Vercel is currently migrating a codebase from Go to Rust, it's interesting to read the reasoning behind the decision.
For example:
Go's preference for simplicity at the filesystem was creating problems for us when it came to file permissions. Go lets users set a Unix-style file permission code: a short number that describes who can read, write, or execute a file.
While this sounds convenient, this abstraction does not work across platforms; Windows actually doesn't have the precise concept of file permissions. Go ends up allowing us to set a file permission code on Windows, even when doing so will have no effect.
In contrast, Rust's explicitness in this area not only made things simpler for us but also more correct. If you want to set a file permission code in Rust, you have to explicitly annotate the code as Unix-only. If you don't, the code won't even compile on Windows. This surfacing of complexity helps us understand what our code is doing before we ever ship our software to users.
Next to PHP, Go is a low-level languageâbut Rust is even lower. Looks like Go is great for heavy lifting on the web, but if you're into building tools to run in different environments Rust is where you want to be.