Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

pulp_redis: Allow to configure Unix Domain Socket #324

Merged
merged 1 commit into from Jun 17, 2020

Conversation

Spredzy
Copy link
Contributor

@Spredzy Spredzy commented Jun 9, 2020

This commit ensures one can configure redis so it listens to unix domain
socket (if wanted) rather than forcing it to listen on TCP socket.

Benefits of this commit has been higlighted in previous PR[1].

Also, this commit introduces pulp_redis_bind to offer an expected
experience for people using pulp/pulp_installer when it comes to
configure network services (ie. pulp_api_bind, pulp_content_bind).

fixes #6931

[1] #322

@pulpbot
Copy link
Member

pulpbot commented Jun 9, 2020

Attached issue: https://pulp.plan.io/issues/6931

@Spredzy
Copy link
Contributor Author

Spredzy commented Jun 9, 2020

This tested has been tested with the following two scenarios:

Scenario 1: Using Unix Domain Socket

- hosts: localhost
  vars:
    pulp_settings:
      secret_key: secret
      content_origin: "http://{{ ansible_fqdn }}"
      x_pulp_api_host: "{{ pulp_api_host }}"
      x_pulp_api_port: "{{ pulp_api_port }}"
      x_pulp_api_user: "admin"
      x_pulp_api_password: "{{ pulp_default_admin_password }}"
      x_pulp_api_prefix: "pulp_ansible/galaxy/automation-hub/api"
      galaxy_require_content_approval: "False"
      redis_url: 'unix:///var/run/redis/redis.sock'
    pulp_default_admin_password: password
    pulp_install_plugins:
      pulp-ansible: {}
      galaxy-ng: {}
      pulp-container: {}
    pulp_api_workers: 4
    pulp_redis_bind: 'unix:/var/run/redis/redis.sock'
  roles:
    - pulp_redis
    - pulp_database
    - pulp_workers
    - pulp_resource_manager
    - pulp_webserver
    - pulp_content
    - chouseknecht.ansible_galaxy_config
  environment:
    DJANGO_SETTINGS_MODULE: pulpcore.app.settings

Scenario 2: Using the defaults value for pulp_redis_bind 127.0.0.1:6379

- hosts: localhost
  vars:
    pulp_settings:
      secret_key: secret
      content_origin: "http://{{ ansible_fqdn }}"
      x_pulp_api_host: "{{ pulp_api_host }}"
      x_pulp_api_port: "{{ pulp_api_port }}"
      x_pulp_api_user: "admin"
      x_pulp_api_password: "{{ pulp_default_admin_password }}"
      x_pulp_api_prefix: "pulp_ansible/galaxy/automation-hub/api"
      galaxy_require_content_approval: "False"
    pulp_default_admin_password: password
    pulp_install_plugins:
      pulp-ansible: {}
      galaxy-ng: {}
      pulp-container: {}
    pulp_api_workers: 4
  roles:
    - pulp_database
    - pulp_workers
    - pulp_resource_manager
    - pulp_webserver
    - pulp_content
    - chouseknecht.ansible_galaxy_config
  environment:
    DJANGO_SETTINGS_MODULE: pulpcore.app.settings

Both have deployed successfully, and the following can be observed in /pulp/v3/api/status:

"redis_connection": {
        "connected": true
 },

Comment on lines +7 to +17
- name: Ensure Redis will listen on the specified TCP socket
lineinfile:
path: '{{ pulp_redis_conf_file }}'
regexp: '{{ item.regexp }}'
line: '{{ item.line }}'
loop:
- regexp: '^port '
line: 'port {{ pulp_redis_port }}'
- regexp: '^bind '
line: 'bind {{ pulp_redis_host }}'
notify: restart redis
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Comment on lines +6 to +12
- name: Ensure pulp is part of group redis
user:
name: '{{ pulp_user }}'
groups: redis
append: true

- name: Ensure Redis will not listen on a TCP socket
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I liked these ensure tasks

roles/pulp_redis/README.md Outdated Show resolved Hide resolved
Copy link
Member

@mikedep333 mikedep333 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! See 1 suggestion.

roles/pulp_redis/handlers/main.yml Show resolved Hide resolved
This commit ensures one can configure redis so it listens to unix domain
socket (if wanted) rather than forcing it to listen on TCP socket.

Benefits of this commit has been higlighted in previous PR[1].

Also, this commit introduces `pulp_redis_bind` to offer an expected
experience for people using `pulp/pulp_installer` when it comes to
configure network services (ie. `pulp_api_bind`, `pulp_content_bind`).

fixes #6931

[1] pulp#322
@mikedep333 mikedep333 merged commit 7631297 into pulp:master Jun 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants