Skip to content

Commit

Permalink
redis/nexctloud: Migrate to Valkey
Browse files Browse the repository at this point in the history
Fix #92
  • Loading branch information
JGoutin committed Nov 15, 2024
1 parent 566841d commit 1a8cb35
Show file tree
Hide file tree
Showing 24 changed files with 177 additions and 163 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ directly:
* **nginx**: Install a [Nginx](https://nginx.org) web server.
* **postgresql**: Install a [PostgreSQL](https://www.postgresql.org) database.
* **php_fpm**: Install a [PHP-FPM](https://php-fpm.org) server.
* **redis**: Install [Redis](https://redis.io) in memory data store.
* **valkey**: Install [Valkey](https://valkey.io) in memory data store.
* **rpmfusion**: Enable [RPMFusion](https://rpmfusion.org) repositories.

## Installation
Expand Down
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ tags:
- php_fpm
- postfix
- postgresql
- redis
- valkey
- rpmfusion
- security
- squid
Expand Down
2 changes: 1 addition & 1 deletion index.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ These roles are used as main roles dependencies:
[PostgreSQL](https://www.postgresql.org) database.
* [**php_fpm**](roles/php_fpm/README.md): Install a [PHP-FPM](https://php-fpm.org)
server.
* [**redis**](roles/redis/README.md): Install [Redis](https://redis.io) in memory data
* [**valkey**](roles/valkey/README.md): Install [Valkey](https://valkey.io) in memory data
store.
* [**rpmfusion**](roles/rpmfusion/README.md): Enable [RPMFusion](https://rpmfusion.org)
repositories.
Expand Down
4 changes: 2 additions & 2 deletions roles/nextcloud/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Configuration:
* Provide variables to easily configure Nextcloud options.
* Provide mail configuration (With default to the system mail server).
* Auto-update Nextcloud and Nextcloud applications using a dedicated service.
* Configure Redis & APCu cache.
* Configure Valkey & APCu cache.
* Provide `occ` command Bash auto-completion.
* Configure Nextcloud Cron using a dedicated service.
* Use Nginx and PostgreSQL as backend.
Expand All @@ -38,7 +38,7 @@ server configuration.
### Limitations

This role is mainly intended and optimized to run Nextcloud as a single server.
It does not yet support to run PostgreSQL or Redis on another machine to create
It does not yet support to run PostgreSQL or Valkey on another machine to create
a scalable infrastructure.

## Dependencies
Expand Down
2 changes: 1 addition & 1 deletion roles/nextcloud/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ _php_core:
- mbstring
- pgsql # PostgreSQL connector
- process # include: posix
- redis # Redis connector
- redis # Valkey/Redis connector
- sodium
- xml # include: libxml, SimpleXML, XMLReader, XMLWriter, XMLReader
- zip
Expand Down
2 changes: 1 addition & 1 deletion roles/nextcloud/tasks/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
- name: trusted_domains 1
value: "{{ nextcloud_domain }}"
- name: redis host
value: /var/run/redis/redis.sock
value: /var/run/valkey/valkey.sock
- name: redis port
value: 0
type: integer
Expand Down
6 changes: 3 additions & 3 deletions roles/nextcloud/tasks/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
php_session_sid_length: 36 # Fail with higher values
php_modules: "{{ [_php_core, _php_preview, _php_external, _php_ldap] | flatten | unique }}"

- name: Ensure Redis is installed
- name: Ensure Valkey is installed
ansible.builtin.include_role:
name: jgoutin.home.redis
name: jgoutin.home.valkey
vars:
redis_user: nextcloud
valkey_user: nextcloud

- name: Ensure Nginx is installed
ansible.builtin.include_role:
Expand Down
40 changes: 0 additions & 40 deletions roles/redis/README.md

This file was deleted.

2 changes: 0 additions & 2 deletions roles/redis/defaults/main.yml

This file was deleted.

13 changes: 0 additions & 13 deletions roles/redis/files/httpd_redis.te

This file was deleted.

81 changes: 0 additions & 81 deletions roles/redis/tasks/main.yml

This file was deleted.

3 changes: 0 additions & 3 deletions roles/redis/templates/netdata_redis.conf.j2

This file was deleted.

2 changes: 1 addition & 1 deletion roles/rpmfusion/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Redis Ansible Role
# Valkey Ansible Role

## Description

Expand Down
40 changes: 40 additions & 0 deletions roles/valkey/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Valkey Ansible Role

## Description

This role installs a [Valkey](https://valkey.io/) in memory data store.

### Features

Configuration:
* Bind to Unix socket.
* Log in Systemd journal.

Security:
* Run in a Systemd sandbox.
* Work with SElinux enforced.

## Dependencies

*None*

## Variables

### Optional

| Name | Default Value | Description |
|--------------------|---------------|---------------------------------------------------------|
| `valkey_log_level` | `"warning"` | Valkey log level in the journal. |
| `valkey_user` | | If specified, allow this Unix user to access to Valkey. |

## Example Playbook

```yaml
---
- hosts: all
become: true
collections:
- jgoutin.home
roles:
- valkey
```
2 changes: 2 additions & 0 deletions roles/valkey/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
valkey_log_level: warning
13 changes: 13 additions & 0 deletions roles/valkey/files/httpd_valkey.te
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

module httpd_valkey 1.0;

require {
type unconfined_service_t;
type var_run_t;
type httpd_t;
class sock_file write;
class unix_stream_socket connectto;
}

allow httpd_t unconfined_service_t:unix_stream_socket connectto;
allow httpd_t var_run_t:sock_file write;
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Service]
StateDirectory=redis
StateDirectory=valkey
StateDirectoryMode=0700
LogsDirectory=redis
LogsDirectory=valkey
LogsDirectoryMode=0700

# Restart on failure
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions roles/redis/meta/main.yml → roles/valkey/meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
galaxy_info:
author: JGoutin
description: This Ansible role installs Redis on Fedora.
description: This Ansible role installs Valkey on Fedora.
license: GPL-3.0
min_ansible_version: "2.14"
platforms:
Expand All @@ -12,6 +12,6 @@ galaxy_info:
galaxy_tags:
- fedora
- system
- redis
- valkey

dependencies: []
Loading

0 comments on commit 1a8cb35

Please sign in to comment.