Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trellis CLI deploy flag suggestion #208

Closed
3 tasks done
jt-adwisemedia opened this issue Nov 17, 2021 · 7 comments
Closed
3 tasks done

Trellis CLI deploy flag suggestion #208

jt-adwisemedia opened this issue Nov 17, 2021 · 7 comments

Comments

@jt-adwisemedia
Copy link

Summary

Add support for the --limit flag for the trellis deploy <environment> command, currently we have to write the entire ansible-playbook deploy.yml -e env=production -e site=yoursite.tld --limit=kinsta_production, would be nice if you could just write trellis deploy production --limit=kinsta_production.

Motivation

Nice quality of life change, convenience.

@swalkinshaw
Copy link
Member

Probably makes sense to support natively. In the meantime, I think you could use extra vars:

trellis deploy --extra-vars ansible_limit=kinsta_production production

@swalkinshaw
Copy link
Member

@jt-adwisemedia I assume you're using the limit option because of this guide? https://kinsta.com/blog/bedrock-trellis/

In most cases, limit shouldn't be needed at all because there's only one host per environment. Ie: one staging server, one production server, etc.

We'll try and get that guide updated because limit seems redundant. This means you also don't need that option when using the CLI. You can verify this by just running trellis deploy production and making sure it does the same thing as with --limit.

If there's a difference, feel free to re-open this issue.

@dalepgrant
Copy link

@swalkinshaw I've come here looking for exactly this. Example of a use case here in Roots Discourse.

We have our Trellis structured as follows:

trellis/
├── group_vars/         
    └── production/
        ├── main.yml
        └── vault.yml
    └── staging/
└── host_vars
    └── server1/
        └── wordpress_sites.yml
    └── server2/
    └── staging1/
    └── staging2/

Our deploy then looks like this with the old deploy.sh script:

./bin/deploy.sh production domain.example --limit=server1

Not strictly related to this issue, but if I try to run your suggestion while provisioning, trellis-cli gives an error

trellis provision --extra-vars ansible_limit=server1 production
Error: production is not a valid environment, valid options are [development]

@swalkinshaw
Copy link
Member

That should work... can you try it with quotes?

trellis provision --extra-vars "ansible_limit=server1" production

@swalkinshaw
Copy link
Member

swalkinshaw commented Mar 21, 2022

Wait sorry I misread that error message. It's handling the command correctly but it's only detecting the development environment for some reason?

Do you not have a wordpress_sites.yml file under production? That's how it detects environments

@dalepgrant
Copy link

No, the wordpress_sites.yml files are under the host_vars folders, one per server so we can choose which site(s) sit where.

@swalkinshaw
Copy link
Member

Opened a new issue for that: #278

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants