简体   繁体   English

开发与生产之间的Rails问题

[英]Rails problems between development and production

I'm dealing with some weird inconsistencies on my production server for my rails website/blog. 我正在处理我的Rails网站/博客的生产服务器上的一些奇怪的不一致之处。

For instance, on my development server (just running Webrick) this is my navbar (which is correct) and shows up 100% of the time: 例如,在我的开发服务器上(仅运行Webrick),这是我的导航栏(是正确的),并显示100%的时间:

在此处输入图片说明

After pushing my latest code to the production server (passenger & nginx), my navbar now shows (notice the missing blog link) and shows up about 40% of the time. 将我的最新代码推送到生产服务器(passenger和nginx)后,我的导航栏现在显示(请注意缺少的博客链接)并显示大约40%的时间。 I have to keep hitting 'refresh' on my browser until the blog link to shows: 我必须在浏览器上不断点击“刷新”,直到显示博客链接:

在此处输入图片说明

What gives here? 这里有什么? New to RoR, but I believe the issue lies with my Blog MVC. RoR的新手,但我认为问题出在我的Blog MVC上。 I've been taking a look at the log files for nginx and they show nothing. 我一直在查看nginx的日志文件,但它们什么也没显示。

Where else can I go to diagnose this issue? 我还能去哪里诊断这个问题?


Here is the code in my navbar partial (_navigation.html.erb) 这是我的导航栏部分(_navigation.html.erb)中的代码

<div class="navbar-collapse collapse">
  <ul class="nav navbar-nav">
    <li class="active"><a href="/">Home</a></li>
    <li><%= link_to("How It Works", "/howto") %></li>
    <li><%= link_to("FAQ", "/frequent") %></li>
    <li><%= link_to("Blog", blogs_path) %></li>
    <li><%= link_to("Contact Us", "/contact_forms/new") %></li>
  </ul>
</div>

Tailing production.log isn't very revealing either. 拖尾production.log也不是很清楚。 When the 'Blog' link does load: 当“博客”链接确实加载时:

I, [2015-03-31T12:48:59.624208 #5061]  INFO -- : Started GET "/" for X.X.X.X at 2015-03-31 12:48:59 -0400
I, [2015-03-31T12:48:59.625722 #5061]  INFO -- : Processing by StaticPagesController#home as HTML
D, [2015-03-31T12:48:59.627223 #5061] DEBUG -- :   Testimonial Load (0.4ms)  SELECT "testimonials".* FROM "testimonials"
I, [2015-03-31T12:48:59.628629 #5061]  INFO -- :   Rendered layouts/_navigation.html.erb (0.3ms)
I, [2015-03-31T12:48:59.631063 #5061]  INFO -- :   Rendered layouts/_footer.html.erb (0.5ms)
I, [2015-03-31T12:48:59.631303 #5061]  INFO -- :   Rendered static_pages/home.html.erb within layouts/application (3.1ms)
I, [2015-03-31T12:48:59.632149 #5061]  INFO -- : Completed 200 OK in 6ms (Views: 4.3ms | ActiveRecord: 0.4ms)

When the Blog link doesn't load production.log hardly has anything written to it. 当Blog链接无法加载production.log时,几乎没有写入任何内容。 It's like the server is only registering a partial load of the page or something. 就像服务器仅注册页面的部分负载或其他内容一样。

I've made my changes, rebooted the web server (both nginx & passenger), and even rebooted the actual server itself... still no luck. 我进行了更改,重新启动了Web服务器(nginx和passenger),甚至重新启动了实际的服务器本身……仍然没有运气。

I'm at a loss on what to do to fix this issue since everything works perfectly fine in development and I'm still pretty new to RoR. 由于在开发过程中一切正常,我对RoR还是很陌生,因此在解决该问题上该做什么。

The source code is pretty trivial and there is no conditional branching ( if ) around the blog link. 源代码非常简单,并且博客链接周围没有条件分支( if )。

Therefore, the only explanation is that the code running in production is not the one you have in development. 因此,唯一的解释是,生产环境中运行的代码不是您正在开发中的代码。

Make sure your deploy was successful. 确保您的部署成功。 Inspect your server folder to make sure the code is in there. 检查您的服务器文件夹,以确保代码在其中。 Also make sure the webserver was restarted, otherwise it may still be serving the previously deployed code. 还要确保Web服务器已重新启动,否则它可能仍在服务先前部署的代码。 For Passenger and Nginx you need (unless it changed) to touch the restart.txt file inside the /tmp/restart.txt project folder in order to perform a Passenger restart (without obviously restarting the entire Nginx process). 客运和Nginx的需要(除非它改变),以touchrestart.txt内部文件/tmp/restart.txt项目文件夹,以执行客运重启(没有明显的重新启动整个过程Nginx的)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Rails:开发和生产之间的迁移和数据库差异 - Rails: Migration and database differences between development and production Rails - Mongoid:生产和开发之间的问题缓慢 - Rails - Mongoid : Slow problem between production and development 用于开发和生产的Rails初始化程序 - Rails initializer for development and production 开发和生产环境之间的路由差异(Ruby on Rails) - Routing Discrepancy Between Development and Production Environments (Ruby on Rails) twitter-bootstrap-rails-开发和生产之间的差异 - twitter-bootstrap-rails - differences between development and production 在rails中开发模式和生产模式有什么区别? - in rails what is the difference between development mode and production mode? Yaml :: load_file在开发和生产之间的作用不同(Rails) - Yaml::load_file acting different between development and production (Rails) 什么可能导致铁路中本地/开发和生产路由之间的差异? - What could cause a discrepancy between local/development and production routing in rails? Rails 3加载静态文件以及开发和生产之间的区别 - Rails 3 loading static files, and the difference between development and production Rails 5 ActionCable正在开发和生产环境之间传递消息 - Rails 5 ActionCable is crossing messages between development and production environments
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM