deployphp / deployer

The PHP deployment tool with support for popular frameworks out of the box
https://deployer.org
MIT License
10.61k stars 1.48k forks source link

Recipes not working #1719

Closed sweebee closed 4 years ago

sweebee commented 6 years ago
Q A
Issue Type Question
Deployer Version 6.3
Local Machine OS MacOS
Remote Machine OS Ubuntu 18

Description

I added the bugsnag recipe, but deploying doesn't work anymore. First I added require 'recipe/bugsnag.php'; but I get: failed to open stream: No such file or directory in.

The i tried: require '../../.composer/vendor/deployer/recipes/recipe/bugsnag.php'; (that location exists) but then i get: [InvalidArgumentException] Task `deploy` not found

Content of deploy.php

<?php

namespace Deployer;

require 'recipe/common.php';

require 'recipe/bugsnag.php';

// Bugsnag
set('bugsnag_api_key','xxxxx');
after('deploy', 'deploy:bugsnag');

// Project repository
set('repository', 'git@gitlab.com:app.git');

// Shared files/dirs between deploys
set('shared_files', ['.env']);
set('shared_dirs', ['storage']);

// Writable dirs by web server
set('writable_dirs', ['storage', 'public']);

// Hosts
host('hostname')
    ->stage('production')
    ->user('user')
    ->set('deploy_path', '/home/user/app')
    ->set('branch', 'master');

// Deploy tasks
task('deploy', [
    'deploy:lock',
    'deploy:release',
    'deploy:update_code',
    'deploy:shared',
    'deploy:writable',
    'deploy:vendors',
    'npm',
    'artisan',
    'deploy:symlink',
    'deploy:unlock',
    'opcache',
    'cleanup',
    'success'
]);

// Build assets
task('npm', 'npm ci; npm run prod');

// Run Laravel artisan commands
task('artisan', 'php artisan storage:link; php artisan migrate --force; php artisan cache:clear');

// Clear the opcache
task('opcache', function(){
    run('php -r "opcache_reset();"');
    run('curl -H "Host: '.get('hostname').'" https://127.0.0.1/cc.php -k');
});

// If deploy fails automatically unlock.
after('deploy:failed', 'deploy:unlock');
antonmedv commented 6 years ago

Really strange. Works for me just fine. Will look into issue more later.

scryba commented 5 years ago
require 'recipe/laravel.php';
require 'recipe/rollbar.php';
require 'recipe/telegram.php';

set('rollbar_token', function () {
    return getenv('ROLLBAR_TOKEN');
});
set('rollbar_username', function () {
    return getenv('ROLLBAR_USER');
});

//Telegram Configuration
set('telegram_token', function () {
    return getenv('TELEGRAM_TOKEN');
});
set('telegram_chat_id', function () {
    return getenv('TELEGRAM_ID');
});

With my situation, Laravel works fine and I do not get any errors but the telegram notification is not sent as well as that of rollbar.

@rafaelstz tried your suggestion but still Rollbar and Telegram not working.

composer.json

"require-dev": {
        "deployer/deployer": "^6.2",
        "deployer/recipes": "^6.2",

Update. Got it to work using instructions from here; https://github.com/deployphp/deployer/issues/1446

antonmedv commented 4 years ago

Fixed in master. Please verify. deployer and recipes repos now one.