Possible to dynamically load hosts from an API response rather than defining them in hosts.yml? #2635
Unanswered
nathan-io
asked this question in
Help needed
Replies: 3 comments
|
It’s totally okay to load host from a database or via a RPC or via an API call. This is benefits of using just php for configuration. Fetch host at deploy.php at root level. It should be okay. |
0 replies
|
Thank you! Sounds good. I didn't even consider pulling hosts from a database, that could be even better than the API call. I'm trying to "Mark as answer", but nothing happens when I click in Chrome or FF. I can't close the "Marking answers" help modal either. Hopefully GitHub fixes that soon... |
0 replies
|
I got this working using the Cloudways API.... in deploy.php the key bit is |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I'm trying to avoid the need to manually edit
hosts.ymlordeploy.phpeach time we create or destroy production hosts (scaling up/down).The goal is to fully automate the process of updating our host definitions, so no one has to touch
deploy.phporhosts.ymlas a result of a created/destroyed host.One idea I had was creating a custom Deployer task which makes an API call to list all of our active DigitalOcean droplets, extracting those with a tag indicating that it is a deployable host (ex: all servers tagged "production-application-server").
Then, in
deploy.phpwe callhost()for each returned "production-application-server" resource.Is this possible, or recommended? Are there better solutions?
If not, another approach I thought about was using a CLI tool like yq to programmatically update
hosts.ymlany time we created or destroyed a host. At least this way, the process can still be automated.Thank you for any replies!
All reactions