You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This uses Go template logic, which is cool. I looked and did not find any documentation for the template support, but I checked out the code to make sure I understood how it worked and what was going on. In particular, you load the runtime environment into the Go template converter such that environment vars can be accessed with dot notation (like .CONSUL). All good so far.
We then went to add Redis scaling, based largely on the example here:
To handle Redis scaling, some relatively complex script logic and consul interaction is used (to determine if a given instance should attempt to promote itself to master, among other things). That logic is here:
That logic uses jq (https://stedolan.github.io/jq/) in order to read and re-write it's containerpilot.json file (so that it is advertising the proper set of services, specifically master vs replica).
The problem, if it's not obvious already, is that the containerpilot.json files using the consul agent Go template logic are not valid JSON files, and thus cannot be processed with jq.
I attempted to use consul-template to pre-process the containerpilot.json file in the same way ContainerPilot does, but I could not figure out a way to load the environment such that the template would render properly. I don't particularly want to write my own Go program just to do this, and then figure out how to drag that into my container.
What would be super cool is if ContainerPilot exposed a mechanism of pre-processing the containerpilot.json file, maybe the ability to run containerpilot with a -template param (using the same format as consul-template)? That way I could have ContainerPilot pre-process the containerpilot.json file, then I could interact with it (using jq or whatever) as a JSON file. This would also encapsulate the other features that are creeping into the ContainerPilot template support (which are great, they would just be a hassle to duplicate and maintain if I had to write my own separate program to do this).
The text was updated successfully, but these errors were encountered:
TL;DR
Details:
We are in the process of modifying our AutoPilot project so that we can scale consul and redis.
On the consul side, we use the pattern here to selectively configure/enable consul agent:
https://github.com/autopilotpattern/wordpress/blob/master/etc/containerpilot.json
This uses Go template logic, which is cool. I looked and did not find any documentation for the template support, but I checked out the code to make sure I understood how it worked and what was going on. In particular, you load the runtime environment into the Go template converter such that environment vars can be accessed with dot notation (like .CONSUL). All good so far.
We then went to add Redis scaling, based largely on the example here:
https://github.com/Faithlife/redis-autopilot
To handle Redis scaling, some relatively complex script logic and consul interaction is used (to determine if a given instance should attempt to promote itself to master, among other things). That logic is here:
https://github.com/Faithlife/redis-autopilot/blob/master/bin/manage.sh
That logic uses jq (https://stedolan.github.io/jq/) in order to read and re-write it's containerpilot.json file (so that it is advertising the proper set of services, specifically master vs replica).
The problem, if it's not obvious already, is that the containerpilot.json files using the consul agent Go template logic are not valid JSON files, and thus cannot be processed with jq.
I attempted to use consul-template to pre-process the containerpilot.json file in the same way ContainerPilot does, but I could not figure out a way to load the environment such that the template would render properly. I don't particularly want to write my own Go program just to do this, and then figure out how to drag that into my container.
What would be super cool is if ContainerPilot exposed a mechanism of pre-processing the containerpilot.json file, maybe the ability to run containerpilot with a -template param (using the same format as consul-template)? That way I could have ContainerPilot pre-process the containerpilot.json file, then I could interact with it (using jq or whatever) as a JSON file. This would also encapsulate the other features that are creeping into the ContainerPilot template support (which are great, they would just be a hassle to duplicate and maintain if I had to write my own separate program to do this).
The text was updated successfully, but these errors were encountered: