From 1d9e1c66abb91d2657beacabcc9e3f552b8f5c12 Mon Sep 17 00:00:00 2001 From: Matthew Mosesohn Date: Sun, 20 Apr 2014 19:42:40 +0400 Subject: [PATCH] Update OSTF to use ostf.conf instead of params OSTF deployment with a conf file will allow simplier calling of OSTF service from supervisord. blueprint fuel-containerization-of-services Change-Id: I5c81335fa0d59e9bdfc5faf38990281aad8e73eb --- deployment/puppet/nailgun/manifests/ostf.pp | 40 ++++++++++++------- .../puppet/nailgun/templates/ostf.conf.erb | 9 +++++ .../templates/supervisor/ostf.conf.erb | 2 +- 3 files changed, 35 insertions(+), 16 deletions(-) create mode 100644 deployment/puppet/nailgun/templates/ostf.conf.erb diff --git a/deployment/puppet/nailgun/manifests/ostf.pp b/deployment/puppet/nailgun/manifests/ostf.pp index 030a16e790..73d3f39dfe 100644 --- a/deployment/puppet/nailgun/manifests/ostf.pp +++ b/deployment/puppet/nailgun/manifests/ostf.pp @@ -1,16 +1,18 @@ class nailgun::ostf( $pip_opts, $production, - $venv = '/opt/fuel_plugins/ostf', - $dbuser = 'ostf', - $dbpass = 'ostf', - $dbname = 'ostf', - $dbhost = '127.0.0.1', - $dbport = '5432', - $dbengine = 'postgresql+psycopg2', - $host = '127.0.0.1', - $port = '8777', - $logfile = '/var/log/ostf.log', + $venv = '/opt/fuel_plugins/ostf', + $dbuser = 'ostf', + $dbpass = 'ostf', + $dbname = 'ostf', + $dbhost = '127.0.0.1', + $dbport = '5432', + $nailgun_host = '127.0.0.1', + $nailgun_port = '8000', + $dbengine = 'postgresql+psycopg2', + $host = '127.0.0.1', + $port = '8777', + $logfile = '/var/log/ostf.log', ){ package{'libevent-devel':} package{'openssl-devel':} @@ -30,11 +32,10 @@ class nailgun::ostf( exec {'ostf-init': command => "/usr/bin/ostf-server \ - --host=${host} --port=${port} --log_file=${logfile} \ - --dbpath '${dbengine}://${dbuser}:${dbpass}@${dbhost}:${dbport}/${dbname}' \ --after-initialization-environment-hook || /bin/true", require => [ Package["fuel-ostf"], + File["/etc/ostf/ostf.conf"], ], before => Class['nailgun::supervisor'], } @@ -77,10 +78,8 @@ class nailgun::ostf( nailgun::venv::pip { "${venv}_ostf": package => 'fuel-ostf', } - exec {'ostf-init': + exec {'ostf-init2': command => "$venv/bin/ostf-server \ - --host=${host} --port=${port} --log_file=${logfile} \ - --dbpath '${dbengine}://${dbuser}:${dbpass}@${dbhost}:${dbport}/${dbname}' \ --after-initialization-environment-hook || /bin/true", require => [ Postgresql::Db[$dbname], @@ -97,4 +96,15 @@ class nailgun::ostf( content => template('nailgun/supervisor/ostf.conf.erb'), require => Package['supervisor'], } + file { '/etc/ostf/': + ensure => directory, + owner => 'root', + group => 'root', + mode => '0750', + } + file { '/etc/ostf/ostf.conf': + owner => 'root', + group => 'root', + content => template('nailgun/ostf.conf.erb'), + } } diff --git a/deployment/puppet/nailgun/templates/ostf.conf.erb b/deployment/puppet/nailgun/templates/ostf.conf.erb new file mode 100644 index 0000000000..6a55017e93 --- /dev/null +++ b/deployment/puppet/nailgun/templates/ostf.conf.erb @@ -0,0 +1,9 @@ +[adapter] +server_host = <%= @host %> +server_port = <%= @port %> +dbpath = <%= @dbengine %>://<%= @dbuser %>:<%= @dbpass %>@<%= @dbhost %>/<%= @dbname %> +lock_dir = /var/lock +nailgun_host = <%= @nailgun_host %> +nailgun_port = <%= @nailgun_port %> +log_file = <%= @logfile %> +after_init_hook = False diff --git a/deployment/puppet/nailgun/templates/supervisor/ostf.conf.erb b/deployment/puppet/nailgun/templates/supervisor/ostf.conf.erb index c7ecb82035..8ff8f68ea4 100644 --- a/deployment/puppet/nailgun/templates/supervisor/ostf.conf.erb +++ b/deployment/puppet/nailgun/templates/supervisor/ostf.conf.erb @@ -1,5 +1,5 @@ [program:ostf] -command=<%= @ostf_env %>/bin/ostf-server --host=<%= @host %> --port=8777 --log_file=<%= @logfile %> --dbpath <%= @dbengine %>://<%= @dbuser %>:<%= @dbpass %>@<%= @dbhost %>:<%= @dbport %>/<%= @dbname %> +command=/usr/bin/ostf-server process_name=%(program_name)s numprocs=1 numprocs_start=0