Search code examples
laravelrsyncphp-deployer

Deployer PHP not copying files from Laravel's storage folder


I'm using Deployer PHP with laravel and rsync recipes to deploy my Laravel project but for some reason the files in the storage/app folder are not copied from the git branch to the storage folder on the server. The .gitignore is correctly set and the files that I need to be synced are in fact in git. So the problem seems to lie with Deployer not copying the files to the shared/storage/app folder

storage/app/.gitignore:

*
!.gitignore
!public/
!public/*
!templates/
!templates/*
!templates/fonts/
!templates/fonts/*

deployer.php

<?php declare(strict_types=1);

namespace Deployer;

// Include the Laravel & rsync recipes:
require 'recipe/rsync.php';
require 'recipe/laravel.php';

 ...

set('rsync_src', function () {
        return __DIR__ . '/www'; // My LAravel project is in a sub folder of the git branch
    });

// Configuring the rsync exclusions.
add('rsync', [
        'exclude' => [
            '.git',
            '/.env',
            '/storage/framework/',
            '/storage/logs/',
            '/vendor/',
            '/node_modules/',
            '.gitlab-ci.yml',
            'deploy.php',
        ],
    ]);

 ...

Any ideas on what could be the issue and possible solution here?


Solution

  • This appears to be by design. Deployer manages /storage as a shared folder because it contains information that you probably want to retain across releases, such as sessions, logs, etc.

    I'm guessing the files you want moved in this way would be better off if you maintained them under /resources