`
wuhuizhong
  • 浏览: 668804 次
  • 性别: Icon_minigender_1
  • 来自: 中山
社区版块
存档分类
最新评论

使用Torquebox在Windows下面进行Rails的部署

 
阅读更多

一、安装Torquebox


参考:
http://torquebox.org/getting-started/3.0.1/first-steps.html#first-steps-windows
http://torquebox.org/documentation/3.0.1/

JAVA_HOME=D:\Program Files\Java\jdk1.7.0_21
JBOSS_HOME=D:\torquebox-3.0.1\jboss
JRUBY_HOME=D:\torquebox-3.0.1\jruby
TORQUEBOX_HOME=D:\torquebox-3.0.1

E:\ruby_workspace\rails_example>cd rails_example
E:\ruby_workspace\rails_example>rails new .
Installing turbolinks (2.0.0)
Using uglifier (2.3.2)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.

E:\ruby_workspace\rails_example>rails g scaffold post title body:text

E:\ruby_workspace\rails_example>rake db:migrate

E:\ruby_workspace\rails_example>torquebox deploy --env=production
E:\ruby_workspace\rails_example>torquebox deploy
Deployed: rails_example-knob.yml
    into: D:/torquebox-3.0.1/jboss/standalone/deployments
   
E:\ruby_workspace\rails_example>echo Y | jruby -S torquebox run

二、注意端口占用情况


1.查看所有的端口占用情况
C:\>netstat -ano

2.查看指定端口的占用情况
C:\>netstat -aon|findstr "8080"

3.查看PID对应的进程
C:\Users\Administrator>tasklist|findstr "4160"
java.exe                      4160 Console                    2    257,432 K

C:\Users\Administrator>tasklist|findstr "7500"
java.exe                      7500 Console                    2    473,848 K

4.结束该进程
C:\Users\Administrator>taskkill /f /t /im java.exe
成功: 已终止 PID 7500 (属于 PID 5940 子进程)的进程。
成功: 已终止 PID 4160 (属于 PID 8200 子进程)的进程。


三、测试


http://localhost:8080/posts

Illegal key size: possibly you need to install Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files for your JRE

要求安装JCE,到Oracle 官网上(http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html)下载一个UnlimitedJCEPolicyJDK7.zip文件,解压缩后包含两个jar文件:local_policy.jar和US_export_policy.jar。将这两个文件替换$JAVA_HOME/jre/lib/security目录下两个同名文件,如,在我的电脑是就是替换D:\Program Files\Java\jdk1.7.0_21\jre\lib\security目录下两个文件。替换后,重启电脑。
 
四、应用


git clone git://github.com/netzke/netzke-demo.git && cd netzke-demo 
echo Y | jruby -S bundle install

注意:
1.需要ExtJs扩展类CheckColumn
http://code.vistaehr.com/bed-board-medsphere/src/fc3b2fb91eb5485728b0c36c28f9fd8c284176e0/web-app/js/extjs/examples/ux/?at=default

2.发布为 production时注意
问题:
ActionView::Template::Error (undefined method `js_compressor' for nil:NilClass):
解决:
修改application.rb
    config.assets.enabled = true
   
参考:
https://groups.google.com/forum/#!topic/netzke/aP-eiocn7qg
http://stackoverflow.com/questions/19378759/rails-4-upgrade-issue-from-rails-3-2-to-rails-4
https://github.com/gazeldx/mystory
http://guides.ruby-china.org/configuring.html
http://2015.iteye.com/blog/1209478
因为3.1后开始采用assets pipeline,所有**.css.scss、**.js.coffee文件都需要预编译,生产环境下默认不会进行编译,而开发环境下默认会先进行编译,所以开发环境不报错。
方法一:修改production.rb
    config.assets.compile = true #默认为false 
修改为true后,以后请求资源时如果发现没有编译会重新编译。但这样会影响效率,建议不要这样做。
方法二:
    rake assets:precompile 
然后重启rails server。这是推荐的做法。


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics