Hi Sajith, If we are going to handle each file separately wouldn't it introduce complications when files are moved and refactored? Wouldn't it be better to patch the PCA as a whole rather than file by file?
Regards, Chamila de Alwis Committer and PMC Member - Apache Stratos Software Engineer | WSO2 | +94772207163 Blog: code.chamiladealwis.com On Mon, Nov 30, 2015 at 6:44 PM, Sajith Kariyawasam <saj...@wso2.com> wrote: > > On Sat, Nov 28, 2015 at 11:55 PM, Imesh Gunaratne <im...@apache.org> > wrote: > >> >> >> On Tue, Nov 24, 2015 at 12:58 PM, Sajith Kariyawasam <saj...@wso2.com> >> wrote: >>> >>> >>> There are two aspects in here as I see. >>> 1) Applying patches to already running server and restart. >>> 2) Applying patches to a 'fresh' server and start >>> >>> It would have been ideal if we can achieve both scenarios above, but >>> yes, with the points you have mentioned (1) is not possible. I remember we >>> had a discussion in past regarding this, >>> did we finalized it?. So, if there is a running cluster (say,100 nodes) >>> and if we need to apply a patch, approach would be to spawn up 'new' >>> instances with the patches? >>> >>> Yes, currently we might need to do this because, if we apply a patch in >> an active instance and restart the server. During that period it will >> receive requests via the load balancer and those will fail. Few months back >> Shaheed proposed a software update management feature to handle this logic. >> >> >>> Even in that scenario, there is no easy way to track the changes being >>> done to the originally released binary, since the current approach is to >>> replace the old files with patched files. >>> The model I was thinking is to implement a model where PCA always keep >>> the original files (backed up) and read the latest files (from a patch >>> location), which is the exact way of Carbon >>> patch model. >>> >>> Right, I think this is a good approach. Can you please explain it using >> an example? >> >> > I have attached a sample directory structure. There will be a separate > directory named "patches", into which the patches need to be copied. > Say we have patched "agentgithandler.py" in patch0500 and its copied in > patches directory as shown. > When the agent starts up it checks whether there are any "patchxxxx" > directories, and if so it backs up the original file(s) into patch0000, and > replace original file with the patched file. > > If the patch folder is removed we need to restore the original file, in > order to cater for that, the logic should be, at the startup agent checks > whether there are any files in patch0000 directory > (which means a patch is already applied) and search for that file in > patchxxxx directories, if not found it compares the md5sum with the file in > the original location. > If it doesn't match, it will replace with the file in patch0000. > > Those logic needs to be written in python code and to be executed before > starting any of the agent related code. > > I will try to send a PR soon so that it will be much clear about the > process, and we can review it and do any modifications needed. > > > > >> Thanks >> >> >>> Can you please explain the patching process you are proposing? >>>> >>>> Thanks >>>> >>>> On Wed, Nov 11, 2015 at 6:07 PM, Sajith Kariyawasam <saj...@wso2.com> >>>> wrote: >>>> >>>>> Hi Devs, >>>>> >>>>> At the moment Python Cartridge Agent (PCA) doesn't have a convenient >>>>> way of applying patches. >>>>> If there is an issue identified and fixed, in order to apply the fix >>>>> to a running system that particular file(s) has to be replaced in the >>>>> running system, >>>>> and there is no easy way to revert the patch is there is any issue >>>>> found later. >>>>> Also, there is no way of tracking the list of patches applied. >>>>> >>>>> I would like to suggest to implement a patching model for PCA, similar >>>>> to that we have in Stratos core, which is based on carbon [1] >>>>> WDYT ? >>>>> >>>>> [1] >>>>> https://docs.wso2.com/display/Carbon420/WSO2+Patch+Application+Process >>>>> >>>>> Thanks, >>>>> Sajith >>>>> >>>>> -- >>>>> Sajith Kariyawasam >>>>> *Committer and PMC member, Apache Stratos, * >>>>> *WSO2 Inc.; http://wso2.com <http://wso2.com>* >>>>> *Mobile: 0772269575 <0772269575>* >>>>> >>>> >>>> >>>> >>>> -- >>>> Imesh Gunaratne >>>> >>>> Senior Technical Lead, WSO2 >>>> Committer & PMC Member, Apache Stratos >>>> >>> >>> >>> >>> -- >>> Sajith Kariyawasam >>> *Committer and PMC member, Apache Stratos, * >>> *WSO2 Inc.; http://wso2.com <http://wso2.com>* >>> *Mobile: 0772269575 <0772269575>* >>> >> >> >> >> -- >> Imesh Gunaratne >> >> Senior Technical Lead, WSO2 >> Committer & PMC Member, Apache Stratos >> > > > > -- > Sajith Kariyawasam > *Committer and PMC member, Apache Stratos, * > *WSO2 Inc.; http://wso2.com <http://wso2.com>* > *Mobile: 0772269575* >