On Tuesday 19 May 2009 21:36:40 Peter Amiri wrote:

We've been there, done that!

Sample resin.conf:
  <cluster>

    --> All your interesting settings stuff goes here! <--

    <host-default>
      <resin:import path="host.xml" />
      <access-log path="${path}/../${logs}/engine_access.log">
        <rollover-period>2W</rollover-period>
      </access-log>
      <log level='warning' path='${path}/../${logs}/engine_error.log' 
name='com.caucho'>
        <rollover-size>1mb</rollover-size>
      </log>

      <web-app id="/" root-directory="${path}">
        <stdout-log path="${path}/../${logs}/stdout.log">
            <rollover-size>1mb</rollover-size>
        </stdout-log>
        <stderr-log path="${path}/../${logs}/stderr.log">
            <rollover-size>1mb</rollover-size>
        </stderr-log>
        <authenticator type='com.caucho.server.security.JdbcAuthenticator'>
        <init>
            <data-source>jdbc/main</data-source>
            <password-query>SELECT password FROM auth_users WHERE login = 
?</password-query>
            <role-query>SELECT name FROM auth_roles WHERE login = ?</role-query>
            <password-digest>none</password-digest>
        </init>
        </authenticator>
      </web-app>

      <database>
        <jndi-name>jdbc/main</jndi-name>
        <driver type="org.postgresql.Driver">
          <url>jdbc:postgresql://localhost:5432/${database}</url>
          <user>${db.user}</user>
          <password>${db.user}</password>
        </driver>
        <prepared-statement-cache-size>64</prepared-statement-cache-size>
        <max-connections>20</max-connections>
        <max-idle-time>10s</max-idle-time>
      </database>
    </host-default>

    <host-deploy path="conf/virtual" />
  </cluster>

then, we have resin/conf/virtual/<domain> directories, which contain only one
configuration file: host.xml
<host xmlns="http://caucho.com/ns/resin";
        xmlns:resin="http://caucho.com/ns/resin/core";>
        <resin:set var="path" value="/home/sites/maket5/www" />
        <resin:set var="logs" value="logs" />
        <resin:set var="database" value="maket5" />
        <resin:set var="db.user" value="maket5" />
</host>
(this is one example)

This way, you get virtual hosting, adding and removing sites without restarting
resin, flexible site directory locations and it works generally just fine.
The trick is <web-app id="/" root-directory="${path}">

There's another way, you can leave <host-default> unchanged
this way, your conf/virtual/<domain>/host.xml will look like this:
<host xmlns="http://caucho.com/ns/resin"; root-directory="/home/yoursite./www">
    <access-log path="../logs/engine_access.log">
        <rollover-period>2W</rollover-period>
    </access-log>
    <log level='warning' path='../logs/engine_error.log' name='com.caucho'>
        <rollover-size>1mb</rollover-size>
    </log>

    <web-app id="/" root-directory=".">
        <stdout-log path="../logs/stdout.log">
            <rollover-size>1mb</rollover-size>
        </stdout-log>
        <stderr-log path="../logs/stderr.log">
            <rollover-size>1mb</rollover-size>
        </stderr-log>
        <authenticator type='com.caucho.server.security.JdbcAuthenticator'>
        <init>
            <data-source>jdbc/main</data-source>
            <password-query>SELECT password FROM auth_users WHERE login = 
?</password-query>
            <role-query>SELECT name FROM auth_roles WHERE login = ?</role-query>
            <password-digest>none</password-digest>
        </init>
        </authenticator>
    </web-app>

    <database>
        <jndi-name>jdbc/main</jndi-name>
        <driver type="org.postgresql.Driver">
            <url>jdbc:postgresql://192.168.200.254:5432/yourdb</url>
            <user>yourdb</user>
            <password>yourdb</password>
        </driver>
        <prepared-statement-cache-size>64</prepared-statement-cache-size>
        <max-connections>20</max-connections>
        <max-idle-time>30s</max-idle-time>
    </database>

</host>

But, I've chose to move all that info into host-default, and make host.xml only
supply variables.

> Scott,
> 
> Thanks for the input. May be I'm going about this the wrong way. What  
> is the best practices for setting up shared virtual hosting of Resin.  
> I basically want to provide Railo (http://www.getrailo.org) hosting.  
> Railo is a CFML engine that can run on top of any J2EE container.  
> Right now I am using the cPanel control panel and have hooks  
> programmed in to create the necessary domain.xml files which are  
> tapped into a single install of Resin.
> 
> The current architecture works ]like this, when a user signs up, a new  
> domain.xml file is created and stored in a config directory. Then the  
> script does a touch on the resin.conf file to force a restart. The  
> resin.conf includes the newly created domain.xml using the  
> <resin:import> tag that reads all the xml files in the config  
> directory. So everything is working and automated, I just wanted to  
> know if there was a way to make it so the applications didn't see the  
> service go up and down.
> 
> Any advice you could provide on this would be appreciated.



_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest

Reply via email to