zokradonh / kopano-docker

Unofficial Kopano Docker images for all Kopano services.
MIT License
59 stars 36 forks source link

[webapp] Moving plugin configs at read-only systems failed #457

Closed nupplaphil closed 3 years ago

nupplaphil commented 4 years ago

Describe the bug In case extending the kopano_webapp image with plugins, all plugins with config files are making the start of webap as a read-only container failing, like:

kopano_webapp_1     | Notice: Container is run read-only, skipping package installation.                  
kopano_webapp_1     | If you want to have additional packages installed in the container either:          
kopano_webapp_1     | - build your own image with the packages already included                           
kopano_webapp_1     | - switch the container to 'read_only: false'                                        
kopano_webapp_1     | Using PHP-Mapi: 10.0.6.406.69083f1d7-0+217.1                                        
kopano_webapp_1     | Using Kopano WebApp: 4.4.2955+1806.1                                                
kopano_webapp_1     | mv: cannot remove '/etc/kopano/webapp/config-contactfax.php': Read-only file system 
kopano_webapp_1     | copied '/etc/kopano/webapp/config-contactfax.php' -> '/tmp/webapp/config-contactfax.php'

To Reproduce

  1. create a new Dockerfile like:
    
    FROM zokradonh/kopano_webapp

install Kopano WebApp and refresh ca-certificates

hadolint ignore=SC2129

RUN \

install

set -x && \
apt-get update && apt-get install -y --no-install-recommends \
   kopano-webapp-plugin-contactfax  kopano-webapp-plugin-desktopnotifications kopano-webapp-plugin-filepreviewer kopano-webapp-plugin-files kopano-webapp-plugin-filesbackend-owncloud kopano-webapp-plugin-folderwidgets kopano-webapp-plugin-gmaps kopano-webapp-plugin-mdm kopano-webapp-plugin-quickitems kopano-webapp-plugin-smime kopano-webapp-plugin-titlecounter kopano-webapp-plugin-webappmanual \
&& rm -rf /var/cache/apt /var/lib/apt/lists
2. add it to a docker-compose file, like:
```docker-compose
 kopano_webapp:
    build: ./webapp
    #    image: ${docker_repo:?err}/kopano_webapp:${WEBAPP_VERSION}                                      
    hostname: webapp
    #read_only: true
  1. Build the image with docker-compose build
  2. Start it with docker-compose up kopano_webapp

Expected behavior Startup without errors, so the plugins are working even with read-only containers.

fbartels commented 4 years ago

Ugh. Do you know the feeling of regret when touching a specific code path, when afterwards all the side effects of this small change come creeping in? :sweat_smile:

create a new Dockerfile like:

That is actually not necessary. There is a make target called build-webapp-plugins that will create a WebApp image with plugins pre-installed.

But even if these packages were installed before, based on prior tickets in this repo, I would guess they were never configured through environment variables?

I have tinkered with it a bit and the best solution I could come up with so far is included as an example in the linked pr. Essentially you need to enhance the Dockerfile where you install your additional selection of plugins with the snippet that can be found at the end of https://github.com/zokradonh/kopano-docker/blob/5ba557c3264c357a1f0953b7bb68f9bef044e5f1/webapp/Dockerfile.plugins

.. or run your container not read only (but I would opt for enhancing your Dockerfile).

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days