From 814b6585e536c1af66d1521f1ec95a44c174cdef Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Wed, 25 May 2016 17:31:25 -0400 Subject: [PATCH] Add memcached to api server This commit adds installing and configuring memcached to the api server. It then configures the api server to use memcached for it's local response cache. This is needed to enable the async worker from openstack-health change I0fd29839c72ca2fdfb4c4724bb3da7e283e3d27d. Change-Id: I3057e7f9f920550a12c12c1bfeb643a713c5f696 --- manifests/api.pp | 16 ++++++++++++++-- metadata.json | 3 ++- templates/openstack-health.conf.erb | 2 ++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/manifests/api.pp b/manifests/api.pp index 65e77a1..cf2bfaf 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -50,6 +50,11 @@ class openstack_health::api( version => 'system', } + class { '::memcached': + max_memory => '60%', + listen_ip => '127.0.0.1', + } + vcsrepo { $elastic_recheck_dir : ensure => latest, owner => 'openstack_health', @@ -95,9 +100,16 @@ class openstack_health::api( ensure => present, } + package {'libmemcached-dev': + ensure => present, + } + exec { 'requirements': - command => "${virtualenv_dir}/bin/pip install -U -r ${source_dir}/requirements.txt", - require => Python::Virtualenv[$virtualenv_dir], + command => "${virtualenv_dir}/bin/pip install -U -r ${source_dir}/requirements.txt pylibmc", + require => [ + Python::Virtualenv[$virtualenv_dir], + Package['libmemcached-dev'], + ], subscribe => Vcsrepo[$source_dir], refreshonly => true, timeout => 1800, diff --git a/metadata.json b/metadata.json index 99bb290..90cd9fa 100644 --- a/metadata.json +++ b/metadata.json @@ -19,6 +19,7 @@ } ], "dependencies": [ - {"name":"openstackinfra/vcsrepo","version_requirement":">= 0.0.8"} + {"name":"openstackinfra/vcsrepo","version_requirement":">= 0.0.8"}, + {"name":"saz/memcached","version_requirement":">= 2.8.1"} ] } diff --git a/templates/openstack-health.conf.erb b/templates/openstack-health.conf.erb index c54c0c1..d9921f3 100644 --- a/templates/openstack-health.conf.erb +++ b/templates/openstack-health.conf.erb @@ -1,6 +1,8 @@ [default] query_dir = <%= @elastic_recheck_dir %>/queries cache_expiration = <%= @cache_expiration %> +cache_backend = dogpile.cache.pylibmc +cache_url = 127.0.0.1 db_uri = <%= scope.lookupvar("openstack_health::api::db_uri") %> <% if @ignored_keys.length > 0 -%> ignored_run_metadata_keys =