Forge ahead!

In one of our previous blogs, we have already written about the PHP framework Laravel, which we enjoy using. Now we will look at Laravel Forge, which is built on top of the Laravel stack and optimized entirely around Laravel.

In a nutshell, Laravel Forge is a SaaS solution from Laravel that allows server management and deployment. This blog will tell you why we think Forge is great.

Based on Laravel

As we mentioned at the beginning, Laravel Forge, as the name suggests, is based on Laravel, which we use for almost all our projects. The most significant advantage is that all workflows, patterns, and packages in the Laravel ecosystem are seamlessly integrated into Forge. As a result, tasks like managing queues, starting cronjobs, managing logs, and environment variables are all super easy to perform. Therefore, the jump to Forge was a logical conclusion since the optimization of the framework and the perfect integration make the work incredibly easy.

All you need

Laravel Forge is a dream for setting up and configuring servers. It includes many cloud options, countless automation options, and direct monitoring of the servers in Forge itself. Unfortunately, the monitoring is quite plain, but it gives you the basic requirements: If processor, memory, storage, or anything goes down, you can get a notification mail.

Forge contains the complete package you need to set up your server and installs it automatically:

  • Ubuntu 20.04 
  • Nginx
  • PHP 7 – 8.1
  • MySQL/MariaDB/Postgres
  • Redis
  • Memcached

Instead of hosting your PHP applications directly, Laravel Forge logs into your server via SSH and installs required the software to run PHP applications. This means that Forge is portable: you can switch hosting providers at any time and still maintain consistent server setups. This way, you can let the customer decide where they want to host their app while nothing changes for us. It doesn’t matter if one customer is on AWS and the other on Hetzner; the management remains entirely the same.

Security is taken care of automatically: SSH and firewall are out of the box, and security updates are performed automatically. SSL certificates can be installed with one click, without complex DNS entries. In addition, you can securely back up your MySQL or Postgres databases to AWS S3 or DigitalOcean Spaces.

If you need more than that, you can always add it yourself. For example, we had to encode videos for a project. Therefore, we installed FFMPEG on the servers as well. In another project, we needed a read/write replica setup of our databases. Just install MariaDB on several servers and then connect and set up the replica. Forge was absolutely unaffected by this. The only thing to watch out for is manually updating Forge-managed software like MariaDB.

Git good

Forge lets you upload code directly from your Github with the push to deploy feature. It couldn’t be easier: Just push to master on your GitHub, Bitbucket, or custom Git repository. In addition, the deployments allow for simple bash scripts. This is super convenient if you want to run additional artisan commands while deploying. For example, we have a command in a project that exports the localizations as JSON and then copies them to the public folder so that Javascript can access them.

Team Management

A factor not to be underestimated is Forge’s feature to manage teams, especially when the team grows as fast as Dotbite’s does. With Forge, you can create closed pages management, setting who can access which pages. Forge uses user isolation so that each of the sites on your servers is a separate, secure user, preventing compromised applications from accessing other sites on the server

Dark days

The fact that most of us were not programmers when we started our first project, timebite, can also be seen before we started using Forge. Admittedly, it was pretty janky how we managed servers and deployed updates back then. Fortunately, the days of manual updates with FileZilla at 3:30 in the morning and self-built deploy scripts via git, bash, and PHP are long gone. Don’t tell anybody!

Forge saves us substantial time during deployment and allows us to perform updates securely. Now we can even do it on the fly:

Bright future with Laravel Forge

Photo by Ivana Cajina on Unsplash

Our latest example, Quinn shows how great Forge works: We moved over the Christmas holidays for the upcoming release of our new dashboard, as there will be many updates for the different universities that use Quinn. The migration didn’t even take a whole day. Everything was set up top-notch within no time, and it’s already a breeze to work with. If this reads like an ad, we promise we haven’t been paid by Laravel. We just like Forge a lot!