Table of Contents
DevOP
Managing php python javaee app server
- Enable python with mod-wsgi: http://www.howtoforge.com/forums/showthread.php?t=24109
- mod-python is an embedded python intepreter. mod-cgi invokes external intepreters, which may run as different user than www-root. So more security added. mod-wsgi is like mod-cgi but more resource-friendly on production server.
- mod-proxy to redirect requests to JavaEE Server.
mod_python is the closest equivalent of mod_php, but this doesn't mean that mod_python will suit your needs. For each programming language you have to enumerate all the possible options and choose the one you'll need. For PHP, you have mod_php and mod_cgi, but from this two mod_cgi is inferior in almost all ways to mod_php so people usually choose the latter. (There are some alternatives, like suphp if you need more security, etc.) For Python you have mod_cgi, which will run the python interpreter each time you make a request. Mod_python instead has python embedded so it's usually faster and simpler to do, but for large projects, or projects that are using a framework (like DJango) you will probably want to use mod_wsgi because it is the most resource-friendly. For ruby you also have the option to use mod_cgi, but that will be way too slow. mod_ruby is also an option, but only for small programs. mod_fastcgi was usually the option for rails/merb and other ruby based web frameworks, but they are superseeded by mod_rails and mod_rack, which are esource-friendly. But for simple scripts the latter are a bit too heavy-weight. For mono (asp.net) you have mod_mono, which is usually the only option. For java you usually run a separate Tomcat/Jetty web server, and use mod_proxy. Of course running a separate web server and use mod_proxy is usually an option for all the web frameworks, although it is mostly suitable for the development process only. For production environments you have to choose carefuly the best option (the one which is the mostly resource-friendly) your framework (django,rails,asp.net,etc.) needs
- Setup apache2 proxy to jbossAS: http://ocpsoft.org/opensource/jboss-application-server-7-on-port-80-with-apache-httpd-proxypass/
Continuous Integration Environment
Setup reference:
- Development: notebook
- Git: bitbucket? visrc?
- Jenkin CI Server: dev-host, better in VM?
- Deployment
- dev: host
- Test: vm
- Production: visrc.com netbook
Setup
Installation
- Jenkin CI with yum. Jenkin is auto-started on port 8080
- JbossAS 7.1
- Check out project on Eclipse
Configuration-JBOSS AS
Firstly we setup development, test, production server on single host. We configure multiple jbossAS instances on one machine.
https://community.jboss.org/thread/221012
- cp -rp default development
- vim ~/development/configuration/standalone.xml
<socket-binding-group name=“standard-sockets” default-interface=“public” port-offset=“${jboss.socket.binding.port-offset:10000}”
>
<socket-binding name="management-native" interface="management" port="${jboss.management.native.port:9999}"/>- create start script
cat<< 'EOF' > development.sh; chomod +x development.sh standalone.sh -Djboss.server.base.dir=$(pwd)/../development -Dorg.jboss.boot.log.file=$(pwd)/../development/log/boot.log -Dlogging.configuration=$(pwd)/../development/configuration/logging.properties EOF- In eclipse, go to Window / Preferences / Server / Runtime Environments / Add
C
reate a runtime environment “JBoss 7.1 Runtime Development”.
The configuration file must be a relative path like this: ....\development\configuration\standalone.xml
The JBoss tools eclipse seems to expect files to be in the default “standalone” folder.
- In the server view, right click New / Server
Select JBoss Community / JBoss AS 7.1 with the runtime created at step 3 (development).
- In the server view, double click on the server created at step 4 (or press F3) to open the parameter editor.
- In section “Server Ports”, uncheck “Detect from Local Runtime” and specify offset 10000. Again, we spent some time checking and unchecking these options and the only way to make it work is to override only this field.
- Click on the “Deployment” tab to see deployment default settings.
- Select “Use a custom deploy folder” and edit the directory fields.
- Replace “standalone/deployments” by “foo/deployments”.
- Replace “standalone/tmp” by “foo/tmp”.
- In the server’s parameter editor, go back to the overview, General Information, click “Open launch configuration”.
- First, uncheck “Always update arguments related to the runtime”.
- The “Program arguments” should look like this:
- mp “C:/tools/jboss/jboss-as-7.1.1.Final/modules” -jaxpmodule javax.xml.jaxp-provider org.jboss.as.standalone -b 0.0.0.0 –server-config=../../development/configuration/standalone.xml
You may use whatever parameters you need, the important thing for our setup is to specify the server configuration file relative to the default “standalone” path.
- The VM arguments now:
server -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true “-Dorg.jboss.boot.log.file=/home/dang/data/devfs/opt/jbossAS/development/log/boot.log” “-Dlogging.configuration=file:home/dang/data/devfs/opt/jbossAS/foo/configuration/logging.properties” “-Djboss.home.dir=/home/dang/data/devfs/opt/jbossAS/” “-Djboss.server.base.dir=/home/dang/data/devfs/opt/jbossAS/development” * Again, you may have to adjust these parameters to your needs. The important thing is to define the following: * Boot log file : -Dorg.jboss.boot.log.file=<path to boot file> * Logging configuration file: -Dlogging.configuration=<URL to log file configuration> * Base directory: -Djboss.server.base.dir=<Instance path> * Try to start and stop the server, look at the output to make sure the ports have the expected offset. * Make sure everything works: * Ppen a browser on “localhost:18080”, then open the administrative console. * In the “Runtime” section, click “Configuration” and “Environment Properties”. * Look at, say, “catalina.home” : it should be “C:\tools\jboss\jboss-as-7.1.1.Final\foo\tmp”. That’s it! ==== Setup Jenkins ==== * http://www.mastertheboss.com/jenkins/jenkins-tutorial/page-2