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

[BUG] Database access not working for cron script #5770

Closed
yaleman opened this issue Oct 29, 2023 · 4 comments · Fixed by #5772
Closed

[BUG] Database access not working for cron script #5770

yaleman opened this issue Oct 29, 2023 · 4 comments · Fixed by #5772
Assignees
Labels
Docker Everything related to Docker
Milestone

Comments

@yaleman
Copy link

yaleman commented Oct 29, 2023

Describe the bug

Feeds are not updating and this error appears in the logs:

I recently upgraded to 1.22.0 and migrated from sqlite to postgres. Reading and marking existing posts read works, but the cron script is throwing errors about being unable to connect to the database:

FreshRSS[2127]: [yaleman] [Sat, 28 Oct 2023 06:41:11 +1000] [error] --- Access to database is denied for ``: SQLSTATE[08006] [7] could not translate host name ":" to address: Name or service not known

And no updates are happening to feeds since the upgrade - until I exec into the container and run the actualize script manually.

To Reproduce
Steps to reproduce the behavior:

Using the following docker container:

    Image:           freshrss/freshrss:1.22.0-arm
    Image ID:        docker.io/freshrss/freshrss@sha256:108cfbb097b96f4b893752a257d39a676b122eacef4ba3527b5c769c6b0a1f96

Config db section:

  'db' =>
  array (
    'type' => 'pgsql',
    'host' => getenv('FRESHRSS_POSTGRESQL_PORT_5432_TCP_ADDR').":".getenv('FRESHRSS_POSTGRESQL_PORT_5432_TCP_PORT'),
    'user' => getenv("DB_USER"),
    'password' => getenv("DB_PASSWORD"),
    'base' => getenv("DB_BASE"),
    'prefix' => false,
    'connection_uri_params' => '',
    'pdo_options' =>
    array (
    ),
  ),

The environment variables are confirmed to be working otherwise no data would appear - but the reader functionality and marking them read works.

Expected behavior

Feeds to be updated automatically with the cron timer.

Screenshots

n/a

Environment information (please complete the following information):

  • Device: linux
  • OS: docker container
  • Browser: n/a
  • FreshRSS version: 1.22.0
  • Database version: postgresql (docker postgres:15.4)
  • PHP version: the one in the container (PHP 8.2.7 (cli) (built: Jun 9 2023 19:37:27) (NTS))
  • Installation type: k8s, container

Additional context

The error would indicate that it's somehow loading the configuration but not getting the environment variables from the container? They need to come from there because it's running in kubernetes and are dynamically set on startup to point at the DB.

@yaleman
Copy link
Author

yaleman commented Oct 29, 2023

Running it manually in the container works fine:

root@freshrss-8477cdcbbc-9lwt7:/var/www/FreshRSS# . /var/www/FreshRSS/Docker/env.txt; \
                su www-data -s /bin/sh -c 'php /var/www/FreshRSS/app/actualize_script.php' \
                2>> /proc/1/fd/2 > /tmp/FreshRSS.log
root@freshrss-8477cdcbbc-9lwt7:/var/www/FreshRSS# cat /tmp/FreshRSS.log
Results:
yaleman OK
End.

(And there's fresh updates in my feed)

@Alkarex Alkarex added the Docker Everything related to Docker label Oct 29, 2023
@Alkarex Alkarex added this to the 1.22.1 milestone Oct 29, 2023
@Alkarex Alkarex self-assigned this Oct 29, 2023
Alkarex added a commit to Alkarex/FreshRSS that referenced this issue Oct 29, 2023
fix FreshRSS#5770
Note, the syntax complying with https://www.shellcheck.net/wiki/SC2002 does not seem to work in ash / Alpine
@Alkarex
Copy link
Member

Alkarex commented Oct 29, 2023

I have made a patch #5772
Would you be able to test? I have made a test image freshrss/freshrss:pr5772

Alkarex added a commit that referenced this issue Oct 29, 2023
fix #5770
Note, the syntax complying with https://www.shellcheck.net/wiki/SC2002 does not seem to work in ash / Alpine
@Alkarex
Copy link
Member

Alkarex commented Oct 29, 2023

Merged. Tests of freshrss/freshrss:edge and freshrss/freshrss:edge-alpine and freshrss/freshrss:edge-arm welcome

@Alkarex
Copy link
Member

Alkarex commented Oct 29, 2023

@yaleman Maybe you could also give hints to #5748

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docker Everything related to Docker
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants