stekel/laravel-deploy

Helpful command for deploying a given repository to a remote machine.

v3.1.9 2023-03-08 00:38 UTC

This package is auto-updated.

Last update: 2024-05-08 03:22:56 UTC


README

Helpful command for deploying a given repository to a remote machine

Installation

composer require stekel/laravel-deploy

Laravel Version Laravel-Deploy Version
v5.x v1.x
v6.x v2.x
v7.x v3.x

Create the config file php artisan vendor:publish --provider="stekel\LaravelDeploy\Laravel\Providers\LaravelDeployServiceProvider"

Create a site configuration class

<?php

namespace App;

use stekel\LaravelDeploy\Site;

class SampleSite extends Site
{
    public function prod()
    {
        $this->ssh('192.168.1.100, admin, password, function ($connection) {
            $connection->command('git reset --hard');
            $connection->command('git pull');
            $connection->command('composer install --optimize-autoloader --no-dev');
            $connection->command('php artisan migrate');
            $connection->command('php artisan cache:clear');
            $connection->command('php artisan config:cache');
            $connection->command('php artisan route:cache');
            $connection->command('php artisan view:cache');
        });
    }
}

Reference that class in the config

// ...   
    'sites' => [
        'sample-site' => \App\SampleSite::class,
    ],
// ... 

Reference the site/environment when deploying

// stekel:deploy {site} {environment}
stekel:deploy sample-site prod