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

Logo Disappears After Page Refresh in Branding Settings #362

Closed
Psycho0verload opened this issue Jul 16, 2023 · 4 comments
Closed

Logo Disappears After Page Refresh in Branding Settings #362

Psycho0verload opened this issue Jul 16, 2023 · 4 comments

Comments

@Psycho0verload
Copy link

Psycho0verload commented Jul 16, 2023

Infos

  • Docker version 24.0.4, build 3713ee1
  • Docker Compose version v2.19.1
  • Operating system (Docker host): Ubuntu 22.04

Expected behavior

I upload a logo under Branding and this is then displayed to me, for example, when I log in

Actual behavior

I upload a logo under Branding and this is no longer accessible with status 404 after a reload of the website at the latest.

Description

Dear Zammad team,

I am encountering an issue with the branding feature in Zammad. When I attempt to upload a logo through the branding settings, the image initially appears to be successfully uploaded and displayed. However, when I refresh the page, the logo becomes unavailable.

Here are the details of the issue as they appear in the logs:

Upon initial logo upload:

zammad-zammad-railsserver-1    | I, [2023-07-16T09:44:27.211537#1-113760]  INFO -- : NOTICE create - self.created_by_id is different: 1/3
zammad-zammad-railsserver-1    | I, [2023-07-16T09:44:27.279909#1-113760]  INFO -- : NOTICE create - self.created_by_id is different: 1/3
zammad-zammad-railsserver-1    | I, [2023-07-16T09:44:27.308246#1-113760]  INFO -- : Setting.set('product_logo', "9291c0de6860b64bb96411f41e8ae3b8.png")
zammad-zammad-railsserver-1    | I, [2023-07-16T09:44:27.318348#1-113760]  INFO -- : Completed 200 OK in 199ms (Views: 0.6ms | ActiveRecord: 87.3ms | Allocations: 25885)

And then, after refreshing the page:

zammad-zammad-nginx-1          | 172.31.239.254 - - [16/Jul/2023:09:46:00 +0000] "GET /api/v1/settings/?full=true&_=1689500759418 HTTP/1.1" 200 24413 "https://helpdesk.mydomain.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/115.0"
zammad-zammad-nginx-1          | 2023/07/16 09:46:00 [error] 14#14: *93 open() "/opt/zammad/public/assets/images/9291c0de6860b64bb96411f41e8ae3b8.png" failed (2: No such file or directory), client: 172.31.239.254, server: _, request: "GET /assets/images/9291c0de6860b64bb96411f41e8ae3b8.png HTTP/1.1", host: "helpdesk.mydomain.com", referrer: "https://helpdesk.mydomain.com/"

It seems the image is not being persisted properly, or there is a problem retrieving it after page refresh. This issue consistently happens regardless of the logo image file I attempt to use.

Your assistance in resolving this matter would be greatly appreciated.

Thank you.

@klml
Copy link

klml commented Jul 20, 2023

We may have a similar problem in zammad-helm.

At the init of zammad-0, the postgresql-init aborted after setting product_logo:

$ oc logs zammad-0 -c postgresql-init
...
I, [2023-07-20T06:34:15.703646#11-6180]  INFO -- : Setting.set('product_logo', "83082929b160f0c39c212914ddff9cb3.png")
rake aborted!

I'm not sure if there might be a coincidence after all?

Full log

$ oc logs zammad-0 -c postgresql-init
I, [2023-07-20T06:34:13.200735 #11]  INFO -- : ActionCable is using the redis instance at redis://:zammad@zammad-redis-master:6379.
I, [2023-07-20T06:34:13.306528#11-6180]  INFO -- : Using memcached as Rails cache store.
I, [2023-07-20T06:34:13.306986#11-6180]  INFO -- : Using the Redis back end for Zammad's web socket session store.
I, [2023-07-20T06:34:15.703646#11-6180]  INFO -- : Setting.set('product_logo', "83082929b160f0c39c212914ddff9cb3.png")
rake aborted!
Errno::EROFS: Read-only file system @ rb_sysopen - /opt/zammad/public/assets/images/83082929b160f0c39c212914ddff9cb3.png
/opt/zammad/lib/static_assets.rb:177:in `initialize'
/opt/zammad/lib/static_assets.rb:177:in `open'
/opt/zammad/lib/static_assets.rb:177:in `sync'
/opt/zammad/config/initializers/logo.rb:11:in `block in <main>'
/usr/local/bundle/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:427:in `instance_exec'
/usr/local/bundle/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:427:in `block in make_lambda'
/usr/local/bundle/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:198:in `block (2 levels) in halting'
/usr/local/bundle/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:604:in `block (2 levels) in default_terminator'
/usr/local/bundle/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:603:in `catch'
/usr/local/bundle/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:603:in `block in default_terminator'
/usr/local/bundle/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:199:in `block in halting'
/usr/local/bundle/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:512:in `block in invoke_before'
/usr/local/bundle/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:512:in `each'
/usr/local/bundle/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:512:in `invoke_before'
/usr/local/bundle/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:105:in `run_callbacks'
/usr/local/bundle/gems/activesupport-6.1.7.3/lib/active_support/reloader.rb:88:in `prepare!'
/usr/local/bundle/gems/railties-6.1.7.3/lib/rails/application/finisher.rb:124:in `block in <module:Finisher>'
/usr/local/bundle/gems/railties-6.1.7.3/lib/rails/initializable.rb:32:in `instance_exec'
/usr/local/bundle/gems/railties-6.1.7.3/lib/rails/initializable.rb:32:in `run'
/usr/local/bundle/gems/railties-6.1.7.3/lib/rails/initializable.rb:61:in `block in run_initializers'
/usr/local/bundle/gems/railties-6.1.7.3/lib/rails/initializable.rb:60:in `run_initializers'
/usr/local/bundle/gems/railties-6.1.7.3/lib/rails/application.rb:391:in `initialize!'
/opt/zammad/config/environment.rb:7:in `<main>'
/usr/local/bundle/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/usr/local/bundle/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/usr/local/bundle/gems/zeitwerk-2.6.8/lib/zeitwerk/kernel.rb:38:in `require'
/usr/local/bundle/gems/activesupport-6.1.7.3/lib/active_support/dependencies.rb:332:in `block in require'
/usr/local/bundle/gems/activesupport-6.1.7.3/lib/active_support/dependencies.rb:299:in `load_dependency'
/usr/local/bundle/gems/activesupport-6.1.7.3/lib/active_support/dependencies.rb:332:in `require'
/usr/local/bundle/gems/railties-6.1.7.3/lib/rails/application.rb:367:in `require_environment!'
/usr/local/bundle/gems/railties-6.1.7.3/lib/rails/application.rb:533:in `block in run_tasks_blocks'
/usr/local/bundle/gems/bundler-2.4.1/lib/bundler/cli/exec.rb:58:in `load'
/usr/local/bundle/gems/bundler-2.4.1/lib/bundler/cli/exec.rb:58:in `kernel_load'
/usr/local/bundle/gems/bundler-2.4.1/lib/bundler/cli/exec.rb:23:in `run'
/usr/local/bundle/gems/bundler-2.4.1/lib/bundler/cli.rb:491:in `exec'
/usr/local/bundle/gems/bundler-2.4.1/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/bundle/gems/bundler-2.4.1/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/bundle/gems/bundler-2.4.1/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/usr/local/bundle/gems/bundler-2.4.1/lib/bundler/cli.rb:34:in `dispatch'
/usr/local/bundle/gems/bundler-2.4.1/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/usr/local/bundle/gems/bundler-2.4.1/lib/bundler/cli.rb:28:in `start'
/usr/local/bundle/gems/bundler-2.4.1/exe/bundle:45:in `block in <top (required)>'
/usr/local/bundle/gems/bundler-2.4.1/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/usr/local/bundle/gems/bundler-2.4.1/exe/bundle:33:in `<top (required)>'
/usr/local/bundle/bin/bundle:25:in `load'
/usr/local/bundle/bin/bundle:25:in `<main>'
Tasks: TOP => db:migrate => db:load_config => environment
(See full trace by running task with --trace)

@krsh79
Copy link

krsh79 commented Jul 24, 2023

We have the same problem, the difference from zammad 5.4.1 is that docker-compose.yml only connect to volume the path /opt/zammad/var (in 5.4.1 the volume takes all /opt/zammad directory)

As the result, two needed directory aren't include in the volume and shared between the zammad dockers :

  1. This folders contains the company logo in a flat file to allow nginx access: /opt/zammad/public/assets/images
  2. This path must also be include if you store the files in the filesystem (default is the database on zammad new install): /opt/zammad/storage/fs

Another problem, is the corporate logo is missing on the filesystem, the zammad-init docker will crash and zammad wouldn't run anymore. In my case I have to delete the files record from the postgres database to recover my installation.

For the original problem of logo missing in the page, you have to declare a new volume for the /opt/zammad/public/assets/images in docker-compose.yml (Example bellow for added lines, add the volume to every service listed and define a new volume in the volumes section) :

services:
  zammad-backup:
    volumes:
      - zammad-assets_images:/opt/zammad/public/assets/images:ro

  zammad-init:
    volumes:
      - zammad-assets_images:/opt/zammad/public/assets/images

  zammad-nginx:
    volumes:
      - zammad-assets_images:/opt/zammad/public/assets/images

  zammad-railsserver:
    volumes:
      - zammad-assets_images:/opt/zammad/public/assets/images

  zammad-scheduler:
    volumes:
      - zammad-assets_images:/opt/zammad/public/assets/images:ro

  zammad-websocket:
    volumes:
      - zammad-assets_images:/opt/zammad/public/assets/images:ro

volumes:
  zammad-assets_images:
    driver: local

Maybe someone can better design the needed access level (ro/rw) by every container and if needed by all. I have include the volume in every container using the /opt/zammad/var, access level might be not aligned with best practice.

For anyone having the problem of "Storage Mechanism" set to "Filesystem" and not "Database" under System->Storage, we must define another volume like this :

services:
  zammad-backup:
    volumes:
      - zammad-fs:/opt/zammad/storage/fs:ro

  zammad-init:
    volumes:
      - zammad-fs:/opt/zammad/storage/fs:ro

  zammad-nginx:
    volumes:
      - zammad-fs:/opt/zammad/storage/fs:ro

  zammad-railsserver:
    volumes:
      - zammad-fs:/opt/zammad/storage/fs

  zammad-scheduler:
    volumes:
      - zammad-fs:/opt/zammad/storage/fs:ro

  zammad-websocket:
    volumes:
      - zammad-fs:/opt/zammad/storage/fs:ro

volumes:
  zammad-fs:
    driver: local

@jonathan8devs
Copy link

Duplicate of #354
Fixed with #363

@mgruner
Copy link
Collaborator

mgruner commented Aug 23, 2023

Closing duplicate.

@mgruner mgruner closed this as not planned Won't fix, can't repro, duplicate, stale Aug 23, 2023
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

5 participants