[Unit] Description=Fix Valkey socket group ownership and permissions BindsTo=valkey.service After=valkey.service [Service] Type=oneshot # Wait for socket to exist (max 10 seconds) ExecStart=/bin/sh -c 'i=0; while [ ! -S {{ valkey_unix_socket_path }} ] && [ $i -lt 100 ]; do sleep 0.1; i=$((i+1)); done' ExecStart=/bin/chgrp {{ valkey_client_group }} {{ valkey_unix_socket_path }} # Set to 777 for containers that switch users after startup (e.g. Nextcloud root->www-data) # Security is maintained via password authentication (requirepass) ExecStart=/bin/chmod 777 {{ valkey_unix_socket_path }} RemainAfterExit=yes [Install] WantedBy=multi-user.target