πDeploy a Laravel App to Clouddley Triggr
Learn how to deploy a Laravel app to Triggr.
In this guide, we'll learn how to deploy a Laravel application on Triggr. Before that, letβs talk about what Clouddley Triggr is. Clouddley Triggr is a zero downtime application deployment tool that auto-detects your runtime and deploys your application to your server, virtual machines, and bare metal. Let's get started!
Prerequisites
A Clouddley account.
A Laravel application.
A Virtual machine in a Cloud platform or bare metal server.
Deploy the Laravel Application
Optimize your Codebase for Deployment
Prior to your Laravel application deployment on Triggr, with the way Triggr is designed, you would need to set up specific requirements, which include specifying the required PHP extensions and web server for your application.
PHP Extensions
In Laravel, PHP extensions add extra functionalities and improve performance. Laravel handles most extensions automatically to ensure the required ones are installed on your host server for optimal application performance. To set this up on Triggr, you need to;
Create a
.php.ini.d
folder in the applicationβs root directory.Create a custom
.ini
file in the.php.ini.d
folder.
For this application, we created a file custom.ini
with the necessary extensions needed for the application to run smoothly.
This enables the required extensions for this application. You can read more about enabling extensions here.
Web server
We will be deploying this application with Nginx, a popular choice for deploying Laravel applications due to its speed, security features, ease of configuration, and compatibility with PHP-FPM. To configure this, we will be creating a Toml file project.toml
in the application root directory.
TOML is a configuration file format language that is intended to be minimal and easy to read. TOML stands for βTomβs Obvious, Minimal Language,β which refers to the creator Tom Preston-Werner.
From the Toml Website
This defines the configuration settings that can be assessed during the build process. Once you are done, you are ready to deploy your application on Triggr.
Accessing Clouddley Triggr
Open your web browser, log in to your Clouddley account
Navigate to Triggr and click on Add App
Step 1: Configure Git
Choose the version control platform your code is hosted on, either GitHub or Bitbucket. For this tutorial, we will be using Github.
Click on the Select username/organization dropdown and click on Add username/organization to connect your GitHub user or organization account.
Select your repository and the branch.
Click on NEXT
Step 2: Configure VM
To configure your VM, insert your VM username, its hostname or IP address, and the VM port for ssh access.
Download the public key to your local machine.
Run the command provided on your local machine, allowing Triggr to connect to your virtual machine.
ssh-copy-id -f -i ~/path/to/downloaded/Publickey username@ipaddress
Click on Verify. This verifies the connection
Click on NEXT
Step 3: Configure app settings
Insert the name of the application and its port.
The firewall of the virtual machine should allow access to the application port.
You can add environment variables by adding the key-value pair in the environment variable section and clicking on save or adding it by clicking on the + button.
As you know copying environment variables individually from your .env file can be cumbersome, triggr has a powerful UI which allows you copy and paste all the variables at once from the .env file
Triggr deploys your application as a container; therefore, you need to specify the environment variables.
To configure the Notification settings of the application, switch the disabled button in the notification section and select which event(failed, timeout, or success) you want to be notified of.
Input your Email address.
Click on Create App
Step 4: Test and Verify the app
Upon app creation, your app appears on the Triggr dashboard.
After the app deployment is complete, the app status changes from
DEPLOYING
toRUNNING
Click on the application's URL, which opens the deployed application in your browser.
You can test the application functionalities.
You have successfully deployed your Laravel application on Triggr.
You can navigate to deployments, click on the icon in the actions column to view logs, download your logs, and restart the build if needed.
Conclusion
Last updated