Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Multiple problems in Sentinel installation #21

Open
quulah opened this issue May 30, 2017 · 1 comment
Open

Multiple problems in Sentinel installation #21

quulah opened this issue May 30, 2017 · 1 comment

Comments

@quulah
Copy link

quulah commented May 30, 2017

Installation of the Sentinel fails with the following errors. I have a pull request ready.

The sentinel.rb has a few errors:

No resource or method named `owner' for `RedisCookbook::Resource::RedisSentinel "redis-sentinel"
>>   redis_sentinel node['redis']['sentinel']['service_name'] do
[2017-05-30T12:45:16+00:00] DEBUG: Re-raising exception: NoMethodError - undefined method `[]' for nil:NilClass

Package installation fails atleast on Ubuntu 16.04, this affects the default recipe too.

       [2017-05-30T13:11:52+00:00] ERROR: redis_installation[redis] (blp-redis::default line 12) had an error: Mixlib::ShellOut::ShellCommandFailed: apt_package[redis-server] (/tmp/kitchen/cache/cookbooks/blp-redis/libraries/redis_installation_package.rb line 111) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '100'
       ---- Begin output of ["apt-get", "-q", "-y", "-o", "Dpkg::Options::=--path-exclude=/etc/redis*", "install", "redis-server=2:3.0.6-1"] ----
       STDOUT: Reading package lists...
       Building dependency tree...
       Reading state information...
       The following NEW packages will be installed:
         redis-server
       0 upgraded, 1 newly installed, 0 to remove and 156 not upgraded.
       Need to get 0 B/343 kB of archives.
       After this operation, 918 kB of additional disk space will be used.
       Selecting previously unselected package redis-server.
(Reading database ... 47609 files and directories currently installed.)
       Preparing to unpack .../redis-server_2%3a3.0.6-1_amd64.deb ...
       Unpacking redis-server (2:3.0.6-1) ...
       Processing triggers for man-db (2.7.5-1) ...
       Processing triggers for systemd (229-4ubuntu7) ...
       Processing triggers for ureadahead (0.100.0-19) ...
       Setting up redis-server (2:3.0.6-1) ...
       dpkg-statoverride: warning: --update given but /etc/redis/redis.conf does not exist
       Job for redis-server.service failed because the control process exited with error code. See "systemctl status redis-server.service" and "journalctl -xe" for details.
       invoke-rc.d: initscript redis-server, action "start" failed.
       dpkg: error processing package redis-server (--configure):
        subprocess installed post-installation script returned error exit status 1
       Processing triggers for systemd (229-4ubuntu7) ...
       Processing triggers for ureadahead (0.100.0-19) ...
       Errors were encountered while processing:
        redis-server
       STDERR: E: Sub-process /usr/bin/dpkg returned an error code (1)
       ---- End output of ["apt-get", "-q", "-y", "-o", "Dpkg::Options::=--path-exclude=/etc/redis*", "install", "redis-server=2:3.0.6-1"] ----
       Ran ["apt-get", "-q", "-y", "-o", "Dpkg::Options::=--path-exclude=/etc/redis*", "install", "redis-server=2:3.0.6-1"] returned 100

Kitchen files have no version and the run_lists in the policies are a bit mixed.

[2017-05-30T13:21:04+00:00] ERROR: Cookbook 'blp-redis' version '3.0.0' depends on chef version ["~> 12.5"], but the running chef version is 13.1.31
       [2017-05-30T13:21:04+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

The redis_sentinel resource has a broken template version handling.

[2017-05-30T13:49:12+00:00] DEBUG: Re-raising exception: NoMethodError - redis_sentinel[redis-sentinel] (blp-redis::sentinel line 14) had an error: NoMethodError: undefined method `first' for nil:NilClass
/tmp/kitchen/cache/cookbooks/blp-redis/libraries/redis_sentinel.rb:66:in `default_config_source'

Sentinel service parameters don't have --sentinel and the permissions of the file stop the service from starting.

May 30 13:50:11 sentinel-ubuntu-1604 redis-server[5370]: >>> 'sentinel monitor mymaster 127.0.0.1 6379 2'
May 30 13:50:11 sentinel-ubuntu-1604 redis-server[5370]: sentinel directive while not in sentinel mode
6609:X 30 May 13:59:57.508 # Sentinel config file /etc/redis-sentinel.conf is not writable: Permission denied. Exiting...
@quulah
Copy link
Author

quulah commented May 30, 2017

The first two are easily fixed.

For the third, I moved the usage of dpkg_autostart to have :create before the installation is done.

For the fourth one, I added Chef version 12.20.3 to the .kitchen.yml files and also added the sentinel suite to the .kitchen.dokken.yml. I also changed the policies to have the run_lists separately, as it looked to me as the default recipe was always converged even though the sentinel one should be separate. But, I have not used Policyfiles before so that could be my fault too.

The fifth one was fixed by using the same template handling in redis_sentinel as the redis_instance already has.

And last, but not least, I added the --sentinel parameter for the process. Ubuntu / Debian also have a separate redis-sentinel package, but I think this is the easiest way. The sentinel_program parameter was also unused, but I left it there for now.

The configuration file has now writable permissions for the user. This is related to issue #18 too.

All this required a few changes to the sentinel control files, but now they're passing.

@quulah quulah mentioned this issue May 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant