Results 1 to 4 of 4

Thread: How to run z-push on zimbra jetty: Proof of Concept

Threaded View

  1. #1
    Join Date
    Sep 2009
    Posts
    21
    Rep Power
    6

    Default How to run z-push on zimbra jetty: Proof of Concept

    This is a proof of concept for getting z-push to run on the same server as zimbra without doing too much. It was late when I did this, so I may have missed a step or two. There probably is even a better way to do this! Also, this is only a proof of concept. Future updates will probably break it. As always, use at your own risk!

    This was tested using z-push 2.0.8-1731, zimbrabackend 56.1, Zimbra 8.0.4 OSE on Centos6

    install php-cgi php-process

    :create folder
    opt/z-push and copy z-push files to it
    Configure z-push per install instructions. zimbra url for backend can be localhost or 127.0.0.1

    :create link in opt/zimbra/jetty/webapps to /opt/z-push
    ln -s /opt/zimbra/jetty/webapps/z-push /opt/z-push

    :create shell file called php-cgi-fix.sh in /usr/bin
    #/usr/bin/sh
    export SCRIPT_FILENAME=$1
    /usr/bin/php-cgi

    :create a WEB-INF folder in /opt/z-push

    :create web.xml file with the following info and place in /opt/z-push/WEB-INF
    Code:
    <?xml version="1.0" encoding="ISO-8859-1"?>
        <web-app
          xmlns="http://java.sun.com/xml/ns/j2ee"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
          version="2.4"
        >
    
         <display-name>php</display-name>
    
         <servlet>
           <servlet-name>PHP</servlet-name>
           <servlet-class>org.eclipse.jetty.servlets.CGI</servlet-class>
           <load-on-startup>1</load-on-startup>
    
           <init-param>
                <param-name>commandPrefix</param-name>
                <param-value>/usr/bin/php-cgi-fix.sh</param-value>
           </init-param>
    
              <init-param>
                  <param-name>Path</param-name>
                  <param-value>/bin:/usr/bin:/usr/local/bin</param-value>
              </init-param>
            
         </servlet>
    
         <servlet-mapping>
           <servlet-name>PHP</servlet-name>
           <url-pattern>*.php</url-pattern>
         </servlet-mapping>
    
         <!--
         <welcome-file-list>
           <welcome-file>index.php</welcome-file>
         </welcome-file-list>
         -->
    
    <Call name="addAliasCheck">
        <Arg>
          <New class="org.eclipse.jetty.server.handler.ContextHandler$ApprovePathPrefixAliases"/>
        </Arg>
      </Call>
    
    <security-constraint>
            <web-resource-collection>
                <web-resource-name>deny</web-resource-name>
                <url-pattern>/backend/*</url-pattern>
    	    <url-pattern>/include/*</url-pattern>
                <url-pattern>/lib/*</url-pattern>
    	    <url-pattern>/WEB-INF/*</url-pattern>
                <url-pattern>/config.php</url-pattern>
                <url-pattern>/z-push-top.php</url-pattern>
                <url-pattern>/z-push-admin.php</url-pattern>
                <url-pattern>/INSTALL</url-pattern>
                <url-pattern>/LICENSE</url-pattern>
            </web-resource-collection>
    	<auth-constraint>
           <role-name>deny</role-name>
        	</auth-constraint>
           </security-constraint>
    </web-app>
    :edit /opt/zimbra/jetty/etc/jetty.xml.in
    Find
    Code:
                <Set name="replacement">/service/extension/zimbrasync</Set>
    Change
    Code:
                 <Set name="replacement">/z-push/index.php</Set>
    Add
    I added this below a similar entry for "zimlet"
    Code:
    <Call name="addRule">
    	    <Arg>        
    		<New class="org.eclipse.jetty.rewrite.handler.RewritePatternRule">
    		    <Set name="pattern">/z-push/*</Set>
    		    <Set name="replacement">/z-push</Set>
    		    <Set name="terminating">true</Set>
    		</New>
    	    </Arg>
            </Call>
    Add
    Again, I added this near similar code for "zimlet"
    Code:
    <New id="z-push" class="org.eclipse.jetty.webapp.WebAppContext">
          <Arg><Ref id="Contexts"/></Arg>
          <Arg><SystemProperty name="jetty.home" default="."/>/webapps/z-push</Arg>
          <Arg>/z-push</Arg>
          <Set name="configurationClasses"><Ref id="plusConfig"/></Set>
          <Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</Set>
          <Set name="tempDirectory"><SystemProperty name="jetty.home" default="."/>/work/z-push</Set>
          <Set name="compactPath">true</Set>
          <Get name="errorHandler">
            <Call name="setShowStacks">
              <Arg type="boolean">false</Arg>
            </Call>
          </Get>
          <Call name="setAttribute">
            <Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
    		<Arg>.*/.*jsp-api-[^/]*\.jar$|.*/.*jsp-[^/]*\.jar$|.*/.*taglibs[^/]*\.jar$</Arg>
          </Call> 
        </New>
    :Edit php.ini
    edit etc/php.ini
    magic_quotes_gpc off
    register_globals off
    magic_quotes_runtime off
    short_open_tag on
    cgi.force_redirect = 0
    max_execution_time = 120
    memory_limit = 128M

    :restart jetty
    su zimbra
    zmmailboxdctl restart

    That should do it.
    I welcome any feedback/suggestions. Please let me know if you have any questions, and I'll do my best to answer them.
    Last edited by speedy3k; 09-02-2013 at 12:06 PM.

Similar Threads

  1. Chacal, a CardDAV extension for Thunderbird (proof of concept)
    By ewilen in forum CalDAV / CardDAV / iSync
    Replies: 2
    Last Post: 12-13-2013, 09:55 PM
  2. Trial Install for Proof of Concept
    By Monty3038 in forum Installation
    Replies: 2
    Last Post: 02-07-2011, 09:09 AM
  3. Replies: 1
    Last Post: 09-06-2010, 06:45 AM
  4. Replies: 1
    Last Post: 09-06-2010, 06:45 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •