部署后未更新Laravel应用程序

时间:2018-09-01 19:31:50

标签: laravel web-deployment php-deployer

我们在同一服务器上有多个Laravel应用程序。要进行部署,我使用具有相同deploy.php的部署器 甚至我在服务器上执行命令sudo service php7.1-fpm restartsudo service nginx restart时,一个应用程序仍保持旧状态很长时间。我还检查了是否已部署了新应用程序。 在本地,一切正常。 您是否可以开始搜索?

<?php
    namespace Deployer;

    require 'recipe/laravel.php';
    require 'recipe/npm.php';


    set('local_deploy_path', '/tmp/deployer');

    // Project name
    set('application', 'parley');

    // Project repository
    set('repository', '*****');

    // [Optional] Allocate tty for git clone. Default value is false.
    set('git_tty', true);

    set('writable_dirs', [
        'bootstrap/cache',
        'storage',
        'storage/app',
        'storage/app/public',
        'storage/framework',
        'storage/framework/cache',
        'storage/framework/sessions',
        'storage/framework/views',
        'storage/logs',
    ]);

    // Shared files/dirs between deploys 
    add('shared_files', []);
    add('shared_dirs', []);

    // Writable dirs by web server 
    add('writable_dirs', []);


    // Hosts

    host('*****')
        ->user('***')
        ->port(7881)
        ->identityFile('~/.ssh/id_rsa')
        ->set('deploy_path', '****');


    // Tasks
    task('npm:build', function () {
        run('cd {{release_path}} && npm run production');
    });

    task('deploy:composer_install', function () {
        run('cd {{release_path}} ');
        run('composer install');
    })->desc('running composer install');

    desc('Execute artisan storage:link');
    task('artisan:storage:link', function () {
        $needsVersion = 5.3;
        $currentVersion = get('laravel_version');
        if (version_compare($currentVersion, $needsVersion, '>=')) {
            run('{{bin/php}} {{release_path}}/artisan storage:link');
        }
    });


    desc('Deploy your project');
    task('deploy', [
        'deploy:prepare',
        'deploy:release',
        'deploy:update_code',
        'deploy:shared',
        'deploy:writable',
        'deploy:vendors',
        'deploy:composer_install',
        'artisan:migrate',
        //'artisan:db:seed',
        'npm:install',
        'npm:build',
        'artisan:storage:link',
        'deploy:symlink'
    ]);

0 个答案:

没有答案