我应该在Heroku上部署我的Ruby on Rails应用程序 [英] Should I deploy my Ruby on Rails application on Heroku

查看:124
本文介绍了我应该在Heroku上部署我的Ruby on Rails应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于我自己一点点我24岁,我去年从NC州毕业,并在数学分析硕士学位。统计学,数学,那种事情。我没有强大的编程背景,这对我的问题非常重要。如果我说什么没有任何意义,那就是为什么。自从毕业以来,我一直在和其他几个人一起在Rails应用程序上全职工作。我的编程经验主要是Ruby on Rails(1.2年)。我知道R,SAS(统计语言,对这个问题没有帮助。)



显然,这意味着它有已经过了一年的发展,我们还没有完成。主要开发人员是一个优秀的程序员,只是他已经有一个全职工作,并在空闲时间完成这个应用程序。由于他最近没有足够的时间,我已经对该应用程序承担了全部责任。



我们现在将其部署在Slicehost上。该应用程序处于我们不需要编程的任何东西(除非我们想到更多的功能)。我问我们是否应该迁移到Heroku的原因是,在我看来,Heroku是一个简单的平台,部署。 Slicehost似乎对我来说太复杂了。另一个开发者处理它,而不是我。我看了如何在Heroku部署应用程序,看起来我可以这样做。如果需要,我们需要我们的应用程序来扩展,这是Heroku提供的。就钱而言,我会从最低限度开始(免费),看看它是如何发生的。我可以支付额外的功能,如果我需要。



我们正在使用Redmine进行项目管理和存储库(不是git,我认为我们需要在Heroku上使用)。 git是否类似于Redmine?是否容易使用?



现在,在Slicehost上,我们有4个守护进程(不断运行的进程)。我们有8个delayed_job工作人员。我知道命令行启动守护进程和delayed_job工作。这些工作在Heroku?



我想知道我是否仍然可以使用RAILS_ENV =生产脚本/控制台与Heroku。



用户界面是一个javascript文件。在开发模式下,如果我在终端中执行脚本/服务器,并在浏览器中转到 http:// localhost:3000 , 我能看到它。 Heroku会按照我想要的方式加载这个页面吗?



我们有一个适用于该应用的工作网站,拥有我们自己的域名。我真的不知道DNS是什么,所以我可能无法将Heroku应用程序链接到它,除非有一个简单的方法。我认为Heroku将其链接到appname.heroku.com作为默认。



根据我的编程经验,Heroku是否足够容易使用,我应该找到另一份工作,还是应该提交seppuku?

解决方案

是的,你应该肯定会部署你的应用程序在heroku。要做到这一点,这将是您需要做的:


  1. 确保您已经安装了 git 电脑

  2. 创建一个heroku帐户 here

  3. 安装英雄宝石,并按照此页中的其他操作

  4. 使用git跟踪您的应用程序,并创建您的英雄应用程序,如 here

  5. 在这样做之后,heroku将为您提供一个应用程序的URL,例如 http://blah-bleep-123.heroku.com 。现在,下一步是将您的域名与这个英雄网址相关联。

  6. 如图所示,配置您的域名DNS服务器在此页面。请注意,更改DNS后,可能需要48小时才能正常工作。您可以通过登录您购买域名的网站来更改您的域名DNS。 godaddy.com,hostingdude.com等。

  7. 将此代码添加到您的ApplicationController中。您可以从此页面以及


    $ b执行此操作$ b

      class ApplicationController 
    before_filter:ensure_domain

    APP_DOMAIN ='www.mydomain.com'

    def ensure_domain
    如果request.env ['HTTP_HOST']!= APP_DOMAIN
    #HTTP 301是一个永久重定向
    redirect_tohttp://#{APP_DOMAIN},:status => 301
    end
    end
    end


  8. 确保您全部迁移你的数据库在heroku,通过做 heroku rake db:migrate

  9. 完成所有这些步骤后,你应该是好的。查看您的域名URL,一切都应该很漂亮:)。

  10. 如果您在页面中看到任何错误,您可以通过 heroku日志查看日志

  11. 您可以使用 heroku控制台访问控制台

具有这些功能,heroku非常方便使用。



如果您需要更多帮助,请通知我。

A little about myself. I am 24 years old, I graduated from NC State with a Master's in Analytics last year. Statistics, mathematics, that kind of thing. I don't have a strong programming background, which is pretty important for my question. If I say anything that doesn't make any sense, that is why. Ever since graduation, I have been working full time on a Rails app with a few other people. My programming experience is mainly Ruby on Rails (1.2 years.) I know R, SAS (statistical languages, not helpful for this question.)

Obviously, that means it has been over a year in development, and we aren't done yet. The main developer is an excellent programmer, just that he has a full time job already, and does this app in his spare time. Due to him not having enough time recently, I have been given practically full responsibility for the app.

We have it deployed on Slicehost right now. The app is at a point where we don't need to program anything else (unless we think of more features.) The reason I am asking if we should migrate to Heroku is that it seems to me that Heroku is a simple platform to which to deploy. Slicehost seems too complicated for me. The other developer dealt with it, and not me. I looked at how to deploy the app on Heroku, and it looks like I would be able to do it. We need our app to scale if it needs to, which Heroku offers. As far as money, I would start it at the minimum (free) and see how it goes. I can pay for additional features if I need to.

We are using Redmine for project management and repository (not git, which I think we need to use on Heroku.) Is git similar to Redmine? Is it easy to use?

Right now, on Slicehost, we have 4 daemons (constantly running processes.) We have 8 delayed_job workers. I know the command line to start the daemons and delayed_job workers. Would these work on Heroku?

I am wondering if I can still use RAILS_ENV=production script/console with Heroku.

The user interface is a javascript file. In development mode, if I do script/server in a terminal, and go to http://localhost:3000 in a browser, I can see it. Would Heroku load this page the way I want?

We have a working website for the app, with our own domain name. I don't really know what DNS is, so I probably wouldn't be able to link the Heroku app to it, unless there is an easy way. I think Heroku links it to appname.heroku.com as a default.

Based on my programming experience, would Heroku be easy enough for me to use, should I find another job, or should I commit seppuku?

解决方案

Yes, you should definitely deploy your application in heroku. To do this, this is what you will need to do:

  1. Make sure you have git installed in your computer
  2. Create a heroku account here
  3. Install the heroku gem and do the rest as mentioned in this page
  4. Track your application with git, and create your heroku application as shown here
  5. After you do this, heroku will provide you with a URL for your application, such as http://blah-bleep-123.heroku.com. Now, the next step would be to associate your domain to this heroku URL.
  6. Configure your domain DNS Server as shown in this page. Mind you, after you change your DNS, it might take upto 48 hours for it to work. You can change your domain DNS by logging into the site where you bought your domain, for e.g. godaddy.com, hostingdude.com, etc.
  7. Add this code to your ApplicationController. You can follow this from this page as well

    class ApplicationController
      before_filter :ensure_domain
    
      APP_DOMAIN = 'www.mydomain.com'
    
      def ensure_domain
        if request.env['HTTP_HOST'] != APP_DOMAIN
          # HTTP 301 is a "permanent" redirect
          redirect_to "http://#{APP_DOMAIN}", :status => 301
        end
      end
    end
    

  8. Make sure you migrate all your database in heroku, by doing heroku rake db:migrate
  9. After you have completed all these steps, you should be good. Check out your domain URL, everything should work pretty :).
  10. If you see any errors in your page, you can view the log by heroku logs
  11. You can access console as heroku console

With features as these, heroku is very convenient to work with.

Please let me know if you need more help.

这篇关于我应该在Heroku上部署我的Ruby on Rails应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆