Skip to content

[7.0-beta] Multiple deployments to same host? #2555

@YetiCGN

Description

@YetiCGN
  • Deployer version: 7.0.0-beta.23
  • Deployment OS: Ubuntu 20.04.2 LTS

How do I define two deployments onto the same host in Deployer 7?

With Deployer 5 and 6, we had this working:

// Hosts
host('stage')
    ->hostname('mytarget.example.org')
    ->user('deploy-stage')
    ->stage('stage')
    ->set('deploy_path', '/home/deploy-stage/www')
    ->set('branch', 'develop')
;
// Hosts
host('prod')
    ->hostname('mytarget.example.org')
    ->user('deploy-prod')
    ->stage('prod')
    ->set('deploy_path', '/home/deploy-prod/www')
    ->set('branch', 'develop')
;

I tried to do it like this:

// Hosts
host('mytarget.example.org')
    ->set('user', 'deploy-stage')
    ->set('stage', 'stage')
    ->set('deploy_path', '/home/deploy-stage/www')
    ->set('branch', 'develop')
;
host('mytarget.example.org')
    ->set('user', 'deploy-prod')
    ->set('stage', 'prod')
    ->set('deploy_path', '/home/deploy-prod/www')
    ->set('branch', 'master')
;

which fails (obviously) with the following error:

  Host "mytarget.example.org" already exists.
  If you want to override configuration options, get host with getHost function.

      getHost('mytarget.example.org');

Unfortunately, 7.0.0-beta is the only version right now compatible with PHP 8.0, which we use for this new project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions