Laravel Forge and Workflow

As a developer, workflow is incredibly important. The more efficient and streamlined your development process is, the easier it is to do your job. And not only does it make things easier but it can have some added benefits as well. Laravel Forge is one of Taylor Otwell's efforts to help Laravel developers enjoy a great workflow. It's essentially a very specialized server admin dashboard/control panel aimed at the same developer audience that is likely to heavily use Laravel. One easy way to think of it is like a replacement for CPanel.

Specifically, Forge is a tool that enables developers who primarily use VPS hosting, git, composer, etc to administer their servers and sites using a simple GUI. This is significant for a couple of reasons. Over the past several years the PHP community at large has been maturing and standardizing tools and workflows. As a result more and more developers are utilizing VPS hosting, git, composer, packagist, etc. These things have been around for a long time but they've seemingly gained much more momentum. One trade-off that's made with most VPS hosting is the lack of a standard or included control panel (such as CPanel). As a result there's usually a learning curve adjusting to doing things from the shell (such as scheduling crong jobs). Forge is directly targeted towards these developers and making their workflows easier.

Before we jump into what Forge offers and how it's changed my development workflow I want to make a point. Even though Forge works seamlessly with Laravel and is a product of Taylor Otwell, it's not exclusively for Laravel sites. Ultimately Forge is framework/site agnostic and can be used for any type of site which is a huge selling point in my opinion.

As I've discussed before, I'm a big fan of using DigitalOcean for all of my hosting and they make it very easy to setup a server. However, Forge makes the process even simpler. Once you setup Forge with your DigitalOcean API information, you can create servers from within Forge. Not only that but Forge creates the server using a production ready version of the Laravel Homestead VM image. That means you get an up to date, pre-configured server by pushign a button. Another thing is does is ease the process of creating multiple sites on a server (aka Apache Virtual Hosts). Instead of messing with host files and Apache configs, you have a simple interface where you just add a new site. When you add a new site, you can connect it directly to a git repository which leads to the next benefit.

Without a tool like Forge it's not incredibly difficult to setup staging environments on a server and even have them pull from a different branch of your repository. That being said, Forge makes the process incredibly simple. For instance you can create your main site, example.com and have it linked to the master branch of your example.com repository on Github. Then you can create another site, dev.example.com which links to the development branch of the same repository. And that's all you have to do to setup staging and production environments that pull from separate branches of a repo. The best part is that with one checkbox you can enable git deploy hooks so that when you push to those repos, the server automatically pulls the latest changes. And since Forge is designed with Laravel in mind the default deploy script (which you can easily customize) also runs composer install and artisan migrations.

For me personally just these things have improved my workflow. Testing and deployment are things which I don't have to think about anymore which is great; it allows me to focus on more important things. There are several more features of Forge and things that I enjoy about it, but that's not really the point of this post. As I said, your workflow is incredibly important and that applies to more than just software development. Anytime you spend more time and effort on a process than the actual activity or product, you're missing the point and wasting your time. Along the same lines, the best tools are the ones that get out of your way. Practically speaking, if you spend half of your development time fighting with your code editor/IDE or taking 5 steps to do something simple then your project is suffering. This is the philosophy behind why you see so many senior developers using things like emacs or vim as their primary code editor. They've found a tool that gets out of their way and allows them to be the most efficient. That's not to say you shouldn't put time into learning your tools, but at some point there needs to be a leveling off of that learning curve. The time investment you put in to learning the tool needs to pay off eventually.

For me that means no more spending thirty minutes or more setting up a server and no more opening up a terminal just to deploy to my staging/testing server. Just by switching to a tool like Forge I'm able to save tons of cumulative time that can now be spent on my projects. It gives me more time to focus on the important things like new sites or features. Lastly, Forge isn't the only tool of it's kind. One notable competitor is ServerPilot. ServerPilot and Forge are similar in idea and some of their offerings, but are quite different in several ways. Again it comes down to which tool works best for you and allows you to focus on the important aspects of what you do.

comments powered by Disqus