Develop additional OCC capabilities

There seems to be a general desire for additional occ functionality. Specifically in regards to app installation and management. I’m hoping to solicit feedback on what improvements to occ would be generally useful before opening a Github issue.

This is in reference to ,

Install app via command line - occ app:install · Issue #1599 · nextcloud/server · GitHub - This seems to be docker specific.
https://help.nextcloud.com/t/installing-and-updating-apps-from-the-command-line-occ

I’m basing a lot of this off the capabilities currently in Drupal Drush, and WordPress WP-CLI. I think the following features would be really useful for management of Nextcloud. Especially when you have to do it at scale.

Application abilities.
app:download - Download an application
app:install - Download if needed, and enable.
app:upgrade - Update a specific application, or all applications. Perhaps an --all flag.

Core abilities.
core:download - Download Nextcloud
core:install - Download if needed and then install Nextcloud
core:upgrade - Upgrade Nextcloud to latest version

Example: Automate Nextcloud installations using something like, ./occ core:install --nextcloud-version -db:user= -db:pass= -db:database= /path/to/webroot

Backup and restore capabilities.
backup:sql - Create a backup of the SQL database.
backup:files - Backup up the data directory
restore:files - Restore a data directory
restore:database - Restore the database
restore:all - Wipe the current install and restore from backup?

I know many of these capabilities exist through third party applications, or through custom scripting server side. But it would be really useful if these abilities were integrated. This way providers could have a single supported method by which to automate Nextcloud deployments, upgrades, and general management.

Other ideas? Opinions? Feasibility even?

Installation is already possible via occ (not the code download though):
https://docs.nextcloud.com/server/10/admin_manual/configuration_server/occ_command.html#command-line-installation-label

The updater app was completely rewritten and it is a nice idea to provide some occ-commands to run this directly from command line @LukasReschke

Backup&Restore: I have some doubts here. To implement everything in php is probably a lot of work and you already have a lot of tools doing that (very reliable and very well tested). The problem is that such code must be extremely reliable (you have seen with the updater app, that can be a challenge). Other thing is, there are so many different ways to backup, some just want to copy everything to a different HD, others need to put it over network on non-trusted storage and want it encrypted, or compressed, if you have snapshots (LVM, btrfrs, ZFS) this is a very nice way to run backups and restore (not sure if you can control this via php).

Other idea: Use existing tools, but provide some sample scripts for Nextcloud in particular. We could try to cover some popular use-cases. One could be you have a second hard-disk or mounted network storage and you want a script that backups data+datebase (./backup-script.sh /path/to/nextcloud /path/to/backup).

Hi @tflidd,

Thank you for your response. Looking over my initial post, I actually missed my biggest wish.

Number 1: Allow occ to be installed and run separately from Nextcloud.

Having it installed as separate command would allow it to be used for automated installations, or as a management tool for multiple Nextcloud instances.

The current occ maintenance:install requires you download Nextcloud first, and doesn’t allow setting the installation path. Compare this to having an independent occ command which can handle details such as downloading, extracting, and installation to a specified folder without needing all of Nextcloud first. It’s not a big effort for a single install, but as part of an automated system, having occ able to handle the details is helpful.

That would awesome.

I agree in regards to complex backups. Server backups should definitely be handled outside of Nextcloud. For occ backups, I’m thinking more of a simple database dump, with directory archiving into a tarball, or zip file. Being able to restore automatically from those dumps/archives would be useful as well. As a comparable command, there is drush archive-dump, and drush archive-restore for Drupal, which does exactly that. Like the installation example above, having occ able to handle the details such as database authentication, data-dir locations, and so on makes a difference.

Other opinions welcome.

I’d like manage better users via scripts
Using “OCC users:” at this moment i can’t

  • add/change email
  • add/change quota
  • add/change admin-group