Re: [Resin-interest] Automating virtual hosting....
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-period2W/rollover-period /access-log log level='warning' path='${path}/../${logs}/engine_error.log' name='com.caucho' rollover-size1mb/rollover-size /log web-app id=/ root-directory=${path} stdout-log path=${path}/../${logs}/stdout.log rollover-size1mb/rollover-size /stdout-log stderr-log path=${path}/../${logs}/stderr.log rollover-size1mb/rollover-size /stderr-log authenticator type='com.caucho.server.security.JdbcAuthenticator' init data-sourcejdbc/main/data-source password-querySELECT password FROM auth_users WHERE login = ?/password-query role-querySELECT name FROM auth_roles WHERE login = ?/role-query password-digestnone/password-digest /init /authenticator /web-app database jndi-namejdbc/main/jndi-name driver type=org.postgresql.Driver urljdbc:postgresql://localhost:5432/${database}/url user${db.user}/user password${db.user}/password /driver prepared-statement-cache-size64/prepared-statement-cache-size max-connections20/max-connections max-idle-time10s/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-period2W/rollover-period /access-log log level='warning' path='../logs/engine_error.log' name='com.caucho' rollover-size1mb/rollover-size /log web-app id=/ root-directory=. stdout-log path=../logs/stdout.log rollover-size1mb/rollover-size /stdout-log stderr-log path=../logs/stderr.log rollover-size1mb/rollover-size /stderr-log authenticator type='com.caucho.server.security.JdbcAuthenticator' init data-sourcejdbc/main/data-source password-querySELECT password FROM auth_users WHERE login = ?/password-query role-querySELECT name FROM auth_roles WHERE login = ?/role-query password-digestnone/password-digest /init /authenticator /web-app database jndi-namejdbc/main/jndi-name driver type=org.postgresql.Driver urljdbc:postgresql://192.168.200.254:5432/yourdb/url useryourdb/user passwordyourdb/password /driver prepared-statement-cache-size64/prepared-statement-cache-size max-connections20/max-connections max-idle-time30s/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
Re: [Resin-interest] Automating virtual hosting....
On May 18, 2009, at 10:09 AM, Peter Amiri wrote: Thank you everyone for your assistance on getting this setup. I now have a directory where I can drop individual config files for each domain and get them integrated into the resin.conf file using resin:import. The one issue I have with this is that it requires a restart of Resin to discover the newly added file which will kill everyones sessions and forces a reload of all the web apps. Not a very appealing feature from the customer perspective ;-) Hmm. That's an interesting point. Even if the directory change was detected, Resin would force a restart because the config file affects the cluster, even though you might just be adding a new host. In other words, it wouldn't be sophisticated enough to know that adding a host is isolated. Someone told me I could setup a cluster with two Resin instances running on the same server so if the instances had to be restarted the sessions would be preserved. Does anyone know how to do this? It would be a little more complicated because you'd also need a load balancer. You can use a single resin.xml file. Each Resin server/virtual-host would have its own cluster. (A cluster for Resin is a collection of identically-configured virtual hosts. You can have one server in a cluster.) Assuming you have a single HTTP port, you'd need a load- balance instance of Resin to forward the requests to the proper backend Resin instance. -- Scott -Peter On May 12, 2009, at 4:33 PM, Peter Amiri wrote: Thanks Scott for all the help. This is how far I've gotten. I have added the import block to Resin conf file as follows: resin:import fileset dir=/var/www/vhosts/resinconf include*.xml/include /fileset /resin:import I have also created a directory at : /var/www/vhosts/resinconf and placed the following file in it: showmyip.xml and the file contains the following: cluster xmlns=http://caucho.com/ns/resin; host host-name=www.viditag.com host-aliasviditag.com/host-alias root-directory/var/www/vhosts/viditag.com/httpdocs/root- directory web-app id=/ root-directory=. / /host /cluster When I restart Railo it starts up and doesn't give any errors. But when I try to hit the virtual host I get an error that is indicative that the host block was not loaded. So it seems that the resin:import command doesn't through any errors but cannot find or access the showmyip.xml file. Any ideas what could be causing this? I've alrady chmod the resinconf dir and the showmyip.xml file to 777 to make sure it is not a permission issue but that didn't help matters either. -Peter On May 12, 2009, at 12:19 PM, Scott Ferguson wrote: On May 12, 2009, at 11:33 AM, Peter Amiri wrote: Scott, Do you know what the syntax of the actual xml files should be? Is there a container that should hold the host block in the individual xml files? resin:import always uses the containing context for the top-level xml, because it's like an extension of the current context. Since your host import is inside the cluster, the syntax of your *.xml would be cluster xmlns=http://caucho.com/ns/resin; host ... ... /host /cluster -- Scott -Peter On May 12, 2009, at 11:07 AM, Scott Ferguson wrote: On May 12, 2009, at 10:49 AM, Peter Amiri wrote: I am trying to automate the process of integrating Resin with a cPanel hosting environment. For each customer that signs up for a cPanel account I need to add the virtual hosting tags to the Resin conf file manually. Currently the code block that is added is similar to this: host host-name=www.domainname.com host-aliasdomainname.com/host-alias root-directory/home/path_to_domain/public_html/root- directory web-app id=/ root-directory=. / /host These blocks are added to the cluster.../cluster block within the resin conf file. Unfortunately the path to the domain is not based on the domain name so I cannot setup dynamic virtual hosting based on a path. But I wanted to know if there was a way to write these individual blocks into separate files that got included or imported by the Resin conf file. You can try the resin:import with the fileset syntax: cluster id= ... resin:import fileset dir=hosts include*.xml/include /fileset /resin:import That sounds like it's what you're looking for. -- Scott In other words I can take into a hook for cPanel and create a text file with the contents of the block above (or some new lines if needed) and save it as something like domain.conf. Then I would like to have the resin conf file automatically read in all these domain based conf files based on the path to the file locations and the extension so any new domain conf file that is dropped into the directory would automatically be included or become part of the Resin conf file. Is this doable with Resin 3.1? -Peter
Re: [Resin-interest] Automating virtual hosting....
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. -Peter On May 19, 2009, at 9:25 AM, Scott Ferguson wrote: On May 18, 2009, at 10:09 AM, Peter Amiri wrote: Thank you everyone for your assistance on getting this setup. I now have a directory where I can drop individual config files for each domain and get them integrated into the resin.conf file using resin:import. The one issue I have with this is that it requires a restart of Resin to discover the newly added file which will kill everyones sessions and forces a reload of all the web apps. Not a very appealing feature from the customer perspective ;-) Hmm. That's an interesting point. Even if the directory change was detected, Resin would force a restart because the config file affects the cluster, even though you might just be adding a new host. In other words, it wouldn't be sophisticated enough to know that adding a host is isolated. Someone told me I could setup a cluster with two Resin instances running on the same server so if the instances had to be restarted the sessions would be preserved. Does anyone know how to do this? It would be a little more complicated because you'd also need a load balancer. You can use a single resin.xml file. Each Resin server/virtual-host would have its own cluster. (A cluster for Resin is a collection of identically-configured virtual hosts. You can have one server in a cluster.) Assuming you have a single HTTP port, you'd need a load- balance instance of Resin to forward the requests to the proper backend Resin instance. -- Scott -Peter ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest
Re: [Resin-interest] Automating virtual hosting....
Thank you everyone for your assistance on getting this setup. I now have a directory where I can drop individual config files for each domain and get them integrated into the resin.conf file using resin:import. The one issue I have with this is that it requires a restart of Resin to discover the newly added file which will kill everyones sessions and forces a reload of all the web apps. Not a very appealing feature from the customer perspective ;-) Someone told me I could setup a cluster with two Resin instances running on the same server so if the instances had to be restarted the sessions would be preserved. Does anyone know how to do this? -Peter On May 12, 2009, at 4:33 PM, Peter Amiri wrote: Thanks Scott for all the help. This is how far I've gotten. I have added the import block to Resin conf file as follows: resin:import fileset dir=/var/www/vhosts/resinconf include*.xml/include /fileset /resin:import I have also created a directory at : /var/www/vhosts/resinconf and placed the following file in it: showmyip.xml and the file contains the following: cluster xmlns=http://caucho.com/ns/resin; host host-name=www.viditag.com host-aliasviditag.com/host-alias root-directory/var/www/vhosts/viditag.com/httpdocs/root- directory web-app id=/ root-directory=. / /host /cluster When I restart Railo it starts up and doesn't give any errors. But when I try to hit the virtual host I get an error that is indicative that the host block was not loaded. So it seems that the resin:import command doesn't through any errors but cannot find or access the showmyip.xml file. Any ideas what could be causing this? I've alrady chmod the resinconf dir and the showmyip.xml file to 777 to make sure it is not a permission issue but that didn't help matters either. -Peter On May 12, 2009, at 12:19 PM, Scott Ferguson wrote: On May 12, 2009, at 11:33 AM, Peter Amiri wrote: Scott, Do you know what the syntax of the actual xml files should be? Is there a container that should hold the host block in the individual xml files? resin:import always uses the containing context for the top-level xml, because it's like an extension of the current context. Since your host import is inside the cluster, the syntax of your *.xml would be cluster xmlns=http://caucho.com/ns/resin; host ... ... /host /cluster -- Scott -Peter On May 12, 2009, at 11:07 AM, Scott Ferguson wrote: On May 12, 2009, at 10:49 AM, Peter Amiri wrote: I am trying to automate the process of integrating Resin with a cPanel hosting environment. For each customer that signs up for a cPanel account I need to add the virtual hosting tags to the Resin conf file manually. Currently the code block that is added is similar to this: host host-name=www.domainname.com host-aliasdomainname.com/host-alias root-directory/home/path_to_domain/public_html/root- directory web-app id=/ root-directory=. / /host These blocks are added to the cluster.../cluster block within the resin conf file. Unfortunately the path to the domain is not based on the domain name so I cannot setup dynamic virtual hosting based on a path. But I wanted to know if there was a way to write these individual blocks into separate files that got included or imported by the Resin conf file. You can try the resin:import with the fileset syntax: cluster id= ... resin:import fileset dir=hosts include*.xml/include /fileset /resin:import That sounds like it's what you're looking for. -- Scott In other words I can take into a hook for cPanel and create a text file with the contents of the block above (or some new lines if needed) and save it as something like domain.conf. Then I would like to have the resin conf file automatically read in all these domain based conf files based on the path to the file locations and the extension so any new domain conf file that is dropped into the directory would automatically be included or become part of the Resin conf file. Is this doable with Resin 3.1? -Peter ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com
[Resin-interest] Automating virtual hosting....
I am trying to automate the process of integrating Resin with a cPanel hosting environment. For each customer that signs up for a cPanel account I need to add the virtual hosting tags to the Resin conf file manually. Currently the code block that is added is similar to this: host host-name=www.domainname.com host-aliasdomainname.com/host-alias root-directory/home/path_to_domain/public_html/root- directory web-app id=/ root-directory=. / /host These blocks are added to the cluster.../cluster block within the resin conf file. Unfortunately the path to the domain is not based on the domain name so I cannot setup dynamic virtual hosting based on a path. But I wanted to know if there was a way to write these individual blocks into separate files that got included or imported by the Resin conf file. In other words I can take into a hook for cPanel and create a text file with the contents of the block above (or some new lines if needed) and save it as something like domain.conf. Then I would like to have the resin conf file automatically read in all these domain based conf files based on the path to the file locations and the extension so any new domain conf file that is dropped into the directory would automatically be included or become part of the Resin conf file. Is this doable with Resin 3.1? -Peter ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest
Re: [Resin-interest] Automating virtual hosting....
Thanks Scott for all the help. This is how far I've gotten. I have added the import block to Resin conf file as follows: resin:import fileset dir=/var/www/vhosts/resinconf include*.xml/include /fileset /resin:import I have also created a directory at : /var/www/vhosts/resinconf and placed the following file in it: showmyip.xml and the file contains the following: cluster xmlns=http://caucho.com/ns/resin; host host-name=www.viditag.com host-aliasviditag.com/host-alias root-directory/var/www/vhosts/viditag.com/httpdocs/root- directory web-app id=/ root-directory=. / /host /cluster When I restart Railo it starts up and doesn't give any errors. But when I try to hit the virtual host I get an error that is indicative that the host block was not loaded. So it seems that the resin:import command doesn't through any errors but cannot find or access the showmyip.xml file. Any ideas what could be causing this? I've alrady chmod the resinconf dir and the showmyip.xml file to 777 to make sure it is not a permission issue but that didn't help matters either. -Peter On May 12, 2009, at 12:19 PM, Scott Ferguson wrote: On May 12, 2009, at 11:33 AM, Peter Amiri wrote: Scott, Do you know what the syntax of the actual xml files should be? Is there a container that should hold the host block in the individual xml files? resin:import always uses the containing context for the top-level xml, because it's like an extension of the current context. Since your host import is inside the cluster, the syntax of your *.xml would be cluster xmlns=http://caucho.com/ns/resin; host ... ... /host /cluster -- Scott -Peter On May 12, 2009, at 11:07 AM, Scott Ferguson wrote: On May 12, 2009, at 10:49 AM, Peter Amiri wrote: I am trying to automate the process of integrating Resin with a cPanel hosting environment. For each customer that signs up for a cPanel account I need to add the virtual hosting tags to the Resin conf file manually. Currently the code block that is added is similar to this: host host-name=www.domainname.com host-aliasdomainname.com/host-alias root-directory/home/path_to_domain/public_html/root- directory web-app id=/ root-directory=. / /host These blocks are added to the cluster.../cluster block within the resin conf file. Unfortunately the path to the domain is not based on the domain name so I cannot setup dynamic virtual hosting based on a path. But I wanted to know if there was a way to write these individual blocks into separate files that got included or imported by the Resin conf file. You can try the resin:import with the fileset syntax: cluster id= ... resin:import fileset dir=hosts include*.xml/include /fileset /resin:import That sounds like it's what you're looking for. -- Scott In other words I can take into a hook for cPanel and create a text file with the contents of the block above (or some new lines if needed) and save it as something like domain.conf. Then I would like to have the resin conf file automatically read in all these domain based conf files based on the path to the file locations and the extension so any new domain conf file that is dropped into the directory would automatically be included or become part of the Resin conf file. Is this doable with Resin 3.1? -Peter ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest
Re: [Resin-interest] Automating virtual hosting....
Try turning on resin logging to fine or finest and see if it detects your configuration files. I don't remember the logging statements, but it should be inside one of the default resin.conf files that comes with the distribution. -ck On May 12, 2009, at 4:33 PM, Peter Amiri wrote: Thanks Scott for all the help. This is how far I've gotten. I have added the import block to Resin conf file as follows: resin:import fileset dir=/var/www/vhosts/resinconf include*.xml/include /fileset /resin:import I have also created a directory at : /var/www/vhosts/resinconf and placed the following file in it: showmyip.xml and the file contains the following: cluster xmlns=http://caucho.com/ns/resin; host host-name=www.viditag.com host-aliasviditag.com/host-alias root-directory/var/www/vhosts/viditag.com/httpdocs/root- directory web-app id=/ root-directory=. / /host /cluster When I restart Railo it starts up and doesn't give any errors. But when I try to hit the virtual host I get an error that is indicative that the host block was not loaded. So it seems that the resin:import command doesn't through any errors but cannot find or access the showmyip.xml file. Any ideas what could be causing this? I've alrady chmod the resinconf dir and the showmyip.xml file to 777 to make sure it is not a permission issue but that didn't help matters either. -Peter On May 12, 2009, at 12:19 PM, Scott Ferguson wrote: On May 12, 2009, at 11:33 AM, Peter Amiri wrote: Scott, Do you know what the syntax of the actual xml files should be? Is there a container that should hold the host block in the individual xml files? resin:import always uses the containing context for the top-level xml, because it's like an extension of the current context. Since your host import is inside the cluster, the syntax of your *.xml would be cluster xmlns=http://caucho.com/ns/resin; host ... ... /host /cluster -- Scott -Peter On May 12, 2009, at 11:07 AM, Scott Ferguson wrote: On May 12, 2009, at 10:49 AM, Peter Amiri wrote: I am trying to automate the process of integrating Resin with a cPanel hosting environment. For each customer that signs up for a cPanel account I need to add the virtual hosting tags to the Resin conf file manually. Currently the code block that is added is similar to this: host host-name=www.domainname.com host-aliasdomainname.com/host-alias root-directory/home/path_to_domain/public_html/root- directory web-app id=/ root-directory=. / /host These blocks are added to the cluster.../cluster block within the resin conf file. Unfortunately the path to the domain is not based on the domain name so I cannot setup dynamic virtual hosting based on a path. But I wanted to know if there was a way to write these individual blocks into separate files that got included or imported by the Resin conf file. You can try the resin:import with the fileset syntax: cluster id= ... resin:import fileset dir=hosts include*.xml/include /fileset /resin:import That sounds like it's what you're looking for. -- Scott In other words I can take into a hook for cPanel and create a text file with the contents of the block above (or some new lines if needed) and save it as something like domain.conf. Then I would like to have the resin conf file automatically read in all these domain based conf files based on the path to the file locations and the extension so any new domain conf file that is dropped into the directory would automatically be included or become part of the Resin conf file. Is this doable with Resin 3.1? -Peter ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest