Articles of ruby on rails

乘客模块在“AWSvariables名”错误的AWS Gem上失败

开放免责声明:我对这个问题涉及的技术有各种各样的新手。 但谷歌,她没有屈服 – 一个果实。 我正在尝试将Rails应用程序部署到生产环境中。 这个应用程序工作正常使用WEBRick。 我也使用AWS gem从S3中检索数据。 我用Passenger安装并设置了Nginx。 当我打开页面我正在testing我得到这个错误: /home/ec2-user/.gem/ruby/2.0/gems/aws-s3-0.6.3/lib/aws/s3/extensions.rb:223: `@@{' is not allowed as a class variable name /home/ec2-user/.gem/ruby/2.0/gems/aws-s3-0.6.3/lib/aws/s3/extensions.rb:223: syntax error, unexpected end-of-input unless defined? @@{:instance_writer=>false} ^ (SyntaxError) 我猜想关于Nginx / Passenger / Who-Knows在AWS代码上感到窒息,但是再次使用WEBRick,我不会得到这个错误。

如何告诉Apache如何破坏和防止安装ruby乘客模块

我正在安装一个Ruby on Rails应用程序到Ubuntu 14.04服务器。 作为它的一部分,我需要安装Apache的乘客模块。 当我运行“passenger-install-apache2-module”时,收到一条消息:“您的Apache安装可能会中断”。 它提供了一些build议的命令,但是它们没有显示任何有用的信息。 完整的输出如下。 Ruby,rails,Apache和RVM都已经安装完毕。 我已经尝试在现在之前删除并重新安装它们,但没有成功。 有什么特别的,我需要做的,看看究竟可能会破坏与Apache或乘客? 我想避免重新安装Apache或Ruby。 提前致谢! 乘客脚本之后的确切输出显示所有的依赖性已经被满足。 Sanity checking Apache installation… AH00526: Syntax error on line 10 of /etc/apache2/pf.conf: Invalid command 'RailsEnv', perhaps misspelled or defined by a module not included in the server configuration AH00526: Syntax error on line 10 of /etc/apache2/pf.conf: Invalid command 'RailsEnv', perhaps misspelled […]

请求与nginx,独angular兽和rails的超时问题

我在轨道上有一个应用程序,它在生产中运行独angular兽。 有一些请求需要花费很长时间来处理。 我已经configuration服务器来增加超时,所以这些请求正常工作。 问题是,当请求需要超过30秒的响应时,我得到这个消息: 暂停服务 该服务暂时不可用。 请稍后再试。 在unicorn.rb我有timeout 120configuration和我的nginx.conf是: upstream unicorn_my_app { server unix:/tmp/my_app.socket fail_timeout=0; } server { listen 80; client_max_body_size 4G; server_name www.my_app.com; proxy_read_timeout 120; keepalive_timeout 5; root /home/ubuntu/my_app/current/public; location / { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; if (!-f $request_filename) { proxy_pass http://unicorn_my_app; break; } } error_page 404 500 502 503 […]

SELinux – logrotate不会旋转NGINX日志

我正在使用CentOS,NGINX和Passenger来服务Rails应用程序。 我有SELinux激活,并有一系列与logrotate的问题。 我已经能够通过在线提供各种build议来解决大部分问题。 不幸的是,logrotate没有成功的旋转我的NGINX日志文件。 NGINX安装在/ opt / nginx中 这是我的logrotateconfiguration文件: /opt/nginx/logs/*log { daily rotate 30 missingok notifempty sharedscripts delaycompress postrotate [ ! -f /opt/nginx/logs/nginx.pid ] || kill -USR1 `cat /opt/nginx/logs/nginx.pid` endscript } 这些是我在/ var / log / messages中收到的消息 Mar 9 03:49:14 localhost setroubleshoot: SELinux is preventing /usr/sbin/logrotate from rename access on the file logrotate_temp.RTg4y3. For complete […]

apache2服务不重新启动rails ubuntu

当我input: sudo /etc/init.d/apache2 restart … 要么: service apache2 restart …我得到以下错误: 作业apache2.service失败。 有关详细信息,请参阅“systemctl status apache2.service”和“journalctl -xe” 当我inputsystemctl status apache2.service ,这是结果: apache2.service – LSB: Apache2 web server Loaded: loaded (/etc/init.d/apache2) Active: failed (Result: exit-code) since Thu 2015-08-27 21:18:25 PDT; 3min 1s ago Docs: man:systemd-sysv-generator(8) Process: 20754 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS) Process: 20863 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE) inputjournalctl […]

监视Apache应用程序性能的Rails

在CentOSnetworking应用程序上,我可以使用什么来监控我的Rails on Passenger? 我正在寻找一些简单的东西,可以让我看到实时信息的平均请求/秒和平均请求时间。 理想情况下,这会让我从历史的angular度来看待这个问题。

从Hudson部署Rails应用程序

我使用哈德森作为我的CI,它运作良好,build立运行testing,编码指标,所有这些好东西。 但目前来说,就是这样,没有自动化的部署,我必须手动完成。 我还没有find哈德森的任何一种capistrano插件,我甚至无法看到在Hudson成功构build之后我可以在哪里运行我的帽子部署。 有没有人知道我需要什么来自动化部署到成功的构buildtesting服务器? 我希望每个承诺都能强制构build,并且有条件部署到testing中,以便我可以立即看到所有内容。

Rails3环境在Windows XP,Ubuntu 9.04,Ubuntu 9.10上运行速度非常慢

我已经尝试了所有三个(授予Ubuntu的版本是通过VirtualBox与XP作为主机,但我给了我的系统有所有可用的RAM的图像)。 加载轨道环境需要30-60秒。 铁轨控制台,耙testing:单位 – 任何需要轨道加载。 而不仅仅是第一次 – 每一次。 我甚至使用过自动testing,看它是否有助于unit testing的执行时间,但事实并非如此。 任何时候我改变一个testing,它仍然需要30秒加载,然后约4秒执行。 有没有其他人遇到过这个问题? 有没有人想出了解决这个问题的方法?

如何保护外部服务器上的Ruby on Rails代码?

我必须在客户端的服务器上部署一个Ruby on Rails应用程序,我不希望他们能够查看或修改源代码。 你如何保护代码技术上? 我想构build一个基于Linux的虚拟机,其中包含应用程序代码所在的encryption文件系统。 客户端没有root访问权限,或根本无法直接访问系统。 所有服务自动启动,应用程序可以使用。 你会build议什么?

使用Rails,如何sudo ./runner尽pipe最小sudo PATH和gem不在/ usr / bin

我的背景: ruby企业1.8.7,在CentOS 5上 ruby和gem安装在/ usr / local / bin中 ./runner:正确运行 sudo ./runner Rails需要RubyGems> = 1.3.2。 请安装RubyGems并重试: http : //rubygems.rubyforge.org (因为sudo有一个有限的PATH) sudo PATH = $ PATH ./runner:运行正常,因为runner在PATH中有/ usr / local / bin 题: 有没有其他的select(可能更优雅 – 以最小的变化)启动与sudo亚军,当gem不在/斌或/ usr /斌? 那些我想到的(但不满意): 在/ usr / bin中插入符号链接 修改跑步者? 修改sudoers? 也许有一个configuration文件或一个命令行参数运行的方式?