9 Replies Latest reply on Sep 10, 2009 11:50 AM by pplupo

    One deploy dir per user

    pplupo

      Hi everyone.
      I'm from a large brazilian university and I have been presented the following problem from the laboratory administrators of a computer science department who are seeking to provide JBoss AS for the students.

      ATM, each user has a login and a home directory. At this home dir, there is a public_html where files can be placed to be served by Apache HTTPD (for those who know it, that is made with mod_userdir /home//public_html makes it available at /~).

      In order to provide JBoss AS, it would be nice if one could set it up like that. Indicate a directory in user's profile which would be scanned for deployment and make the application available at some url also configurable.

      So, to be short: I want one instance of JBoss AS scanning multiple dirs for applications to be made available at different urls, depending on the dir, with each dir related to a particular user.

      Can anyone say how it can be done with AS5?

      Thank you, in advance.

        • 1. Re: One deploy dir per user
          peterj

          Which version of JBoss AS5? For 5.1.0, you can edit the applicationURIs property for the BootstrapProfileFactory bean in the server/xxx/conf/bootstrap/profile.xml file, adding in extra directories:

          <property name="applicationURIs">
           <list elementClass="java.net.URI">
           <value>${jboss.server.home.url}deploy</value>
           <value>/path/to/other/dir</value>
           </list>
          </property>



          • 2. Re: One deploy dir per user
            pplupo

            That's nice, it's almost that. Now, how can I make each dir to map to a different URL?
            Like


            ${jboss.server.home.url}deploy
            /path/to/studentA


            ${jboss.server.home.url}deploy
            /path/to/studentB


            so the first element is made available at http://domain/studentA and the second at http://domain/studentB?

            • 3. Re: One deploy dir per user
              pplupo

              I'm sorry, I forgot to tag like code.

              The "${jboss.server.home.url}deploy
              /path/to/studentA
              ${jboss.server.home.url}deploy
              /path/to/studentB"

              should be:

              <property name="applicationURIs">
               <list elementClass="java.net.URI">
               <value>${jboss.server.home.url}deploy</value>
               <value>/path/to/studentA</value>
               </list>
               <list elementClass="java.net.URI">
               <value>${jboss.server.home.url}deploy</value>
               <value>/path/to/studentB</value>
               </list>
              </property>


              • 4. Re: One deploy dir per user
                peterj

                Here's one way - give each directory a .war extension:

                <property name="applicationURIs">
                 <list elementClass="java.net.URI">
                 <value>${jboss.server.home.url}deploy</value>
                 <value>/path/to/studentA.war</value>
                 </list>
                 <list elementClass="java.net.URI">
                 <value>${jboss.server.home.url}deploy</value>
                 <value>/path/to/studentB.war</value>
                 </list>
                </property>


                • 5. Re: One deploy dir per user
                  pplupo

                  But then will they be able to deploy compressed wars or just exploded?

                  In fact, will they be able to deploy ears?

                  • 6. Re: One deploy dir per user
                    peterj

                    No, that of course just provides access to HTML and similar pages.

                    For deploying WAR, EAR and EJB-JARs you would have to go without the .war extension on the directory. (Actually, thinking about it some more, that won't work anyway, though it woulds work in AS 4.x.)

                    I don't know of any way of providing a separate context for each student.

                    • 7. Re: One deploy dir per user
                      pplupo

                      Thank you, Peter, for trying. I still hope someone will answer this.

                      • 8. Re: One deploy dir per user
                        pplupo

                        The session "User Web Applications" at "http://tomcat.apache.org/tomcat-6.0-doc/config/host.html" is exactly what I'm looking for at JBoss.

                        • 9. Re: One deploy dir per user
                          pplupo

                          On Tomcat there is a config file where one can declare:

                          <Host name="localhost" ...>

                          <Listener className="org.apache.catalina.startup.UserConfig"
                          directoryName="public_html"
                          homeBase=c:\Homes"
                          userClass="org.apache.catalina.startup.HomesUserDatabase"/>


                          where "c:\homes" is where users' home folders are and "public_html" is the folder to be scanned for WAR files.

                          Then if there is a user called "pplupo", his contents will be found at C:\homes\pplupo\public_html and his applications will be available at http://host:port/~pplupo automatically.

                          I just want to do something similar with JBoss. Even if it is not that easy, if I have to change multiple files, multiple tags, properties or anything else, but I need to set up an environment like that.

                          Can anyone help me?