roundcube / roundcubemail-docker

Resources to build Docker images for Roundcube Webmail
263 stars 122 forks source link

Unable to install plugins (carddav) #249

Open foorschtbar opened 1 month ago

foorschtbar commented 1 month ago

Hi,

my goal was to upgrade my carddav plugin inside the container with composer, but composer says it missing git:

roundcube-app  | /usr/bin/composer
roundcube-app  | Executing /usr/bin/composer to update dependencies...
roundcube-app  | Composer could not detect the root package (roundcube/roundcubemail) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version
roundcube-app  | Loading composer repositories with package information
roundcube-app  | Updating dependencies
roundcube-app  | Nothing to modify in lock file
roundcube-app  | Installing dependencies from lock file
roundcube-app  | Package operations: 0 installs, 20 updates, 0 removals
roundcube-app  | 
roundcube-app  | In GitDownloader.php line 82:
roundcube-app  |                                                             
roundcube-app  |   git was not found in your PATH, skipping source download 

After some different tries, i setup a new container, but still had problems installing ANY pugins from repo. My minimal (NOT) working example is here:

image: roundcube/roundcubemail:latest
environment:
[...]
  - ROUNDCUBEMAIL_SKIN=elastic
  - ROUNDCUBEMAIL_PLUGINS=carddav
  - ROUNDCUBEMAIL_INSTALL_PLUGINS=true
volumes:
  - ./data/roundcube/html:/var/www/html
[...]

I got

roundcube-app  | Installing plugins from the list
roundcube-app  | Plugins: carddav
roundcube-app  | Composer could not detect the root package (roundcube/roundcubemail) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version
roundcube-app  | 
roundcube-app  | In PackageDiscoveryTrait.php line 369:
roundcube-app  |                                    
roundcube-app  |   Could not find package carddav.  
roundcube-app  |                                    
roundcube-app  |   Did you mean one of these?       
roundcube-app  |       sabre/dav                    
roundcube-app  |       horde/dav                    
roundcube-app  |       sabre/katana                 
roundcube-app  |       syncgw/sabredav              
roundcube-app  |       roundcube/carddav   

then i tried ROUNDCUBEMAIL_PLUGINS=roundcube/carddav and after (two) restarts i got:

roundcube-app  | wait-for-it.sh: roundcube-db:3306 is available after 0 seconds
roundcube-app  | Installing plugins from the list
roundcube-app  | Plugins: roundcube/carddav
roundcube-app  | Composer could not detect the root package (roundcube/roundcubemail) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version
roundcube-app  | Could not scan for classes inside "/usr/src/roundcubemail/vendor/roundcube/carddav/carddav.php" which does not appear to be a file nor a folder
roundcube-app  | Could not scan for classes inside "/usr/src/roundcubemail/vendor/roundcube/carddav/dbmigrations/" which does not appear to be a file nor a folder
[...]
roundcube-app  | errors: PHP Error: Invalid plugin name: roundcube/carddav in /var/www/html/program/lib/Roundcube/rcube_plugin_api.php on line 177 (POST /?_task=mail&_action=refresh)

What i'm doing wrong? Same problems with 3rd party addons link html5_notifier or twofactor_gauthenticator.

thomascube commented 1 month ago

@williamdes Maybe the boolean approach for ROUNDCUBEMAIL_INSTALL_PLUGINS is not sufficient. Composer package names do not always match the plugin names in Roundcube. While ROUNDCUBEMAIL_PLUGINS will enable the given (pre-installed) plugins, we might need to extend ROUNDCUBEMAIL_INSTALL_PLUGINS to become a list of composer packages to be installed (and activated upon installation). Those installed plugins wouldn't need to be listed in ROUNDCUBEMAIL_PLUGINS.

williamdes commented 1 month ago

I did conclude to the same, a new env name should be given for the composer plugins. I have two PRs to create soon. Sorry for the delay, still testing my changes.

sairuk commented 1 month ago

i tried to spin this up today and found enabling ROUNDCUBEMAIL_INSTALL_PLUGINS: 1 also seems to break simple activation of packed in plugins as the composer approach will expect a version string

roundcubemail   | Installing plugins from the list
roundcubemail   | Plugins: archive,zipdownload
roundcubemail   | Composer could not detect the root package (roundcube/roundcubemail) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version
roundcubemail   | 
roundcubemail   | In VersionParser.php line 521:
roundcubemail   |                                                                                
roundcubemail   |   Could not parse version constraint zipdownload: Invalid version string "zip  
roundcubemail   |   download"                                                                    
roundcubemail   |                                                                                
roundcubemail   | 

installing the mfa plugin is possible however activation is not as per the aforementioned naming issues. installation

      ROUNDCUBEMAIL_INSTALL_PLUGINS: 1
      ROUNDCUBEMAIL_PLUGINS: alexandregz/twofactor_gauthenticator:dev-master
roundcubemail   | Plugins: alexandregz/twofactor_gauthenticator:dev-master
roundcubemail   | Composer could not detect the root package (roundcube/roundcubemail) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version
roundcubemail   | ./composer.json has been updated
roundcubemail   | Composer could not detect the root package (roundcube/roundcubemail) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version
roundcubemail   | Running composer update alexandregz/twofactor_gauthenticator
roundcubemail   | Loading composer repositories with package information
roundcubemail   | Updating dependencies
roundcubemail   | Lock file operations: 1 install, 0 updates, 0 removals
roundcubemail   |   - Locking alexandregz/twofactor_gauthenticator (dev-master 77157a4)
roundcubemail   | Writing lock file
roundcubemail   | Installing dependencies from lock file
roundcubemail   | Package operations: 1 install, 0 updates, 0 removals
roundcubemail   |   - Downloading alexandregz/twofactor_gauthenticator (dev-master 77157a4)
roundcubemail   |   - Installing alexandregz/twofactor_gauthenticator (dev-master 77157a4): Extracting archive
roundcubemail   | Creating package config file
roundcubemail   | Generating optimized autoload files

runtime

roundcubemail   | errors: PHP Error: Invalid plugin name: alexandregz/twofactor_gauthenticator:dev-master in /var/www/html/program/lib/Roundcube/rcube_plugin_api.php on line 177 (GET /?_task=settings&_action=responses)

i worked around these issues by mounting in custom plugin volumes inplace in both this container and the nginx one, something like below to both containers then activating with ROUNDCUBEMAIL_PLUGINS: archive,zipdownload,twofactor_gauthenticator

    volumes:
      - ./var/roundcube/plugins/twofactor_gauthenticator:/var/www/html/plugins/twofactor_gauthenticator:
williamdes commented 1 month ago

Please check https://github.com/roundcube/roundcubemail-docker/pull/250 and let me know

foorschtbar commented 1 month ago

Please check #250 and let me know

Works now! Thank u.

I still got the Composer could not detect the root package (roundcube/roundcubemail) version, defaulting to '1.0.0'. See https://getcomposer.org/root-versionbut packages got installed. Some need :dev-master tag for working.

williamdes commented 1 month ago

Thank you for testing!

I still got the Composer could not detect the root package (roundcube/roundcubemail) version, defaulting to '1.0.0'. See https://getcomposer.org/root-versionbut packages got installed. Some need :dev-master tag for working.

Mee too, this is related to the source contents of the composer.json It should maybe be altered in another PR. But I am not sure this is problematic

Codelica commented 2 weeks ago

@williamdes is this change moving to ROUNDCUBEMAIL_COMPOSER_PLUGINS in any dev image currently or just pending the next release?

williamdes commented 2 weeks ago

Because of https://github.com/roundcube/roundcubemail-docker/pull/250 you should consider that it is not in any image for now