Repository navigation
Switch to Valkey 8 #582
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
Switch to Valkey 8 #582
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,7 +27,7 @@ | |
| - role: postgresql | ||
| when: | ||
| - database_mode == 'internal' | ||
| - redis | ||
| - valkey | ||
| - candlepin | ||
| - httpd | ||
| - pulp | ||
|
|
||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| --- | ||
| valkey_container_image: quay.io/sclorg/valkey-8-c10s | ||
| valkey_container_tag: "latest" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| --- | ||
| - name: Populate service facts | ||
| ansible.builtin.service_facts: | ||
|
|
||
| - name: Stop Redis service | ||
| ansible.builtin.service: | ||
| name: redis | ||
| state: stopped | ||
| when: ansible_facts['services']['redis.service']['status'] | default('not-found') != 'not-found' | ||
|
Gauravtalreja1 marked this conversation as resolved.
Resolved
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to Claude, we should rely on existence of
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have no friends called Claude. I do however have access to the Ansible documentation, where this exact line is used in an example how to do it: https://docs.ansible.com/projects/ansible/latest/collections/ansible/builtin/service_facts_module.html#examples |
||
|
|
||
| - name: Remove Redis package | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I am not mistaken, this means we assume Redis package is installed directly on the host. In which scenario it would be installed? I was under the impression that it should be only installed as a container.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For upgrades from RPM-based installations, it will be a package. |
||
| ansible.builtin.package: | ||
| name: redis | ||
| state: absent | ||
|
|
||
| - name: Remove Redis image | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we use the ready-made image module from Ansible instead of chasing the services e.t.c.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not aware that this module can remove quadlet definitions (which is what we're removing here). But if you have an example how it can be done: yes, that'd be cleaner then.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From the example. I suppose it would be a follow-up
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Which removes an image, not an image definition (which is what we're removing here). # cat t.yaml
---
- hosts: localhost
tasks:
- name: Generate image file
containers.podman.podman_image:
name: "quay.io/bitnami/wildfly"
state: quadlet
quadlet_filename: "wildfly"
- name: Delete image definition
containers.podman.podman_image:
name: "quay.io/bitnami/wildfly"
state: absent
quadlet_filename: "wildfly"
# ansible-playbook t.yaml
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
PLAY [localhost]
TASK [Gathering Facts]
ok: [localhost]
TASK [Generate image file]
changed: [localhost]
TASK [Delete image definition]
ok: [localhost]
PLAY RECAP
localhost : ok=3 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
# ls -alh /etc/containers/systemd/
total 12K
drwxr-xr-x. 2 root root 4.0K Jun 29 08:14 .
drwxr-xr-x. 7 root root 4.0K Jun 29 08:12 ..
-rw-r-----. 1 root root 38 Jun 29 08:14 wildfly.image
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am just reading the podman module source...
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I think using
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| ansible.builtin.file: | ||
| path: /etc/containers/systemd/redis.image | ||
| state: absent | ||
|
|
||
| - name: Remove Redis image drop-in directory | ||
| ansible.builtin.file: | ||
| path: /etc/containers/systemd/redis.image.d | ||
| state: absent | ||
|
|
||
| - name: Remove Redis container | ||
| ansible.builtin.file: | ||
| path: /etc/containers/systemd/redis.container | ||
|
Gauravtalreja1 marked this conversation as resolved.
Resolved
|
||
| state: absent | ||
| register: _valkey_remove_redis_container | ||
|
|
||
| - name: Run daemon reload # noqa: no-handler | ||
| ansible.builtin.systemd: | ||
| daemon_reload: true | ||
| when: | ||
| - _valkey_remove_redis_container is changed | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| --- | ||
| - name: Deploy valkey image unit | ||
| ansible.builtin.include_role: | ||
| name: images | ||
| tasks_from: deploy_image.yaml | ||
| vars: | ||
| images_definition: | ||
| name: valkey | ||
| image: "{{ valkey_container_image }}:{{ valkey_container_tag }}" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,25 +1,28 @@ | ||
| --- | ||
| - name: Deploy redis image | ||
| - name: Deploy valkey image | ||
| ansible.builtin.include_tasks: image.yaml | ||
|
|
||
| - name: Create directory for Redis data | ||
| - name: Cleanup Redis | ||
| ansible.builtin.include_tasks: cleanup_redis.yaml | ||
|
|
||
| - name: Create directory for Valkey data | ||
| ansible.builtin.file: | ||
| path: /var/lib/redis | ||
| path: /var/lib/valkey | ||
| state: directory | ||
| owner: 1001 | ||
| group: 1001 | ||
| mode: '0755' | ||
|
|
||
| - name: Run Redis as a container | ||
| - name: Run Valkey as a container | ||
| containers.podman.podman_container: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did we consider using the podman_quadlet module? It has much less options, so I am not sure it will do the trick here.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We didn't, as that module didn't exist when we originally written this code. It's worth investigating whether we should switch the whole codebase to it. But not in this PR which merely renames Redis→Valkey.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| name: redis | ||
| image: redis.image | ||
| name: valkey | ||
| image: valkey.image | ||
| state: quadlet | ||
| network: host | ||
| sdnotify: true | ||
| command: ["run-redis", "--supervised", "systemd"] | ||
| command: ["run-valkey", "--supervised", "systemd"] | ||
| volumes: | ||
| - /var/lib/redis:/data:rw,Z | ||
| - /var/lib/valkey:/data:rw,Z | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This assumes we don't need data migration. Seems OK to me, but just want to confirm. Also I suppose we can delete the old folder, if we don't use it anymore.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, the data is not valuable: #582 (review) And yes, we could delete the old folder in |
||
| quadlet_options: | ||
| - | | ||
| [Install] | ||
|
|
@@ -31,7 +34,7 @@ | |
| ansible.builtin.systemd: | ||
| daemon_reload: true | ||
|
|
||
| - name: Start the Redis Service | ||
| - name: Start the Valkey Service | ||
| ansible.builtin.systemd: | ||
| name: redis | ||
| name: valkey | ||
| state: started | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,5 +13,5 @@ postgresql_container_image: quay.io/sclorg/postgresql-13-c9s | |
| postgresql_container_tag: "latest" | ||
| pulp_container_image: quay.io/foreman/pulp | ||
| pulp_container_tag: "foreman-{{ container_tag_stream }}" | ||
| redis_container_image: quay.io/sclorg/redis-6-c9s | ||
| redis_container_tag: "latest" | ||
| valkey_container_image: quay.io/sclorg/valkey-8-c10s | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need to specify the image twice? There is also mention of the image in
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So that the role can work standalone, while this file being the canonical source of truth for the foremanctl-based deployment. |
||
| valkey_container_tag: "latest" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suppose this means we're OK with whatever comes into RHEL 10?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as before. yes. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ | |
| "foreman", | ||
| "candlepin", | ||
| "pulp", | ||
| "redis", | ||
| "valkey", | ||
| ] | ||
|
|
||
|
|
||
|
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| VALKEY_HOST = 'localhost' | ||
| VALKEY_PORT = 6379 | ||
|
|
||
|
|
||
| def test_valkey_service(server): | ||
| valkey = server.service("valkey") | ||
| assert valkey.is_running | ||
|
|
||
|
|
||
| def test_valkey_port(server): | ||
| valkey = server.addr(VALKEY_HOST) | ||
| assert valkey.port(VALKEY_PORT).is_reachable |
Uh oh!
There was an error while loading. Please reload this page.