Skip to content
This repository has been archived by the owner on Feb 20, 2019. It is now read-only.

Improving app management: script for moving apps to an alternative location #4276

Closed
wants to merge 5 commits into from

Conversation

voroyam
Copy link
Contributor

@voroyam voroyam commented Jul 12, 2018

added a script for moving apps in a apps2 directory to keep owncloud installation clean.

added a script for moving apps in a apps2 directory to keep owncloud installation clean.
@voroyam
Copy link
Contributor Author

voroyam commented Jul 12, 2018

Great, thanks @tboerger

tboerger
tboerger previously approved these changes Jul 12, 2018
Copy link
Contributor

@tboerger tboerger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good to me

@mmattel
Copy link
Contributor

mmattel commented Jul 12, 2018

I have a lot of improvements, I will do a commit which is easier...

@mmattel
Copy link
Contributor

mmattel commented Jul 12, 2018

@voroyam @tboerger pls have a look

@mmattel
Copy link
Contributor

mmattel commented Jul 13, 2018

@tboerger
I did a check if all apps are identified properly, pls see the result. To test, I did this on my instance where I strictly differenciate between apps and apps-external and a fresh extract of the owncloud tar file of 10.0.8 into a newly created folder. The content of the apps/ folder is in both cases identical =ok. (ll = unix list)

The physical content of the /apps and /apps-external folder and the listing of the occ command for (non)shipped apps does not match
This means that the script is doing its work but the result is not that what we want because occ does not give the correct response !

These are the apps how they are currently identified as of 10.0.8

ll apps/ occ app:list --shipped=true ll apps-external/ occ app:list --shipped=false
activity activity
comments comments
configreport configreport
dav dav
encryption encryption
external external
federatedfilesharing federatedfilesharing
federation federation
files files
files_external files_external
files_sharing files_sharing
files_trashbin files_trashbin
files_versions files_versions
files_videoplayer files_videoplayer
firstrunwizard firstrunwizard
market market
notifications notifications
provisioning_api provisioning_api
systemtags systemtags
theme-example theme-example
updatenotification updatenotification
user_external user_external
files_clipboard files_clipboard
files_external_dropbox files_external_dropbox
files_external_ftp files_external_ftp
files_pdfviewer files_pdfviewer
files_texteditor files_texteditor
gallery gallery
guests guests
music music
templateeditor templateeditor

For the record, my present but disabled app are:

  • external
  • theme-example
  • user_external
  • encryption

No pattern match to the table above.

Before this PR gets merged, more work needs to be done

@PVince81 this might interest you too...

@mmattel
Copy link
Contributor

mmattel commented Jul 13, 2018

lib/private/App/AppManager.php#L401

private function loadShippedJson() {
		if ($this->shippedApps === null) {
			$shippedJson = \OC::$SERVERROOT . '/core/shipped.json';

core/shipped.json

{
  "shippedApps": [
    "configreport",
    "dav",
    "federation",
    "federatedfilesharing",
    "files",
    "files_external",
    "files_sharing",
    "files_trashbin",
    "files_versions",
    "provisioning_api",
    "updatenotification"
  ],
  "alwaysEnabled": [
    "files",
    "files_external",
    "dav",
    "federatedfilesharing"
  ]
}

This leads to the point that some apps are delivered by the tar file but not marked as shipped...
For me, either those apps have to be marked as shipped or a process has to be setup when you install the system to check if the apps in question are already present (like in an upgrade) or a suggestion should be made to download them via the marketplace.

Anyway - not a good situation 👎

@mmattel mmattel changed the title script for moving scripts Improving app management: script for moving apps to an alternative location Jul 13, 2018
@PVince81
Copy link
Contributor

Should this rather be an occ command ? occ apps:move, especially considering that OC is already aware of all app repos, versions, etc so more error checking can be put in there

@mmattel
Copy link
Contributor

mmattel commented Jul 18, 2018

@PVince81

👍 I LIKE IT 👍

  • At the end of the day, you will suffer on the same things as described here and in the referenced core issue. This has to be fixed first.
  • Nontheless having an occ command for this is the way to go !

occ maintenance:mode --on
occ apps:move
occ maintenance:mode --off

@@ -71,17 +71,60 @@ The configuration example below shows how to add a second directory, called ``ap
:emphasize-lines: 9-13

After you add a new directory configuration, you can then move apps from the original app directory to the new one.
To do so, follow these steps:
If you want to identify as an example all non core / non shipped apps, use the following command:
Copy link
Contributor

@settermjd settermjd Jul 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest the following to aid in clarity of intent:

If you want to identify, as an example, all non-core or non-shipped apps, use the following command:


::

sudo -uwww-data ./occ app:list --shipped=false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The standard documentation convention is sudo -u www-data php occ.


#. :ref:`Enable maintenance mode <maintenance_commands_label>`.
#. :ref:`Disable the apps <apps_commands_label>` that you want to move.
#. Create a new apps directory and assign it the same user and group, and ownership permissions as the core apps directory.
#. Create a new apps directory like ``apps-external`` and assign it the same user, group and ownership permissions as the core apps directory.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Create a new apps directory like apps-external and/Create a new apps directory, like apps-external, and/g

#. Move the apps from the old apps directory to the new apps directory.
#. Add a new app directory in ``config/config.php``.
#. Add the key for the new app directory in ``config/config.php``.
#. If you're using a cache, such as `Redis <../configuration/server/caching_configuration.html#clearing-the-redis-cache>`_ or `Memcached <../configuration/server/caching_configuration.html#clearing-the-memcached-cache>`_, ensure that you clear the cache.
Copy link
Contributor

@settermjd settermjd Jul 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs convention is to store page links at the bottom of the page, as it makes editing easier. For example:

#. If you're using a cache, such as `Redis`_ or `Memcached`_, ensure that you clear the cache.

... rest of the document...

.. Links

.. _Redis: ../configuration/server/caching_configuration.html#clearing-the-redis-cache
.. _Memcached: ../configuration/server/caching_configuration.html#clearing-the-memcached-cache

Script for moving non core apps in custom app directories
---------------------------------------------------------

In the same way as you can manually move eg non core / non shipped apps to a custom directory, a script
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest the following, for increased clarity:

In the same way as you can manually move apps, e.g., non-core or non-shipped, to a custom directory, a script

#. If you're using a cache, such as `Redis <../configuration/server/caching_configuration.html#clearing-the-redis-cache>`_ or `Memcached <../configuration/server/caching_configuration.html#clearing-the-memcached-cache>`_, ensure that you clear the cache.
#. Re-enable the apps.
#. Disable maintenance mode.

As preparation, please install the ``jq`` library.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/As preparation/In preparation/g

Secondly, please link jq instead of marking it up as code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't know how to link jq.

I doubt that this is my work here.

#. If you're using a cache, such as `Redis <../configuration/server/caching_configuration.html#clearing-the-redis-cache>`_ or `Memcached <../configuration/server/caching_configuration.html#clearing-the-memcached-cache>`_, ensure that you clear the cache.
#. Re-enable the apps.
#. Disable maintenance mode.

As preparation, please install the ``jq`` library.
``jq`` is like sed for JSON data - you can use it to slice, filter, map and transform structured data.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/jq is like/jq is like/g. As jq's already been introduced, there's no need to draw special attention to it.

Copy link
Contributor

@settermjd settermjd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few changes. Otherwise, thanks for creating the PR. Much appreciated.

@settermjd settermjd added the WIP label Jul 30, 2018
suggestions implementation
settermjd added a commit to owncloud/core that referenced this pull request Aug 17, 2018
#29807 documents that moving apps
from the core to a non-core apps folder manually can cause issues. Given
that and the discussion in
owncloud-archive/documentation#4276, I decided to start
writing an app:move command, to make moving apps from the core apps
directory, to a custom non-core apps directory simpler and less messy.

When finished, the command will be able to:

- List apps that can be moved
- List any non-core app directories
- Check that non-core app directories exist
- Move one or more apps from the core apps directory to a non-core apps directory

The other reason for doing this is to better familiarise myself with
ownCloud's internals — something that, for quite some time, I've felt
I've been lacking, and that has been hindering me from doing my work
better.
@voroyam
Copy link
Contributor Author

voroyam commented Sep 13, 2018

Is there any update on this?

@mmattel
Copy link
Contributor

mmattel commented Sep 13, 2018

No, there is no update, not because of coding the script, but because there is a situation where it is currently not 100% identifyable what are admin downloaded apps and which belong to owncloud.
See my comment #4276 (comment) and the following one.

settermjd added a commit to owncloud/docs that referenced this pull request Feb 5, 2019
@settermjd
Copy link
Contributor

Closing as it's been ported to the new docs.

@settermjd settermjd closed this Feb 5, 2019
@settermjd settermjd deleted the apps-move-script branch February 5, 2019 20:05
settermjd added a commit to owncloud/docs that referenced this pull request Feb 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants