Hi Tim thanks a lot for the reply. I am not familiar with what a sidecar process is. I will look into it. If it is specific to haproxy, if you could point to some relevant documentation that would be helpful.
>I am making a > socket call which periodically checks whether the portal has been changed > (from within haproxy action). Leaving aside the writing to file bit for a moment, is it otherwise okay to do to the above within Haproxy alone and read the config fetched from portal into a global variable instead of saving to file? Or is it not an advisable solution? Actually this is what I am doing at present and I have not observed any issues with performance... Thanks, Reshma On Wed, 26 May 2021, 20:31 Tim Düsterhus, <[email protected]> wrote: > Reshma, > > On 5/26/21 4:44 PM, reshma r wrote: > > not). There is a requirement that the configuration file may be changed > > from an external portal. So whenever a change is made in the portal I > would > > like to update my configuration file accordingly. To do this, I am > making a > > socket call which periodically checks whether the portal has been changed > > (from within haproxy action). If so I must write the updated values to > the > > file and it seems I cannot write to a file inside lua action so this is > > where I am stuck. To me, It sounds like this cannot be achieved and I > must > > drop the idea of changing the file from the portal. > > You should implement this in a dedicated sidecar process that checks the > portal API and on a change writes the updated configuration file and > then either updates the state within the running HAProxy process using > the stats socket (e.g. using 'set map' [1] or 'set var' [2]) or reloads > HAProxy depending on your exact requirements. > > Just because you can do a lot of stuff within HAProxy using Lua doesn't > mean that you should or that it's the best solution :-) > > Best regards > Tim Düsterhus > > [1] > https://cbonte.github.io/haproxy-dconv/2.4/management.html#9.3-set%20map > [2] > https://cbonte.github.io/haproxy-dconv/2.4/management.html#9.3-set%20var >

