Skip to content

Cluster mode config.php switch #29444

Closed

Description

@PVince81

Add a config switch in config.php to tell OC that we're in a clustered environment.

At first, this switch must only make sure to force-disable the market app. The reason is that if someone uses the market app to install an app on a single cluster node, the app code will be missing from the other nodes and cause breakage. Force-disabling the market app also means that occ upgrade will not update any app code when run on a single node as it would cause similar issues.

Additionally, the switch could also make the configuration file read-only (like "config_is_read_only").

As discussed with @felixboehm and @patrickjahns.

cc @DeepDiver1975 @butonic @mmattel if you guys have additional feedback

Activity

  1. added
    p1-urgent
    on Nov 3, 2017
  2. added this to the development milestone on Nov 3, 2017
  3. self-assigned this
    on Nov 3, 2017
  4. mmattel commented on Nov 5, 2017

    @mmattel
    Contributor

    When followig this approach, how can apps be installed respectively updated?
    The following is much more efford and going another path, but what about to tell the config the presence of the cluster node(s) (yes, more than two nodes...), and find a way to start installing / updating nodes from the command line only, maybe by just dropping the line to copy paste ? and an additionally check (via the database ?) that all nodes have/run the same versions - else dropping a warning ?

  5. DeepDiver1975 commented on Nov 6, 2017

    @DeepDiver1975
    Contributor

    I consider the management of a clustered setup to be a complex task and a very individual task as well.

    Usually I'd expect a clustered setup to be driven my some kind of automated deployment mechanism.
    This might be something like docker, ansible or what soever.
    The operator of such a clustered setup will prepare the rollout of updates to core and apps via this single deployment mechanism. We shall not intervene in this mechanism by any means.

    Furthermore you cannot run mixed versions of an app. Assume there is a database schema change involved: the new code will apply the schema change and all nodes with the old code will no longer work.

    I think there are enough tools out there to allow proper deployment of clustered setups - there is no need to reinvent the wheel and add any kind of mechanism into the ownCloud code base.

    Finally: adding this flag seems reasonable 👍

  6. PVince81 commented on Nov 6, 2017

    @PVince81
    ContributorAuthor

    @mmattel the points you mention about tracking node app versions has been discussed before. It would be a possible extension to make cluster setup easier. But said extension is not a trivial addition. We identified some potential race conditions with host name updates when dealing with docker nodes. Something to be discussed later on once we consider going that route.

    For now the flag is added to avoid admins mistakenly creating broken setups through market app installs.

  7. DeepDiver1975 commented on Nov 6, 2017

    @DeepDiver1975
    Contributor

    At first, this switch must only make sure to force-disable the market app. The reason is that if someone uses the market app to install an app on a single cluster node, the app code will be missing from the other nodes and cause breakage. Force-disabling the market app also means that occ upgrade will not update any app code when run on a single node as it would cause similar issues.

    In order to fix this issue on a more global basis I suggest to prevent app installation and upgrade in core. The api methods ca be called by any app. Only disabling market seems to be too specific from my pov.

  8. PVince81 commented on Nov 6, 2017

    @PVince81
    ContributorAuthor

    @DeepDiver1975 which API methods ? Do you mean that an app could call APIs to install/upgrade other apps ? If yes, I agree, these code paths should be blocked, possibly with exceptions.

  9. PVince81 commented on Nov 6, 2017

    @PVince81
    ContributorAuthor

    However we need to make sure that the DB upgrade part can run. It's only the code upgrade that we block ?

  10. DeepDiver1975 commented on Nov 6, 2017

    @DeepDiver1975
    Contributor

    @DeepDiver1975 which API methods ? Do you mean that an app could call APIs to install/upgrade other apps ? If yes, I agree, these code paths should be blocked, possibly with exceptions.

    app installation is an api on the IAppManager - see https://github.com/owncloud/core/pull/29458/files#diff-8fa91b147fc76360cb3cfca41a1db57dR444

  11. added 2 commits that reference this issue on Nov 6, 2017
    8b40ce3
    8f7c832
  12. added a commit that references this issue on Nov 7, 2017
    3686fc6
  13. butonic commented on Nov 7, 2017

    @butonic
    Contributor

    @PVince81 @DeepDiver1975 hm, working on federated cluster I had the necessity of finding out if requests originated from another apache server or the load balancer. I think it would be nicer to have a list of valid web servers. From a support perspective it would be great to have more information on the overall owncloud architecture, eg:

    $CONFIG = array (
    	'nodes' => [
    		'web' => [
    			'http://apache1' => ['product' => 'apache', 'version' => 2.4],
    			'https://apache2',
    			'http://apache[4-9]',
    		],
    		'ldap' => [
    			'ldap://ldap.example.tld:389' => ['product' => 'OpenLDAP'],
    			'ldap://dir.example.tld:3890' => ['product' => 'NetApp'],
    			'ldaps://ad.other-example.tld:636' => ['product' => 'Active Directory'],
    		],
    		'storage' => [
    			'nfs://eos.example.tld' => [
    				'version' => 4,
    				'mountpoint' => '/mnt/data'
    			]
    		],
    		'cache' => [
    			'redis://redis.company.tld' => ['version' => 3.3]
    		],
    		'db' => [
    			'mysql:dbname=testdb;host=192.168.1.11' => 'master',
    			'mysql:dbname=testdb;host=192.168.1.12' => 'slave',
    			'mysql:dbname=testdb;host=192.168.1.13' => 'slave',
    		],
    		'antivir' => [
    			'clamav://avscan.example.tld'
    		],
    		'idp' => [
    			'https://idp.example.tld'
    		],
    	],

    Part of this can be learned and shared by storing it in the db, but learning != having an explicit configuration.

  14. PVince81 commented on Nov 7, 2017

    @PVince81
    ContributorAuthor

    I think it would be nicer to have a list of valid web servers

    That would be for the second phase. It becomes way more complicated when you need to detect the host name of a web server and dealing with "expired" web server host names with docker instances that are restarted and reuse the same host names. Ask @felixboehm and @patrickjahns as we had a discussion about this, and whatever solution we'd need would be more than just adding this switch. Something to be designed, estimated and scheduled.

    The switch is now here only to prevent the market app to work.

  15. butonic commented on Nov 7, 2017

    @butonic
    Contributor

    It should prevent the market app from installing app? Downloads should still be possible.

    Regarding cluster deployments it feels redundant with the config_is_read_only option. What are the scenarios:

    1. config rw & app install via market enabled,
    2. config ro & app install via market disabled => deployment via ansible/puppet/chef ...,
    3. config rw & app install via market disabled => actually makes no sense in cluster env, in single node instances ... hm
    4. config ro & app install via market enabled => why on single node instance?
    • in single node instances you may want to make the src readonly, including config.php and app folder
    • in cluster node configs you need some form of automated deployment to make upgrades / changes to config.php and apps over all nodes.
    • admins may want to test drive an app ... which should be done in a test or staging environment

    So, IMO we can reuse the config_is_read_only option (probably rename it). Or ... to reduce the number of code paths, make it readonly by default.

  16. DeepDiver1975 commented on Nov 7, 2017

    @DeepDiver1975
    Contributor

    Thinking about a very dynamic environment where nodes are added and removed based on their needs I consider an entry in the config.php the wrong approach.

    Furthermore in a clustered setup where multiple nodes act as workers of one instance there should be no knowledge about the other nodes. Nodes are stateless. Any request can be executed by any node. Any inter node communication is a breakage of this pattern.

  17. DeepDiver1975 commented on Nov 7, 2017

    @DeepDiver1975
    Contributor

    Regarding cluster deployments it feels redundant with the config_is_read_only option. What are the scenarios:

    absolutly - but at the end @PVince81 and @felixboehm made the decision to add this ....

  18. PVince81 commented on Nov 7, 2017

    @PVince81
    ContributorAuthor

    I think the problem with host names was if we count the host names to detect if we're in a clustered env or not. If only one host: single node. However in the case of docker instances getting a new host name upon boot up, there would be a small time window with the old host name and the new host name, which add up to two. So OC would believe it's in a clustered env for this period of time until the host name expires after TTL... Race condition fun...

  19. butonic commented on Nov 9, 2017

    @butonic
    Contributor

    It seems we need to document how to configure ownCloud in different deployment scenarios.

    make things less automatic, suitable for deployment tools like ansible, puppet, chef, whatever

    config_is_read_only
    operation.mode
    upgrade.disable-web
    upgrade.automatic-app-update
    check_for_working_htaccess
    htaccess.RewriteBase
    trusted_domains
    overwrite.cli.url
    

    @PVince81 @DeepDiver1975 what is the difference between upgrade.automatic-app-update and operation.mode ... the former at least tells you what it does ... operation.mode is even cryptically documented as The mode of operations has various impact on the behavior of ownCloud. That doesn't tell the admin when he needs to change this.

    (reverse) proxy stuff

    overwritehost
    overwriteprotocol
    overwritewebroot
    overwritecondaddr
    trusted_proxies
    forwarded_for_headers
    

    directories

    logfile
    cache_path
    dav.chunk_base_dir
    tempdirectory
    skeletondirectory
    datadirectory
    

    make things readonly

    allow_user_to_change_display_name
    
    • why is there no allow_user_to_change_email setting for this? why are there config options for this at all? The user backend should indicate if an attribute is readonly or not

    other systems related

    mail*
    csrf.disabled
    

    jeez ... how can anyone set up oc correctly?

  20. butonic commented on Nov 9, 2017

    @butonic
    Contributor

    cant we just reuse upgrade.automatic-app-update ?

  21. PVince81 commented on Nov 9, 2017

    @PVince81
    ContributorAuthor

    upgrade.automatic-app-update

    No, because this is about upgrading apps automatically when running occ upgrade.
    The use case is for an admin who wants to manually decide when to update apps either by clicking "Update" in the web UI market app or CLI. So we don't block install/update here.

  22. lock commented on Aug 1, 2019

    @lock

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  23. locked as resolved and limited conversation to collaborators on Aug 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementp1-urgentstatus/STALE

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions