Generate instanceid without loading the site

Nextcloud version (eg, 18.0.2): 19.0.0
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20:04
Apache or nginx version (eg, Apache 2.4.25): Apache
PHP version (eg, 7.1): 7.4

Hello!

I am wondering if you somehow can generate the instanceid without loading the site for example script making.

I’m trying to make an automatic Nextcloud installation script where it will install all necessary packages and installations, then run
sudo -u www-data php /var/www/html/nextcloud/occ maintenance:install

I have seen that the instanceid only generates when you first load the site and not when the netcloud is installed, and that makes the config.php changes hard to do with the script without loading hte site first…

Anyone have any ideas what I can do to combat this?

Another note that I can add is… Is it possible to make the instanceid manually? for example add them yourself in the script with something like this (ofcourse change them per installation)

‘instanceid’ => ‘thisismymanuallyaddedinstanceid’,

Would that work in the long run?

A curl request to the site is not sufficient?

Didn’t think about that… it worked with a simple curl.

Thanks! :slight_smile:

Can you please elaborate how it works?

Error

  • The required instanceid config variable is not configured in the config.php file.Please ask your server administrator to check the Nextcloud configuration.

Thanks.

Update: in the meantime I tried something and that helped!

docker exec -it -u www-data nextcloud bash
www-data@b8ce717d69f9:~/html$ php /var/www/html/occ config:system:delete instanceid
System config value instanceid deleted

It created a new instanceid in the config.php.