Gehel has uploaded a new change for review. https://gerrit.wikimedia.org/r/310307
Change subject: wdqs - make RWStore configuration file configureable ...................................................................... wdqs - make RWStore configuration file configureable To use scap based configuration management, we need to point blazegraph at the location of the generated file. This is mainly a noop at this point, but it provides the required parameters. * wdqs::service::config_file can be used to set the location of the blazegraph config * /etc/wdqs is made writeable to the deploy user so that the config file can be written by scap * wdqs::version is removed as it is unused Bug: T144380 Change-Id: Ib214b857dd46b725afa974232a6e6b8537342e8a --- M hieradata/labs/wikidata-query/common.yaml M modules/wdqs/.fixtures.yml M modules/wdqs/manifests/init.pp M modules/wdqs/manifests/service.pp A modules/wdqs/spec/classes/wdqs_service_spec.rb A modules/wdqs/spec/classes/wdqs_spec.rb M modules/wdqs/templates/initscripts/wdqs-blazegraph.systemd.erb M modules/wdqs/templates/initscripts/wdqs-blazegraph.upstart.erb 8 files changed, 65 insertions(+), 11 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/07/310307/1 diff --git a/hieradata/labs/wikidata-query/common.yaml b/hieradata/labs/wikidata-query/common.yaml index 445e514..10e0830 100644 --- a/hieradata/labs/wikidata-query/common.yaml +++ b/hieradata/labs/wikidata-query/common.yaml @@ -1,6 +1,6 @@ "wdqs::gui::log_aggregator": 'deployment-logstash2.deployment-prep.eqiad.wmflabs:10514' "wdqs::updater::options": '-n wdq -s' -"wdqs::service::use_git_deploy": false +"wdqs::use_git_deploy": false "wdqs::package_dir": '/srv/wdqs/blazegraph' "wdqs::data_dir": '/srv/wdqs/blazegraph' diff --git a/modules/wdqs/.fixtures.yml b/modules/wdqs/.fixtures.yml index 97bb046..a568185 100644 --- a/modules/wdqs/.fixtures.yml +++ b/modules/wdqs/.fixtures.yml @@ -3,7 +3,9 @@ wdqs: "#{source_dir}" base: "../../../../base" diamond: "../../../../diamond" + ferm: "../../../../ferm" java: "../../../../java" monitoring: "../../../../monitoring" + scap: "../../../../scap" stdlib: "../../../../stdlib" wmflib: "../../../../wmflib" diff --git a/modules/wdqs/manifests/init.pp b/modules/wdqs/manifests/init.pp index ae1cf15..7cadfb9 100644 --- a/modules/wdqs/manifests/init.pp +++ b/modules/wdqs/manifests/init.pp @@ -4,13 +4,12 @@ # for now a manual process. # # == Parameters: -# - $version: Version of the service to install # - $username: Username owning the service # - $package_dir: Directory where the service should be installed. # - $data_dir: Directory where the database should be stored # - $log_dir: Directory where the logs go class wdqs( - $version = '0.0.2', + $use_git_deploy = true, $username = 'blazegraph', $package_dir = '/srv/deployment/wdqs/wdqs', $data_dir = '/var/lib/wdqs', @@ -61,11 +60,16 @@ } } + $config_dir_group = $use_git_deploy ? { + true => 'deploy-service', + default => 'root', + } + file { '/etc/wdqs': ensure => directory, owner => 'root', - group => 'root', - mode => '0755', + group => $config_dir_group, + mode => '0775', } file { '/etc/wdqs/vars.yaml': diff --git a/modules/wdqs/manifests/service.pp b/modules/wdqs/manifests/service.pp index f8f65b2..ee27ebb 100644 --- a/modules/wdqs/manifests/service.pp +++ b/modules/wdqs/manifests/service.pp @@ -3,13 +3,14 @@ # Provisions WDQS service package # class wdqs::service( - $use_git_deploy=true, $package_dir=$::wdqs::package_dir, - $username=$::wdqs::username - ) { + $username=$::wdqs::username, + $config_file='RWStore.properties', +) { + include ::wdqs::packages - if $use_git_deploy { + if $::wdqs::use_git_deploy { package { 'wdqs': ensure => present, diff --git a/modules/wdqs/spec/classes/wdqs_service_spec.rb b/modules/wdqs/spec/classes/wdqs_service_spec.rb new file mode 100644 index 0000000..37018f7 --- /dev/null +++ b/modules/wdqs/spec/classes/wdqs_service_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' + +describe 'wdqs::service', :type => :class do + + context 'with systemd' do + let(:facts) { { :initsystem => 'systemd' } } + + it { is_expected.to contain_file('/lib/systemd/system/wdqs-blazegraph.service') + .with_content(/runBlazegraph.sh -f RWStore.properties/) + + } + end + + context 'with upstart' do + let(:facts) { { :initsystem => 'upstart' } } + + it { is_expected.to contain_file('/etc/init/wdqs-blazegraph.conf') + .with_content(/runBlazegraph.sh -f RWStore.properties/) + + } + end + +end \ No newline at end of file diff --git a/modules/wdqs/spec/classes/wdqs_spec.rb b/modules/wdqs/spec/classes/wdqs_spec.rb new file mode 100644 index 0000000..1fcdce0 --- /dev/null +++ b/modules/wdqs/spec/classes/wdqs_spec.rb @@ -0,0 +1,24 @@ +require 'spec_helper' + +describe 'wdqs', :type => :class do + + context 'using git to deploy' do + let(:facts) { { :initsystem => 'systemd' } } + + # secret() is hard to mock, ignoring this test at the moment + xit { is_expected.to contain_file('/etc/wdqs') + .with_group('deploy-service') + } + end + + context 'not using git to deploy' do + let(:params) { { :use_git_deploy => false } } + let(:facts) { { :initsystem => 'systemd' } } + + # secret() is hard to mock, ignoring this test at the moment + xit { is_expected.to contain_file('/etc/wdqs') + .with_group('root') + } + end + +end \ No newline at end of file diff --git a/modules/wdqs/templates/initscripts/wdqs-blazegraph.systemd.erb b/modules/wdqs/templates/initscripts/wdqs-blazegraph.systemd.erb index 32c1b5a..af2a999 100644 --- a/modules/wdqs/templates/initscripts/wdqs-blazegraph.systemd.erb +++ b/modules/wdqs/templates/initscripts/wdqs-blazegraph.systemd.erb @@ -4,7 +4,7 @@ [Service] Type=simple WorkingDirectory=<%= @package_dir %> -ExecStart=/bin/bash <%= @package_dir %>/runBlazegraph.sh +ExecStart=/bin/bash <%= @package_dir %>/runBlazegraph.sh -f <%= @config_file %> User=<%= @username %> StandardOutput=journal+console Restart=always diff --git a/modules/wdqs/templates/initscripts/wdqs-blazegraph.upstart.erb b/modules/wdqs/templates/initscripts/wdqs-blazegraph.upstart.erb index 8fb5cdd..243fab7 100644 --- a/modules/wdqs/templates/initscripts/wdqs-blazegraph.upstart.erb +++ b/modules/wdqs/templates/initscripts/wdqs-blazegraph.upstart.erb @@ -7,6 +7,6 @@ console log chdir <%= @package_dir %> -exec /bin/bash <%= @package_dir %>/runBlazegraph.sh +exec /bin/bash <%= @package_dir %>/runBlazegraph.sh -f <%= @config_file %> respawn respawn limit 10 30 \ No newline at end of file -- To view, visit https://gerrit.wikimedia.org/r/310307 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib214b857dd46b725afa974232a6e6b8537342e8a Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Gehel <gleder...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits