zend-patterns / zendserversdk Goto Github PK
View Code? Open in Web Editor NEWPure ZF2 CLI for zpk creation and webapi client.
License: BSD 3-Clause "New" or "Revised" License
Pure ZF2 CLI for zpk creation and webapi client.
License: BSD 3-Clause "New" or "Revised" License
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.
command
zs-client.phar installApp --target="cloudbees" --zpk=helloworld.zpk --baseUri="/hw" --defaultServer=TRUE --wait
is not returning a result if zpk is deployed successfully.
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:
Now who will beat me to implementing the above?!?
:)
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
If pass parameter in windows like this:
--folder="C:\tests"
--destination="C:\tests"
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
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.
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.
Fails with error message:
The application has thrown an exception!
ZendServerWebApi\Model\Exception\ApiException
This application has already been installed
"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.
configurationExport
configurationDirectivesList
e.g.
zs-client.phar getSystemInfo --target=dave --output-format=keyvalue
Are there any plans to add automated tests to this project?
I think this is crucial, as:
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
Under Windows XP, and probably other Windows OS versions, the phar file does not run as expected.
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
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
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.
Instead of "x=1&z=test" to use something like "x=1 y=test".
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.
When calling command monitorCountIssuesListPredefinedFilter the help text is wrong, it says that "libray version" is returned
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
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
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
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.
The icon image should be added to the final package if specified in the deployment.xml.
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).
Something like
zs-client update
?
Add autocomplete suggestions for bash http://www.gnu.org/software/bash/manual/bash.html#Programmable-Completion, http://www.debian-administration.org/articles/316 .
None of the library commands accept an argument to set default version nor is there anything that utilizes the functionality here http://files.zend.com/help/Zend-Server/zend-server.htm#the_librarysetdefault_method.htm
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
ZendServerWebApi\Model\Exception\ApiException
This action requires a HTTP POST method
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'));
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
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 !
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
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.
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)
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?
According to https://github.com/zend-patterns/ZendServerSDK/blob/af7dd2c8035ee9c1ad0d895fbaea3b5207e22cfd/module/Client/config/zpk/schema.xsd, the version tag, if not present, should be inserted between description and releasedate.
If the tag is present in the original deployment.xml, it works as expected.
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 :)
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">
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.
$ /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.
Please rebuild phar and commit, once this pull request is merged:
zend-patterns/ZendServerWebApiModule#14
Note: a ZPK library for Zend Server is needed as well.
Thanks!
ZD
the --http="..." arg is not available for installApp, in certain situations it needs to be specified. Thanks!
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.
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!).
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:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.