torquebox、jruby配置

开个torquebox配置的文章做记录。

官网 : http://torquebox.org/

下载一个最新的,

点击 官方文档的地方: Documentation

我的服务器是centos6.2

检查java版本:java -version

需要在1.6以上,基本现在都是1.6以上的。

yum install httpd-devel openssl-devel zlib-devel gcc gcc-c++ curl-devel expatdevel gettext-devel mysql-devel readline-devel libxml2-devel libxslt-devel
yum install make libtool autoconf automake imake expat-devel

上传torquebox-dist-2.1.2-bin.zip到/root/tool下(我默认的地方,不一定)

解压:

unzip -q torquebox-dist-2.1.2-bin.zip

 ln -s torquebox-2.0.3 torquebox-current
在etc/profile修改
export TORQUEBOX_HOME=$HOME/torquebox-current
export JBOSS_HOME=$TORQUEBOX_HOME/jboss
export JRUBY_HOME=$TORQUEBOX_HOME/jruby
export PATH=$JRUBY_HOME/bin:$PATH

使配置生效: source /etc/profile

$ mkdir -p ~/torquebox_examples/rails_example

$cd ~/torquebox_examples/rails_example

A)jruby -S gem install activerecord-jdbc-adapter --no-ri --no-rdoc

B)jruby -S gem install jdbc-mysql activerecord-jdbcmysql-adapter --no-ri --no-rdoc

C)jruby -S gem install jruby-openssl --no-ri --no-rdoc

D)jruby -S gem install rails --no-ri --no-rdoc

jruby -S gem update --system

rails new dms -d mysql

//todo 修改数据库配置

bundle install

rake db:create

在项目根目录下跑: torquebox deploy

jboss下jboss/standalone/configuration配置文件standalone.xml

<interfaces>
<interface name='management'>
<inet-address value='${jboss.bind.address.management:127.0.0.1}'/>
</interface>
<interface name='public'>
<inet-address value='${jboss.bind.address:127.0.0.1}'/>
</interface>
<interface name='unsecure'>
<!-- Used for IIOP sockets in the standarad configuration.
To secure JacORB you need to setup SSL -->
<inet-address value='127.0.0.1'/>
</interface>
</interfaces>

改为

<interfaces>
<interface name="management">
<inet-address value="0.0.0.0"/>
</interface>
<interface name="public">
<inet-address value="0.0.0.0"/>
</interface>
<interface name="unsecure">
<inet-address value="0.0.0.0"/>
</interface>
</interfaces>

./standalone.sh

nohup ./standalone.sh &

重启torquebox ,8080端口可以访问了(如占用了,需要修改端口)。

你可能感兴趣的:(jruby)