tobru/nextcloud-openshift

Support Nextcloud autoconfiguration

tobru opened this issue · 2 comments

tobru commented

Find a way to automatically configure Nextcloud on first startup. This could be done f.e. by mounting a ConfigMap containing the autoconfig.php with the needed parameters.

https://docs.nextcloud.com/server/12/admin_manual/configuration_server/automatic_configuration.html

The only point which could make this not so straight forward:

The ../nextcloud/config/autoconfig.php is automatically removed after the initial configuration has been applied.

We need to find out if it doesn't matter when this file just stays there as it can't be deleted when mounted as a ConfigMap.

It works when you create a secret and pass it as env to the deployment config. For the secret I used values from parameters.

- apiVersion: v1
  kind: Secret
  metadata:
    annotations:
      template.openshift.io/expose-admin-user-name: "{.data['admin-user-name']}"
      template.openshift.io/expose-database-password: "{.data['database-password']}"
    name: "${NEXTCLOUD_APPLICATION_NAME}-admin"
  stringData:
    admin-user-name: "${ADMIN_USER_NAME}"
    admin-user-password: "${ADMIN_USER_PASSWORD}"
 - env:
  - name: ADMIN_USER_NAME
      valueFrom:
        secretKeyRef:
          key: admin-user-name
          name: ${NEXTCLOUD_APPLICATION_NAME}-admin
  - name: ADMIN_USER_PASSWORD
       valueFrom:
         secretKeyRef:
            key: admin-user-password
            name: ${NEXTCLOUD_APPLICATION_NAME}-admin