Posts tagged with automation

Join thousands of developers

Every two weeks, I share practical tips, tutorials, and behind-the-scenes insights from maintaining 300+ open source packages.

No spam. Unsubscribe anytime. You can also follow me on X.

Surviving a heatwave using Google Cloud functions

- submitted by Adriaan Marain

This summer in Belgium has been a very hot one, and we're bound to have a couple more very warm weeks during the rest of summer.

I'm not the best at dealing with this kind of heat, and with the temperature inside hitting 28° C, I've been trying to get my home to cool down on a budget: I open the windows when the temperature outside is cooler than inside, and close them when it warms up. I've also noticed the sun hits the living room starting at around 7 in the morning, which means I should close the curtains right around that time to stop the tile floor from heating up.

From the start, I knew it was likely that I would forget to close the windows in time. I would need someone - or something - to remind me. I saw a talk about Google Cloud by Bram Van Damme at JSConf.be a while back, so I decided this could be a fun little project to play around with GCP.

Read more

Getting started with GitHub Actions and Laravel

rubenvanassche.com

My colleague Ruben explores the wonderful world of GitHub actions.

You can write workflows in YAML, which makes them easy to write and read. In the beta version of GitHub Actions you had to use Ocaml, which was quite hard to comprehend, and there was almost no documentation. If you were a bit frightened by the beta version, like me, then rest assured: the YAML version is easier to use, and the documentation is well written.

Read more [rubenvanassche.com]

Automatically detect broken links after a deploy

ohdear.app

You can use the Oh Dear! API to automatically perform health checks on your app after a deploy.

You can use our API to trigger an on demand run of both the uptime check and the broken links checker. If you add this to, say, your deploy script, you can have near-instant validation that your deploy succeeded and didn't break any links & pages.

Read more [ohdear.app]

Run and stop multiple long-running commands from Bash with a trap

liamhammett.com

Liam Hammett explains how you can use the trap command to stop multiple bash process in one go.

Sometimes when working on a project, I’ll always want to run a handful of commands at the same time, some of which may return when they’re done, others might be long-running, like watchers or services actively exposing ports. This is something that might seem simple to do with a basic Bash script at first, but what if your script has multiple processes running side-by-side and you want to be able to stop them all at once too?

Read more [liamhammett.com]

Verify that your site is still online after a deploy

ohdear.app

At the Oh Dear blog, my colleague Mattias explains how to use our service to verify that your site is still online after a deploy.

You can use our API to trigger an on demand run of both the uptime check and the broken links checker. If you add this to, say, your deploy script, you can have near-instant validation that your deploy succeeded and didn't break any links & pages.

Read more [ohdear.app]

Automatic monitoring of Laravel Forge managed sites

ohdear.app

Oh Dear!, the monitoring service that my buddy Mattias and I run, now has the ability to auto import sites from Forge.

Forge recently introduced a feature called tags, whichs allows you to add custom tags to any server or site in Forge. We use those tags to determine which sites we should automatically add to your Oh Dear! Account. Every site or server tagged with oh-dear will be added. This allows you to still pick which sites should - or should not - get monitored.

Read more [ohdear.app]

Automatically close stale issues and pull requests

by Freek Van der Herten – 5 minute read

At Spatie we have over 180 public repositories. Some of our packages have become quite popular. We're very grateful that many of our users open up issues and PRs to ask questions, notify us of problems and try to solve those problems, ... Most of these issues and PRs are handled by our team. But…

Read more

Automatic visual diffing with Puppeteer

Monica Dinculescu, an engineer at Google, shares on her blog how you can use Puppeteer, Mocha and Pixelmatch to create automated visual tests of a webpage.

I did a little song-and-dance that sets up Puppeteer* , takes screenshots of your app (like, all the routes you care about), and then compares them to the “golden” ones. If they match, your test passes! Yes, it only works on Chrome. No, it’s not actually unit testing. Yes, it’s literally just counting pixels but you know what? It counts them in both a wide and a narrow viewport size and any testing is better than no testing at all; fight me.

https://meowni.ca/posts/2017-puppeteer-tests/

Read more

Building an SMS admin powered by Laravel and Nexmo

JMac, the creator of Laravel Shift, shared how he can very easily spin up a new job on his service by sending a simple SMS message.

In the end, all I need is a quick way to run a Shift on the go. Looking back on almost two years of support, I often have the Shift number readily available. Creating the job and adding it to the queue is at most two lines of code. So the steps are not the pain point.

The pain point is connecting to the server. Unless I want to carry my laptop around, I can’t connect to the server to run the Shift. (I actually have taken my laptop with me during peak times.)

What do I carry around with me all the time? My phone. I’m already reviewing the support emails from my phone. Wouldn’t it be great when I need to run a Shift manually to just reply or send a text.

https://jason.pureconcepts.net/2017/09/nexmo-sms-admin-laravel/

Read more

How to automate projects using composer scripts

On the Master Zend Framework blog Matthew Setter explains the scripts section of composer.json.

The scripts section of composer.json allows you to set up a range of commands which relate to your project, commands which call command-line executables and PHP callbacks.

The commands can be named as you see fit, such as test, clean, deploy and so on. Or they can use the names of events which Composer fires during its execution process, such as post-root-package-install, pre-install-cmd, and post-package-update.

In today’s tutorial, I’m going to take you through examples which highlight both approaches

http://www.masterzendframework.com/series/tooling/composer/automation-scripts/

Read more

The next version of Laravel News has been launched

Earlier today laravel-news.com, the official Laravel news source, received a new coat of paint. In a post announcing the launch Eric shares how the site works behind the curtains.

During this move, I have redone the way the site is powered. Previously it ran on WordPress with a custom theme I put together, it worked fine but added new features, and sections became harder and harder, and I wanted the ability to use what I am comfortable with, Laravel. However, I didn’t want to give up the media library and editing experience of WordPress.

So to have the best of both worlds I kept the old site on WordPress and used the WP Rest API paired with the Laravel Scheduler. This allows me to automatically sync data from WordPress into my database without having to rebuild an entire CMS admin area. I have the same setup for the podcast section, and it hooks into the Simplecast API to pull those over.

https://laravel-news.com/2016/08/welcome-to-the-next-version-of-laravel-news/

I sure would like to read a tutorial on how that sync works in detail.

Read more

The Bash For Loop, The First Step in Automation on Linux

In a post on his site Mattias Geniar shares how to write for loops in Bash.

Let me first start by saying something embarrassing. For the first 4 or 5 years of my Linux career -- which is nearing 10 years of professional experience -- I never used loops in Bash scripts. Or at the command line.

The thing is, I was a very fast mouse-clicker. And a very fast copy/paster. And a good search & replacer in vim and other text editors. Quite often, that got me to a working solution faster than working out the quirky syntax, testing, bugfixing, ... of loops in Bash.

And, to be completely honest, if you're managing just a couple of servers, I think you can get away with not using loops in Bash. But, once you master it, you'll wonder why you haven't learned Bash for-loops sooner.

https://ma.ttias.be/bash-loop-first-step-automation-linux/

Read more

Recovering from a rm -rf

????

I run a small hosting provider with more or less 1535 customers and I use Ansible to automate some operations to be run on all servers. Last night I accidentally ran, on all servers, a Bash script with a `rm -rf {foo}/{bar}` with those variables undefined due to a bug in the code above this line.

All servers got deleted and the offsite backups too because the remote storage was mounted just before by the same script (that is a backup maintenance script).

http://serverfault.com/questions/769357/recovering-from-a-rm-rf

Read more