<-- Back to The Cleavr Slice

26 April 2022

guide

laravel

Easily deploy your Laravel apps

Laravel has fast become the go-to backend framework for many PHP developers. It's easy to see why, Laravel is easy to learn and, with it's vast ecosystem, helps you build and deliver full-featured web applications quickly and with little effort.

If you're familar with Laravel and the suite of tools surrounding it, you've likely heard of, and even used, Forge and Envoyer.

Forge is an application that helps you provision servers and deploy your web apps. Envoyer is a separate application that gives you more flexibility with your deployments, basically adding some muscle to the basic deployment scheme that Forge offers.

Cleavr is essentially what you'd get if Forge and Envoyer had a baby... An awesome, supercharged baby that dives down to the same depths of NodeJS as it does PHP. 🐣

Setting up and deploying your Laravel apps is super effortless using Cleavr. Cleavr does the majority of the heavy-lifting so that you can sit back, click a couple of buttons, and sip on your ☕️.

Follow these steps to provision a server, setup your Laravel site on your server, and deploy in just minutes.

Step 1: Provision A New Server

Provision a new server in your Cleavr account with your favorite VPS provider.

Select the Laravel Optimized Server type to also install common dependencies and services for Laravel applications.

Step 2: Add A New Site

Once the server has completed provisioning, click into the server and add a new site.

Select Laravel as the web app type. You can also choose to include a database.

Once everything is set how you want it for your new site, click Add.

Cleavr will automatically install PHP, NodeJS, and a database server if one has not already been installed on the server. Also, Cleavr will automatically configure a base .env file for your application and fill in the database connection information.

Step 3: Configure Web App

In the Web App section, click Complete Setup for the web app that was automatically added after your site is successfully created.

Configure code repository

The first step is to tie the app to the Git repo that the code is stored on.

Once configured, click Update.

Updating will then unlock additional areas for your web app.

Configure environment variables

Select the Environment tab. This will pull in the starter .env file that Cleavr automatically generated on site creation.

You'll notice Cleavr already filled in some required variables; including the database connection variables.

Edit the .env file with any additional required variables for your app and then click Sync to update.

The Environments page also has options to 'Clear and Build Config Cache', 'Reload php-fpm', and 'Restart queue' that are specific to Laravel actions. You can enable these options when syncing the .env file if desired.

Configure deployment hooks

Click on the Deployment Hooks section and review the pre-populated hooks. The pre-populated hooks are typically enough to deploy the standard Laravel application. However, you'll want to add additional hooks that are required to deploy your app.

After your first deployment, you'll want to review the deployment hooks again to see if they are necessary for following deployments. For example, you likely will want to disable the 'Migrate Database' hook after the first run.

Step 4: Deploy

Once you have your web app configured how you need it, deploy! 🚀

Additional Features To Help Manage Your Apps

Take control of your servers and deployments. Without breaking a sweat.

Sign up for a 5-day free trial of Cleavr Pro. No credit card required until you decide to subscribe.

Sign up for free