owncloud-ansible/owncloud

Fix: Defining app config values breaks ansible script execution

d7oc opened this issue · 7 comments

d7oc commented

If the S3 configuration is given in the owncloud_config_extra section like this:

owncloud_config_extra:
  - objectstore:
      class: 'OCA\\Files_Primary_S3\\S3Storage'
      arguments:
        bucket: "owncloud"
        part_size: "5242880"
        concurrency: "5"
        options:
          version: "2006-03-01"
          region: "us-east-1"
          credentials:
            key: "username"
            secret: "password"
          use_path_style_endpoint: true
          endpoint: "http:\/\/hostname:8000"

Ansible aborts the execution due to a class not found exception in occ check. A separate execution of occ check looks like this:

occ check
An unhandled exception has been thrown:
Error: Class 'OCA\Files_Primary_S3\S3Storage' not found in /var/www/owncloud/lib/private/legacy/util.php:115
Stack trace:

The reason is that the apps are installed

- include_tasks: apps.yml
after the config is written
- name: Install ownCloud config file
so the system doesn't know the class when occ check is executed in
- name: Get ownCloud setup status

As we are using the market app to install further apps, we can only install new apps after the main installation.
So, one idea would be, to install app configuration after the main installation.

However, you are trying to install files_primary_s3 which specifically needs to have its configuration available before maintenance:install.

Which ownCloud install package are you using? I'm not sure whether the complete bundle even includes files_primary_s3. Perhaps you need to provide a custom owncloud tarball to the ansible playbook which includes it?

d7oc commented

files_primary_s3 is even missing in the complete install package, so it needs to be installed separately right now. I placed the tarball in an asset directory in this case as the system here was air gapped. The custom tarball would be a workaround which might do the trick. But when it comes to workarounds I can also run the Ansible script twice, once without the configuration to just install the app, and once with the configuration to have everything completed.

So you think there is no solution for this in which we can just change the order of execution in the Ansible script?

present=['market:install'],

The oc_app library within this playbook uses market:install to install additional apps.
Therefore we cannot change the order of execution.

The custom tarball would be a workaround which might do the trick. But when it comes to workarounds I can also run the Ansible script twice, once without the configuration to just install the app, and once with the configuration to have everything completed.

I was thinking about this one too, yes you could do that one too.

d7oc commented

Last thing which came to my mind: What about inventing something like owncloud_config_extra_post_install which will be written just after the general installation but before the installation of apps? Stuff like the S3 configuration which refers to app classes would then just go there.

Yes, that might be a good idea.

I think files_primary_s3 only needs to be fully configured before the first user login.
If for example the admin logs in before it is configured, then the user storage will be created in the datadirectory.

But we need to verify first, that it isn't needed before maintenance:install, because then this idea wouldn't work.

d7oc commented

Who can verify this?

Who can verify this?

I would recommend to either read the code, or try it out. Wasabi/Backblaze (among others) offer trial S3 access.