Backup Config Module - Beta - Final stage

Hi Davide,
I understand now what you wanted to say with splitting the package.
I have no problem with building two packages.

The only issue i can see is if you use the “default” UI of the BCM you will lose some functionality.

But let’s see how this goes.
PS have you tested the BCM on your system ?

1 Like

Thank you for supporting me, Bogdan!

The Enterprise version has already a similar feature that uploads the config backups to the private Nethesis cloud.

Therefore my goal is supporting both UIs (and whatever future one) with a common API.

Yeah of course I did it to give an attempt at the merge!

1 Like

The PKI module in nethserver-base has now an upload field for custom certificates. Have a glance at the module and view code!

It required a fix to the ajax library in Nethgui to work.

1 Like

Hi Davide.
Just let me know when you have the packages ready, to give them a test from the Software Center.

4 Likes

nice feature :slight_smile:

2 Likes

Hi Bogdan,
I’ve just pushed an experimental package to nethforge-testing, please have a look at it

http://packages.nethserver.org/nethserver/7.2.1511/nethforge-testing/x86_64/Packages/nethserver-backup-history-0.0.0-1.14.ga492b60.ns7.noarch.rpm

Probably there are some things to fix; at least I managed to re-pack your code without requiring changes to the core package. Now we can see how to enhance it!

3 Likes

@Davide, I’ll give it a try this on a fresh NS instance and let you know.
Thanks for you work on this package!

4 Likes

To move out of “testing”, I think it requires at least two enhancements:

  • Enforce authentication on each HTTP request.
    You could move bkp_jlib_ajax.php logic to Nethserver\Module\BackupConfig\History class.
  • Remove the need of backup/ symlink and 0644 permissions on backup archives.
    Backup archives can’t be world-readable because they may contain sensitive informations. You could isolate privileged operations into some scripts, as you already did, and call them with sudo.

I think the latest PKI - Server certificate page is very similar to this module and could be an example of how to arrange the things:

  • Lists some files
  • Allows uploading and validating new files
  • Allows selecting an item as “default/target”
  • Performs privileged operations with sudo
6 Likes

Hi Davide,
I agree with you on enforcing the auth on http requests.
On the second point (removing the need for backup/ symlink), I can see the functions to obtain the list of backups but I do not see how you can download the files after that since there will not be a function that will be able to read the file to put it to the header buffer…

So, List / Delete archives, will be possible, but i can’t see the mechanism for download. I’ve mentioned this before, that i can’t make this feature available… :frowning:
Do you have a possible way to achieve this ?

We can follow the VPN example to achieve the download feature:

We can wrap cat into an helper executed with sudo.

I agree Davide, it looks like the best solution and it will also keep the same “profile” as the rest of the NS code.
This starts to look very promising!
I’ll try to take a look at the section of code for getting the file into the view.

I still don’t get how the function will get triggered when you click the download button… :blush:

1 Like

Button click events are handled in javascript by this class:

@Davide,
I’ve installed the Backup History module you provided and i have encountered two issues:
1 After a backup is made (or a backup is deleted) , on the History tab i see the table for 1 second then it gets replaced by this:

Or after delete by this:

  1. After i hit the button “Backup now” again after a backup was just made it freezes and remains like this:

Only if I hit “reload” on the browser or refresh the page it restores normal operation.

The pages seem to be affected ONLY after the backup button has been clicked or after an event (Like delete).

Otherwise if no event has been used it looks normal.

2 Likes

I’m looking at it next week! If we agree on moving the logic into the History controller, I’m sure we get back all this issues solved :wink:

1 Like

Sure Davide, I’ on for how this module can be improved.

I think that we can remove the tabs Backup and Restore and keep only one that will have the Backup and Restore functions alongside the table of backups. (they are kind of redundant in my opinion)

As I have said, I’ll try to take a look at the code you provided as reference and figure it out if I can.
This way I can help you on porting all this to the more standard NS code :wink:

I agree, they are kinda redundant and we could arrange the whole UI in a cleaner way, too. But I must keep into account the Enterprise module that - as said above - already provides a similar feature. I need some time to iron out the kinks, please be (still) patient!

Meanwhile, we can safely proceed with this add-on!

1 Like

Not a problem. Take your time, there is no pressure issue from my side :slight_smile:

BR
Bogdan

3 Likes

Well that time has passed, it’s time to take in hand this module again!

Starting from @Ctek’s work (and straight from our meeting at FOSDEM17) I’m going to develop a configuration backup enhancement. The goal is the same

  • “restore from backup” at first system boot (FirstConfigWiz UI module)
  • configuration backup history
  • history length customization
  • upload an item to the history
  • restore from history

Tracked by issue https://github.com/NethServer/dev/issues/5314

6 Likes

Looks a great news, Bogdan will be happy to hear that

This is an UI mockup

Row available actions:

  • Restore
  • Download

Configure options:

  • History length
2 Likes