Improve Panko formula
- enabled kitchen tests
- removed unneeded kitchen ymls
- added possibility to configure site from pillar
- fixed small issues with pillars
- fixed old site template
Change-Id: Iba29c459794bc350ab0640a0447efaa6e9512dfd
Related-Prod: PROD-17189
diff --git a/.kitchen.docker.yml b/.kitchen.docker.yml
deleted file mode 100644
index 348675b..0000000
--- a/.kitchen.docker.yml
+++ /dev/null
@@ -1,43 +0,0 @@
----
-driver:
- name: docker
- hostname: panko.ci.local
- use_sudo: false
-
-provisioner:
- name: salt_solo
- salt_install: bootstrap
- salt_bootstrap_url: https://bootstrap.saltstack.com
- salt_version: latest
- require_chef: false
- log_level: error
- formula: panko
- grains:
- noservices: True
- state_top:
- base:
- "*":
- - panko
- pillars:
- top.sls:
- base:
- "*":
- - panko
-
-verifier:
- name: inspec
- sudo: true
-
-
-platforms:
- - name: <%=ENV['PLATFORM'] || 'ubuntu-xenial'%>
- driver_config:
- image: <%=ENV['PLATFORM'] || 'trevorj/salty-whales:xenial'%>
- platform: ubuntu
-
-suites:
- - name: default
- # provisioner:
- # pillars-from-files:
- # panko.sls: tests/pillar/default.sls
-# vim: ft=yaml sw=2 ts=2 sts=2 tw=125
diff --git a/.kitchen.openstack.yml b/.kitchen.openstack.yml
deleted file mode 100644
index 6dbf7b2..0000000
--- a/.kitchen.openstack.yml
+++ /dev/null
@@ -1,41 +0,0 @@
-
-# usage: `KITCHEN_LOCAL_YAML=.kitchen.openstack.yml kitchen test`
-
-# https://docs.chef.io/config_yml_kitchen.html
-# https://github.com/test-kitchen/kitchen-openstack
-
----
-driver:
- name: openstack
- openstack_auth_url: <%= ENV['OS_AUTH_URL'] %>/tokens
- openstack_username: <%= ENV['OS_USERNAME'] || 'ci' %>
- openstack_api_key: <%= ENV['OS_PASSWORD'] || 'ci' %>
- openstack_tenant: <%= ENV['OS_TENANT_NAME'] || 'ci_jenkins' %>
-
- #floating_ip_pool: <%= ENV['OS_FLOATING_IP_POOL'] || 'nova' %>
- key_name: <%= ENV['BOOTSTRAP_SSH_KEY_NAME'] || 'bootstrap_insecure' %>
- private_key_path: <%= ENV['BOOTSTRAP_SSH_KEY_PATH'] || "#{ENV['HOME']}/.ssh/id_rsa_bootstrap_insecure" %>
-
-
-platforms:
- - name: ubuntu-14.04
- driver:
- username: <%= ENV['OS_UBUNTU_IMAGE_USER'] || 'root' %>
- image_ref: <%= ENV['OS_UBUNTU_IMAGE_REF'] || 'ubuntu-14-04-x64-1455869035' %>
- flavor_ref: m1.medium
- network_ref:
- <% if ENV['OS_NETWORK_REF'] -%>
- - <% ENV['OS_NETWORK_REF'] %>
- <% else -%>
- - ci-net
- <% end -%>
- # force update apt cache on the image
- run_list:
- - recipe[apt]
- attributes:
- apt:
- compile_time_update: true
-transport:
- username: <%= ENV['OS_UBUNTU_IMAGE_USER'] || 'root' %>
-
-# vim: ft=yaml sw=2 ts=2 sts=2 tw=125
diff --git a/.kitchen.vagrant.yml b/.kitchen.vagrant.yml
deleted file mode 100644
index bf2dec2..0000000
--- a/.kitchen.vagrant.yml
+++ /dev/null
@@ -1,30 +0,0 @@
----
-driver:
- name: vagrant
- vm_hostname: panko.ci.local
- use_sudo: false
- customize:
- memory: 512
-
-
-provisioner:
- name: salt_solo
- salt_install: bootstrap
- salt_bootstrap_url: https://bootstrap.saltstack.com
- salt_version: latest
- require_chef: false
- formula: panko
- log_level: info
- state_top:
- base:
- "*":
- - panko
- pillars:
- top.sls:
- base:
- "*":
- - panko
- grains:
- noservices: True
-
-# vim: ft=yaml sw=2 ts=2 sts=2 tw=125
diff --git a/.kitchen.yml b/.kitchen.yml
new file mode 100644
index 0000000..1d18119
--- /dev/null
+++ b/.kitchen.yml
@@ -0,0 +1,71 @@
+---
+driver:
+ name: docker
+ hostname: panko.ci.local
+ use_sudo: false
+
+provisioner:
+ name: salt_solo
+ salt_install: bootstrap
+ salt_bootstrap_url: https://bootstrap.saltstack.com
+ salt_version: latest
+ require_chef: false
+ log_level: error
+ formula: panko
+ grains:
+ noservices: True
+ dependencies:
+ - name: linux
+ repo: git
+ source: https://github.com/salt-formulas/salt-formula-linux
+ - name: apache
+ repo: git
+ source: https://github.com/salt-formulas/salt-formula-apache
+ state_top:
+ base:
+ "*":
+ - linux.system
+ - apache
+ - panko
+ pillars:
+ top.sls:
+ base:
+ "*":
+ - linux_repo_openstack
+ - panko
+ - release
+ pillars-from-files:
+ linux_repo_openstack.sls: tests/pillar/repo_mcp_openstack_<%= ENV['OS_VERSION'] || 'pike' %>.sls
+
+verifier:
+ name: inspec
+ sudo: true
+
+platforms:
+ - name: <%= ENV['PLATFORM'] || 'ubuntu-xenial' %>
+ driver_config:
+ image: <%= ENV['PLATFORM'] || 'epcim/salt-formulas:saltstack-ubuntu-xenial-salt-2016.3' %>
+ platform: ubuntu
+
+suites:
+
+ - name: server_cluster
+ provisioner:
+ pillars-from-files:
+ panko.sls: tests/pillar/server_cluster.sls
+ pillars:
+ release.sls:
+ panko:
+ server:
+ version: <%= ENV['OS_VERSION'] || 'pike' %>
+
+ - name: server_single
+ provisioner:
+ pillars-from-files:
+ panko.sls: tests/pillar/server_single.sls
+ pillars:
+ release.sls:
+ panko:
+ server:
+ version: <%= ENV['OS_VERSION'] || 'pike' %>
+# vim: ft=yaml sw=2 ts=2 sts=2 tw=125
diff --git a/.travis.yml b/.travis.yml
index 7a77247..e90c8eb 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -17,15 +17,16 @@
- bundle install
env:
- - PLATFORM=trevorj/salty-whales:trusty
- - PLATFORM=trevorj/salty-whales:xenial
+ - PLATFORM=epcim/salt-formulas:saltstack-ubuntu-xenial-salt-2016.3 OS_VERSION=pike SUITE=server_cluster
+ - PLATFORM=epcim/salt-formulas:saltstack-ubuntu-xenial-salt-2016.3 OS_VERSION=pike SUITE=server_single
before_script:
- set -o pipefail
- make test | tail
script:
- - test ! -e .kitchen.yml || bundle exec kitchen test -t tests/integration
+ - test ! -e .kitchen.yml || bundle exec kitchen converge ${SUITE} || true
+ - test ! -e .kitchen.yml || bundle exec kitchen verify ${SUITE} -t tests/integration
notifications:
webhooks:
@@ -36,4 +37,4 @@
on_start: never # options: [always|never|change] default: always
on_cancel: never # options: [always|never|change] default: always
on_error: never # options: [always|never|change] default: always
- email: false
+ email: false
\ No newline at end of file
diff --git a/panko/files/pike/panko-api.apache2.conf.Debian b/panko/files/pike/panko-api.apache2.conf.Debian
index b5b7f31..acde5ac 100644
--- a/panko/files/pike/panko-api.apache2.conf.Debian
+++ b/panko/files/pike/panko-api.apache2.conf.Debian
@@ -11,4 +11,13 @@
</IfVersion>
ErrorLog /var/log/apache2/panko_error.log
CustomLog /var/log/apache2/panko_access.log combined
+ <Directory /usr/bin>
+ <IfVersion >= 2.4>
+ Require all granted
+ </IfVersion>
+ <IfVersion < 2.4>
+ Order allow,deny
+ Allow from all
+ </IfVersion>
+ </Directory>
</VirtualHost>
diff --git a/panko/server.sls b/panko/server.sls
index 944c82e..f0dadce 100644
--- a/panko/server.sls
+++ b/panko/server.sls
@@ -12,13 +12,28 @@
- require:
- pkg: panko_server_packages
-{%- if not grains.get('noservices', False) %}
panko_syncdb:
cmd.run:
- name: panko-dbsync
+ {%- if grains.get('noservices') %}
+ - onlyif: /bin/false
+ {%- endif %}
- require:
- file: /etc/panko/panko.conf
-{%- endif %}
+
+{#- Creation of sites using templates is deprecated, sites should be generated by apache pillar, and enabled by panko formula #}
+{%- if pillar.get('apache', {}).get('server', {}).get('site', {}).panko is defined %}
+
+apache_enable_panko_wsgi:
+ apache_site.enabled:
+ - name: wsgi_panko
+ {%- if grains.get('noservices') %}
+ - onlyif: /bin/false
+ {%- endif %}
+ - require:
+ - pkg: panko_server_packages
+
+{%- else %}
/etc/apache2/sites-available/panko-api.conf:
file.managed:
@@ -27,17 +42,26 @@
- require:
- pkg: panko_server_packages
-panko_api_config:
- file.symlink:
- - name: /etc/apache2/sites-enabled/panko-api.conf
- - target: /etc/apache2/sites-available/panko-api.conf
+apache_enable_panko_wsgi:
+ apache_site.enabled:
+ - name: panko-api
+ {%- if grains.get('noservices') %}
+ - onlyif: /bin/false
+ {%- endif %}
+ - require:
+ - file: /etc/apache2/sites-available/panko-api.conf
+
+{%- endif %}
panko_apache_restart:
service.running:
- enable: true
- name: apache2
+ {%- if grains.get('noservices') %}
+ - onlyif: /bin/false
+ {%- endif %}
- watch:
- file: /etc/panko/panko.conf
- - file: /etc/apache2/sites-available/panko-api.conf
+ - apache_enable_panko_wsgi
-{%- endif %}
+{%- endif %}
\ No newline at end of file
diff --git a/tests/pillar/repo_mcp_openstack_pike.sls b/tests/pillar/repo_mcp_openstack_pike.sls
new file mode 100644
index 0000000..789b907
--- /dev/null
+++ b/tests/pillar/repo_mcp_openstack_pike.sls
@@ -0,0 +1,12 @@
+linux:
+ system:
+ enabled: true
+ repo:
+ mirantis_openstack_repo:
+ source: "deb http://mirror.fuel-infra.org/mcp-repos/pike/{{ grains.get('oscodename') }} pike main"
+ architectures: amd64
+ key_url: "http://mirror.fuel-infra.org/mcp-repos/pike/{{ grains.get('oscodename') }}/archive-mcppike.key"
+ pin:
+ - pin: 'release a=pike'
+ priority: 1050
+ package: '*'
\ No newline at end of file
diff --git a/tests/pillar/server_cluster.sls b/tests/pillar/server_cluster.sls
index ac67542..5176570 100644
--- a/tests/pillar/server_cluster.sls
+++ b/tests/pillar/server_cluster.sls
@@ -1,6 +1,5 @@
panko:
server:
- region: RegionOne
enabled: true
version: pike
bind:
@@ -14,6 +13,7 @@
user: panko
password: misterio
endpoint_type: internalURL
+ region: RegionOne
database:
engine: mysql
host: 127.0.0.1
@@ -25,6 +25,47 @@
engine: memcached
members:
- host: 127.0.0.1
+ port: 11211
- host: 127.0.0.1
+ port: 11211
- host: 127.0.0.1
-
+ port: 11211
+apache:
+ server:
+ enabled: true
+ default_mpm: event
+ mpm:
+ prefork:
+ enabled: true
+ servers:
+ start: 5
+ spare:
+ min: 2
+ max: 10
+ max_requests: 0
+ max_clients: 20
+ limit: 20
+ site:
+ panko:
+ enabled: false
+ available: true
+ type: wsgi
+ name: panko
+ host:
+ name: panko.ci.local
+ address: 127.0.0.1
+ port: 8977
+ log:
+ custom:
+ format: >-
+ %v:%p %{X-Forwarded-For}i %h %l %u %t \"%r\" %>s %D %O \"%{Referer}i\" \"%{User-Agent}i\"
+ wsgi:
+ daemon_process: panko-api
+ processes: 2
+ threads: 1
+ user: panko
+ group: panko
+ display_name: '%{GROUP}'
+ script_alias: '/ /usr/bin/panko-api'
+ application_group: '%{GLOBAL}'
+ authorization: 'On'
diff --git a/tests/pillar/server_single.sls b/tests/pillar/server_single.sls
index a85faa0..44fe17c 100644
--- a/tests/pillar/server_single.sls
+++ b/tests/pillar/server_single.sls
@@ -1,6 +1,5 @@
panko:
server:
- region: RegionOne
enabled: true
version: pike
bind:
@@ -14,6 +13,7 @@
user: panko
password: misterio
endpoint_type: internalURL
+ region: RegionOne
database:
engine: mysql
host: 127.0.0.1
@@ -21,3 +21,47 @@
name: panko
user: panko
password: misterio
+ cache:
+ engine: memcached
+ members:
+ - host: 127.0.0.1
+ port: 11211
+apache:
+ server:
+ enabled: true
+ default_mpm: event
+ mpm:
+ prefork:
+ enabled: true
+ servers:
+ start: 5
+ spare:
+ min: 2
+ max: 10
+ max_requests: 0
+ max_clients: 20
+ limit: 20
+ site:
+ panko:
+ enabled: false
+ available: true
+ type: wsgi
+ name: panko
+ host:
+ name: panko.ci.local
+ address: 127.0.0.1
+ port: 8977
+ log:
+ custom:
+ format: >-
+ %v:%p %{X-Forwarded-For}i %h %l %u %t \"%r\" %>s %D %O \"%{Referer}i\" \"%{User-Agent}i\"
+ wsgi:
+ daemon_process: panko-api
+ processes: 2
+ threads: 10
+ user: panko
+ group: panko
+ display_name: '%{GROUP}'
+ script_alias: '/ /usr/bin/panko-api'
+ application_group: '%{GLOBAL}'
+ authorization: 'On'