Laravel Forge + Envoyer + Managed Hosting = Nucleus

Mattias Geniar, Wednesday, October 4, 2017

I've been enjoying using Laravel a lot lately, a modern PHP framework that comes with queues, a CLI component, decent standards and an incredibly large package ecosystem, not the least by the Spatie guys who publish a ton of their work online.

What has always fascinated me by the Laravel ecosystem is that the creator, Taylor Otwell, saw the bigger picture of application development. It's not just about writing code, it's about running infrastructure to support it (Laravel Forge), deploying code reliably (Laravel Envoyer), writing maintainable tests (Laravel Dusk), ... Everything is neatly packaged and available.

Forge: a managed hosting alternative

With Forge, everyone can create a Laravel-optimized server on providers like Digital Ocean, Linode or Ocean in mere minutes. A VM gets deployed, a config is written and you can SSH and git clone to get started.

While I see the appeal, the sysadmin in me wonders;

  • Who monitors those servers? If MySQL crashes at 11PM, who fixes it?
  • Who takes care of the updates? The security ones get auto-applied (a sane default), but who takes care of package updates?
  • Who handles the security of the machines? Do you know what's running? Do you know its configs? What are you exposing? What versions are you running?
  • Who takes care of the back-ups of the databases and files? How regularly are they stored? Are they copied offsite?
  • How quickly can you get up and running again if a server crashes? Or if it accidentally gets deleted?

So in general: who manages that Forge server?

I fear, for many sites deployed via Forge, there isn't anyone actively managing that server. That's a shame, because even though Forge's default are OK'ish, one day you'll wish your site/server was actually managed by a team that understands hosting and servers. And that's where we come in.

At Nucleus, we specialize in managed hosting & custom made server setups. And we've got a pre-built template specific for running Laravel applications. We manage all the configs, we take care of back-ups, the 24/7 support and interventions, the monitoring & graphing of your CPU/memory/disk capacity, monthly reporting of uptime, etc.

If you're looking for Managed Laravel Hosting, come have a chat. Our Laravel-optimized servers come pre-configured with all you need like PHP 7.1, Redis, the schedule:run cron, supervisor workers, a pre-generated .env config, a deploy script, pre-installed composer/yarn, SSH access, ... well, all you need to reliably run Laravel.

Deploy with the ease of Envoyer, tailored to our servers

I'll admit, our server setup is slightly different than Forge's. I think it's better in a couple of critical ways, though, which is why we've tailored the deploy mechanisme to our setup.

For starters, we run CentOS over the latest Ubuntu, for stability. But we combine it with modern packages, so you get PHP 7.1, MariaDB 10.2, Redis 4 & all other up-to-date packages you'd expect.

We also run multiple PHP-FPM master pools for better OPCache efficiency,  multiple Redis instances, tight firewalling, an opinionated (but proven) directory layout, ... all things that slightly influence your deployment. To make that easier, we publish a simple Laravel package to help take care of your deploys.

To install, run these 2 commands in your Laravel application;

$ composer require nucleus/laravel-deploy
$ php artisan vendor:publish --provider=Nucleus\\Deploy\\DeployServiceProvider

After that, deploying to your Nucleus server(s) is as simple as:

$ php artisan deploy

That's it.

The deploy reads a few parameters from your .env configuration (like host, username, your git repository location etc.) and handles the rest.

It uses the nucleus/laravel-deploy package, whose source is up on Github. Feedback is more than welcome! It's only a 1.0 version now, we plan to extend the functionality with HipChat/Slack hooks, better notifications, multi-server support & whatever fancy things we can come up with.

Don't like the way it deploys? Change it. It's a Laravel Blade template, easy to read, easy to extend. It's based on Spatie's deploy script, tuned to our stack.

Ease of use + stability + quality = Nucleus

OK, sounds like some marketing BS, I agree. ;-)

If you're developing a Laravel application and you're looking for reliable, quality hosting by a team of experts who -- quite literally -- speak your language, poke me on Twitter as @mattiasgeniar or have a look at the nucleus.be website. I'd love to have a chat with you to see how we can help support your business and how we can improve our Laravel-focussed hosting offering.



Hi! My name is Mattias Geniar. I'm a Support Manager at Nucleus Hosting in Belgium, a general web geek & public speaker. Currently working on DNS Spy & Oh Dear!. Follow me on Twitter as @mattiasgeniar.


Share this post

Did you like this post? Will you help me share it on social media? Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *