Skip to content

039 Automated backup system in JCB

Llewellyn van der Merwe edited this page Dec 19, 2018 · 21 revisions

Hi I would like to demonstrate to you the new automated backup feature that's been added to JCB It is part of a Extension Which I called the API Which really gives you the option of Querying JCB Via a URL To perform certain functions First of which would be to actually generate a backup We not sure exactly What kind of features we should be adding to this API And we started to discussion About this one kid hopping Welcome to Give me a shout To send me an email you can Just check here Email address Behind this link here Features we want to add to the API Currently the first one like I said is the backup feature Now JCB already Has in its Component area Export component feature which we basically just extended To automate But we've left it as well Here is a button called backup and it actually is the same feature except You can now manually also trigger that feature Now what does backup feature does Ida been triggered by a A cron job or being triggered by this button Is it actually Takes all your components And Exports them Encrypt stem Stores them on a local folder And emails the key to a Trusted email address Would you have set up Now The Components that are in your trash will not be Actually part of this backup So only components that are published Or unpublished or archived Will be in the back of every everything else will be Lord And Basically when the backup runs either manually or automated fire A cron job It will take hers components Use the specific keys as it would with an exporting of a component An encrypted And Store them in that folder as I said Now There are some things you need to set up For this to work As expected The first of these being in the options area of JCB there are some new Feature so let's just open that So we see there is now a mail configuration Idk IM And a cron job Tab in added and also this field here called API user Maybe let me start with this field The API user Obama Rolly be used 4 The ID that is used In the permission structure You see When you are in the components area And you trigger this feature manually It actually uses this current logged in user To determine whether that The components being you know encrypted and backed up Weather has the permission to actually Do that Now Getaway As we increase the permission structure of JCB You might end up having components that certain individuals who are in certain groups may not have access Them And then there might be components and Fields and buse that they may have access to Or some that they may not have access to And so we're ready now Laying some of the foundation to make sure that there isn't some loophole Where are there by Triggering a bash sorry at batch Update on export of components or backup The camp extrude certain components which they actually by Default don't have access to I know that's a long explanation but But that's just to give you a background to why we still need an API user We still need a user Which now if it's automated the backup That this user ID actually Allows him to make the backup So that means that the IP API user should be a user Which has the permission To all the actual components Fields and Well everything actually In the JCB component Now It is secure because like I said the component Gets Compiled And stored locally We might Consider adding The option to push the component backup to an FTP Server But that part is not fully functional yet We we have had D The proposals made to do that so that The Back-up is actually not even on the same system But I did it's secure on another system so if this system Collapses You you still safe You still got you your data out So that sounds to me as a good Idea and so we will be adding an FTP Option as well Which will very much for the work similar as your components When you compile a component and it sends it off to a sale server or Or such That is really the same features will make use of anyway so That's just talking about Selecting an API user And why that is important Now When we go to the cron job Tab Will see that there is some is true basic instructions here Ioffer goes if you familiar with cron jobs I suppose there everything is self explanatory Those who are not I would suggest to Google around Find some tutorials Read up Make sure you know what you're doing And that you're a very comfortable and setting up a cron job There are various ways for you to trigger this URL The system currently detects whether your system actually can run crawl request And if it can't it will fall back on the we get option Assuming that JCB is installed In an environment that allows these two functions to work If not you can simply take Only the URL And run it in a cron job In in the manner that is Uno applicable to your system And know that This your L actually just triggers The backup to start And when the backups finished It actually just tells you The same message that you will get If you run the backup by clicking back up here You see there is a green message that pops up Saying yes the backup was done the email was sent Does are the only messages That also actually Gets returned on this URL So they they are the same Now We currently throwing that responds away But you could Added to log Depending on how regularly this cron jobs running There isn't the date currently I think It might make sense for us to add a date But the states there isn't one Ok so now we if you're running in a firewall your Joomla website has a firewall install Bald like RS firewall Then you you might need to adapt your Your curl request To behave like a real browser And here is a a a a post on stackoverflow that could actually help you Understand more about that So now currently the Chrome backup folder path is set Here And so it can't be only backups to a local folder As I said we will add an FTP option here Will still work out how we can do that and still have it secure Joomla doesn't by Default actually Encrypt fields in the Inno Global configuration of your component And So that's my be part of what makes it difficult for us to implement This Here but But do you will come up The point is currently It stores it into a local folder And it Emails the backup key to the email address that you set in here No make sure that email address is secure And that it is safe Obviously because the keys are being sent to it Now here is a naming structure for your file By Default it actually adds only up till the day so it will Make backups all through the day but override the file every time Unless you add an hour then it'll only per hour over I did I need to add a minute It will actually never override it because it will be a different minute every So that is To rename your package and to see how much of the backups you want Keep And If we go to the mail configuration area you see that it currently set to use the global Mail Configuration switch is your Joomla default Now I would advise that you use a very secure method of sending Emails So I the SMTP Bees overriding the SMTP settings here Or if you use the global ones then override or insured at your Global Email settings in Joomla is also using SMTP That it actually runs through an SSL and is secure Ok the dkim is also a added feature Which can increase Trust And security Off your emails Then there is the folder sorry there the company Details Which At this stage Is important To add since it will also become part of the backup package And we will look at that again when we restore a backup to show you where this information comes up Ok so that some of the settings you need to first set Within your Global configuration Now once you've set those settings Company settings your cron job settings Your local path to email the name And your User API user You can save and close this area And we can start looking at a component See this feature in action Since this is a default Joomla website Sorry tomorrow Install and JCB install There's only one component here And it's the demo component Now usually the demo component doesn't have Encryption key So I'll open it And I've already said it because I've done this video A few times So You basically come and set an export key In at least one of the components That will be part of the backup If any one of the components That are being backup have an export key It will extreme Krypt all the components with that export key If multiple ones have an export key it will Combine the skis To use as the input Pinky It has those keys so the actual key is not what is actually being used And the actual key that's being used is the one that will be emailed out To do that trusted email address So we'll save and close the the demo component And Then We will just run a manual backup here Which like I explained before is really similar to the cron job except that it's triggered by clicking This button Ok so we just click it there And The moment since it's a very Just one component It's not a very big Process it should It finished quite quickly And it will basically say ok The Back-up has been Done successfully The owner details was set so if for some reason you forgot To set the owner details in the options area it will actually tell you that here And the email With the new key was sent So now To make sure that your backup actually works You should now go check the folder In which you set The Back-up should be placed And see whether the backup is there And also Check the email addresses see where they Did they received the key So I'll be doing that quickly Ok I see I have a backup actually here in the folder As expected So the backups been done I can double click into the backup And make sure that it has all the Expected files And at this stage it looks It Like It does if you have a lot of custom Files That you've added into the component There will also be an extra custom Folder in the zip Document And I not only an image one Ok so we will test this backup by actually importing it But first let's see if we will see if the email as well So here we can see that it also send the email as expected With the corresponding key Will be using this kit test the backup Be sure again like I said that it actually sent the key Do a secure Website email address And that That The even the email that sense The Email from Gmail Is using a security LSM Now let's test this backup A backup only makes sense if we actually lost our data so I'm gonna take Component And basically Wipe this one is deleted Throw that in trash Then go to trash Hand Empty the trash So now There is no components Chicken import components Now we need to browse to the directory Weather component was backed up so we'll click on the directory tab There we have the components Fast to the actual backup A package And we click on get file Now we will take that key that was sent to us via the email And we will force the update And will update key here And we'll click continue Sorry I just step back from moment again Because I realised it didn't explain with you seeing here and like I said before your Package data of the owner of the package is displayed here And the package details are displayed here So if you have more than one component backed up all those components will show Here on the components being imported And here You will see the The package owner Details And get the key from this link here So I will Again do this import I just wanted to quickly Get back to that Let's Let's click continue Wonderful so we have the component back It's all being restored And that's really what the purposes of the backup Is it when something goes wrong You can actually come back to where it was when the backup was made We can test with a backup has been successfully restored by going to the compiler And then selecting the component And clicking on compile Russia currency is been completely successfully built And we can now click on install the demo component And then we can even go To the demo component And see that Everything is actually working Adding a new look They said all the various fields As it usually R Available in the demo component Well thank you for watching that is automated settings for JCB And setting them up and you making use of them

Clone this wiki locally