Bug 2165092

Summary: Wrong port specified when `rails_cache_store` is set to `redis`
Product: Red Hat Satellite Reporter: Pablo Mendez Hernandez <pmendezh>
Component: InstallationAssignee: Ewoud Kohl van Wijngaarden <ekohlvan>
Status: CLOSED ERRATA QA Contact: Jameer Pathan <jpathan>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.13.0CC: ehelms, ekohlvan, fperalta, jhutar, jpathan
Target Milestone: 6.15.0Keywords: Performance, Triaged, WorkAround
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-04-23 17:13:19 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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.

Comment 11 Brad Buckingham 2023-10-30 11:29:29 UTC
Bulk setting Target Milestone = 6.15.0 where sat-6.15.0+ is set.

Comment 14 errata-xmlrpc 2024-04-23 17:13:19 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: Satellite 6.15.0 release), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2024:2010