Skip to content

trellis alias generates wrong path for a site on Kinsta #446

@andronocean

Description

@andronocean

Version

1.11.1

What did you expect to happen?

This is a very minor bug, easy to correct manually. It seems to be happening because of differences between the file structure of a stock Trellis site vs a Kinsta environment, and Trellis's assumptions around the project_root variable.

What I expected: running trellis alias on a project with a staging environment on Kinsta should create the alias with a path: parameter like {{ project_root }} + /current/web/wp. It should use the custom {{ project_root }} I set in group_vars/staging/main.yml according to Kinsta's instructions for Bedrock & Trellis.

In other words, it should look something like this, for my project_root: /www/examplecom_123/public

# wp-cli.trellis-alias.yml

"@staging":
  path: "/www/examplecom_123/public/current/web/wp"

What actually happens?

The generated wp-cli.trellis-alias.yml inserts the site domain from the wordpress_sites.yml into the path:

"@staging":
  ssh: "examplecom@X.X.X.X:YYYYY"
  path: "/www/examplecom_123/public/example.com/current/web/wp"

Steps to reproduce

What my Trellis environment config looks like (actual sites anonymized):

# group_vars/staging/wordpress_sites.yml

# Created by trellis-cli v1.11.1
# Documentation: https://roots.io/trellis/docs/wordpress-sites/

wordpress_sites:
  example.com:
    site_hosts:
    - canonical: staging.example.com
    local_path: ../site
    repo: # redacted # 
    repo_subtree_path: site
    branch: main
    ...etc
# group_vars/staging/main.yml
# modified according to Kinsta instructions

mysql_root_password: "{{ vault_mysql_root_password }}" # Define this variable in group_vars/staging/vault.yml
project_root: /www/examplecom_123/public
www_root: /www/examplecom_123/public
web_user: examplecom
web_group: www-data

Note: trellis deploy works perfectly with this configuration — it's just the trellis alias command that generates the wrong WP CLI config. Manually correcting the path to /www/examplecom_123/public/current/web/wp fixes it and makes wp @staging somecommand work perfectly.

System info

  • macOS 14.5
  • trellis-cli from homebrew

Log output

No response

Please confirm this isn't a support request.

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions