From 922c3005c3e60a1e570bf98589f9ecf9c35bacb9 Mon Sep 17 00:00:00 2001 From: wangyaoguang Date: Wed, 6 Apr 2016 09:49:42 +0800 Subject: [PATCH] add puppet manifests and conf files for rubbos httpd module 1. add two manifests 2. add two configuration files,httpd.conf and workers.properties JIRA: BOTTLENECK-52 Change-Id: Icb651238f597a91ac9b748db487c24959825485c Signed-off-by: wangyaoguang --- .../rubbos_httpd/files/apache_conf/httpd.conf | 324 +++++++++++++++++++++ .../files/apache_conf/workers.properties | 64 ++++ .../rubbos_httpd/manifests/rubbos_httpd_off.pp | 85 ++++++ .../rubbos_httpd/manifests/rubbos_httpd_on.pp | 151 ++++++++++ 4 files changed, 624 insertions(+) create mode 100644 testsuites/rubbos/puppet_manifests/modules/rubbos_httpd/files/apache_conf/httpd.conf create mode 100644 testsuites/rubbos/puppet_manifests/modules/rubbos_httpd/files/apache_conf/workers.properties create mode 100644 testsuites/rubbos/puppet_manifests/modules/rubbos_httpd/manifests/rubbos_httpd_off.pp create mode 100644 testsuites/rubbos/puppet_manifests/modules/rubbos_httpd/manifests/rubbos_httpd_on.pp diff --git a/testsuites/rubbos/puppet_manifests/modules/rubbos_httpd/files/apache_conf/httpd.conf b/testsuites/rubbos/puppet_manifests/modules/rubbos_httpd/files/apache_conf/httpd.conf new file mode 100644 index 00000000..88c62581 --- /dev/null +++ b/testsuites/rubbos/puppet_manifests/modules/rubbos_httpd/files/apache_conf/httpd.conf @@ -0,0 +1,324 @@ +############################################################################# +# Copyright (c) 2016 Huawei Technologies Co.,Ltd and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + + +ServerRoot "REPLACED_RUBBOS_APP_TOOLS/apache2" + + + + + + + + + + + + +PidFile logs/httpd.pid + + +Timeout 5 +KeepAlive Off +MaxKeepAliveRequests 100 +KeepAliveTimeout 15 + + +StartServers 5 +MinSpareServers 5 +MaxSpareServers 10 +ServerLimit 4000 +MaxClients 4000 +MaxRequestsPerChild 0 + + + +ServerLimit 200 +ThreadLimit 300 +StartServers 1 +MaxClients 300 +MinSpareThreads 5 +MaxSpareThreads 50 +ThreadsPerChild 150 +MaxRequestsPerChild 0 + + + +NumServers 5 +StartThreads 5 +MinSpareThreads 5 +MaxSpareThreads 10 +MaxThreadsPerChild 20 +MaxRequestsPerChild 0 + + + +ThreadsPerChild 250 +MaxRequestsPerChild 0 + + + +StartThreads 10 +MaxClients 50 +MaxRequestsPerThread 10000 + + + +ThreadStackSize 65536 +StartThreads 250 +MinSpareThreads 25 +MaxSpareThreads 250 +MaxThreads 1000 +MaxRequestsPerChild 0 +MaxMemFree 100 + + + +StartServers 2 +MinSpareThreads 5 +MaxSpareThreads 10 +MaxRequestsPerChild 0 + + +Listen 8000 + + + +User apache +Group apache + + + +ServerAdmin you@example.com + +UseCanonicalName Off + +DocumentRoot "REPLACED_RUBBOS_APP_TOOLS/apache2/htdocs" + + + Options FollowSymLinks + AllowOverride None + + + + Options Indexes FollowSymLinks + AllowOverride None + Order allow,deny + Allow from all + + +UserDir public_html +DirectoryIndex index.html index.html.var +AccessFileName .htaccess + + Order allow,deny + Deny from all + + +TypesConfig conf/mime.types +DefaultType text/plain + + + MIMEMagicFile conf/magic + + +HostnameLookups Off + +ErrorLog logs/error_log +LogLevel warn +LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined +LogFormat "%h %l %u %t \"%r\" %>s %b" common +LogFormat "%{Referer}i -> %U" referer +LogFormat "%{User-agent}i" agent +CustomLog logs/access_log common + +ServerTokens Full +ServerSignature On +Alias /icons/ "REPLACED_RUBBOS_APP_TOOLS/apache2/icons/" + + + Options Indexes MultiViews + AllowOverride None + Order allow,deny + Allow from all + + +AliasMatch ^/manual(?:/(?:de|en|es|fr|ja|ko|ru))?(/.*)?$ "REPLACED_RUBBOS_APP_TOOLS/apache2/manual$1" + + + Options Indexes + AllowOverride None + Order allow,deny + Allow from all + + + SetHandler type-map + + + SetEnvIf Request_URI ^/manual/(de|en|es|fr|ja|ko|ru)/ prefer-language=$1 + RedirectMatch 301 ^/manual(?:/(de|en|es|fr|ja|ko|ru)){2,}(/.*)?$ /manual/$1$2 + + +ScriptAlias /cgi-bin/ "REPLACED_RUBBOS_APP_TOOLS/apache2/cgi-bin/" + + + + + + AllowOverride None + Options None + Order allow,deny + Allow from all + + +IndexOptions FancyIndexing VersionSort +AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip + +AddIconByType (TXT,/icons/text.gif) text/* +AddIconByType (IMG,/icons/image2.gif) image/* +AddIconByType (SND,/icons/sound2.gif) audio/* +AddIconByType (VID,/icons/movie.gif) video/* + +AddIcon /icons/binary.gif .bin .exe +AddIcon /icons/binhex.gif .hqx +AddIcon /icons/tar.gif .tar +AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv +AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip +AddIcon /icons/a.gif .ps .ai .eps +AddIcon /icons/layout.gif .html .shtml .htm .pdf +AddIcon /icons/text.gif .txt +AddIcon /icons/c.gif .c +AddIcon /icons/p.gif .pl .py +AddIcon /icons/f.gif .for +AddIcon /icons/dvi.gif .dvi +AddIcon /icons/uuencoded.gif .uu +AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl +AddIcon /icons/tex.gif .tex +AddIcon /icons/bomb.gif core + +AddIcon /icons/back.gif .. +AddIcon /icons/hand.right.gif README +AddIcon /icons/folder.gif ^^DIRECTORY^^ +AddIcon /icons/blank.gif ^^BLANKICON^^ + +DefaultIcon /icons/unknown.gif + +ReadmeName README.html +HeaderName HEADER.html + +IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t +AddLanguage ca .ca +AddLanguage cs .cz .cs +AddLanguage da .dk +AddLanguage de .de +AddLanguage el .el +AddLanguage en .en +AddLanguage eo .eo +AddLanguage es .es +AddLanguage et .et +AddLanguage fr .fr +AddLanguage he .he +AddLanguage hr .hr +AddLanguage it .it +AddLanguage ja .ja +AddLanguage ko .ko +AddLanguage ltz .ltz +AddLanguage nl .nl +AddLanguage nn .nn +AddLanguage no .no +AddLanguage pl .po +AddLanguage pt .pt +AddLanguage pt-BR .pt-br +AddLanguage ru .ru +AddLanguage sv .sv +AddLanguage zh-CN .zh-cn +AddLanguage zh-TW .zh-tw + +LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW +ForceLanguagePriority Prefer Fallback +AddCharset ISO-8859-1 .iso8859-1 .latin1 +AddCharset ISO-8859-2 .iso8859-2 .latin2 .cen +AddCharset ISO-8859-3 .iso8859-3 .latin3 +AddCharset ISO-8859-4 .iso8859-4 .latin4 +AddCharset ISO-8859-5 .iso8859-5 .latin5 .cyr .iso-ru +AddCharset ISO-8859-6 .iso8859-6 .latin6 .arb +AddCharset ISO-8859-7 .iso8859-7 .latin7 .grk +AddCharset ISO-8859-8 .iso8859-8 .latin8 .heb +AddCharset ISO-8859-9 .iso8859-9 .latin9 .trk +AddCharset ISO-2022-JP .iso2022-jp .jis +AddCharset ISO-2022-KR .iso2022-kr .kis +AddCharset ISO-2022-CN .iso2022-cn .cis +AddCharset Big5 .Big5 .big5 +# For russian, more than one charset is used (depends on client, mostly): +AddCharset WINDOWS-1251 .cp-1251 .win-1251 +AddCharset CP866 .cp866 +AddCharset KOI8-r .koi8-r .koi8-ru +AddCharset KOI8-ru .koi8-uk .ua +AddCharset ISO-10646-UCS-2 .ucs2 +AddCharset ISO-10646-UCS-4 .ucs4 +AddCharset UTF-8 .utf8 +AddCharset GB2312 .gb2312 .gb +AddCharset utf-7 .utf7 +AddCharset utf-8 .utf8 +AddCharset big5 .big5 .b5 +AddCharset EUC-TW .euc-tw +AddCharset EUC-JP .euc-jp +AddCharset EUC-KR .euc-kr +AddCharset shift_jis .sjis + +AddType application/x-compress .Z +AddType application/x-gzip .gz .tgz +AddHandler type-map var + +BrowserMatch "Mozilla/2" nokeepalive +BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0 +BrowserMatch "RealPlayer 4\.0" force-response-1.0 +BrowserMatch "Java/1\.0" force-response-1.0 +BrowserMatch "JDK/1\.0" force-response-1.0 + +BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully +BrowserMatch "^WebDrive" redirect-carefully +BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully +BrowserMatch "^gnome-vfs" redirect-carefully + + Include conf/ssl.conf + + + +LoadModule jk_module "REPLACED_RUBBOS_APP_TOOLS/apache2/modules/mod_jk.so" + +# Where to find workers.properties +JkWorkersFile REPLACED_RUBBOS_APP_TOOLS/apache2/conf/workers.properties + +# Where to put jk logs +JkLogFile REPLACED_RUBBOS_APP_TOOLS/apache2/logs/mod_jk.log + +# Set the jk log level [debug/error/info] +JkLogLevel info + +# Select the log format +JkLogStampFormat "[%a %b %d %H:%M:%S %Y] " + +# JkOptions indicate to send SSL KEY SIZE, +JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories + +# JkRequestLogFormat set the request format +JkRequestLogFormat "%w %V %T" + +# Globally deny access to the WEB-INF directory + + AllowOverride None + deny from all + + +#Important: which requrests will be reouted to app server +JkMount /*/servlet/* worker1 +JkMount /*.jsp worker1 + +ServerName localhost diff --git a/testsuites/rubbos/puppet_manifests/modules/rubbos_httpd/files/apache_conf/workers.properties b/testsuites/rubbos/puppet_manifests/modules/rubbos_httpd/files/apache_conf/workers.properties new file mode 100644 index 00000000..cdf0a783 --- /dev/null +++ b/testsuites/rubbos/puppet_manifests/modules/rubbos_httpd/files/apache_conf/workers.properties @@ -0,0 +1,64 @@ +############################################################################# +# Copyright (c) 2016 Huawei Technologies Co.,Ltd and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + + +# workers.properties +# +# This file provides jk derived plugins with the needed information to +# connect to the different tomcat workers. Note that the distributed +# version of this file requires modification before it is usable by a +# plugin. +# + +# workers.tomcat_home should point to the location where you +# installed tomcat. This is where you have your conf, webapps and lib +# directories. +workers.tomcat_home=REPLACED_RUBBOS_APP_TOOLS/apache-tomcat-5.5.17 + +# workers.java_home should point to your Java installation. Normally +# you should have a bin and lib directories beneath it. +workers.java_home=REPLACED_RUBBOS_APP_TOOLS/jdk1.6.0_27 + +# You should configure your environment slash... ps=\ on NT and / on UNIX +# and maybe something different elsewhere. +ps=/ + + +# The workers that your plugins should create and work with +worker.list=worker1 + +# Here, it can be declared multiple session handlers, such as s1, s2 +REPLACED_HANDLERS_DETAILS +# examples: +#worker.s1.port=8009 +#worker.s1.host=btnks-2 +#worker.s1.type=ajp13 +#worker.s1.lbfactor=1 + +worker.worker1.type=lb +worker.worker1.balance_workers=REPLACED_HANDLERS +# example: +#worker.worker1.balance_workers=s1 +worker.worker1.sticky_session=True +worker.worker1.method=Session + +# Defining a worker named inprocess and of type jni +# Note that the name and the type do not have to match. +worker.inprocess.type=jni + +# Additional class path components. +worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)tomcat.jar + +# Setting the command line for tomcat. +# Note: The cmd_line string may not contain spaces. +worker.inprocess.cmd_line=start + +worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)lib$(ps)i386$(ps)server$(ps)libjvm.so +worker.inprocess.stdout=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stdout +worker.inprocess.stderr=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stderr diff --git a/testsuites/rubbos/puppet_manifests/modules/rubbos_httpd/manifests/rubbos_httpd_off.pp b/testsuites/rubbos/puppet_manifests/modules/rubbos_httpd/manifests/rubbos_httpd_off.pp new file mode 100644 index 00000000..5d5f3839 --- /dev/null +++ b/testsuites/rubbos/puppet_manifests/modules/rubbos_httpd/manifests/rubbos_httpd_off.pp @@ -0,0 +1,85 @@ +############################################################################# +# Copyright (c) 2016 Huawei Technologies Co.,Ltd and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + + +class rubbos_httpd::rubbos_httpd_off { + + include params::rubbos_params + + # Declare some variables + $rubbos_app_tools = $params::rubbos_params::rubbos_app_tools + + # Ensure apache2 service is stopped + service {'stop apache http server': + ensure => stopped, + hasstatus => false, + status => "ps aux | grep 'bin/httpd.*start$'", + start => "${rubbos_app_tools}/apache2/bin/apachectl -f ${rubbos_app_tools}/apache2/conf/httpd.conf -k start", + stop => "${rubbos_app_tools}/apache2/bin/apachectl -f ${rubbos_app_tools}/apache2/conf/httpd.conf -k stop", + } + + # delete directory + file {'${rubbos_app_tools}/httpd-2.0.64.tar.gz': + ensure => absent, + path => "${rubbos_app_tools}/httpd-2.0.64.tar.gz", + force => true, + backup => false, + } + + file {'${rubbos_app_tools}/httpd-2.0.64': + ensure => absent, + path => "${rubbos_app_tools}/httpd-2.0.64", + force => true, + recurse => true, + backup => false, + require => Service['stop apache http server'], + } + + file {'${rubbos_app_tools}/tomcat-connectors-1.2.32-src.tar.gz': + ensure => absent, + path => "${rubbos_app_tools}/tomcat-connectors-1.2.32-src.tar.gz", + force => true, + backup => false, + } + + file {'${rubbos_app_tools}/tomcat-connectors-1.2.32-src': + ensure => absent, + path => "${rubbos_app_tools}/tomcat-connectors-1.2.32-src", + force => true, + recurse => true, + backup => false, + require => Service['stop apache http server'], + } + + # Delete apache2 directory + exec {'rm -rf ${rubbos_app_tools}/apache2': + cwd => "${rubbos_app_tools}/", + command => "rm -rf ${rubbos_app_tools}/apache2", + path => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"], + onlyif => "test -d ${rubbos_app_tools}/apache2", + } + + # delete user and group + user {'apache': + name => "apache", + ensure => absent, + groups => "apache", + password => "apache", + require => [ + File['${rubbos_app_tools}/httpd-2.0.64'], + File['${rubbos_app_tools}/tomcat-connectors-1.2.32-src'], + Exec['rm -rf ${rubbos_app_tools}/apache2']], + } + group {'apache': + name => "apache", + ensure => absent, + require => User['apache'], + } + +} diff --git a/testsuites/rubbos/puppet_manifests/modules/rubbos_httpd/manifests/rubbos_httpd_on.pp b/testsuites/rubbos/puppet_manifests/modules/rubbos_httpd/manifests/rubbos_httpd_on.pp new file mode 100644 index 00000000..92d819cd --- /dev/null +++ b/testsuites/rubbos/puppet_manifests/modules/rubbos_httpd/manifests/rubbos_httpd_on.pp @@ -0,0 +1,151 @@ +############################################################################# +# Copyright (c) 2016 Huawei Technologies Co.,Ltd and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + + +class rubbos_httpd::rubbos_httpd_on { + + include params::rubbos_params + require rubbos_common::rubbos_common_on + + # Declare some variables + $rubbos_app_tools = $params::rubbos_params::rubbos_app_tools + + # Prepare apache2 directory + exec {'mkdir ${rubbos_app_tools}/apache2': + command => "mkdir -p ${rubbos_app_tools}/apache2", + creates => "${rubbos_app_tools}/apache2", + path => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"], + } + + # Prepare packages + file {'${rubbos_app_tools}/httpd-2.0.64.tar.gz': + ensure => file, + path => "${rubbos_app_tools}/httpd-2.0.64.tar.gz", + source => "puppet:///modules/rubbos_httpd/httpd-2.0.64.tar.gz", + backup => false, + } + + exec {'tar xzvf ${rubbos_app_tools}/httpd-2.0.64.tar.gz': + cwd => "${rubbos_app_tools}", + command => "tar xzvf ${rubbos_app_tools}/httpd-2.0.64.tar.gz", + path => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"], + require => File['${rubbos_app_tools}/httpd-2.0.64.tar.gz'], + } + + file {'${rubbos_app_tools}/tomcat-connectors-1.2.32-src.tar.gz': + ensure => file, + path => "${rubbos_app_tools}/tomcat-connectors-1.2.32-src.tar.gz", + source => "puppet:///modules/rubbos_httpd/tomcat-connectors-1.2.32-src.tar.gz", + backup => false, + } + + exec {'tar xzvf ${rubbos_app_tools}/tomcat-connectors-1.2.32-src.tar.gz': + cwd => "${rubbos_app_tools}", + command => "tar xzvf ${rubbos_app_tools}/tomcat-connectors-1.2.32-src.tar.gz", + path => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"], + require => File['${rubbos_app_tools}/tomcat-connectors-1.2.32-src.tar.gz'], + } + + # Add user and group + group {'apache': + name => "apache", + ensure => present, + before => User['apache'], + } + user {'apache': + name => "apache", + ensure => present, + groups => "apache", + password => "apache", + } + + # Install apache http server + exec {'${rubbos_app_tools}/httpd-2.0.64/configure': + cwd => "${rubbos_app_tools}/httpd-2.0.64", + command => "${rubbos_app_tools}/httpd-2.0.64/configure --prefix=${rubbos_app_tools}/apache2 --enable-module=so --enable-so --with-mpm=worker", + path => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"], + require => [ + Exec['tar xzvf ${rubbos_app_tools}/httpd-2.0.64.tar.gz'], + User['apache'], + Exec['mkdir ${rubbos_app_tools}/apache2']], + } + + exec {'make httpd': + cwd => "${rubbos_app_tools}/httpd-2.0.64", + command => "make", + path => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"], + require => Exec['${rubbos_app_tools}/httpd-2.0.64/configure'], + } + + exec {'make install httpd': + cwd => "${rubbos_app_tools}/httpd-2.0.64", + command => "make install", + path => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"], + require => Exec['make httpd'], + } + + # Install mod jk + exec {'${rubbos_app_tools}/tomcat-connectors-1.2.32-src/native/configure': + cwd => "${rubbos_app_tools}/tomcat-connectors-1.2.32-src/native", + command => "${rubbos_app_tools}/tomcat-connectors-1.2.32-src/native/configure --with-apxs=${rubbos_app_tools}/apache2/bin/apxs --enable-jni --with-java-home=${rubbos_app_tools}/jdk1.6.0_27", + path => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"], + require => Exec['make install httpd'], + } + + exec {'make mod jk': + cwd => "${rubbos_app_tools}/tomcat-connectors-1.2.32-src/native", + command => "make", + path => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"], + require => Exec['${rubbos_app_tools}/tomcat-connectors-1.2.32-src/native/configure'], + } + + exec {'make install mod jk': + cwd => "${rubbos_app_tools}/tomcat-connectors-1.2.32-src/native", + command => "make install", + path => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"], + require => Exec['make mod jk'], + } + + # Config apache http server + file {'${rubbos_app_tools}/apache2/conf/httpd.conf': + ensure => file, + path => "${rubbos_app_tools}/apache2/conf/httpd.conf", + source => "puppet:///modules/rubbos_httpd/apache_conf/httpd.conf", + show_diff => false, + require => Exec['make install mod jk'], + } + + file {'${rubbos_app_tools}/apache2/conf/workers.properties': + ensure => file, + path => "${rubbos_app_tools}/apache2/conf/workers.properties", + source => "puppet:///modules/rubbos_httpd/apache_conf/workers.properties", + show_diff => false, + require => Exec['make install mod jk'], + } + + file {'${rubbos_app_tools}/apache2/htdocs/rubbos': + ensure => directory, + path => "${rubbos_app_tools}/apache2/htdocs/rubbos", + recurse => true, + source => "puppet:///modules/rubbos_httpd/apache_files/rubbos_html", + show_diff => false, + require => Exec['make install mod jk'], + } + + # Ensure apache2 service is running + service {'apache http server': + ensure => running, + hasstatus => false, + status => "ps aux | grep 'bin/httpd.*start$'", + start => "${rubbos_app_tools}/apache2/bin/apachectl -f ${rubbos_app_tools}/apache2/conf/httpd.conf -k start", + stop => "${rubbos_app_tools}/apache2/bin/apachectl -f ${rubbos_app_tools}/apache2/conf/httpd.conf -k stop", + require => File['${rubbos_app_tools}/apache2/htdocs/rubbos'], + } + +} -- 2.16.6