Setting up hosting heroku.com + custom domain name * for beginners

    So, I have not seen such material anywhere, so I consider it necessary to publish this information.image
    • We register on Heroku.com a letter with a link arrives quickly, I received it after 30 seconds.
    • Next, you need to install git, I worked in windows OS ( I think those who use it know how to install on linux ), here is the win version , if you use the portable version, you need to go to the directory ( where you unpacked ) git from the command line interface , and run either the git-bash.bat shell ( I personally prefer to work with it ), or use the cmd, git-cmd.bat commands only.
    • Next, you need to install gem heroku with the command ( sudo ) gem install heroku it has dependencies with other gems, in general they will install themselves automatically, but if not, then here are the links for them: rest-client , launchy , json .
    • Then create the application, I created a simple rack-application (rack is automatically set when the heroku gem set, but if not then ( sudo ) gem the install rack ), well, you can create a course that you like, put a file in any folder config.ru with the following content:
      run lambda { |env| [
        200,
        {"content-type" => "text/html"},
        "hello from russia, time is now #{ Time.now }"
        ] }
    • Go to the application folder, initialize with the git init command , add git add. , sign git commit -m 'new Rack app' .
    • We create an application on heroku using the heroku create command any-name-in-English (if you don’t set the last parameter, it will name the application from the bulldozer, such as blooming-cloud-48), it will ask you to enter an email and password, and then generate RSA keys. git remote will automatically add!
    • Fill our application on heroku with the git push heroku master command .
    • Heroku Supports user domains, DNS in CNAME format, this is a condition of their architecture . I purchased a domain here , for 85 p. in the zone .ru, replenished the balance through yandex money, but they did not come right away - I had to write in support, after that the money was credited. It supports managing DNS records of the CNAME type, but if your domain control panel does not support this feature, you can see how this problem is solved using free DNS services.
    • We buy a domain ( if you don’t have one ), everything is elementary there.
    • We select the item “use the registrar server”, click change, and now zone management is availableimage
    • Well, here, I think, everything is also intuitively clear, the first line is @ so that we can enter the domain without the www prefix , and in the second line with it.
      image
    • We check if DNS and our domain work with the host www.example.com command , the answer should be something like this (I used SSH access to my application, and checked from there) image
      if it says something like “not found”, check the DNS settings , ask someone else to check, or create a GRPS connection and check through it.image
    • Go to the folder with your application on the local computer, using the heroku domains: add www.somedomainname.com command , bind the domain to your application, the result is something like this
      image
    • We go to the domain address and everything should work right away (it worked for me instantly ).
    well that's all
    oh yes, your RACK | RAILS | MERB application, by default it works in production mode, the
    application works here it-karma.ru and www.it-karma.ru
    #update pictures are reloaded on photobucket.com, minor errors have been fixed.

    Also popular now: