Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom config.php content in fpm chroot gets removed by nc #10904

Closed
k4ffee opened this issue Aug 28, 2018 · 4 comments
Closed

Custom config.php content in fpm chroot gets removed by nc #10904

k4ffee opened this issue Aug 28, 2018 · 4 comments

Comments

@k4ffee
Copy link

k4ffee commented Aug 28, 2018

Hello there :), as suggest in the forums: https://help.nextcloud.com/t/custom-config-php-content-in-fpm-chroot-gets-removed-by-nc/34767

as described in the title, if 've a problem with my setup. Background:
Running NC via nginx & php-fpm using the php-fpm chroot option. Everythings works fine so far (eg. Webcron) except using operating system cron.
Because of the fpm chroot settings, php-fpm needs other path settings in config.php eg.

'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/chroot-data/public/apps',
      'url' => '/apps',
      'writable' => true,
    ),
  ),
  'datadirectory' =>'/chroot-data/nextcloud_data',

Works fine. But running (as nextcoud user)

php -f /srv/users/nextcloud/chroot/chroot-data/public/cron.php

will fail, because of the different filesystem structure seen by php-cli.
One solution often found on the web is to prepend the data & apps directory option with something like this:

((php_sapi_name() != 'cli') ? '' : '/srv/users/nextcloud/chroot')

(or setting something like $CUSTOM_ROOT = ... at the top of the config file for more readability)

Sadly this seems to be cleaned out by nc sanitize operations and the only way I see to stop that, is to set

'config_is_read_only' => true,

but this also stops the Updater from working (need to change config.php manually).

So, long story short, is there any other way (like 'overwrite.cli.url' => )to respect the nc paths in a chrooted environment ?

Thanks in advance :slight_smile:
Michael

Steps to reproduce

  1. Install Nextcloud
  2. Put custom code in config.php, like
    'datadirectory' => ((php_sapi_name() != 'cli') ? '' : '/srv/users/nextcloud/chroot') . '/data'
  3. Wait for cronjob

Expected behaviour

Your manual changes stays untouched

Actual behaviour

Your manual changes gets cleaned out

Server configuration

Operating system: Gentoo Linux

Web server: nginx 1.14.0

Database: mysql Ver 15.1 Distrib 10.1.31-MariaDB, for Linux (x86_64) using readline 7.0

PHP version: PHP 7.1.18

Nextcloud version: 13.0.5

Updated from an older Nextcloud/ownCloud or fresh install: from 12.x

Where did you install Nextcloud from:

Signing status:

Signing status ``` No errors have been found. ```

List of activated apps:

App list
php occ app:list
fails because of chroot

Nextcloud configuration:

Config report
php occ config:list system
fails because of chroot

Are you using external storage, if yes which one: -

Are you using encryption: no

Are you using an external user-backend, if yes which one: -

Logs

Cron error log

Cron error log
Aug 28 17:15:01 localhost CROND[29776]: (domain) CMDOUT (App directory "/data/public/apps" not found! Please put the Nextcloud apps folder in the Nextcloud folder or the folder above. You can also configure the location in the config.php file.)
@k4ffee
Copy link
Author

k4ffee commented Aug 28, 2018

Today NC told me that the last cronjob ran 15 days ago, ... so the above issue seems to occur even if you add the 'config_is_read_only' => true, line in config.php

So, the only workaround I see at the moment is to remove write permission from config.php ...

@nextcloud-bot
Copy link
Member

GitMate.io thinks possibly related issues are #10569 (get avatar custom status from user config), #3269 (Default config.php appstore), #8115 (NC mistaken PHP-FPM version 5.4.16 as PHP version), #1358 (config.php - Disable Remember Login), and #9726 (Add documentation to config.php for share_folder).

@blizzz
Copy link
Member

blizzz commented Sep 12, 2018

place the condition in config/custom.config.php (create it), this should not be overwritten iirc.

@k4ffee
Copy link
Author

k4ffee commented Sep 30, 2018

Works. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants