Laravel Deployer - The Ultimate Deployment Tool for Your Laravel Application

Laravel Deployer - The Ultimate Deployment Tool for Your Laravel Application

Are you tired of manually deploying your Laravel application every time you make a change to your codebase? Do you want to automate your deployment process to save time and avoid human errors? If yes, then Laravel Deployer is the perfect tool for you.

Laravel Deployer is an open-source deployment tool that helps you automate the deployment process of your Laravel application. With Laravel Deployer, you can easily deploy your application to different environments such as production, staging, and development.

In this blog post, we will discuss what Laravel Deployer is, how it works, and how you can use it to automate your deployment process.

What is Laravel Deployer?

Laravel Deployer is a deployment tool that helps you automate the deployment process of your Laravel application. It uses a simple configuration file to define your deployment strategy and performs the deployment process automatically.

Laravel Deployer is specifically designed for Laravel applications and comes with many Laravel-specific features.

Best Features:

  • No downtime deployment

  • Reverse to the previous deploy

  • MySQL Backup

  • Restore MySQL from backup

  • UI of the Deployer

How does Laravel Deployer work?

Laravel Deployer works by creating a new deployment and then making a symbolic link to the server root. It also allows you to write deployment-specific commands, like running migrations or seeders.

How to setup Laravel Deployer

  • Clone the repository
git clone https://github.com/sohag-pro/laravel-deployer.git
  • Install dependencies
composer install
  • Create a copy of your .env file
cp .env.example .env
  • Generate an app encryption key
php artisan key:generate
  • put the env variable in .env file
GIT_REMOTE_URL=https://github.com/sohag-pro/laravel-deployer.git
# full path from root from where the project will be server
# with a trailing slash
SERVE_DIR=/Users/sohag/Projects/deployer-test/www/

# full path from root from where the project will be cloned and all other operations will be done
# Should be different from SERVE_DIR and should be created manually before running the script
# with a trailing slash
BASE_DIR=/Users/sohag/Projects/deployer-test/

# where the backups will be stored
VERSION_DIR=backups

# where the storage will be linked
STORAGE_DIR=storage

# Where the dump SQL will be stored
DB_DIR=database

# which db to dump
DEPLOYER_DB_NAME=

# user to dump db
DEPLOYER_DB_USER=

# password to dump db
DEPLOYER_DB_PASSWORD=
  • Run the local development server
php artisan serve

How to add deployment-specific commands?

Just create a file in your project root named afterDeploy.sh and all your commands there. All of them will be executed on the deployment.

The repo is actively looking for contributions, if you can do some contributions, please have a look.

Thank you for your interest.