Bug 2165092 - Wrong port specified when `rails_cache_store` is set to `redis`
Summary: Wrong port specified when `rails_cache_store` is set to `redis`
Keywords:
Status: VERIFIED
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Installer
Version: 6.13.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium with 1 vote
Target Milestone: Unspecified
Assignee: Ewoud Kohl van Wijngaarden
QA Contact: Jameer Pathan
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-01-27 16:18 UTC by Pablo Mendez Hernandez
Modified: 2023-06-21 13:50 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 36037 0 Normal Closed Manage Redis service when the cache store is set to Redis 2023-02-27 11:30:16 UTC
Red Hat Issue Tracker SAT-17459 0 None None None 2023-05-01 19:46:50 UTC

Description Pablo Mendez Hernandez 2023-01-27 16:18:19 UTC
Description of problem:

While investigating https://bugzilla.redhat.com/show_bug.cgi?id=2122461 and after installing the `foreman-redis` package, trying to  configure `redis` as the rails cache store with:

`satellite-installer --foreman-rails-cache-store type:redis`

the installer will fail because it'll try to configure port 8479 instead of 6379.


Version-Release number of selected component (if applicable):

Satellite 6.13 Snap 8


How reproducible:

Always.


Steps to Reproduce:
1. Install `foreman-redis` package from brew
2. Run: `satellite-installer --foreman-rails-cache-store type:redis`
3.


Actual results:

~~~
# satellite-installer --foreman-rails-cache-store type:redis
2023-01-27 14:34:07 [NOTICE] [root] Loading installer configuration. This will take some time.
2023-01-27 14:34:10 [NOTICE] [root] Running installer with log based terminal output at level NOTICE.
2023-01-27 14:34:10 [NOTICE] [root] Use -l to set the terminal output log level to ERROR, WARN, NOTICE, INFO, or DEBUG. See --full-help for definitions.
Package versions are locked. Continuing with unlock.
2023-01-27 14:34:16 [NOTICE] [configure] Starting system configuration.
2023-01-27 14:34:30 [NOTICE] [configure] 250 configuration steps out of 1564 steps complete.
2023-01-27 14:34:36 [NOTICE] [configure] 500 configuration steps out of 1565 steps complete.
2023-01-27 14:34:38 [NOTICE] [configure] 750 configuration steps out of 1569 steps complete.
2023-01-27 14:34:39 [NOTICE] [configure] 1000 configuration steps out of 1575 steps complete.
2023-01-27 14:34:40 [NOTICE] [configure] 1250 configuration steps out of 1575 steps complete.
2023-01-27 14:35:34 [ERROR ] [configure] Systemd start for foreman failed!
2023-01-27 14:35:34 [ERROR ] [configure] journalctl log for foreman:
2023-01-27 14:35:34 [ERROR ] [configure] -- Logs begin at Fri 2023-01-27 14:12:08 UTC, end at Fri 2023-01-27 14:35:34 UTC. --
2023-01-27 14:35:34 [ERROR ] [configure] Jan 27 14:32:27 satellite.blue.ddns.perf.redhat.com systemd[1]: Starting Foreman...
2023-01-27 14:35:34 [ERROR ] [configure] Jan 27 14:32:45 satellite.blue.ddns.perf.redhat.com foreman[5966]: => Booting Puma
2023-01-27 14:35:34 [ERROR ] [configure] Jan 27 14:32:45 satellite.blue.ddns.perf.redhat.com foreman[5966]: => Rails 6.1.7 application starting in production
2023-01-27 14:35:34 [ERROR ] [configure] Jan 27 14:32:45 satellite.blue.ddns.perf.redhat.com foreman[5966]: => Run `bin/rails server --help` for more startup options
2023-01-27 14:35:34 [ERROR ] [configure] Jan 27 14:32:52 satellite.blue.ddns.perf.redhat.com foreman[5966]: /usr/share/gems/gems/foreman_theme_satellite-11.0.0.2/app/models/concerns/distributor_version.rb:5: warning: already initialized constant Katello::Glue::Provider::DISTRIBUTOR_VERSION
2023-01-27 14:35:34 [ERROR ] [configure] Jan 27 14:32:52 satellite.blue.ddns.perf.redhat.com foreman[5966]: /usr/share/gems/gems/katello-4.7.0.5/app/models/katello/glue/provider.rb:3: warning: previous definition of DISTRIBUTOR_VERSION was here
2023-01-27 14:35:34 [ERROR ] [configure] Jan 27 14:32:52 satellite.blue.ddns.perf.redhat.com foreman[5966]: Exiting
2023-01-27 14:35:34 [ERROR ] [configure] Jan 27 14:32:52 satellite.blue.ddns.perf.redhat.com foreman[5966]: /usr/share/ruby/socket.rb:1214:in `__connect_nonblock': Permission denied - connect(2) for 127.0.0.1:8479 (Errno::EACCES)
. . .
~~~

Expected results:

Success.


Additional info:

This configuration works:

~~~
# grep redis /etc/foreman/settings.yaml 
  :redis_url: redis://localhost:6379/6
  :type: redis
    - redis://localhost:6379/0
~~~

Comment 1 Pablo Mendez Hernandez 2023-01-30 11:59:30 UTC
Modifying the template like this before running `satellite-installer` makes the installation succeed:

~~~
sed -i.orig \
  's#^\(    - redis://localhost:\)\(8479\)\(/0\)$#\16379\3#' \
  /usr/share/foreman-installer/modules/foreman/templates/settings.yaml.erb
~~~

In a diff format:

~~~
diff -u /usr/share/foreman-installer/modules/foreman/templates/settings.yaml.erb.orig /usr/share/foreman-installer/modules/foreman/templates/settings.yaml.erb
--- /usr/share/foreman-installer/modules/foreman/templates/settings.yaml.erb.orig	2023-01-17 16:36:05.000000000 +0000
+++ /usr/share/foreman-installer/modules/foreman/templates/settings.yaml.erb	2023-01-30 10:40:43.873993118 +0000
@@ -106,7 +106,7 @@
     - redis://<%= url %>
 <%     end -%>
 <%   else -%>
-    - redis://localhost:8479/0
+    - redis://localhost:6379/0
 <%   end -%>
   :options:
 <%   if scope["foreman::rails_cache_store"].key?("options") -%>
~~~

Comment 2 Bryan Kearney 2023-02-02 16:03:37 UTC
Upstream bug assigned to ekohlvan

Comment 3 Bryan Kearney 2023-02-02 16:03:39 UTC
Upstream bug assigned to ekohlvan

Comment 4 Pablo Mendez Hernandez 2023-02-15 16:41:41 UTC
The code in https://github.com/theforeman/puppet-foreman/pull/1109 fixes the issue for me as well.

Comment 5 Bryan Kearney 2023-02-17 12:03:29 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/36037 has been resolved.

Comment 7 Jameer Pathan 2023-06-20 13:07:13 UTC
Verified:

Verified with:
- Satellite 6.14.0 snap 4
- foreman-redis-3.7.0-0.5.rc3.el8sat.noarch

Test steps:
- Run "satellite-installer --foreman-rails-cache-store type:redis"

Observations:
- Satellite-installer completed successfully.

Comment 10 Ewoud Kohl van Wijngaarden 2023-06-21 13:50:01 UTC
It should be noted that by default it uses db 0. Dynflow defaults to db 6 while Pulp defaults to db 8. Satellite doesn't support other services on the same host, but it still may have been better to avoid db 0 just to be sure. I opened https://github.com/theforeman/puppet-foreman/pull/1122 to do that.


Note You need to log in before you can comment on or make changes to this bug.