Skip to content

Commit 995fb64

Browse files
committed
Use unix socket for httpd -> Foreman communication
1 parent 6a62f7e commit 995fb64

File tree

5 files changed

+18
-3
lines changed

5 files changed

+18
-3
lines changed

playbooks/deploy.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@
3333
foreman_db_password: "CHANGEME"
3434
foreman_oauth_consumer_key: abcdefghijklmnopqrstuvwxyz123456
3535
foreman_oauth_consumer_secret: abcdefghijklmnopqrstuvwxyz123456
36+
foreman_listen_stream: /run/httpd.foreman.sock
3637
foreman_url: "https://{{ ansible_fqdn }}"
38+
httpd_foreman_backend: "unix://{{ foreman_listen_stream }}|http://%{HTTP_HOST}/"
3739
httpd_server_ca_certificate: "{{ ca_certificate }}"
3840
httpd_client_ca_certificate: "{{ ca_certificate }}"
3941
httpd_server_certificate: "{{ server_certificate }}"

roles/foreman/templates/foreman.socket.j2

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ Description=Foreman socket
33

44
[Socket]
55
ListenStream={{ foreman_listen_stream }}
6+
SocketUser=apache
7+
SocketMode=0600
8+
9+
NoDelay=false
10+
ReusePort=true
11+
Backlog=1024
612

713
[Install]
814
WantedBy=sockets.target

roles/httpd/defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
httpd_ssl_dir: /etc/pki/httpd
22
httpd_pulp_api_backend: http://localhost:24817
33
httpd_pulp_content_backend: http://localhost:24816
4-
httpd_foreman_backend: http://localhost:3000
4+
httpd_foreman_backend: http://localhost:3000/

roles/httpd/tasks/main.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@
1212
state: true
1313
persistent: true
1414

15+
# TODO: probably not the right boolean
16+
- name: Set daemons_enable_cluster_mode so Apache can connect to unix sockets
17+
ansible.posix.seboolean:
18+
name: daemons_enable_cluster_mode
19+
state: true
20+
persistent: true
21+
1522
- name: Disable welcome page
1623
ansible.builtin.file:
1724
path: /etc/httpd/conf.d/welcome.conf

roles/httpd/templates/foreman-ssl-vhost.conf.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@
7070
ProxyPass /pulp !
7171
ProxyPass /icons !
7272
ProxyPass /server-status !
73-
ProxyPass / {{ httpd_foreman_backend }}/ retry=0 timeout=900
74-
ProxyPassReverse / {{ httpd_foreman_backend }}/
73+
ProxyPass / {{ httpd_foreman_backend }} retry=0 timeout=900
74+
ProxyPassReverse / {{ httpd_foreman_backend }}
7575

7676
AddDefaultCharset UTF-8
7777
</VirtualHost>

0 commit comments

Comments
 (0)