Magento 2 is even less suitable for a one click install extension approach than Magento 1.
I would recommend a deployment workflow where you do your upgrades on a build or staging system and then synchronize the files to the live system after testing.
Example setup
Move your Magento installation outside the document root, for example to /var/www/example.com/release/1
and create /var/www/example.com/htdocs
as symlink to /var/www/example.com/release/1/pub
. Then /var/www/example.com/htdocs
must be configured as document root in your vhost settings.
To easily switch the symlink to a new release, you have to move some files outside of the release
directory and replace them with symlinks to the new location:
pub/.htaccess
pub/media
pub/static
pub/var
app/etc/config.php
(I hope, I didn't forget anything important. For Magento 1, it is .htaccess
,media
,var
,app/etc/local.xml
)
A new release will be copied from the staging server to /var/www/example.com/release/2
, the symlinks to the files/directories listed above will be created within, then the main symlink is switched from release/1
to release/2
. So the actual update is one atomic operation, if you don't count flushing cache and triggering database update scripts.
All this can be easily automated, so once you have set it all up, deployment gets easy again, and you can be much more confident that it works.
Update: OK, as I understand now, you get an error during the database update. I fear the best solution for that is to go into maintenance mode for this (hopefully very short) period:
touch var/.maintenance.flag
setup:upgrade
rm var/.maintenance.flag