From 60f27d475a9e1ab088dce4bb3369b5513d344714 Mon Sep 17 00:00:00 2001 From: Ugo Bellavance Date: Fri, 21 Apr 2017 11:28:42 -0400 Subject: [PATCH 01/10] Improved/fixed comments to include all variables. Also, fixed admin_api_target_name that was mispelled. --- manifests/init.pp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 621f7b5..e77c51e 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -28,12 +28,25 @@ # Password for Zend Server database. #[*db_schema*] # Schema to use for Zend Server (default:'zendserver') +#[*db_host*] +# Hostname of the MySQL server for ZS database #[*admin_api_key_name*] -# Zend Server 64 charachter API key to use for interfacing with Zend Server (Default:'admin') +# Zend Server 64 character API key to use for interfacing with Zend Server (Default:'admin') #[*admin_api_key_secret*] -# = 'caff756fd7682fa35901afa923822f63771570c25afd5368eaa659f2f71d4d6f', +# API secret to be used +#[*admin_api_target_name*] +# Name of the target to be used (must already exist, see SDK docs) +#[*create_facts*] +# Create facts or not #[*admin_email*] # Email address to which Zend Server will send administrative messages. +#[*zsurl*] +# Zend server API address (default = http://localhost:10081) +#[*default_server*] +# Default server +#[*external_url*] +# External URL + # === Examples # # class {'zendserver': @@ -75,7 +88,7 @@ $db_host = undef, $admin_api_key_name = $zendserver::params::admin_api_key_name, $admin_api_key_secret = $zendserver::params::admin_api_key_secret, - $admin_api_target_neme = $zendserver::params::admin_api_target_name, + $admin_api_target_name = $zendserver::params::admin_api_target_name, $create_facts = $zendserver::params::create_facts, $admin_email = $zendserver::params::admin_email, $zsurl = $zendserver::params::zsurl, From fad9700e7efea379fadcac260856cc8ebccb4861 Mon Sep 17 00:00:00 2001 From: Ugo Bellavance Date: Fri, 21 Apr 2017 22:12:32 -0400 Subject: [PATCH 02/10] Added a require for the service in the bootstrap so that it waits until the service is up before running the bootsrap. --- manifests/bootstrap/exec.pp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/manifests/bootstrap/exec.pp b/manifests/bootstrap/exec.pp index 415b386..42126ba 100644 --- a/manifests/bootstrap/exec.pp +++ b/manifests/bootstrap/exec.pp @@ -15,8 +15,9 @@ command => '/usr/local/zend/bin/zs-bootstrap-puppet.sh', creates => '/usr/local/zend/tmp/zs-done', require => [ + Service ['zend-server'], File['zs-bootstrap-puppet.sh'], File['/usr/local/zend/bin/zs-client.phar'], File['zs-puppet-common-functions.sh']], } -} \ No newline at end of file +} From 37c2e12e648e49c953cd1031da1dae7b4ac28fb7 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 23 Apr 2017 21:06:36 -0400 Subject: [PATCH 03/10] Improved comments, added validates for api_key_ values, commented out notifies --- manifests/init.pp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index e77c51e..b5c8952 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -5,11 +5,11 @@ #[*accept_eula*] # Accept Zend Server End User License Agreement (default:true) #[*admin_password*] -# Password for zend server console +# Password for zend server web console/GUI (admin user) #[*manage_repos*] # Should the class manage Zend Server repositories (default:true) #[*webserver*] -# Web Server to manage. Valid options:'apache','nginx' (default:'apache') +# Web Server to install/manage. Valid options:'apache','nginx' (default:'apache') #[*phpversion*] # PHP version to install. (default:'5.5') #[*license_name*] @@ -31,13 +31,13 @@ #[*db_host*] # Hostname of the MySQL server for ZS database #[*admin_api_key_name*] -# Zend Server 64 character API key to use for interfacing with Zend Server (Default:'admin') +# API key name to create (username part of the API key) #[*admin_api_key_secret*] -# API secret to be used +# 64 character secret used to create an API key #[*admin_api_target_name*] # Name of the target to be used (must already exist, see SDK docs) #[*create_facts*] -# Create facts or not +# Create facts or not (will send facts in the facter facts dir) #[*admin_email*] # Email address to which Zend Server will send administrative messages. #[*zsurl*] @@ -97,7 +97,8 @@ validate_bool($manage_repos) validate_re($webserver, ['\Aapache|nginx\Z',], 'Only apache or nginx are supported.') validate_re($phpversion, ['\A5.3|5.4|5.5|5.6|7.0|7.1\Z',], 'Only versions 5.4 to 7.1 are supported.') - # TODO: api_key_name + web_api_key_secret are required if join_cluster=true + validate_re($admin_api_key_name, ['^\w{5,20}$','api_key_name is required and must be 5-20 characters.']) + validate_re($admin_api_key_secret, ['^\w{64}$','api_key_secret is required and must be 64 characters.']) anchor { 'zendserver::begin': } -> class { '::zendserver::requirements': } -> class { '::zendserver::install': } -> @@ -106,9 +107,12 @@ class { '::zendserver::cluster': } ~> class { '::zendserver::service': } -> anchor { 'zendserver::end': } - notify{ "zendserversetup key {$admin_api_key_name}": } - notify{ "zendserversetup secret {$admin_api_key_secret}": } - notify{ "zendserversetup hash ${zend_api_key_hash}": + +# Removing all notifies because it makes unclean puppet runs +# and it is useless as the api_key_name and secret is mandatory +# notify{ "zendserversetup key {$admin_api_key_name}": } +# notify{ "zendserversetup secret {$admin_api_key_secret}": } +# notify{ "zendserversetup hash ${zend_api_key_hash}": require => [ Service['zend-server'], Class['zendserver::bootstrap'], From 09f9cc3c2e34618aa2ba5c23a866e70918d98839 Mon Sep 17 00:00:00 2001 From: Ugo Bellavance Date: Mon, 24 Apr 2017 21:02:02 -0400 Subject: [PATCH 04/10] Removed another section. Wouldn't work otherwise. --- manifests/init.pp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index b5c8952..cfc74b9 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -113,9 +113,9 @@ # notify{ "zendserversetup key {$admin_api_key_name}": } # notify{ "zendserversetup secret {$admin_api_key_secret}": } # notify{ "zendserversetup hash ${zend_api_key_hash}": - require => [ - Service['zend-server'], - Class['zendserver::bootstrap'], - ] - } +# require => [ +# Service['zend-server'], +# Class['zendserver::bootstrap'], +# ] +# } } From 64caed9d21dbc28cce1b44ed06a20eb79e1f16c7 Mon Sep 17 00:00:00 2001 From: Ugo Bellavance Date: Sat, 29 Apr 2017 21:29:50 -0400 Subject: [PATCH 05/10] Update README.md Fixed headers and anchors --- README.md | 55 +++++++++++++++++++++++++++---------------------------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index ea17c9d..ff4a8c1 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,28 @@ -#Zend Server Puppet Module - -####Table of Contents - -1. [Overview](#Overview) -2. [Module Description](#Module Description) -3. [Setup](#Setup) - * [Components affected by this module](#Components affected by this module) - * [Setup requirements](#Setup requirements) - * [Getting started](#Getting Started) - * [Module Installation](#Module Installation) -4. [Usage](#Usage) -5. [Further Reference](#Further Reference) -5. [Limitations](#Limitations) -6. [Contributing to this module](#Contributing to this module) - -##Overview +# Zend Server Puppet Module + +## Table of Contents + +1. [Overview](#overview) +2. [Module Description](#module-description) +3. [Setup](#setup) + * [Components affected by this module](#components-affected-by-this-module) + * [Setup requirements](#setup-requirements) + * [Getting started](#getting-started) + * [Module Installation](#module-installation) +4. [Usage](#usage) +5. [Further Reference](#further-reference) +5. [Limitations](#limitations) +6. [Contributing to this module](#contributing-to-this-module) + +## Overview The zendserver module allows you to easily manage Zend Server with Puppet. -##Module Description +## Module Description This module installs, "bootstraps" and manages a cluster (or single machine) running Zend Server. Zend Server is an integrated PHP application server for mobile and web apps. Zend Server will also install a web server (apache/nginx) if it is not already installed on your system. Check http://www.zend.com for more information about Zend Server. -##Setup +## Setup -###Components affected by this module +### Components affected by this module The module downloads and installs: * Zend Server using the distro's package manager (apt/yum). @@ -37,7 +37,7 @@ The module modifies files under the following directories (and sub directories): * Apache configuration (/etc/apache2 or /etc/httpd depending on distro). * Nginx configuration (if relevant). -###Setup Requirements +### Setup Requirements Operating System: * RHEL/Centos >=6 @@ -53,7 +53,7 @@ Puppet dependencies: For a cluster environment also access to a mysql server. -###Getting started +### Getting started If you want to get started quickly you can checkout our [Vagrant testing box](https://github.com/davidl-zend/zendserverpuppet-vagrant). This code will: @@ -73,7 +73,7 @@ You can view and modify the following files to customize the vagrant setup: * /data/common.yaml - This files contains parameters to be passed to puppet on the Vagrant box (using hiera). * /manifests/site.pp - Example puppet manifest which uses the zendserver module. -###Module installation +### Module installation To manually install the module: @@ -97,17 +97,17 @@ To manually install the module: ``` Alternatively you can use R10K to install the module and dependencies (see the puppet file in the above Vagrant test box for reference. -##Usage +## Usage For reference about the module's public API (classes and resources that should be used) check: [Module API reference](doc/API_REFERENCE.md) You can check the comments in the code for further information. -##Further reference +## Further reference You can check [Zend Server's online help zend-online-help](http://files.zend.com/help/Zend-Server/zend-server.htm) for instructions and more information. [R10K Instructions](http://terrarum.net/blog/puppet-infrastructure-with-r10k.html) -##Limitations +## Limitations The module is still under testing - please try it on a non-production system first. * It is recommended you do not use the module to manage a Zend Server system that was not installed with this module(Such a setup might work but is untested). @@ -118,8 +118,7 @@ The module is still under testing - please try it on a non-production system fir * Support for apache (2.2/2.4) web server (nginx support is untested). * The module is not compatible with the puppetlabs/apache module. Do not use both modules to manage the same node (=server). puppetlabs/apache can be used to manage other nodes. -##Contributing to this module +## Contributing to this module If you wish to help our efforts you can open issues in the github repository or contribute code. To contribute, please fork the repository and send us a pull-request with your changes using github. You can email cloud-paas-dev@zend.com for further questions. - From 0439ab094ed6a1bdbe09a538641f0b90044260fd Mon Sep 17 00:00:00 2001 From: Ugo Bellavance Date: Sat, 29 Apr 2017 21:45:26 -0400 Subject: [PATCH 06/10] Update README.md --- README.md | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ff4a8c1..1a57d83 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Zend Server Puppet Module + Server Puppet Module ## Table of Contents @@ -18,7 +18,24 @@ The zendserver module allows you to easily manage Zend Server with Puppet. ## Module Description -This module installs, "bootstraps" and manages a cluster (or single machine) running Zend Server. Zend Server is an integrated PHP application server for mobile and web apps. Zend Server will also install a web server (apache/nginx) if it is not already installed on your system. Check http://www.zend.com for more information about Zend Server. +On the first run, this module: +* Installs Zend Server +* "bootstraps" the installation + * Sets the license + * Sets the admin and (optional) developer password for the web admin interface + * Creates a target + * A target is an API key/hash pair that is saved in a file, that allow one to do API calls using only the name of the target (does not send the key/hash pair on the network + * The target info (key/hash) is saved in a file, typically $home/.zsapi.ini. However, when using puppet,there is no $HOME, so the file is in /.zsapi.ini (at the root). This may change in the future. +* Configures a cluster (or single machine) running Zend Server. + * Sets up a database for the cluster +* Creates puppet facts about Zend Server + +It can also: + +* Define or deploy an application +* ... to be continued + +Zend Server is an integrated PHP application server for mobile and web apps. Zend Server will also install a web server (apache/nginx) if it is not already installed on your system. Check http://www.zend.com for more information about Zend Server. ## Setup From dc63135da7fc2f368fb8d71f6f868905c0613f0a Mon Sep 17 00:00:00 2001 From: Ugo Bellavance Date: Wed, 26 Apr 2017 12:26:40 -0400 Subject: [PATCH 07/10] Fixes Issue #15 - Cannot install on RHEL6. --- manifests/repo/redhat.pp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/manifests/repo/redhat.pp b/manifests/repo/redhat.pp index 13d5e67..337b9b9 100644 --- a/manifests/repo/redhat.pp +++ b/manifests/repo/redhat.pp @@ -6,8 +6,19 @@ warning("${name} should not be directly included in the manifest.") } + unless ($::osfamily == 'RedHat') and (versioncmp($::operatingsystemrelease, '6.0') >= 0) { + fail("OS family ${::osfamily}-${::operatingsystemrelease} is not supported. Only RedHat >= 6 is suppported. RHEL 5 is EOL") + } + + $rpmdir = $::operatingsystemrelease ? { + /^5.*$/ => 'rpm', + /^6.*$/ => 'rpm', + /^7.*$/ => 'rpm_apache2.4', + } + + yumrepo { 'Zend': - baseurl => "http://repos.zend.com/zend-server/${zendserver::zend_server_version}/rpm_apache2.4/${::architecture}", + baseurl => "http://repos.zend.com/zend-server/${zendserver::zend_server_version}/${rpmdir}/${::architecture}", descr => 'Zend Server', enabled => 1, gpgcheck => 1, @@ -15,7 +26,7 @@ } yumrepo { 'Zend_noarch': - baseurl => "http://repos.zend.com/zend-server/${zendserver::zend_server_version}/rpm_apache2.4/noarch", + baseurl => "http://repos.zend.com/zend-server/${zendserver::zend_server_version}/${rpmdir}/noarch", descr => 'Zend Server', enabled => 1, gpgcheck => 1, From 582f6a236d646875f7a2e06dcb79ae1ed36ef15d Mon Sep 17 00:00:00 2001 From: Ugo Bellavance Date: Mon, 1 May 2017 11:56:21 -0400 Subject: [PATCH 08/10] Update README.md Many improvements, updates, fixes. Updated the supported components section, re-organized the description of what the module does. Other fixes. --- README.md | 50 +++++++++++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 1a57d83..f8d718f 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,12 @@ The zendserver module allows you to easily manage Zend Server with Puppet. ## Module Description On the first run, this module: * Installs Zend Server +* Installs the desired web server (httpd or nginx), if not already installed +* Deploys an SDK client (zs-client.phar) + * Will be discontinued in the future as all supported Zend Server Versions already install it by default, in another location) + * The usage of `/usr/local/zend/bin/zs-client.sh` will probably replace the call to the phar * "bootstraps" the installation + * Deploys a file (`/usr/local/zend/bin/zs-puppet-common-functions.sh`), that contains functions for the bootstrap * Sets the license * Sets the admin and (optional) developer password for the web admin interface * Creates a target @@ -29,24 +34,23 @@ On the first run, this module: * Configures a cluster (or single machine) running Zend Server. * Sets up a database for the cluster * Creates puppet facts about Zend Server + * The Zend Server-related facts are managed every puppet run It can also: -* Define or deploy an application -* ... to be continued +* Define, deploy, remove or update an application +* Deploy or remove a library +* Install/enable/configure a 3rd-party extension (pear, pecl, OS package) +* Do an API call with the SDK client + * See https://github.com/zend-patterns/ZendServerSDK for details +* Execute commands with zs-manage (Using the SDK client should be preferred) +* Create a target (most likely useless by itself, but used by the bootstrap process) Zend Server is an integrated PHP application server for mobile and web apps. Zend Server will also install a web server (apache/nginx) if it is not already installed on your system. Check http://www.zend.com for more information about Zend Server. ## Setup ### Components affected by this module -The module downloads and installs: - - * Zend Server using the distro's package manager (apt/yum). - * Zend Framework (as a library in Zend Server) - * Symphony php framework (as a library in Zend Server) - * A web server (either apache or nginx) using the distro's package manager (apt/yum). - * Zend Server next generation SDK - (See https://github.com/zend-patterns/ZendServerSDK for details) The module modifies files under the following directories (and sub directories): @@ -55,20 +59,30 @@ The module modifies files under the following directories (and sub directories): * Nginx configuration (if relevant). ### Setup Requirements -Operating System: -* RHEL/Centos >=6 -* Debian >= 6 -* Ubuntu >= 10.04 +Typically, only vendor-supported (LTS, if applicable) versions are supported and tested with this module. + +* Operating System. Currently vendor-supported version: + + * [RHEL](https://access.redhat.com/support/policy/updates/errata/#Life_Cycle_Dates) 6+ + * [Centos](https://wiki.centos.org/About/Product) 6+ + * [Debian](https://wiki.debian.org/DebianReleases) 7+ + * [Ubuntu](https://www.ubuntu.com/info/release-end-of-life) 12.04+ + +* Zend Server +Only the [currently supported Zend Server versions](http://www.zend.com/en/support-center/support/php-long-term-support) are supported and tested. Currently: + *7.0 + *8.5 + *9.1 Puppet dependencies: * Puppet version >= 3.4 * The following puppet-forge modules: * puppetlabs/stdlibs - * puppetlabs/apt + * puppetlabs/apt (for Debian and Ubuntu) -For a cluster environment also access to a mysql server. +For a cluster environment, access to a mysql server is required. ### Getting started If you want to get started quickly you can checkout our [Vagrant testing box](https://github.com/davidl-zend/zendserverpuppet-vagrant). @@ -116,7 +130,7 @@ Alternatively you can use R10K to install the module and dependencies (see the p ## Usage For reference about the module's public API (classes and resources that should be used) check: -[Module API reference](doc/API_REFERENCE.md) +[Module API reference](doc/API_REFERENCE.md) or [SDK code on Github](https://github.com/zend-patterns/ZendServerSDK/). The [Zend Server documentation section about the API](http://files.zend.com/help/Zend-Server/content/introduction2.htm may also be useful). You can check the comments in the code for further information. @@ -129,10 +143,8 @@ The module is still under testing - please try it on a non-production system fir * It is recommended you do not use the module to manage a Zend Server system that was not installed with this module(Such a setup might work but is untested). * You should make sure that no other PHP installation is present on the system (such as the distros' php or manually installed versions). - * Before installing Zend Server, define the nginx repository: http://nginx.org/en/linux_packages.html#stable. (Without this installation of zend server will fail) + * Before installing Zend Server for use with Nginx, define the nginx repository: http://nginx.org/en/linux_packages.html#stable. (Without this installation of zend server will fail) * The module does not add /usr/local/zend/bin to the search path - you might want to do it yourself. - * Zend Server version >=7.0 (older versions are untested). Default version is 8.0. - * Support for apache (2.2/2.4) web server (nginx support is untested). * The module is not compatible with the puppetlabs/apache module. Do not use both modules to manage the same node (=server). puppetlabs/apache can be used to manage other nodes. ## Contributing to this module From c8d6c1c4538ba58ae3919eed43d02d5d8375bbe8 Mon Sep 17 00:00:00 2001 From: Ugo Bellavance Date: Mon, 1 May 2017 13:52:19 -0400 Subject: [PATCH 09/10] Update README.md Fixed ZS server versions list --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f8d718f..12b263d 100644 --- a/README.md +++ b/README.md @@ -71,9 +71,9 @@ Typically, only vendor-supported (LTS, if applicable) versions are supported and * Zend Server Only the [currently supported Zend Server versions](http://www.zend.com/en/support-center/support/php-long-term-support) are supported and tested. Currently: - *7.0 - *8.5 - *9.1 + * 7.0 + * 8.5 + * 9.1 Puppet dependencies: From 22363972bf736050d95f86d94915f8451f8ecaa4 Mon Sep 17 00:00:00 2001 From: Ugo Bellavance Date: Tue, 2 May 2017 10:53:03 -0400 Subject: [PATCH 10/10] Changed manifest/repo/debian.pp so that it doesn't use an LSB fact, then remove the installation of the lsb package requirement. --- manifests/init.pp | 1 - manifests/repo/debian.pp | 2 +- manifests/requirements.pp | 8 -------- 3 files changed, 1 insertion(+), 10 deletions(-) delete mode 100644 manifests/requirements.pp diff --git a/manifests/init.pp b/manifests/init.pp index cfc74b9..864dc34 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -100,7 +100,6 @@ validate_re($admin_api_key_name, ['^\w{5,20}$','api_key_name is required and must be 5-20 characters.']) validate_re($admin_api_key_secret, ['^\w{64}$','api_key_secret is required and must be 64 characters.']) anchor { 'zendserver::begin': } -> - class { '::zendserver::requirements': } -> class { '::zendserver::install': } -> class { '::zendserver::sdk::install': } -> class { '::zendserver::bootstrap': } ~> diff --git a/manifests/repo/debian.pp b/manifests/repo/debian.pp index 7dfb77d..8e8caa1 100644 --- a/manifests/repo/debian.pp +++ b/manifests/repo/debian.pp @@ -22,7 +22,7 @@ case $::operatingsystem { 'Ubuntu' : { - if $::lsbdistrelease + 0 >= 14.04 { + if $::operatingsystemrelease + 0 >= 14.04 { $zend_repository = "http://repos.zend.com/zend-server/${zendserver::zend_server_version}/deb_apache2.4" } else { $zend_repository = "http://repos.zend.com/zend-server/${zendserver::zend_server_version}/deb_ssl1.0" diff --git a/manifests/requirements.pp b/manifests/requirements.pp deleted file mode 100644 index a138582..0000000 --- a/manifests/requirements.pp +++ /dev/null @@ -1,8 +0,0 @@ -# == Class: zendserver::requirements -# Manage all requirements for Zend Server installation. This class should not be included directly in the manifest. -# -class zendserver::requirements inherits zendserver { - package { $zendserver::package_lsbrelease: - ensure => installed, - } -} \ No newline at end of file