Giter Site home page Giter Site logo

zend-patterns / zendserversdk Goto Github PK

View Code? Open in Web Editor NEW
22.0 24.0 17.0 25.25 MB

Pure ZF2 CLI for zpk creation and webapi client.

License: BSD 3-Clause "New" or "Revised" License

Shell 1.80% PHP 97.21% HTML 0.95% Batchfile 0.04%
zend-server php zpk zend-framework zs-client

zendserversdk's Introduction

Table of Contents

Intro

ZendServerSDK, aka zs-client, is a command line application that communicates with Zend Server's WebAPI. It can run on all modern Operating Systems(OS) such as Linux, Mac OS X and Windows.

Requirements

PHP version >=5.3.3 with enabled phar module.

Installation

You can copy locally the latest stable version as a stand-alone file from: https://github.com/zend-patterns/ZendServerSDK/raw/master/bin/zs-client.phar

On Linux you can execute the following command:

wget https://github.com/zend-patterns/ZendServerSDK/raw/master/bin/zs-client.phar

Contributing

Linux: Build Status and Windows: Build status

If you wish to contribute to the project, please read the CONTRIBUTING.md

Usage

Run the phar file with --help to see the available commands:

php zs-client.phar  --help

Use Cases

Adding Target

A target is representing the information needed to connect to a Zend Server. Every target contains unique name and must have URL that points to the location of the Zend Server, WebAPI key and secret and optionally a target can contain information about the version of Zend Server.

To add a target run the following command:

php bin/zs-client.phar addTarget --target="<put-here-unique-name>" \
                                --zskey="<put-here-the-webapi-key-name>" \
                                --zssecret="<put-here-the-webapi-key-hash>" \
                                --zsurl="<(optional)put-here-valid-url>" \
                                --zsversion="<(optional)put-here-the-version>"

To update a target run the command with the same --target value and provide the new values.

zsurl: if not specified, the value http://localhost:10081 is used. zsversion: if not specified, the latest Zend Server version will be used.

The information about the available targets is saved in the home directory of the current user in a file named .zsapi.ini.

Using Targets

Once a target has been defined, specify it in subsequent commands by adding its unique name to the argument list, as in this example:

php bin/zs-client.phar monitorGetIssuesListPredefinedFilter \
                             --target="<unique-name-from-addTarget-command>" \
                             --filterId="Resources Issues"

Deploying PHP application

You have a PHP application that you want to deploy to Zend Server. In order to use the deployment you will have to enable deployment support, create a package and upload it to the remote server.

Below are the steps that you need to take:

Enable Deployment Support

php bin/zs-client.phar initZpk --folder="<folder-where-the-PHP-code-is>"

This will add two new files in the specified folder: deployment.xml and deployment.properties.

Configure the Deployment

Using Zend Studio 10 or normal text editor edit the deployment.xml file and change the XML data to match your application name, version, etc.

Create Package

Run the following command.

php bin/zs-client.phar packZpk --folder="<folder-where-the-PHP-code-is>" --destination="<folder-where-the-package-will-be-created>"

It will output the name of the newly created package file. You have to use this name to install or update an existing application on Zend Server. If you want to use other name for the output file you can use the --name="{desired-zpk-name}" option.

Composer Integration

There is experimental integration with composer that allows you to download the dependant packages, as described in composer.json, download them and convert them to zpk files. The above command with composer integration will look like this

php bin/zs-client.phar packZpk --folder="<folder-where-the-PHP-code-is>" \
			      --destination="<folder-where-the-package-will-be-created>" \
                              --composer

The result from the command will be list of packages in the order that they have to be installed (top first, bottom last). Example:

/tmp/zendframework.zend-stdlib-2.2.4.zpk /tmp/zendframework.zend-console-2.2.4.zpk /tmp/zendframework.zend-file-2.2.4.zpk /tmp/zendframework.zend-mvc-2.2.4.zpk /tmp/zendframework.zend-text-2.2.4.zpk /tmp/zendframework.zend-math-2.2.4.zpk /tmp/zendframework.zend-json-2.2.4.zpk /tmp/zendframework.zend-serializer-2.2.4.zpk /tmp/zenddevops.webapi-dev-dev.zpk /tmp/AddYourUniqueApplicationName-1.0.0.zpk

Deploy Package

Run the following command to install a package.

php bin/zs-client.phar installApp --zpk="<location-of-the-zpk-file>" \
                                 --target="<the-name-of-the-target>" \
                                 --baseUri="<baseUri>"

You can use the same command to update a package. User parameters during the installation can be passed using --userParams="{provide-params-as-query-string}". For example if you want to pass parameter APPLICATION_ENV and DB_TYPE then you can use the following

php bin/zs-client.phar installApp --zpk="<location-of-the-zpk-file>" \
                                 --target="<the-name-of-the-target>" \
                                 --baseUri="<baseUri>" \
                                 --userParams="APPLICATION_ENV=staging&DB_TYPE=mysql"

Safe Package Deployment

If you deploy a new version of your zpk if the old version is still being deployed then this can lead to unpredictable results. In order to prevent this you can use the --safe flag. If it is present zs-client will check if there is a current deployment going on for this app and will exit if that is the case.

Example:

php bin/zs-client.phar installApp --zpk="<location-of-the-zpk-file>" --safe ...

If you want to be safe AND want to wait for the previous deployment to finish then you can use the --safe and --wait flags together.

Example:

php bin/zs-client.phar installApp --zpk="<location-of-the-zpk-file>" --safe --wait ...

Deploy Multiple Packages

If you use the composer integration then packZpk can create multiple packages, instead of one. Below is a suggestion how you can deploy these newly created packages in the correct order.

ZPKS=`php bin/zs-client.phar packZpk --folder="<folder-where-the-PHP-code-is>" \
			      	        --destination="<folder-where-the-package-will-be-created>" \
	                                --composer`;

for i in $ZPKS; do 
	php bin/zs-client.phar installApp --zpk="$i" \
                                 --target="<the-name-of-the-target>" \
                                 --baseUri="<baseUri>" \
                                 --userParams="APPLICATION_ENV=staging&DB_TYPE=mysql"
done;

HTTP tuning

Changing Connection Timeout

In some cases we may expect slower communication between the client and the server. In that case we can set explicitly the http timeout to a bigger value. The example below shows how to set it to 40 seconds.

php bin/zs-client.phar getSystemInfo --target="<name-of-the-target> \
                                    --http="timeout=40" 

Accepting Self-Signed SSL Certificates

In most cases the HTTPS access to your Zend Server will use self-signed certificate. In order to instruct the client to accept the SSL certificate you can do the following.

php bin/zs-client.phar getSystemInfo --target="<name-of-the-target> \
                                    --http="sslverify=0" 

Combining Multiple HTTP options

If you want to combine multiple HTTP options in the same request then you can format the value of the http parameter as a valid HTTP query string. Request with timeout of 40 seconds and acceptance of self-signed certificates will look like this.

php bin/zs-client.phar getSystemInfo --target="<name-of-the-target> \
                                    --http="timeout=40&sslverify=0"

Persisting the HTTP Options

If you want to keep the http options saved to a target then when defining or updating the target define also the http parameter. Format the value as valid HTTP query string. Take a look at the following example.

php bin/zs-client.phar addTarget --target="<name-of-the-target> \
                                --zsurl="http://x.y.z" \
                                --zskey="admin" \
                                --zssecret="<secret-hash>" \
                                --http="timeout=40&sslverify=0"

Output formats

In the cases where the output is text zs-client supports three formats: xml, which is the default one, json and kv(key value). To specify the desired format you have to use the --output-format parameter.

Example:

php bin/zs-client.phar getSystemInfo --target=zserver --output-format=kv

Will return

status=Error
edition=ZendServerCluster
zendServerVersion=7.0.0
supportedApiVersions[0]=application/vnd.zend.serverapi;version=1.2
supportedApiVersions[1]=application/vnd.zend.serverapi;version=1.3
...
supportedApiVersions[6]=application/vnd.zend.serverapi;version=1.8
phpVersion=5.5.13
operatingSystem=Linux
deploymentVersion=2.0
serverLicenseInfo[status]=OK
...
serverLicenseInfo[nodeLimit]=100
serverLicenseInfo[edition]=ENTERPRISE
...
managerLicenseInfo[evaluation]=

Providing array values

Some commands accept arrays as arguments.

For example configurationExtensionsOn allows you turn on multiple extensions at the same time. The code below turns on bcmath and tidy:

php bin/zs-client.phar configurationExtensionsOn --target=zserver --extensions=bcmath,tidy

Notice the syntax of the extensions value. It is a list of items having comma as delimiter. If for some reason you want to replace the comma with another delimiter this can be done by adding the new delimiter enclosed in smaller than (<) and bigger than (>). In the example below we use semicolon as delimiter:

php bin/zs-client.phar configurationExtensionsOn --target=zserver --extensions=bcmath;tidy<;>

If needed you can pass more complicated array data. For example a PHP array like the one below ...

$data = array (
   'x' => array(
      'a' => 1,
      'b' => 2,
   ),
   y => 3
);

... can be represented in the command line using the following syntax.

php bin/zs-client.phar installApp --userParams='x[a]=1&x[b]=2&y=3' --target=zserver ...

Here the default delimiter is &. If you want to use custom delimiter, semicolon for example, then you can specify it similar to the previous example:

php bin/zs-client.phar installApp --userParams='x[a]=1;x[b]=2;y=3<;>' --target=zserver ...

Notice about delimiters: Choose your delimiter wisely.

  • Choose custom delimiter only if the default ones ("," and "&") do not work for you.
  • A delimiter should not be special character that is interpreted by your shell.
  • A delimiter should not be special character that is removed silently by your shell.
  • A delimiter should not be one of the characters that are already in the data.

Deployment properties syntax

In the deployment.properties file one can specify the files that will become part of the application or part of the deployment scripts. Read this document for more information. Make sure to read about the way scriptsdir.includes values are processed.

For application excludes we support following wildcard syntax:

  • **/{something} - will exclude all entries that have base name {something}, no matter if they are files or folders, Example: **/.svn excludes all folders and files with the name .svn. This is true for /.svn, public/.svn or module/folder-with-file/.svn. If the entry is folder then the content of that folder and sub-folders will be excluded too.
  • *{something} - will exclude all entries ending with {something} in their name. Example: *.fla will exclude all files ending with .fla, like video.fla. or directories, like more.fla.

Feedback

For questions and feedback write to slavey (at) zend DOT com.

zendserversdk's People

Contributors

boedah avatar brobie avatar burkl avatar chukshirley avatar clarkphp avatar gonzalez avatar kher avatar maxbeutel avatar minkbear avatar perforce-sp avatar pleckey avatar ryanheath86 avatar slaff avatar slaff-at-zend avatar slav-at-attachix avatar swilczynski avatar zvikazend avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zendserversdk's Issues

Using Targets: Add setTarget for Rapid Management

When you run commands on specific target, you execute commands like:
zs-client.sh --target= <--params 1,2,3>
or
zs-client.sh <--params 1,2,3> --target=

To quickly work with direct command + params patterns on a single target at a time,
a command like 'setTarget ' can be used, which will set the default target for all consequent commands.

Notes:

  1. Using --target in a command will override default / pre-set target.
  2. If default target should be unset, just run 'zs-client setTarget' or 'zs-client setTarget=' to unset.
  3. When a default target is set, zs-client will show the used target on every execution, with full target details, so there is no question where the command is going to be executed, i.e.:
    Using Target: 'My Cluster' => http://my-cluster.com:10081

configurationStoreDirectives does not set the session handler

I am trying to set up a ZS cluster using vagrant and docker.

As part of the procedure, I run "zs-client.phar configurationStoreDirectives --directives='session.save_handler=cluster’ …”, but it seems not work.

The command return value is 0, the output is the following:



configurationStoreDirectives




^M

The ZS UI and also SSHing in the box and look at php.ini show the directives has not been changed.

cygwin, phar missing Zend\Http\Client\Adapter\ctype_xdigit()

PHP version:

PHP 5.6.8 (cli) (built: Apr 16 2015 17:31:50)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

zs-client's reported versions:

ZendServerWebApi Client version 1.2
Zend Server Client v1.0

error exists both when using the .phar as an executable and after extracting with the phar utility followed by calling index.php.

Arguments which precipitated the error are:

zs-client addTarget --target="ZendLive" --zskey="zs-client"  --zssecret="removed" --zsurl="http://zendserver.local:10081/"

Error output:

PHP Fatal error:  Call to undefined function Zend\Http\Client\Adapter\ctype_xdigit() in /home/dllewellyn/bin/zs-client.unpacked/vendor/zendframework/zend-http/Zend/Http/Client/Adapter/Socket.php on line 2

Fatal error: Call to undefined function Zend\Http\Client\Adapter\ctype_xdigit() in /home/dllewellyn/bin/zs-client.unpacked/vendor/zendframework/zend-http/Zend/Http/Client/Adapter/Socket.php on line 2

zs-client.phar addTarget yields exception with message saying user should add a target.

$ /vagrant/zs-client.phar addTarget --target=testServer --zsurl="http://localhost:10081" --zskey=admin --zssecret=obfuscated --zsversion="7.0"

PHP Fatal error:  Uncaught exception 'Zend\Console\Exception\RuntimeException' with message 'Make sure that you have set your target first. \n
                                                                This can be done with phar:///vagrant/zs-client.phar/module/Client/Module.php addTarget --target=<UniqueName> --zsurl=http://localhost:10081/ZendServer --zskey= --zssecret=' in phar:///vagrant/zs-client.phar/module/Client/Module.php:10
Stack trace:
#0 [internal function]: Client\Module->postRoute(Object(Zend\Mvc\MvcEvent))
#1 phar:///vagrant/zs-client.phar/vendor/zendframework/zend-eventmanager/Zend/EventManager/EventManager.php(2): call_user_func(Array, Object(
Zend\Mvc\MvcEvent))
#2 phar:///vagrant/zs-client.phar/vendor/zendframework/zend-eventmanager/Zend/EventManager/EventManager.php(2): Zend\EventManager\EventManage
r->triggerListeners('route', Object(Zend\Mvc\MvcEvent), Object(Closure))
#3 phar:///vagrant/zs-client.phar/vendor/zendframework/zend-mvc/Zend/Mvc/Application.php(2): Zend\EventManager\EventManager->trigger('r in ph
ar:///vagrant/zs-client.phar/module/Client/Module.php on line 10

Fatal error: Uncaught exception 'Zend\Console\Exception\RuntimeException' with message 'Make sure that you have set your target first. \n
                                                                This can be done with phar:///vagrant/zs-client.phar/module/Client/Module.php addTarget --target=<UniqueName> --zsurl=http://localhost:10081/ZendServer --zskey= --zssecret=' in phar:///vagrant/zs-client.phar/module/Client/Module.php:10
Stack trace:
#0 [internal function]: Client\Module->postRoute(Object(Zend\Mvc\MvcEvent))
#1 phar:///vagrant/zs-client.phar/vendor/zendframework/zend-eventmanager/Zend/EventManager/EventManager.php(2): call_user_func(Array, Object(
Zend\Mvc\MvcEvent))
#2 phar:///vagrant/zs-client.phar/vendor/zendframework/zend-eventmanager/Zend/EventManager/EventManager.php(2): Zend\EventManager\EventManage
r->triggerListeners('route', Object(Zend\Mvc\MvcEvent), Object(Closure))
#3 phar:///vagrant/zs-client.phar/vendor/zendframework/zend-mvc/Zend/Mvc/Application.php(2): Zend\EventManager\EventManager->trigger('r in ph
ar:///vagrant/zs-client.phar/module/Client/Module.php on line 10

Steps to reproduce.

  1. Fresh install of Zend Server 7.0 on a new vagrant box chef/ubuntu-14.04
  2. Bootstrapped Zend Server with Developer launch profile
  3. Download zs-client.phar from zend-patterns/ZendServerSDK
  4. Ran zs-client.phar addTarget command noted above.

implement delayed join

in some cloud setups, the cluster node servers might come up before the database server. For these scenarios, it would be useful to have a delayed join cluster method that pings the database server and only joins the node when the server's ready.

Windows phar file issues

Under Windows XP, and probably other Windows OS versions, the phar file does not run as expected.

Deployment scripts directory is mandatory

Hi there,

If you don't provide any deployment scripts directory within deploiement.properties, first packaging will succeed but will throw a exception and then deployment will fail.

When using the filterSave method, the zs-client.phar sends an HTTP method error

I've tried to use a method to import a filter rule from one server to other, but when using the filterSave method, it requires a POST method:

php zs-client.phar filterSave --type=issue --target=zst --name=CLIQueryAllEvents --data={"applicationIds":[29]}
2015-04-30T16:24:43-03:00 ERR (3): This action requires a HTTP POST method


filterSave


unexpectedHttpMethod

The application has thrown an exception!

ZendServerWebApi\Model\Exception\ApiException
This action requires a HTTP POST method

Custom Version when packing

For continuous deployment it would be helpful to have have an additional parameter - e.g. --version - for the packZpk command which allows to specify the version of the package without touching the xml manually

Autodetect Zend Server version

Currently, when creating an SDK target, you have the option of specifying the Zend Server version via the --version option. If you fail to do so, it defaults to "6.3".

This is not useful, particularly for the upcoming version 8, where using that version results in the SDK being unusable when that target is specified.

The better path would be to try and connect to the Zend Server API and determine the version from the API -- and to potentially prompt the user for the version if the API cannot provide that information (even better: provide information in that prompt to guide the user to discover the version from the UI!).

Local Config Handling

Since command addTarget reads and modifies .zs_api.ini, it raises a security concerns with leftovers target details after use and maintenance of config and targets.

On every zs-client.phar execution, the first line should be something like:
Config file: none
or
Config file: /path/to/.zs_api.ini

This way there is no mistake whether something is recorded on the system with sensitive data.

Next, these extra commands can come in handy:

  1. zs-client.phar config (path)
    display .zs_api.ini calculated path (matching the logic in addTarget - Windows or Home) and "Exists!" if exists
  2. zs-client.phar config print
    display config file content, or error if not available or empty
  3. zs-client.phar config delete
    or: zs-client.phar cleanup [--force](removes the config and any temp files after prompt or -f / --force).
  4. zs-client.phar listTargets
  5. zs-client.phar removeTarget --target=XYZ
  6. zs-client,phar removeAllTargets
    This is not the same as deleting config, since in the future we might like to see more configuration besides the ZS targets (user prefs, behaviour prefs, logging, command history, macros etc.)

Now who will beat me to implementing the above?!?
:)

Add better documentation for the deployment.properties properties

  • Explain what is appdir directory and what is scriptsdir.
  • Give examples how the appdir is working and how to include and exclude files.
  • Give examples how the scriptsdir is working and how to include and exclude files.
  • Add the final information to a wiki and append it to the existing Zend Server documentation.

Automated tests

Are there any plans to add automated tests to this project?
I think this is crucial, as:

  • the documentation is sparse (especially for the scriptsdir stuff)
  • users will download the latest phar (according to the README), breaking existing functionality can be hard to spot (especially as there are no released versions or a CHANGELOG)

First candidates I see would be the scriptsdir stuff (as I also had the most problems with it), to address #34, #56, #57.

In the first step, only package creation can be tested, not deploying itself (which could be added later on). So errors like #35 could be catched.

E.g. I could not find documentation on how the "persistent resources" feature is working (which did not in my case): http://files.zend.com/help/Zend-Server/content/understanding_the_package_structure.htm

RuntimeException on launch

I have a host (note for self: host328) on which we get a RuntimeException when trying to launch the script. It just fails to load and do anything useful.

# php /usr/local/lib/xxx/zendserver/zs-client.phar command:help

Fatal error: Uncaught exception 'Zend\Stdlib\Exception\RuntimeException' with message 'glob('config/autoload/{,*.}{global,local}.php', 1024) failed' in phar:///usr/local/lib/xxx/zendserver/zs-client.phar/vendor/zendframework/zend-stdlib/Zend/Stdlib/Glob.php:2
Stack trace:
#0 phar:///usr/local/lib/xxx/zendserver/zs-client.phar/vendor/zendframework/zend-stdlib/Zend/Stdlib/Glob.php(2): Zend\Stdlib\Glob::systemGlob('config/autoload...', 16)
#1 phar:///usr/local/lib/xxx/zendserver/zs-client.phar/vendor/zendframework/zend-modulemanager/Zend/ModuleManager/Listener/ConfigListener.php(2): Zend\Stdlib\Glob::glob('config/autoload...', 16)
#2 phar:///usr/local/lib/xxx/zendserver/zs-client.phar/vendor/zendframework/zend-modulemanager/Zend/ModuleManager/Listener/ConfigListener.php(2): Zend\ModuleManager\Listener\ConfigListener->addConfigByPath('config/autoload...', 'glob_path')
#3 [internal function]: Zend\ModuleManager\Listener\ConfigListener->onLoadModulesPost(Object(Zend\ModuleManager\ModuleEvent))
#4 phar:///usr/local/lib/xxx/zends in phar:///usr/local/lib/xxx/zendserver/zs-client.phar/vendor/zendframework/zend-stdlib/Zend/Stdlib/Glob.php on line 2

Any idea what could cause such error, or how to investigate further?

Zend Server 6.3 unsupported

Using a target with ZS Version 6.3: I get an "Uncaught exception 'RuntimeException' with message 'Invalid or unsupported Zend Server version'" error message when calling e.g. 'getSystemInfo' command

AddTarget optional http parameters are expected in controller

Hi !

Seen this warning :PHP Warning: Invalid argument supplied for foreach() in /var/www/ZendServerSDK/module/Client/src/Client/Controller/TargetController.php on line 39.

The thing is http parameters is optinal but clearly expected at line 39 !

Use of monitorCountIssuesListPredefinedFilter

I've tried to use this method but everytime I get a response stating that the method is not available on the server.

object(stdClass)#460 (3) { ["zendServerAPIResponse"]=> string(34) "http://www.zend.com/server/api/1.2" ["requestData"]=> object(stdClass)#475 (2) { ["apiKeyName"]=> string(7) "Unknown" ["method"]=> string(7) "default" } ["errorData"]=> object(stdClass)#482 (2) { ["errorCode"]=> string(13) "unknownMethod" ["errorMessage"]=> string(91) "The requested action 'monitorCountIssuesListPredefinedFilter' does not exist on this server" } } {"result":null}

It seams it reverts to use of the version 1.2 of the API in which it doesn't exists. But I've tried to force the use of version 1.7 adding the ';version=1.7; to the headers (Content-type and Accept) but it still reverts to 1.2.

I might be doing something wrong on the versioning negotiation, or there is a bug the reverts to 1.2 on this method. I've tried it on versions 6.3 and 8 of Zend Server.

Support stamp version when using packZpk command

For example, If you want to change version number when creating package zpk.
So the command will be like this below:
php /usr/local/bin/zs-client.phar packZpk --folder='${project.basedir}' --destination='${project.basedir}' --name='application.zpk' --version='1.0.0.999'

This command will change version number in deployment.xml before creating zpk file.

packZpk is adding deployment scripts into scripts/scripts directory

It is creating scripts directory inside another scripts directory which makes Zend Server unable to unpack and execute deployment scripts like post_stage.php

This issue is probably caused by pack method of ZpkInvokable where it calls

$zpk->addFile($fullPath, $this->fixZipPath($baseDir.$path));

For scripts directory it tries to do

$zpk->addFile($fullPath, $this->fixZipPath('scripts/'.'scripts/post_stage.php'));

Empty subfolder is not in ZPK as expect

Example:
Foo/test_empty is empty subfolder.

when order command packZpk. The ouput in ZPK is:
< empty folder name >/Foo/Test_empty

It should not have "empty folder" in ZPK

ERROR When run php zs-client.phar --help

Update
After update composer, the problem is gone. Please close this issues.
Thanks.

run command:
php zs-client.phar --help

error:

SCREAM: Error suppression ignored for
Fatal error: Class 'Zend\Stdlib\ArrayObject' not found in C:\wamp\www\ZendServerSDK\vendor\zenddevops\webapi\Module.php on line 89

Call Stack:
0.0179 691640 1. {main}() C:\wamp\www\ZendServerSDK\bin\zs-client.phar:0
0.0184 695864 2. require('phar://C:/wamp/www/ZendServerSDK/bin/zs-client.phar/index.php') C:\wamp\www\ZendServerSDK\bin\zs-client.phar:14
0.0255 916608 3. Zend\Mvc\Application::init() phar://C:/wamp/www/ZendServerSDK/bin/zs-client.phar/index.php:2
0.1154 3646656 4. Zend\Mvc\Application->bootstrap() C:\wamp\www\ZendServerSDK\vendor\zendframework\zendframework\library\Zend\Mvc\Application.php:242
0.2226 5256984 5. Zend\EventManager\EventManager->trigger() C:\wamp\www\ZendServerSDK\vendor\zendframework\zendframework\library\Zend\Mvc\Application.php:145
0.2227 5257160 6. Zend\EventManager\EventManager->triggerListeners() C:\wamp\www\ZendServerSDK\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php:208
0.2332 5522744 7. call_user_func() C:\wamp\www\ZendServerSDK\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php:464
0.2332 5522760 8. ZendServerWebApi\Module->onBootstrap() C:\wamp\www\ZendServerSDK\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php:464

Deployment scripts not properly created into zpk archive

Hi there,

If you put your deployment scripts like post_stage.php into a /deploy directory at the root of the app the resulting package with packZpk will show something like this : /deploy/deploy/post_stage.php.
When deploying on zend server deployment scripts will be not played at all.
It is ok with the same code packaged with Zend Studio.

pagecache commands are not working.

I've tried using the pagecache commands, and am getting errors:

2014-09-08T11:33:12-05:00 ERR (3): The requested action 'pagecacheListRules' does not exist on this server<zendServerAPIResponse xmlns="http://www.zend.com/server/api/1.2">
    <requestData>
        <apiKeyName><![CDATA[Unknown]]></apiKeyName>
        <method>default</method>
    </requestData>
<errorData>
 <errorCode>unknownMethod</errorCode>
 <errorMessage><![CDATA[The requested action 'pagecacheListRules' does not exist on this server]]></errorMessage>
</errorData></zendServerAPIResponse>
======================================================================
   The application has thrown an exception!
======================================================================
 ZendServerWebApi\Model\Exception\ApiException
 The requested action 'pagecacheListRules' does not exist on this server

The server in question is running version 7.0, and I have a target setup correctly (as in, other commands such as deployment work fine).

Creating ZPK broken in Nov 24th phar

When I try to create a zpk file using the latest Nov 24th phar file I get the following error:

PHP Fatal error: Uncaught exception 'Exception' with message 'Incorrect signature or unknown identity' in phar:///var/lib/jenkins/workspace/Staging/ZsClient/bin/zs-client.phar/vendor/zenddevops/webapi/src/ZendServerWebApi/Model/ApiManager.php:2

To test this I used the Oct 31st phar and it works as expected.

Rename createZpk to initZpk

Instead of:
$ php bin/zs-client.php createZpk --folder=""
Use:
$ php bin/zs-client.php initZpk --folder=""

Make the createZpk an alias to initZpk and add deprecated message.
(Suggested by Zvika)

Fix bug in case using real path in windows

If pass parameter in windows like this:
--folder="C:\tests"
--destination="C:\tests"

It shows error

The application has thrown an exception!

Zend\ServiceManager\Exception\RuntimeException
The specified directory does not have deployment.xml.

But it is existing deployment.xml at that path.
After that I took a look on the code and met:
PathInvokable.getAbsolute send the result is wrong for example

running cmd at c:\wamp\www\ZendServerSDK\tests
parameter --folder="C:\wamp\www\ZendServerSDK" 

result from PathInvokable.getAbsolute is

C:\\wamp\\www\\ZendServerSDK\\tests/C:\\wamp\\www\\ZendServerSDK\\tests

I just finished fix it but unable to pull request only my 1 commit.
Please take a look at minkbear/ZendServerSDK@d27b5ac

This action requires the baseUrl parameter

We have been trying to implement continuous integration with jenkins but there is a problem with deployment. We have located it down to that zs-client wont let us add the new application apparantly it does not the the baseUrl in the XML for the server request.

How:
php /usr/local/bin/zs-client.phar installApp --zpk=application.zpk --zsurl='http://ZendServerIP:10081' --zskey='admin' --zssecret='XXXXX' --baseUri='http://OurVhost/' --userAppName='AppNameX' --userParams='APPLICATION_ENV=staging'

Result:
2015-01-07T16:26:55+00:00 ERR (3): This action requires the baseUrl parameter


applicationDeploy


missingParameter

The application has thrown an exception!

ZendServerWebApi\Model\Exception\ApiException
This action requires the baseUrl parameter

As far as i can see you take the var $baseUri and put it into baseUrl we have tried the stable and the development release.

ZendServer version 7.0.0 and 8.0 beta

wrong api credentials after joining a cluster with --wait option

when joining a new server to an existing cluster with method serverAddToCluster and option --wait, an exception ("Incorrect signature or unknown identity") is thrown. This is because the check whether the new server joined successful is done with the new server's credentials, but not with the cluster credentials.

Structure of ZPK is strange when setting scriptsdir.includes

My test case:

Case 1
scriptsdir in XML = zp_script
scriptsdir.includes in file properties = scripts/post_activate.php

Output
zp_script\scripts\post_activate.php

Expected
zp_script\post_activate.php


Case 2
scriptsdir in XML = zp_script
scriptsdir.includes in file properties = zp_script/includes/globals.php

Output
zp_script\includes\globals.php

Expected
zp_script\globals.php


Case 3 => Pass
scriptsdir in XML = zp_script
scriptsdir.includes in file properties = zp_script/post_activate.php

Output
zp_script\post_activate.php

Expected
zp_script\post_activate.php


I think that case 1 and 2 should be pass.
Because scriptsdir.includes are the list of files or folders you want to push them into scriptsdir.

Anyways, I tested all my case with Eclipse PDT with GUI based and export ZPK file with the same XML and properties. The output is the same as my expected.

Notices in installApp command

when calling
zs-client.phar installApp --target="cloudbees" --zpk=helloworld.zpk --baseUri="/hw" --defaultServer=TRUE --wait

I get some Notices:
Notice: Undefined variable: server in phar:///tmp/helloworld/zs-client.phar/module/Client/src/Client/Controller/AppController.php on line 2
PHP Notice: Trying to get property of non-object in phar:///tmp/helloworld/zs-client.phar/module/Client/src/Client/Controller/AppController.php on line 2

Notice: Trying to get property of non-object in phar:///tmp/helloworld/zs-client.phar/module/Client/src/Client/Controller/AppController.php on line 2

Add validateZpk

Add validateZpk command that validates the deployment.xml file and the files described in the deployment.properties.
(Suggested by Zvika)
The validate command, in the case of zdpack, also validates the deployment.xml against an xsd that is supplied in zend server - /usr/local/zend/share/deployment.xsd
Of course, we'd have to make sure that versions don't change between releases, but it has been fairly static.
(Comments by Maurice :)

configurationExport / configurationDirectivesList / Zend Global Directives

configurationExport

  • --output-format is broken. kv => no output. json/xml => zip file
  • only provides a zip file, hard to exploit atomicly
  • zend.user_name can be found in .sql content
  • zend.serial_number can NOT be found anywhere.

configurationDirectivesList

  • no zend.* directives are displayed at all.
  • explictly asking --extension='Zend Global Directives' does not help

Retries in bootstrap command

"apparently after installation it takes a while for ZS to be ready for bootstrap. If I try to bootstrap right after installation the installation fails."

A simple mechanism to retry.

Extra characters in XML output during installApp

There are extra characters in the beginning of the response from the installApp command that break the XML parsing.

Command

/usr/local/bin/zs-client installApp --zpk /home/jan/dev/git/zend-server-bamboo/deployment/target/bamboo/home/xml-data/build-dir/MCD-CDP-JOB1/zpk/52-822629b9f38045c7fd2f2caf4eccae15b9c574cf.zpk --baseUri=/myApp --userAppName=myApp --zsurl=http://10.11.12.68:10081 --zskey=<key> --zssecret=<secret> --zsversion=6.1

Start of response

string(2218) "<zendServerAPIResponse xmlns="http://www.zend.com/server/api/1.5">

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.