Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--template parameter example for zs-client.phar vhostAdd, vhostEdit, vhostValidateTemplate #87

Closed
Schnaaf opened this issue May 27, 2016 · 2 comments

Comments

@Schnaaf
Copy link

Schnaaf commented May 27, 2016

We are in the process of setting up continuous integration on Jenkins. We are having troubles setting up the required vhosts for Zend Server through zs-client.phar.

The problem I have is that I have no clue on how to specify the value for the template parameter in the commands vhostAdd, vhostEdit, vhostValidateTemplate

php /usr/local/bin/zs-client.phar vhostAdd --target=servertarget --name=vhostname --port=port --template=<???>

Can you provide an example for the --template parameter usage?

@Schnaaf Schnaaf changed the title vhostAdd --template="..." example --template parameter example for zs-client.phar vhostAdd, vhostEdit, vhostValidateTemplate May 28, 2016
@slaff
Copy link
Contributor

slaff commented Jun 2, 2016

The --template option accepts as a value local-file-name or the actual template content. If you run the command with --help it will show you more information:

php /usr/local/bin/zs-client.phar vhostAdd --help

* vhostAdd --name= --port= [--template=] [--forceCreation=] [--target=] [--zsurl=] [--zskey=] [--zssecret=] [--zsversion=] [--http=] [--output-format=] 

Add a new virtual host. Receives name, port and template and returns a single virtual hostelement with the same information.
  --name             Name of virtual host.                                                                                                                                                                  
  --port             Port of virtual host.                                                                                                                                                                  
  --template         Template of the virtual host settings according to the web server configuration options. Or an absolute path to a local template vhost file.                                           
  --forceCreation    Force the creation of a virtual host, even if it fails syntax validation. Default: FALSE                                                                                               
  --output-format    Output format. Default is "xml", but you can use json or kv(for key-value) 

slaff pushed a commit to zend-patterns/ZendServerWebApiModule that referenced this issue Jun 2, 2016
@Schnaaf
Copy link
Author

Schnaaf commented Jun 2, 2016

Thanks for your answer and updates. In the meantime I got a more elaborate answer from Zend Support which answered my question in just the right amount of detail. Especially the .tpl extension requirement and pointing me to the examples located in /usr/local/zend/share/. Maybe it is worth it to add this to the documentation as well.

Answer from Zend Support:

While creating, editing or validating a Virtual Host using zs-client.phar, to specify a custom Virtual Host template using the --template option, you need to use any one of the following Virtual Host templates:
Apache --> /usr/local/zend/share/vhost.tpl
Apache with SSL --> /usr/local/zend/share/vhost-ssl.tpl
NginX --> /usr/local/zend/share/vhost-nginx.tpl
NginX with SSL --> /usr/local/zend/share/vhost-nginx-ssl.tpl
You can create a copy of the template file (file extension must be ".tpl") and place it somewhere on your server, for example /root/vhost_templates. Then use this template file in the command. Here's a sample command to add a Virtual Host using zs-client.phar vhostAdd:
# /usr/local/zend/bin/php zs-client.phar vhostAdd --name=samplevhost --port=80 --template=/root/vhost_templates/vhost_sample.tpl --forceCreation=true --zsurl=http://localhost:10081 --zskey=admin --zssecret=123456789abcdef123456789abcdef123456789abcdef123456789abcdef1234
Note: The virtual host template file must be present locally on the server where you run the command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants