humhub-docker icon indicating copy to clipboard operation
humhub-docker copied to clipboard

Permissions - Profile Image

Open r1z1 opened this issue 2 years ago • 6 comments

Hi,

I have this error during the prerequisites step from a fresh docker install (using portainer.io):

Permissions - Profile Image (Hint: Make /var/www/localhost/htdocs/uploads/profile_image writable for the Webserver/PHP!)

My docker-compose

version: '3.1'
services:
  humhub:
    image: mriedmann/humhub:stable
    links:
      - "db:db"
    ports:
      - "8080:80"
    volumes:
      - "config:/var/www/localhost/htdocs/protected/config"
      - "uploads:/var/www/localhost/htdocs/uploads"
      - "modules:/var/www/localhost/htdocs/protected/modules"
    environment:
      HUMHUB_DB_USER: humhub
      HUMHUB_DB_PASSWORD: humhub
  db:
    image: mariadb:10.2
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: humhub
      MYSQL_USER: humhub
      MYSQL_PASSWORD: humhub

If it helps: image

Thx

r1z1 avatar Apr 28 '22 22:04 r1z1

Hi,

You must create the folder called profile_image in uploads.

zarevskaya avatar Apr 30 '22 19:04 zarevskaya

Hi,

The folder exists and seems to have the correct permissions

drwxrwxr-x 3 systemd-network systemd-journal 4096 Apr 25 05:02 profile_image`

r1z1 avatar May 02 '22 15:05 r1z1

Hi,

The folder exists and seems to have the correct permissions

drwxrwxr-x 3 systemd-network systemd-journal 4096 Apr 25 05:02 profile_image`

Okay, change the image by; mriedmann/humhub:1.9

I remember this trick ^^

zarevskaya avatar May 02 '22 15:05 zarevskaya

It depends a bit on your system. What distribution are you on? Is it possible that SELinux or AppArmor is blocking the requests? Also, please have a look inside the container (docker exec -it <containername> sh) and run id to get the current user-id. If it is not 0 (=root) or whatever id systemd-network or systemd-journal has on your system it is unable to write to the directory.

Things you can try:

  • Go inside the container, navigate to the volume and try to create a file manually (touch testfile.txt). If that works it cannot be a SELinux (or similar) or container-engine Problem. It is most likely some issue with the application itself or its configuration.
  • Set chmod -R +rwX <path> to allow everyone on the system access. If this solves the problem your access-rules are incorrect. Try to find the right user-id the application/container is using and set it as owner (chown -R <userid> <path>)
  • Check df and mount if you see anything suspicious going on
  • Post your uname -a cat /etc/os-release and docker info output here (please remove sensitive information beforehand)

Hope we can get this working for you ;)

mriedmann avatar May 02 '22 16:05 mriedmann

I changed the image by mriedmann/humhub:1.9 but still the same issue.

The user inside the docker is root:

/ # id
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),20(dialout),26(tape),27(video)
  • Inside the docker I can create a file in the corresponding folder

  • chmod did nothing

  • nothing suspicious df or mount

  • uname -a Linux 5.13.0-40-generic #45~20.04.1-Ubuntu SMP Mon Apr 4 09:38:31 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

  • cat /etc/os-release:

NAME="Ubuntu"
VERSION="20.04.4 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.4 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
  • docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Docker Buildx (Docker Inc., v0.8.2-docker)
  scan: Docker Scan (Docker Inc., v0.17.0)

Server:
 Containers: 17
  Running: 17
  Paused: 0
  Stopped: 0
 Images: 20
 Server Version: 20.10.15
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 212e8b6fa2f44b9c21b2798135fc6fb7c53efc16
 runc version: v1.1.1-0-g52de29d
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 5.13.0-40-generic
 Operating System: Ubuntu 20.04.4 LTS
 OSType: linux
 Architecture: x86_64
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

The error in only for this folder the other are fine, weird image

r1z1 avatar May 06 '22 15:05 r1z1

Ok very weird, no idea sorry ... I will try to replicate this on my side ... but could take some time.

mriedmann avatar May 08 '22 13:05 mriedmann

Having the same issue running humbub 1.11.4

francoisauclair911 avatar Jan 11 '23 18:01 francoisauclair911

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Jun 23 '23 02:06 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Jul 07 '23 02:07 github-actions[bot]

issues still an ongoing issue and went stale do to inactivity which should of never happened

ghost avatar Sep 17 '23 03:09 ghost

Sorry reopening then

mriedmann avatar Sep 21 '23 13:09 mriedmann

i would like to state i got a stable version of it running for docker and will update the compose files here im currently working on a 3rd party app store repo for the OS known as https://casaos.io which utilizes Docker and Docker-Compose to run files check out more @ https://cloudrack.ca (this is a domain which links cname to my github.io pages https://thunderm16.github.io/Cloudrack-CasaOS-App-Repo/)

I will post the humhub configs needed to run in time sorry seems i lost the files and need to re-run it as this was a app i was planning on adding to my 3rd party app repo and just haven't gotten back to it yet.


PS dont let this close if you can

ghost avatar Sep 21 '23 21:09 ghost

stable works for sure but heres what i have for a casaos yaml im sure it be simple to configure as its still a docker-compose.yaml

show some love by joining our discord link found @ https://cloudrack.ca For the readme on the docker-compose.yaml please see https://github.com/ThunderM16/Cloudrack-CasaOS-App-Repo/blob/main/Apps/Humhub/README.md

name: humhub
services:
  db:
    cpu_shares: 90
    command: []
    container_name: db
    deploy:
      resources:
        limits:
          memory: 15981M
    environment:
      - MYSQL_DATABASE=humhub
      - MYSQL_PASSWORD=humhub
      - MYSQL_ROOT_PASSWORD=root
      - MYSQL_USER=humhub
    image: mariadb:10.2
    labels:
      icon: https://products.containerize.com/social-network-platforms/humhub/menu_image.png
    ports:
      - target: 3306
        published: "3306"
        protocol: tcp
    restart: unless-stopped
    volumes:
      - type: bind
        source: /DATA/AppData/festive_john/var/lib/mysql
        target: /var/lib/mysql
    volumes: []
    devices: []
    cap_add: []
    network_mode: bridge
    privileged: false
  humhub:
    cpu_shares: 90
    command: []
    container_name: humhub
    depends_on:
      db:
        condition: service_started
        restart: true
        required: true
    deploy:
      resources:
        limits:
          memory: 15981M
    environment:
      - HUMHUB_DB_HOST=db:3306
      - HUMHUB_DB_PASSWORD=humhub
      - HUMHUB_DB_USER=humhub
    image: mriedmann/humhub:stable
    labels:
      icon: https://products.containerize.com/social-network-platforms/humhub/menu_image.png
    links:
      - db:db
    ports:
      - target: 80
        published: "8081"
        protocol: tcp
    restart: unless-stopped
    volumes:
      - type: bind
        source: /DATA/AppData/var/www/localhost/htdocs/protected/config
        target: /var/www/localhost/htdocs/protected/config
      - type: bind
        source: /DATA/AppData/var/www/localhost/htdocs/uploads
        target: /var/www/localhost/htdocs/uploads
      - type: bind
        source: /DATA/AppData/var/www/localhost/htdocs/protected/modules
        target: /var/www/localhost/htdocs/protected/modules
      - type: bind
        source: /DATA/AppData/var/www/localhost/htdocs/uploads/profile_image
        target: /var/www/localhost/htdocs/uploads/profile_image
    devices: []
    cap_add: []
    network_mode: bridge
    privileged: false
x-casaos:
  author: self
  category: self
  hostname: 10.0.0.202
  icon: https://products.containerize.com/social-network-platforms/humhub/menu_image.png
  index: /
  port_map: "8081"
  scheme: http
  store_app_id: festive_john
  title:
    custom: HumHub

ghost avatar Sep 21 '23 22:09 ghost

will admit tho im having issues in regards to adjusting the PHP settings any suggestions would be highly appreciated.

ghost avatar Sep 22 '23 01:09 ghost

will admit tho im having issues in regards to adjusting the PHP settings any suggestions would be highly appreciated.

I've currently not had much time on my hands to be much help, could you provide information on what PHP setup you're using?

ArchBlood avatar Sep 22 '23 02:09 ArchBlood

id have to whip a container up again and go all PHP rogue here lol give me some time

ghost avatar Sep 22 '23 15:09 ghost

still here went ghost will update over next hour or so. got working tho.

cloudrack-ca avatar Sep 22 '23 23:09 cloudrack-ca

please check my yaml if you don't mind https://github.com/cloudrack-ca/Cloudrack-CasaOS-App-Repo/tree/main/Apps/Humhub

but should be able to see the below steps here for the current container regarding PHP issue

/ # apk add nano
(1/1) Installing nano (5.9-r0)
Executing busybox-1.34.1-r5.trigger
OK: 254 MiB in 137 packages
/ # php --ini
Configuration File (php.ini) Path: /etc/php7
Loaded Configuration File:         /etc/php7/php.ini
Scan for additional .ini files in: /etc/php7/conf.d
Additional .ini files parsed:      /etc/php7/conf.d/00_ctype.ini,
/etc/php7/conf.d/00_curl.ini,
/etc/php7/conf.d/00_dom.ini,
/etc/php7/conf.d/00_fileinfo.ini,
/etc/php7/conf.d/00_gd.ini,
/etc/php7/conf.d/00_iconv.ini,
/etc/php7/conf.d/00_intl.ini,
/etc/php7/conf.d/00_json.ini,
/etc/php7/conf.d/00_ldap.ini,
/etc/php7/conf.d/00_mbstring.ini,
/etc/php7/conf.d/00_openssl.ini,
/etc/php7/conf.d/00_pdo.ini,
/etc/php7/conf.d/00_session.ini,
/etc/php7/conf.d/00_simplexml.ini,
/etc/php7/conf.d/00_sqlite3.ini,
/etc/php7/conf.d/00_xml.ini,
/etc/php7/conf.d/00_xmlwriter.ini,
/etc/php7/conf.d/00_zip.ini,
/etc/php7/conf.d/01_exif.ini,
/etc/php7/conf.d/01_mysqlnd.ini,
/etc/php7/conf.d/01_phar.ini,
/etc/php7/conf.d/01_xmlreader.ini,
/etc/php7/conf.d/02_pdo_mysql.ini,
/etc/php7/conf.d/99-custom.ini,
/etc/php7/conf.d/apcu.ini,
/etc/php7/conf.d/imagick.ini

/ # nano /etc/php7/php.ini

inside the container /etc/php7/php.ini here its an issues found inside the PHP

;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;

; Whether to allow HTTP file uploads.
; http://php.net/file-uploads
file_uploads = On

; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
; http://php.net/upload-tmp-dir
;upload_tmp_dir =

; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 2M

; Maximum number of files that can be uploaded via a single request
max_file_uploads = 20

cloudrack-ca avatar Sep 22 '23 23:09 cloudrack-ca

If you're using the latest beta then you should use PHP 8+

I'm also seeing multiple MySQL installed;

https://stackoverflow.com/questions/41812651/what-is-the-difference-between-mysqlnd-pdo-and-pdo-mysql-extensions-in-php

ArchBlood avatar Sep 23 '23 18:09 ArchBlood

If you're using the latest beta then you should use PHP 8+

I'm also seeing multiple MySQL installed;

https://stackoverflow.com/questions/41812651/what-is-the-difference-between-mysqlnd-pdo-and-pdo-mysql-extensions-in-php

not talking about me are you cause ..... my docker-compose.yaml has 1 db.. @ArchBlood

cloudrack-ca avatar Sep 28 '23 21:09 cloudrack-ca

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Oct 29 '23 01:10 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Nov 12 '23 01:11 github-actions[bot]

mkdir /uploads/profile_image docker exec humhub_humhub_1 chmod 755 /var/www/localhost/htdocs/uploads/profile_image docker exec humhub_humhub_1 chown -R nginx:nginx /var/www/localhost/htdocs/uploads/profile_image

joel72265 avatar Dec 22 '23 08:12 joel72265