Skip to content

Laravel on Forge

Forge is our go-to platform for deploying Laravel applications. This play book will walk you through the most basic steps and vanilla configuration for deploying a Laravel project on Forge. For advanced configurations, refer to the latter half of this guide.

This guide assumes you are deploying to an existing server on Forge. If you want to provision a new server, follow these steps first //TODO add link to provisioning guide.

  1. Sign-in to Forge and Navigate to the server page you are wanting to deploy to.
  2. Click the Add a new site button and select Laravel from the dropdown.
  3. Select the Github repository and branch you want to deploy.
  4. Create a new database and name it something identifiable to the project.
  5. Add a custom domain if you have one decided, otherwise use the default domain forge gives you.
  6. Enable the Install composer dependencies option.
  7. Click Generate a site deploy key… and add it to your Github repository. You can find this in the repo settings under Deploy Keys. You should make the key read-only.
  8. Open advanced settings and update the Frontend Package Manager to Bun (or whatever the project uses).
  9. Click Create site and wait for the site to finish loading.
  1. Navigate to the site’s setting page and click environment.
  2. Go through the env and add any missing variables you need. Now is a good time to update the any default values too such as APP_NAME
  3. Toggle on config:cache and press Save.
  4. You should now be ready to deploy by clicking the Deploy button. Wait for the deploy finish and check nothing errored.
  5. If you need to run any seeders, navigate to Commands and run them using php artisan db:seed --class=YourSeederClass --force
  1. Navigate to the DNS provider and add an A record for the domain you are using pointing to the server’s IP address.
  1. Navigate to the domain page click add certificate.
  2. If you have a basic DNS implementation (No proxy), click Let’s Encrypt and generate a certificate for the domains you want to use. If you are using Cloudflare proxy, refer to the Cloudflare SSL guide //TODO add link to cloudflare ssl guide.
  3. Make sure the certificate installed and activated successfully.

You should now be able to access your site via the domain you configured.

This section will cover more advanced/niche configurations that were not covered in the basic section.

// scheduler

// back ups

// multi tenancy

// nightwatch

// maintenance mode

// reverb

// custom daemons

// deploy on push

// phpmyadmin

// heart beats

// logging

// cron jobs

While the majority of the functionality of your project is now configured, there are still a few steps you should take to ensure your application is secure and suitable for production. Look at the security guide for further steps // TODO add link to security guide.