Configure apache via apache state
Change-Id: I4a8b0dce70f334f6520d0b7a33ba7f97d6cdfc56
Related-Prod: PROD-16189
diff --git a/.kitchen.yml b/.kitchen.yml
index e704682..c93f958 100644
--- a/.kitchen.yml
+++ b/.kitchen.yml
@@ -14,6 +14,10 @@
formula: horizon
grains:
noservices: False
+ dependencies:
+ - name: apache
+ repo: git
+ source: https://github.com/salt-formulas/salt-formula-apache
state_top:
base:
"*":
@@ -22,6 +26,7 @@
top.sls:
base:
"*":
+ - apache_single
- horizon
verifier:
@@ -41,10 +46,12 @@
- name: cluster
provisioner:
pillars-from-files:
+ apache_single.sls: tests/pillar/apache_single.sls
horizon.sls: tests/pillar/cluster.sls
- name: single
provisioner:
pillars-from-files:
+ apache_single.sls: tests/pillar/apache_single.sls
horizon.sls: tests/pillar/single.sls
# vim: ft=yaml sw=2 ts=2 sts=2 tw=125
diff --git a/.travis.yml b/.travis.yml
index 9e91ad8..e607c9a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -20,8 +20,6 @@
- bundle install
env:
- - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2016.3 SUITE=cluster
- - PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2016.3 SUITE=single
- PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2017.7 SUITE=cluster
- PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2017.7 SUITE=single
- PLATFORM=epcim/salt:saltstack-ubuntu-xenial-salt-2018.3 SUITE=cluster
diff --git a/horizon/map.jinja b/horizon/map.jinja
index cf7c503..8e5f9fe 100644
--- a/horizon/map.jinja
+++ b/horizon/map.jinja
@@ -4,7 +4,7 @@
{% set server = salt['grains.filter_by']({
'Debian': {
- 'pkgs': ['apache2', 'libapache2-mod-wsgi', dashboard_package, 'python-lesscpy', 'python-memcache', 'gettext-base'],
+ 'pkgs': [dashboard_package, 'python-lesscpy', 'python-memcache', 'gettext-base'],
'pkgs_multi': ['python-memcache', 'python-psycopg2', 'python-imaging',
'python-docutils', 'python-simplejson', 'build-essential',
'libxslt1-dev', 'libxml2-dev', 'libffi-dev', 'libssl-dev',
diff --git a/horizon/server/service.sls b/horizon/server/service.sls
index d0d76c8..4110bb1 100644
--- a/horizon/server/service.sls
+++ b/horizon/server/service.sls
@@ -1,6 +1,9 @@
{%- from "horizon/map.jinja" import server with context %}
{%- if server.enabled %}
+include:
+ - apache
+
horizon_packages:
pkg.installed:
- names: {{ server.pkgs }}
diff --git a/metadata.yml b/metadata.yml
index b2edf1a..20dc81c 100644
--- a/metadata.yml
+++ b/metadata.yml
@@ -4,3 +4,5 @@
dependencies:
- name: linux
source: "https://github.com/salt-formulas/salt-formula-linux"
+ - name: apache
+ source: "https://github.com/salt-formulas/salt-formula-apache"
diff --git a/tests/pillar/apache_single.sls b/tests/pillar/apache_single.sls
new file mode 100644
index 0000000..c8802f0
--- /dev/null
+++ b/tests/pillar/apache_single.sls
@@ -0,0 +1,50 @@
+ apache:
+ server:
+ enabled: true
+ bind:
+ address: 0.0.0.0
+ ports:
+ - 80
+ - 443
+ protocol: tcp
+ modules:
+ - ssl
+ - rewrite
+ default_mpm: prefork
+ mpm:
+ prefork:
+ servers:
+ start: 5
+ spare:
+ min: ${apache:server:mpm:prefork:servers:start}
+ max: 10
+ # Avoid memory leakage by restarting workers every x requests
+ max_requests: 0
+ # Should be 80% of server memory / average memory usage of one worker
+ max_clients: 150
+ # Should be same or more than max clients
+ limit: ${apache:server:mpm:prefork:max_clients}
+ event:
+ servers:
+ start: 5
+ spare:
+ min: 25
+ max: 75
+ threads_per_child: 25
+ # Avoid memory leakage by restarting workers every x requests
+ max_requests: 0
+ # Should be 80% of server memory / average memory usage of one worker
+ max_clients: 150
+ limit: 64
+ worker:
+ servers:
+ start: 5
+ spare:
+ min: 25
+ max: 75
+ threads_per_child: 25
+ # Avoid memory leakage by restarting workers every x requests
+ max_requests: 0
+ # Should be 80% of server memory / average memory usage of one worker
+ max_clients: 150
+ limit: 64
diff --git a/tests/pillar/cluster.sls b/tests/pillar/cluster.sls
index 9eeab95..d6ab61d 100644
--- a/tests/pillar/cluster.sls
+++ b/tests/pillar/cluster.sls
@@ -1,3 +1,5 @@
+include:
+ - .apache_single
horizon:
server:
enabled: true
diff --git a/tests/pillar/single.sls b/tests/pillar/single.sls
index 08f6794..63acaff 100644
--- a/tests/pillar/single.sls
+++ b/tests/pillar/single.sls
@@ -1,3 +1,5 @@
+include:
+ - .apache_single
horizon:
server:
enabled: true