Deployer: dep task_name -> you need to specify at least one host or stage

Created on 18 Jun 2019  路  3Comments  路  Source: deployphp/deployer

| Q | A
| ----------------- | ---
| Issue Type | Question
| Deployer Version | 6.4.3
| Local Machine OS | ubuntu
| Remote Machine OS | ubuntu

The documentation doesn't say I need to pass a stage or host when running tasks, can you not have standalone tasks without requiring a host or stage for general commands you want to run before staging and all that jazz?

I've also tried calling ->local() on the task and I still get the same error.

docs needed minor bug

Most helpful comment

Actually, it's a bit hidden on this page.
You have to add the following code to your deploy.php file:

set('default_stage', 'staging');

All 3 comments

Actually, it's a bit hidden on this page.
You have to add the following code to your deploy.php file:

set('default_stage', 'staging');

I've found that option useful for as the same need. Reference: #1517

https://deployer.org/docs/hosts.html#localhost

Here is my simple solution:

set('default_stage', 'local');

task('test', function ()
{
  $result = run('uptime');
  writeln('uptime: '. $result);
});

localhost()
  ->stage('local');

dep test command will use default_stage as stage default by itself. Also you don't need to use runLocally or ->local() anymore for non-stage tasks.

Fixed!

<?php

namespace Deployer;

task('test', function () {
    run('date');
});
Was this page helpful?
0 / 5 - 0 ratings

Related issues

krve picture krve  路  4Comments

dima-stefantsov picture dima-stefantsov  路  4Comments

lsv picture lsv  路  4Comments

brunodevel picture brunodevel  路  3Comments

sweebee picture sweebee  路  3Comments