【问题标题】:Deployer PHP not copying files from Laravel's storage folderDeployer PHP 没有从 Laravel 的存储文件夹中复制文件
【发布时间】:2020-11-27 19:14:30
【问题描述】:

我正在使用带有 laravel 和 rsync 配方的 Deployer PHP 来部署我的 Laravel 项目,但由于某种原因,storage/app 文件夹中的文件没有从 git 分支复制到服务器上的 storage 文件夹。 .gitignore 设置正确,我需要同步的文件实际上在 git 中。所以问题似乎在于 Deployer 没有将文件复制到 shared/storage/app 文件夹

存储/应用程序/.gitignore:

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

部署者.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',
        ],
    ]);

 ...

关于这里可能出现的问题和可能的解决方案有什么想法吗?

【问题讨论】:

    标签: laravel rsync php-deployer


    【解决方案1】:

    这似乎是设计使然。 Deployer 将 /storage 管理为共享文件夹,因为它包含您可能希望跨版本保留的信息,例如会话、日志等。

    我猜你想以这种方式移动的文件如果你在 /resources 下维护它们会更好

    【讨论】:

    • 除非有人想出更好的选择,否则我最终会这样做。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-10-13
    • 2023-01-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-15
    • 2016-05-27
    相关资源
    最近更新 更多