To read more check the official docs: Laravel Envoy Documentation
How to install SSH connection from local machine to server
Before you can deploy your application using Laravel Envoy, you need to set up an SSH connection between your local machine and the server where your application is hosted. This allows you to run commands on the server from your local machine. To set up an SSH connection, you need to generate an SSH key pair on your local machine and add the public key to theauthorized_keys
file on the server.
Generate SSH Key Pair
To generate an SSH key pair, run the following command in your terminal:Add Public Key to Server
After generating the SSH key pair, you need to add the public key to theauthorized_keys
file on the server. You can do this by running the following command:
user
with your server username and server
with the server IP address or domain name.
Deployment Script
The deployment script is located in theEnvoy.blade.php
file in the root directory of your Laravel application. The script contains tasks for deploying your application, running migrations, clearing caches, and more.
Here is an example of a deployment script using Laravel Envoy:
Envoy.blade.php
Running the Deployment Script
After installing Laravel Envoy, you can run the deployment script using the following command:deploy
story defined in the Envoy.blade.php
file.
You can also run separate tasks from the deployment script using the following command:
If you’ve given your SSH key a passphrase then you’ll be prompted to provide it multiple times during the deployment.To avoid this you can combine the contents of the tasks into a single task, which will mean you only get prompted for the passphrase once.