friendica / docker

Docker image for Friendica

Home Page:https://friendi.ca

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

New Installation won't start

stavros-k opened this issue · comments

scale# k logs -n ix-friend friend-friendica-85bc5c879f-2fdn8
Initializing Friendica 2021.09 ...
Initializing finished
New Friendica instance
Installation with environment variables
Waiting for MySQL friend-mariadb initialization...
.......................................................
Starting Friendica installation ...

Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 4096 bytes) in /var/www/html/vendor/paragonie/sodium_compat/src/Compat.php on line 2572

This deployed in kubernetes, After the fatal error, friendica fails to auto configure and asks for manual DB creds and the whole startup wizard.

OS: TrueNAS Scale
Friendica (Container): friendica:2021.09@sha256:115de1231f1879bdaf28984d1f42241091578c69367ff86e52eff88bec17607d AND friendica:2021.09@sha256:7cc99f0fcfe47e3ea7b76ba436df5c4243f8ac2490b314c3d64c179715bb5fc4
MariaDB (Container): bitnami/mariadb:10.6.5@sha256:b58ad197fbd3401808cad50276a2768d6403fe66cc86282191c92d5576021d34

(Last known working container: friendica:2021.09@sha256:b726be54dd63a7cf67095a8ac9ee3bd1b158b9607572030789b4bd970cf918d9)

Pointed from: friendica/friendica#10756

You can find more for the envs set here
https://github.com/truecharts/apps/blob/master/charts/stable/friendica/values.yaml

Thank you for copying your report!

since 2 days I have the same issue and don't find why it crashes like that. I set a memory_limit to php to 512M and don't have this kind of issue before. i'm wondering if there is something that has changed recently.

Initializing Friendica 2021.09 ...
Upgrading Friendica from 2021.09 ...
cannot delete non-empty directory: logs
Initializing finished
Upgrading Friendica ...

Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 4096 bytes) in /var/www/html/vendor/paragonie/sodium_compat/src/Compat.php on line 2572

my deployment is separate in 2 containers one for web the second for cron. I'm using apache version.

This looks like the memory limit actually is 2M which is way too low to run Friendica. Please check your php.ini file although I'm not able to assist with Docker-specific questions.

i setup memory_limit to 1024M using a custom.ini file mounted in /usr/local/etc/php/conf.d/custom.ini

but after running php -ini i see there a friendica.ini with this value: memory_limit=${PHP_MEMORY_LIMIT} environment variable I never set. By the way it looks to be set to 512M by default.

When I run php -ini memory is well set to more than 2M so I don't understand. After setting PHP_MEMORY_LIMIT I have:

root@friendica-web-6c89769b49-tb6db:/var/www/html# php -ini|grep mem
/usr/local/etc/php/conf.d/docker-php-ext-memcached.ini,
memory_limit => 1024M => 1024M
report_memleaks => On => On
memcached
memcached support => enabled
libmemcached version => 1.0.18
memcached.compression_factor => 1.3 => 1.3
memcached.compression_threshold => 2000 => 2000
memcached.compression_type => fastlz => fastlz
memcached.default_binary_protocol => Off => Off
memcached.default_connect_timeout => 0 => 0
memcached.default_consistent_hash => Off => Off
memcached.serializer => php => php
memcached.sess_binary_protocol => On => On
memcached.sess_connect_timeout => 0 => 0
memcached.sess_consistent_hash => On => On
memcached.sess_consistent_hash_type => ketama => ketama
memcached.sess_lock_expire => 0 => 0
memcached.sess_lock_max_wait => not set => not set
memcached.sess_lock_retries => 5 => 5
memcached.sess_lock_wait => not set => not set
memcached.sess_lock_wait_max => 150 => 150
memcached.sess_lock_wait_min => 150 => 150
memcached.sess_locking => On => On
memcached.sess_number_of_replicas => 0 => 0
memcached.sess_persistent => Off => Off
memcached.sess_prefix => memc.sess.key. => memc.sess.key.
memcached.sess_randomize_replica_read => Off => Off
memcached.sess_remove_failed_servers => Off => Off
memcached.sess_sasl_password => no value => no value
memcached.sess_sasl_username => no value => no value
memcached.sess_server_failure_limit => 0 => 0
memcached.store_retry_count => 2 => 2
Collecting memory statistics => No
Registered save handlers => files user memcached redis rediscluster 
opcache.memory_consumption => 128 => 128
opcache.preferred_memory_model => no value => no value
opcache.protect_memory => Off => Off

which sounds good?

hmm .. at least it seems like a bug introduced at #67

And php --ini indicates only files /usr/local/etc/php/conf.d/*

But I'm running this command in the cron container as it is not affected by the issue. So maybe I'm missing something.

so i changed the default command with php -ini but I can see a memory_limit set to 1024M.

hmm .. at least it seems like a bug introduced at #67

do you know if there are actions I can do to get some interesting information ?

i don't see a different tag for 2021.09 maybe I could use 2021.09-rc ?

hmm .. at least it seems like a bug introduced at #67

do you know if there are actions I can do to get some interesting information ?

I try to figure out how we can find the root cause .. I'm using this setting since the PR and I don't have any problems.

can you post your current docker.compose.yml for app and cron? maybe I can find a hint ...

i don't see a different tag for 2021.09 maybe I could use 2021.09-rc ?

what do you mean?

ha .. I get the error with a "blank" example, like

version: '2.1'
services:

  db:
    image: mariadb
    restart: always
    volumes:
      - db:/var/lib/mysql/
    environment:
      - MYSQL_RANDOM_ROOT_PASSWORD=yes
    env_file:
      - db.env

  redis:
    image: redis
    restart: always

  app:
    image: friendica:apache
    restart: always
    volumes:
      - friendica:/var/www/html
    environment:
      - FRIENDICA_ADMIN_MAIL=admin@friendica.local
      - FRIENDICA_TZ=Europe/Vienna
      - FRIENDICA_LANG=de
      - FRIENDICA_URL=https://friendica.local
      - FRIENDICA_SITENAME=Friendica
      - SMTP=mail
    env_file:
      - db.env
    depends_on:
      - db
    ports:
      - "80:80"

  cron:
    image: friendica:apache
    restart: always
    volumes:
      - friendica:/var/www/html
    entrypoint: /cron.sh
    environment:
      - FRIENDICA_ADMIN_MAIL=admin@friendica.local
      - FRIENDICA_TZ=Europe/Vienna
      - FRIENDICA_LANG=de
      - FRIENDICA_URL=https://friendica.local
      - FRIENDICA_SITENAME=Friendica
      - SMTP=mail
    depends_on:
      - db
    env_file:
      - db.env

volumes:
  db:
  friendica:

I'll investigate it!

on my side i'm using a kubernetes deployment. i tried with memory limit to -1 without any success.

I'm wondering if the issue isn't located in Compat library itself which uses some memory limit its own code.

...
    spec:
      containers:
        - name: friendica-web
          image: friendica:2021.09
          imagePullPolicy: Always
          resources:
            requests:
              memory: "512Mi"
              cpu: "250m"
            limits:
              memory: "2Gi"
              cpu: "1200m"
          ports:
            - containerPort: 80
          volumeMounts:
            - name: friendica-data-root
              mountPath: /var/www/html
            - name: friendica-php-config
              mountPath: /usr/local/etc/php/conf.d/custom.ini
              subPath: custom.ini
          envFrom:
            - configMapRef:
                name: friendica-app-config
            - secretRef:
                name: friendica-secret
        - name: friendica-cron
          image: friendica:2021.09
          imagePullPolicy: Always
          resources:
            requests:
              memory: "128Mi"
              cpu: "250m"
            limits:
              memory: "512Mi"
              cpu: "800m"
          command: ["/cron.sh"]
          volumeMounts:
            - name: friendica-data-root
              mountPath: /var/www/html
            - name: friendica-php-config
              mountPath: /usr/local/etc/php/conf.d/custom.ini
              subPath: custom.ini
            - name: friendica-cron-scripts
              mountPath: /init-cron.sh
              subPath: init-cron.sh
          ports:
            - containerPort: 80
          envFrom:
            - configMapRef:
                name: friendica-cron-config
            - secretRef:
                name: friendica-secret
apiVersion: v1
kind: ConfigMap
metadata:
  name: friendica-app-config
data:
  MYSQL_HOST: 10.128.1.2
  MYSQL_PORT: "3306"
  MYSQL_USER: friendica
  MYSQL_DATABASE: friendica
  FRIENDICA_UPGRADE: "true"
  REDIS_HOST: friendica-redis.friendica.svc.cluster.local
  REDIS_PORT: "6379"
  PHP_MEMORY_LIMIT: "-1"
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: friendica-cron-config
data:
  MYSQL_HOST: 10.128.1.2
  MYSQL_PORT: "3306"
  MYSQL_USER: friendica
  MYSQL_DATABASE: friendica
  FRIENDICA_UPGRADE: "true"
  REDIS_HOST: friendica-redis.friendica.svc.cluster.local
  REDIS_PORT: "6379"
  PHP_MEMORY_LIMIT: 512M
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: friendica-app-php
data:
  custom.ini: |
    upload_max_filesize = 10M
    memory_limit = 1024M
---

My question about 2021.09-rc is to know if this version is usable as a fallback image as 2021.09 i used friday morning is not available anymore. But while writting I'm wondering if this rc doesn't contain the issue which erases local config :)

My question about 2021.09-rc is to know if this version is usable as a fallback image as 2021.09 i used friday morning is not available anymore. But while writting I'm wondering if this rc doesn't contain the issue which erases local config :)

This version is still available, do you use a specific tag ?

https://hub.docker.com/layers/friendica/library/friendica/2021.09/images/sha256-350e1c00ff0c07e928cd5ac72bfc4dbf9e39c719935a39eb438773b2e2d84ffd?context=explore

on my side i'm using a kubernetes deployment. i tried with memory limit to -1 without any success.

I'm wondering if the issue isn't located in Compat library itself which uses some memory limit its own code.

I don't think so, because we're using the autoinstaller for our Vagrant setup in the upstream and it's still working fine..

uuuuhh .. I found it - wrong apostrophe leads to wrong variable substitution..

root@d9562facbfea:/var/www/html# cat /usr/local/etc/php/conf.d/friendica.ini 
memory_limit=${PHP_MEMORY_LIMIT}
upload_max_filesize=${PHP_UPLOAD_LIMIT}
post_max_size=${PHP_UPLOAD_LIMIT}

uuuuhh .. I found it - wrong apostrophe leads to wrong variable substitution..

root@d9562facbfea:/var/www/html# cat /usr/local/etc/php/conf.d/friendica.ini 
memory_limit=${PHP_MEMORY_LIMIT}
upload_max_filesize=${PHP_UPLOAD_LIMIT}
post_max_size=${PHP_UPLOAD_LIMIT}

Nice 🙂 i think we have now to wait for a new dockerhub image? It is the only place where image is hosted?

Btw I'm wondering why php -ini gives me a correct memory limit.

My question about 2021.09-rc is to know if this version is usable as a fallback image as 2021.09 i used friday morning is not available anymore. But while writting I'm wondering if this rc doesn't contain the issue which erases local config :)

This version is still available, do you use a specific tag ?

https://hub.docker.com/layers/friendica/library/friendica/2021.09/images/sha256-350e1c00ff0c07e928cd5ac72bfc4dbf9e39c719935a39eb438773b2e2d84ffd?context=explore

Yes this version is available but contains the new feature. I had the issue because my node pull on friday this new image which was updated 10d ago. My question was how to retrieve a 2021.09 without this new feature. But now it looks to be fixed I would prefer getting the new image 😉

@valvin1 / @scifijunk - I fixed it the wrong way :D But now #188 should "really" fix it ..

Thank you for your fix. Does the image has been pushed on dockerhub (it doesn't look it is) or is there another place to get it in oder I reopen my instance?

It looks image has been updated my instance has started back automatically around midnight 🙂 thank you

Yes, the new release and the fix were merged some hours ago, so it's rolled out now :).
Hope it's now fixed for every circumstances

Well, I just notice the Email notification about this issue and I can't say I ever had this kind of problem. I will say that I stopped using the latest tag when 2021.07 came and went to use the stable tag due to having issues with the latest tag. After that, I had no more problems. In my setup for friendica I have friendica and cron using friendica:stable and MariaDB using latest. I'm also managing my Kubernetes with Portainer which helps me a lot.

Maybe that will help.